Extract continuous-time system matrices #2912
|
Hello! I was wondering how one could go about extracting the system matrices (i.e., M, C, K, and H) at a given equilibrium configuration. Currently, I'm extracting the global matrix and then algebraically computing the jacobians. This, unfortunately, introduces a dependency on the time discretization, which for my purpose is undesirable. I'm aware there is some ongoing work on making these matrices available (ref), but rather than wait, I'd like to try to see if there is some way to extract this on my own. Currently, I'm taking a look at I'm new to SOFA so even the simplest details/suggestions would be very instructive. Thank you so much for the help! |
Replies: 2 comments 9 replies
|
Hi @jjalora you are right that there is an ongoing work on this topic. It should be ready for the next release in June (I hope). The matrix K is computed in the If you can't wait for the next release, you'll need to hack the C++ code to get the K matrix. Here is what I suggest:
Note that the hack I provided has not been tested. You'll need to setup the Good luck, Alex |
|
Accessing the matrices is still a work in progress, but you can find an open pull request of SofaPython3 where you can do what you want: sofa-framework/SofaPython3#262 Any feedback is welcome. |
Hi @jjalora
you are right that there is an ongoing work on this topic. It should be ready for the next release in June (I hope).
The matrix K is computed in the
addKToMatrixfunctions of all force fields. Unfortunately, the contributions are all summed up into a global matrix. You can extract the global matrix, but cannot retrieve K from it.If you can't wait for the next release, you'll need to hack the C++ code to get the K matrix. Here is what I suggest:
MatrixLinearSolver, create another member dedicated to the K matrix (Matrix kMatrix;).MatrixLinearSolver::setSystemMBKMatrix.mops.addMBK_ToMatrix, call it again but withmFactorset to 0,bFactorset to 0 andkFactor…