Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuayi committed Apr 17, 2023
1 parent 90dc2fe commit c9974d4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fealpy/fem/LinearElasticityOperatorIntegrator.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import numpy as np

class LinearElasticityOperatorIntegrator:
def __init__(self, lam, mu, q=3):
def __init__(self, lam, mu, q=None):
self.lam = lam
self.mu = mu
self.q = q
self.q = q

def assembly_cell_matrix(self, space, index=np.s_[:], cellmeasure=None, out=None):
"""
construct the linear elasticity fem matrix
"""

q = self.q
lam = self.lam
mu = self.mu

GD = len(space)
mesh = space[0].mesh
ldof = space[0].number_of_local_dofs()
p = space[0].p
GD = mesh.geo_dimension()
q = self.q if self.q is not None else p+1


if cellmeasure is None:
cellmeasure = mesh.entity_measure('cell', index=index)
Expand Down
26 changes: 26 additions & 0 deletions test/fem/test_linear_elasticity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy as np

import pytest

def test_linear_elasticity_lfem(p, n):
"""
@brief Lagrange 元求解线弹性问题
"""
from fealpy.pde.linear_elasticity_model import BoxDomainData2d
from fealpy.mesh import TriangleMesh
from fealpy.functionspace import LagrangeFESpace as Space
from fealpy.functionspace import LagrangeFiniteElementSpace as OldSpace
from fealpy.fem import LinearElasticityOperatorIntegrator
from fealpy.fem import BilinearForm
from fealpy.fem import LinearForm

pde = BoxDomainData2d()
domain = pde.domain()
mesh = TriangleMesh.from_box(box=domain, nx=n, ny=n)
space = Space(mesh, p=p)

bform = BilinearForm(space)
bform.add_domain_integrator(LinearElasticityOperatorIntegrator(pde.lam)
bform.assembly()


0 comments on commit c9974d4

Please sign in to comment.