Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the mass and stiffness matrices extracted from SOFA do not match the right matrices extracted from COMSOL ? #4954

Open
SustechShenCong opened this issue Sep 1, 2024 · 7 comments

Comments

@SustechShenCong
Copy link

In my work I need to extract the dynamical model from SOFA, i.e. extracting mass and stiffness matrices from SOFA. I follow the SOFA instructions which use "mass_matrix = root.mass.assembleMMatrix()" & "stiffness_matrix = root.force_field.assembleKMatrix()" to obtain the mass and stiffness matrices. My test example is a cube with 8 Square unit, which results 27 nodes, i.e. 81dofs. see
mesh
The COMSOL result of mass matrix is below:
Comsol_M
The SOFA result of mass matrix is below:
SOFA_M

@SustechShenCong
Copy link
Author

In this issue I only consider the shape of the matrix, not the detailed values!!!

@SustechShenCong
Copy link
Author

Solution refers to #3134

@alxbilger
Copy link
Contributor

I assume that you use MeshMatrixMass.

In MeshMatrixMass, the mass integration is distributed on vertices and edges. In a hexahedron, some vertices are not connected by edges. Therefore, this type of interaction is not taken into account in the mass matrix. And that is why, you see a lot more zeros in the matrix in SOFA.

I guess you will have more accurate results with tetrahedra, where this situation does not happen.

@SustechShenCong
Copy link
Author

Thank you very much for your prompt reply! Your suggestions will be very helpful to me!

@SustechShenCong
Copy link
Author

Another question, If there are some ways to extract the Constraints Matrix and "Internal Force Vector and its Jacobian". Some simple examples would be greatly appreciated!

@alxbilger
Copy link
Contributor

There is a work in progress to extract the constraint matrix.
The internal force vector is available in the MechanicalObject, in the force Data field (but it is merged with all the other forces).

@SustechShenCong
Copy link
Author

Thank you very much for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants