import matplotlib.pyplot as plt
from fealpy.mesh.simple_mesh_generator import boxmesh3d
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix, spdiags, eye

L = 1
W = 0.2
lam = 1.25
mu = 1
g = 0.4 * (W / L)**2

D = np.zeros((6, 6), dtype=np.float)
D[0:3, 0:3] = lam
D[range(3), range(3)] += mu
D[range(6), range(6)] += mu

mesh = boxmesh3d([0, 1, 0, 0.2, 0, 0.2], nx=50, ny=10, nz=10, meshtype='tet')
cell = mesh.entity('cell')

vol = mesh.entity_measure('cell')
NC = mesh.number_of_cells()
NN = mesh.number_of_nodes()
grad = mesh.grad_lambda()

B = np.zeros((NC, 12, 6), dtype=np.float)  # NC X 12 X 6

B[:, 0:4, [0, 5, 4]] = grad
B[:, 4:8, [5, 1, 3]] = grad
B[:, 8:12, [4, 3, 2]] = grad

A = np.einsum('ijk, km, inm, i->ijn', B, D, B, vol)
Пример #2
0
 def init_mesh(self, n=1):
     from fealpy.mesh.simple_mesh_generator import boxmesh3d
     domain = self.domain()
     mesh = boxmesh3d(domain, nx=5 * n, ny=1 * n, nz=1 * n, meshtype='tet')
     return mesh