6 October 2020 at 14:26 #17294jjcasmarBlocked
I am implementing a Mapping that, given my degress of freedom, computes the deformation gradient. Then I have an energy that depends on the deformation gradient. With this scheme, I have some doubts.
First of all, the math for this scheme would be
u = DoF F = g(u) // Deformation gradient is a function of the DoF E = e(F) // Energy is a function of the deformation gradient dE/du = dE/dF * dF/du d2E/du2 = (dF/du)^T * d2E/dF2 * dF/du + dE/dF * d2F/du2
I am not sure how all this happens in SOFA. I have a ForceField which I am going to use with a ConjugateGradient solver, so I have implemented
addDForcefunctions. If I understand SOFA correctly,
addForcehas to compute
addDForcehas to compute
First question I have is how I can compute
d2E/dF2if hessian depends on
F. In this case I only receive what I believe is
dx = dF/du * du
The second question is how the force is actually computed. According to the math i wrote, it is
dE/du = dE/dF * dF/duand
addForcereceives what I believe is
x = F = g(u). When is the
Finally, what happens if my mapping is not linear and therefore I need the second derivative of the deformation gradient wrt the DoF?10 October 2020 at 00:03 #17342HugoKeymaster
Thank you for your question.
I see you are doing things in a similar way than what was developed in the Flexible plugin.
You perfectly understood the definition of
I am just not sure to see how your scene is created. Could you please describe it (including your mapping)?
Hugo10 October 2020 at 16:17 #17351jjcasmarBlocked
Sorry, cant share the scene description right now. Ill do it ASAP.
One thing I normally dont have clear if is I have to add the kFactor or dt on the computations and also the sign of the result.
For example, if used in a EulerImplicit solver, the force is multiplied by the dt and the hessian is multiplied by dt+beta value (or something like that, I dont have the details right infront of me). It would be nice to add in the documentation if we need to multiply our force and hessian by these quantities.
Also, the force is the
-dE/du, but I always have to double check if the solver is assuming Im returning the force or the derivative of the energy. It would be nice to specify all this in the documentation clearly.30 October 2020 at 14:19 #17487HugoKeymaster
Sorry for keeping you waiting last two weeks.
kFactor is indeed not straightforward to understand. It’s a good point.
kFactor is defined in the MechanicalParams. These are set by the ODESolver (integration scheme) when writing:
matrix = MechanicalMatrix(mFactor, bFactor, kFactor);
For instance, for EulerImplicitSolver we have:
matrix = MechanicalMatrix(1+tr*h*f_rayleighMass.getValue(),-tr*h,-tr*h*(h+f_rayleighStiffness.getValue()));
In this case:
kFactor = -tr * h * (h+f_rayleighStiffness.getValue())
This kFactor is therefore used in implicit schemes, and it must be applied in the addDForce and addKToMatrix, when the implicit part of forces are applied.
Could reformulate your last point?
I am not sure to get where lies the lack of clarity.
Finally, I profit from this post to thank you directly for your strong activity around SOFA! Good to have you.
PS: it would great to hear from your work at the SOFA Symposium in 3 weeks!
- You must be logged in to reply to this topic.