Skip to content

Commit ac3ed74

Browse files
authored
Fix by passing state link when using other topology than edges (#550)
1 parent ae1d496 commit ac3ed74

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

splib/mechanics/mass.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
# TODO : use the massDensity ONLY and deduce totalMass if necessary from it + volume
77

88
@ReusableMethod
9-
def addMass(node, elem:ElementType, totalMass=DEFAULT_VALUE, massDensity=DEFAULT_VALUE, lumping=DEFAULT_VALUE, **kwargs):
9+
def addMass(node, elem:ElementType, totalMass=DEFAULT_VALUE, massDensity=DEFAULT_VALUE, lumping=DEFAULT_VALUE, topology=DEFAULT_VALUE, **kwargs):
1010
if (not isDefault(totalMass)) and (not isDefault(massDensity)) :
1111
print("[warning] You defined the totalMass and the massDensity in the same time, only taking massDensity into account")
1212
del kwargs["massDensity"]
1313

14-
# if(elem !=ElementType.POINTS and elem !=ElementType.EDGES):
15-
# node.addObject("MeshMatrixMass",name="mass", totalMass=totalMass, massDensity=massDensity, lumping=lumping, **kwargs)
16-
# else:
17-
# if (not isDefault(massDensity)) :
18-
# print("[warning] mass density can only be used on a surface or volumetric topology. Please use totalMass instead")
19-
# if (not isDefault(lumping)) :
20-
# print("[warning] lumping can only be set for surface or volumetric topology")
14+
if(elem !=ElementType.POINTS and elem !=ElementType.EDGES):
15+
node.addObject("MeshMatrixMass",name="mass", totalMass=totalMass, massDensity=massDensity, lumping=lumping, topology=topology, **kwargs)
16+
else:
17+
if (not isDefault(massDensity)) :
18+
print("[warning] mass density can only be used on a surface or volumetric topology. Please use totalMass instead")
19+
if (not isDefault(lumping)) :
20+
print("[warning] lumping can only be set for surface or volumetric topology")
2121

22-
node.addObject("UniformMass",name="mass", totalMass=totalMass, **kwargs)
22+
node.addObject("UniformMass",name="mass", totalMass=totalMass, topology=topology,**kwargs)
2323

stlib/materials/deformable.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ class DeformableBehaviorParameters(MaterialParameters):
1414
parameters : list[float] = dataclasses.field(default_factory=lambda: [1000, 0.45]) # young modulus, poisson ratio
1515

1616
def __addDeformableMaterial(node):
17-
addMass(node, node.parameters.elementType, massDensity=node.parameters.massDensity, lumping=node.parameters.massLumping)
17+
18+
massKwargs = {}
19+
if node.parameters.elementType != ElementType.EDGES: #If we use the MeshMatrixMass, then the mass will need us to specify the mstate to use
20+
massKwargs["geometryState"] = "@States"
21+
22+
addMass(node, node.parameters.elementType, massDensity=node.parameters.massDensity, lumping=node.parameters.massLumping, topology="@../Geometry/container", mass=massKwargs)
1823
# TODO : change this with inheritance
1924
if(node.parameters.constitutiveLawType == ConstitutiveLaw.HYPERELASTIC):
2025
addHyperelasticity(node, node.parameters.elementType, node.parameters.parameters, topology="@../Geometry/container")

0 commit comments

Comments
 (0)