def iso_quad(element_nodes, xi, eta): from numpy import sum,array from numpy.linalg import det from numpy.linalg import inv shape = array([(1.0 - xi) * (1.0 - eta) / 4.0,(1.0 + xi) * (1.0 - eta) / 4.0,(1.0 + xi) * (1.0 + eta) / 4.0,(1.0 - xi) * (1.0 + eta) / 4.0]) shape_dxi = array([-(1.0 - eta) / 4.0,(1.0 - eta) / 4.0,(1.0 + eta) / 4.0,-(1.0 + eta) / 4.0]) shape_deta = array([-(1.0 - xi) / 4.0,-(1.0 + xi) / 4.0,(1.0 + xi) / 4.0,(1.0 - xi) / 4.0]) x = element_nodes[:, 0] y = element_nodes[:, 1] jacobi = array([[sum(shape_dxi * x), sum(shape_dxi * y)],[sum(shape_deta * x), sum(shape_deta * y)]]) jacobian = det(jacobi) inverted_jacobi = inv(jacobi) shape_dx = inverted_jacobi[0, 0] * shape_dxi + inverted_jacobi[0, 1] * shape_deta shape_dy = inverted_jacobi[1, 0] * shape_dxi + inverted_jacobi[1, 1] * shape_deta return jacobian, shape, shape_dx, shape_dy