Home › Forum › SOFA › Programming with SOFA › External force on a vertex
- This topic has 5 replies, 2 voices, and was last updated 4 years, 11 months ago by Hugo.
-
AuthorPosts
-
9 October 2019 at 16:33 #14364agnivBlocked
I am trying to build a scene (with the SOFA Python plugin) where a particular vertex of a tetrahedral mesh is subjected to a sequence of translation, given by this:
node.createObject('LinearMovementConstraint',name='moveConst',template='Vec3d',relativeMovements='true',movements='4 0 0 0 4 0 0 0 4',showMovement='true', keyTimes='1 1.5 2 2.5', indices = str(self.node))
where
self.node
is the vertex ID.Given this sequence of motion, I would like to know the external, unbalanced force acting on the object to cause this deformation, i.e., the amount of force I need to apply using a
LinearForceField
type of object to cause the same amount of deformation in the mechanical mesh. I would like to record these forces when a steady-state has been reached and the vertex has reached the desired position.I tried to do this using two methods:
node.getChild('myRootNode').getObject('myMech').findData('force').value[self.node]
node.createObject("Monitor" , name="myMonitor", indices=str(self.node), ExportForces='true', showForces='false',fileName='/path/to/log/file.txt')
Both these methods produce similar outputs, but they do not seem to be reasonable.
For example, at the
keyTimes
, it shows the force to be zero for most of the simulation, and then suddenly jumps to a meaningful value after a few sequence of translation has already been executed.Could you please let me know the proper way to get this done (or point me to a proper documentation for doing this). Thanks in advance.
11 October 2019 at 19:40 #14395HugoKeymasterHi @agniv
The first concern that I have is that you are mixing two notions of “nodes”.
I would rather name the indices that you want to pass to your constraint:self.constraintIndices
Because
node
is also the graph node..The idea of looking into the force vector was good, I don’t know exactly what makes the values to suddenly jump..
Internal forces resulting from imposed displacement are computed by the mechanical constitutive law. Depending on the FEM mechanical model you are using, you could export in the C++ code the vector resulting from theaddForce()
function.Best
Hugo
11 October 2019 at 23:42 #14397agnivBlockedSo, can I assume that the VecDeriv object ‘f’ in the
addForce()
method of FastTetrahedralCorotationalForceField would provide the force on each indices?So the inverse of the resultant of all the forces is the external force needed to cause the same displacement?
If that is correct, it will neatly solve my problem. I will try this out soon.
Thanks a lot.
27 November 2019 at 16:33 #14634HugoKeymasterHi @agniv
Sorry for the delay of my reply, we have been busy with the SOFA Week. You can find out more about this annual community event on SofaFramework’s YouTube account.
The contribution computed in the
addForce()
function and added in the f vector corresponds to the explicit contribution of the internal forces (due to the mechanical constitutive law). If you are in an implicit scheme, the internal forces contribute to the f vector with both an explicit contribution and an implicit contribution, related to the derivative of the internal force with regards to the degrees of freedom in theaddDForce()
function. More info can be found in the documentation here.Therefore you sentence “the inverse of the resultant of all the forces is the external force needed to cause the same displacement” would be true only in an explicit scenario. Because in implicit, the mechanical model also influences the system matrix A.
If I remember properly you are working in Hybrid team in Rennes. Is this correct?
In case you need a deeper introduction to SOFA, please let me know.Best
Hugo
27 November 2019 at 23:01 #14651agnivBlockedHi Hugo,
I’m in Rainbow team, not Hybrid.
Thanks for the information, I’ll stick to explicit solvers for the purpose.
Regards,
Agniv29 November 2019 at 08:58 #14662HugoKeymasterIf my previous reply answers your question, do not hesitate to close this topic.
You can open a new one anytime.Best wishes,
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.