-
Notifications
You must be signed in to change notification settings - Fork 347
Description
The component EulerExplicitSolver does not properly support mapped masses.
When the mass matrix is diagonal (it can be UniformMass or DiagonalMass, or even a lumped MeshMatrixMass), the acceleration can be computed trivially from the force without any linear solver. However, when this diagonal mass is mapped, the acceleration is not
Instead,
To illustrate this problem, here is a simple scene with a 2d particle submitted to gravity:
def createScene(root):
root.addObject("DefaultAnimationLoop")
root.addObject('RequiredPlugin', pluginName=[
'Sofa.Component.LinearSolver.Direct',
'Sofa.Component.Mapping.Linear',
'Sofa.Component.Mass',
'Sofa.Component.ODESolver.Forward',
'Sofa.Component.StateContainer',
'Sofa.Component.Visual',
'SofaMatrix',
'SofaMatrix.imgui',
])
root.addObject("LineAxis", size=2)
root.addObject("EulerExplicitSolver", symplectic=False)
root.addObject("SparseLDLSolver", template="CompressedRowSparseMatrix")
root.addObject("GlobalSystemMatrixImage")
initial_position = [0.0, 0.0]
initial_velocity = [1.0, 1.0]
root.addObject("MechanicalObject", template="Vec2", name="particle",
position=[initial_position], velocity=[initial_velocity])
with root.addChild("mapped_mass") as mapped_mass_node:
mapped_mass_node.addObject("MechanicalObject", template="Vec2", name="mapped_particle")
mapped_mass_node.addObject("IdentityMapping", input="@../particle", output="@mapped_particle")
mapped_mass_node.addObject("UniformMass", template="Vec2", name="mass", vertexMass=1.0)
root.addObject("VisualPointCloud", position="@particle.position", sphereRadius=0.05, drawMode="Sphere", color="navy")
root.addObject("TrailRenderer", template="Vec2", position="@particle.position")
return rootIn this scene, the mapping is trivial: the identity. So its presence should not change the behavior. What we observe with the current implementation:
A trajectory compatible with a zero acceleration.
What we should observe:
