sofa
sofa copied to clipboard
Constraints between multiple objects under a single solver
I am questioning the support of multiple objects under a single pair ODE solver + linear solver, compared to a dedicated solver for each object. This is in the context of Lagrangian constraints, i.e. with the use of a FreeMotionAnimationLoop.
I made a scene where two beams are connected by BilateralLagrangianConstraint (pink points in the middle). The expected behavior can be seen in the video:
https://github.com/user-attachments/assets/19aba729-5168-4ad7-b0f0-0815b9b0fda7
In this scene, I tested two scenarios:
- Both beams are represented each by a
MechanicalObjectand are under a single common linear solver - Same, but each beam has its own dedicated solver
For each of these scenarii, I tested with LinearSolverConstraintCorrection and GenericConstraintCorrection.
The scene is available here: https://gist.github.com/alxbilger/8569b4c0548d4450aadcb67ec65fd2b6
With LinearSolverConstraintCorrection:
- Scenario 2 is working properly.
- Scenario 1 explodes.
With GenericConstraintCorrection, both scenes are working properly.
I can observe in LinearSolverConstraintCorrection that matrix sizes are incompatible. There should be a problem of local-global basis. It explains the crash, but I did not catch where this comes from in the code, and if it can be fixed. Is there a specific reason it is like that? I did not really understand why we have both constraint corrections... They appear to build the compliance matrix very similarly.
Even if scenario 2 is working as expected. The coupling terms of the stiffness matrix cannot be captured when using two different solvers.
In scenario 1, I am also questioning the accuracy of the computation of the compliance matrix projected in the constraint space. I feel that we forget the coupling terms, i.e. all the terms $H_i A^{-1} H_j$ when $i \neq j$. What do you think?