def str_el4(coord, ul): """Compute the strains at each element integration point This one is used for 4-noded quadrilateral elements. Parameters ---------- coord : ndarray Coordinates of the nodes of the element (4, 2). ul : ndarray Array with displacements for the element. Returns ------- epsGT : ndarray Strain components for the Gauss points. xl : ndarray Configuration of the Gauss points after deformation. """ epsl = np.zeros([3]) epsG = np.zeros([3, 4]) xl = np.zeros([4, 2]) XW, XP = gau.gpoints2x2() for i in range(4): ri = XP[i, 0] si = XP[i, 1] ddet, B = stdm4NQ(ri, si, coord) epsl = np.dot(B, ul) epsG[:, i] = epsl[:] N = sha4(ri, si) xl[i, 0] = sum(N[0, 2*i]*coord[i, 0] for i in range(4)) xl[i, 1] = sum(N[0, 2*i]*coord[i, 1] for i in range(4)) return epsG.T, xl
def uel4nquad(coord, par): """Quadrilateral element with 4 nodes Parameters ---------- coord : ndarray Coordinates for the nodes of the element (4, 2). enu : float Poisson coefficient (-1, 0.5). Emod : float Young modulus (>0). Returns ------- kl : ndarray Local stiffness matrix for the element (8, 8). Examples -------- >>> coord = np.array([[-1, -1], [1, -1], [1, 1], [-1, 1]]) >>> stiff = uel4nquad(coord, 1/3, 8/3) >>> stiff_ex = 1/6 * np.array([ ... [ 8, 3, -5, 0, -4, -3, 1, 0], ... [ 3, 8, 0, 1, -3, -4, 0, -5], ... [-5, 0, 8, -3, 1, 0, -4, 3], ... [ 0, 1, -3, 8, 0, -5, 3, -4], ... [-4, -3, 1, 0, 8, 3, -5, 0], ... [-3, -4, 0, -5, 3, 8, 0, 1], ... [ 1, 0, -4, 3, -5, 0, 8, -3], ... [ 0, -5, 3, -4, 0, 1, -3, 8]]) >>> np.allclose(stiff, stiff_ex) True """ Emod = par[0] enu = par[1] rho = par[2] calpha = par[3] cbeta = par[4] kl = np.zeros([8, 8]) ml = np.zeros([8, 8]) cl = np.zeros([8, 8]) C = fem.umat(enu, Emod, rho) XW, XP = gau.gpoints2x2() ngpts = 4 for i in range(0, ngpts): ri = XP[i, 0] si = XP[i, 1] alf = XW[i] ddet, B = fem.stdm4NQ(ri, si, coord) N = fem.sha4(ri, si) kl = kl + np.dot(np.dot(B.T, C), B) * alf * ddet ml = ml + rho * np.dot(N.T, N) * alf * ddet cl = calpha * kl + cbeta * ml return kl, ml, cl
def uel4nquad(coord, enu, Emod): """Quadrilateral element with 4 nodes Parameters ---------- coord : ndarray Coordinates for the nodes of the element (4, 2). enu : float Poisson coefficient (-1, 0.5). Emod : float Young modulus (>0). Returns ------- kl : ndarray Local stiffness matrix for the element (8, 8). Examples -------- >>> coord = Matrix([[-1, -1], [1, -1], [1, 1], [-1, 1]]) >>> stiff = uel4nquad(coord, S(1)/3, S(8)/3) >>> stiff_ex = 1/6 * Matrix([ ... [ 8, 3, -5, 0, -4, -3, 1, 0], ... [ 3, 8, 0, 1, -3, -4, 0, -5], ... [-5, 0, 8, -3, 1, 0, -4, 3], ... [ 0, 1, -3, 8, 0, -5, 3, -4], ... [-4, -3, 1, 0, 8, 3, -5, 0], ... [-3, -4, 0, -5, 3, 8, 0, 1], ... [ 1, 0, -4, 3, -5, 0, 8, -3], ... [ 0, -5, 3, -4, 0, 1, -3, 8]]) >>> (stiff - stiff_ex).norm()/stiff_ex.norm() < 1e-6 True """ kl = np.zeros([8, 8]) C = fem.umat(enu, Emod) XW, XP = gau.gpoints2x2() ngpts = 4 for i in range(0, ngpts): ri = XP[i, 0] si = XP[i, 1] alf = XW[i] ddet, B = fem.stdm4NQ(ri, si, coord) kl = kl + B.T*C*B*alf*ddet return kl
def str_el4(coord, ul): """Compute the strains at each element integration point This one is used for 4-noded quadrilateral elements. Parameters ---------- coord : ndarray Coordinates of the nodes of the element (4, 2). ul : ndarray Array with displacements for the element. Returns ------- epsGT : ndarray Strain components for the Gauss points. xl : ndarray Configuration of the Gauss points after deformation. """ epsl = np.zeros([3]) epsG = np.zeros([3, 4]) epsGT = np.zeros([4, 3]) xl = np.zeros([4, 2]) x, y = symbols('x y') XW, XP = gau.gpoints2x2() for i in range(4): ri = XP[i, 0] si = XP[i, 1] ddet, B = stdm4NQ(ri, si, coord) epsl = B*ul epsG[:, i] = epsl[:] N = sha4(ri, si) NN = N.subs([(x, ri), (y, si)]) xl[i, 0] = sum(NN[0, 2*i]*coord[i, 0] for i in range(4)) xl[i, 1] = sum(NN[0, 2*i]*coord[i, 1] for i in range(4)) epsGT = epsG.T return epsGT, xl