# Set the load at the right hand edge for i in range(numNodesY): R[-(i*2+2), 0] = endLoadXY[0] / numNodesY R[-(i*2+1), 0] = endLoadXY[1] / numNodesY for iel in range(numElements): if ourSolution: if numElementNodes == 3: K_el, f_el = tri.tri3e(ex[iel], ey[iel], Dmat, thickness, eq) # K_el_s, f_el_s = cfc.plante(ex[iel], ey[iel], ep, Dmat, eq) # f_el_s = f_el_s.T # f_error = np.max(np.abs(f_el - f_el_s)) # K_error = np.max(np.abs(K_el - K_el_s)) elif numElementNodes == 6: K_el, f_el = tri.tri6e(ex[iel], ey[iel], Dmat, thickness, eq) elif numElementNodes == 4: K_el, f_el = quad.quad4e(ex[iel], ey[iel], Dmat, thickness, eq) elif numElementNodes == 9: K_el, f_el = quad.quad9e(ex[iel], ey[iel], Dmat, thickness, eq) else: if numElementNodes == 3: # core version of plante /tri3el K_el, f_el = cfc.plante(ex[iel], ey[iel], ep, Dmat, eq) # Transpose so correct dim for assem f_el = f_el.T elif numElementNodes == 4: # Number of intergration points. 1, 2 or 3 n = 2 ep = np.array([ep[0], ep[1], n]) K_el, f_el = cfc.plani4e(ex[iel], ey[iel], ep, Dmat, eq)
# Ke, fe = tri.plante(ex,ey,ep,D,eq) Ke = np.array(np.zeros((12, 12))) fe = np.array(np.zeros((12, 1))) rigX = np.array(np.zeros((12, 1))) rigY = np.array(np.zeros((12, 1))) rigR = np.array(np.zeros((12, 1))) for i in range(6): rigX[i * 2, 0] = 1.0 rigY[i * 2 + 1, 0] = 1.0 rigR[i * 2, 0] = ey[i] rigR[i * 2 + 1, 0] = -ex[i] Ke, fe = tri.tri6e(ex, ey, D, th, eq) print('Stiffness matrix:\n', Ke) print('Consistent forces:\n', fe) fx = Ke * rigX fy = Ke * rigY fr = Ke * rigR print('Force from rigX translation:\n', fx) print('Force from rigY translation:\n', fy) print('Force from rigR rotation:\n', fr) constEx = np.mat(np.zeros((12, 1))) constEy = np.mat(np.zeros((12, 1))) constGamma1 = np.mat(np.zeros((12, 1)))