Home › Forum › SOFA › Programming with SOFA › [SOLVED] Question on TetrahedronHyperelasticityFEMForceField
Tagged: Linux_ubuntu, SOFA_2012
- This topic has 6 replies, 2 voices, and was last updated 3 years, 7 months ago by nicklj.
-
AuthorPosts
-
10 April 2021 at 16:01 #19127nickljBlocked
When I use SOFA for simulating hyperelastic material under large deformation, I found that TetrahedronHyperelasticityFEMForceField is outperformed to other ForceField in terms of accuracy. However, when I tried to understand the code behind this, I met some difficulties in understanding the code as follows:
1. Generally when we programming the hyperelastic material behavior for FEM simulation, we need the tangent matrix for assembling the stiffness matrix, as shown in the ElasticityTensor function in the NeoHookean.h. However, it seems this function is not used in the TetrahedronHyperelasticityFEMForceField. Instead, it uses the applyElasticityTensor, which I’m not very clear on how it works.
2. In the TetrahedronHyperelasticityFEMForceField.inl, the function “addForce” makes perfect sense to me as it calculates the internal force using the PK2 stress comes form the material model. I can also roughly understand that in the updateTangentMatrix, the code wants to compute the linear part of stiffness matrix “N” and the higher-order part of the stiffness matirx “M”. However, in the addKToMatrix(and updateTangentMatrix) function, it seems first store all the stiffness matrix information on the edge, and assemble on an edge basis. This seems quite different to a standard FEM procedure and looks like some spring kind of forcefield assembly.
I understand this question is quite involved and may need a lot of equations to explain. However, I’m quite amazed that even this kind of assembly doesn’t make quite sense to me, it can achieve very good accuracy and what’s more it can somewhat avoid volumetric locking! Hence I would like to ask is there any supporting reference/literature that I can refer to understand the theory and validity behind it.
Thanks a lot.
11 April 2021 at 16:04 #19133jnbrunetModeratorHey @nicklj,
The
TetrahedronHyperelasticityFEMForceField
has, well, an interesting implementation design… And certainly not very intuitive. If you want to see another implementation of a hyperelastic forcefield which is a little bit more intuitive, I invite you to have a look at the HyperelasticForcefield of the plugin Caribou.Anyway, going back to your questions, it will be easier if we use some equations. Lets take the Saint-Venant-Kirchhoff material as an example. We have
Where is the Green strain tensor.
1. I believe the
applyElasticityTensor(tetinfo, params, input, output)
function computes the product where the tilde denotes the Voigt notation, i.e is a 6×6 matrix (symmetric part of a fourth order tensor) and is a 6×1 vector (symmetric part of a second order tensor). This function is therefore probably used to compute the non linear part of the elemental tangent stiffness matrix (see equation 2.24 of my thesis for a quick reference).2. It stores it on the “edge” because the stiffness matrix is symmetric for a hyperelastic material, i.e. . Hence no need to compute both and . In this very specific case, i.e. a linear tetrahedral element, every pair of nodes (i,j) is also a geometrical edge. This is not the case with hexahedral elements, for example. Again, have a look at the HyperelasticForcefield of the plugin Caribou to see how this is done with a more generic approach (compatible with every isoparametric elements).
I hope that helps a little bit !
J-N11 April 2021 at 16:28 #19136nickljBlockedhi, @jnbrunet,
Thanks a lot for your kind reply and your excellent work on Caribou. I think applyElasticityTensor is more tricky than what you described. I understand your point 2, but I think the code in TetrahedronHyperelasticityFEMForceField did not compute K_ii in updateTangentMatrix (maybe I’m wrong…).
Anyway, maybe there is no need to dig it in more detail, as I think Caribou is an excellent replacement. Actually I’ve read the code of Caribou these days, and the way you did in HyperelasticForcefield is clear and tide. It follows the standard and generic approach and is a very good reference on how to write a decent hyperelastic model in SOFA. I really would like to try it in my work. However, I spent this whole weekend and still not successfully compile it together with SOFA……
11 April 2021 at 16:32 #19137nickljBlockedMay I just take this thread to inquire about the compiling of Caribou? When I compile it with the latest version of SOFA(and in-tree build of SofaPython3), it shows the following errors:
CMake Error at /home/liuj/opt/SOFA/master/lib/cmake/SofaGui/SofaGuiConfig.cmake:40 (find_package): Found package configuration file: /home/liuj/opt/SOFA/master/plugins/SofaGuiQt/lib/cmake/SofaGuiQt/SofaGuiQtConfig.cmake but it set SofaGuiQt_FOUND to FALSE so package "SofaGuiQt" is considered to be NOT FOUND. Reason given by package: The following imported targets are referenced, but are missing: QGLViewer
It bothers me for quite a long time…
11 April 2021 at 17:15 #19138jnbrunetModeratorI think applyElasticityTensor is more tricky than what you described.
Could be, but looking quickly on how it is used, i.e. called 3 times (1 per coordinates), this looks a lot like a kind of “optimization” to compute where is the 6×3 strain variation matrix. It is like the applyElasticityTensor computes the product with one column (one coordinate) of . We could probably check this by comparing/printing it against the caribou forcefield since both of them produce exactly the same stiffness matrix (I validated it).
I understand your point 2, but I think the code in TetrahedronHyperelasticityFEMForceField did not compute K_ii in updateTangentMatrix (maybe I’m wrong…).
Yeah it only computes the upper part of the diagonal matrix (K_ij with i!=j). The K_ii coefficients should be the accumulation of each “edges” connected to the node “i”. So no need to compute/store it.
Anyway, maybe there is no need to dig it in more detail, as I think Caribou is an excellent replacement. Actually I’ve read the code of Caribou these days, and the way you did in HyperelasticForcefield is clear and tide. It follows the standard and generic approach and is a very good reference on how to write a decent hyperelastic model in SOFA.
Thanks a lot ! There is still a lot of work to do, but I very happy to learn that it is still useful to some people 🙂
When I compile it with the latest version of SOFA(and in-tree build of SofaPython3), it shows the following errors
Hum I’m not sure, it looks like a SOFA compilation error… Can you re-post your error here so we can look at it together without polluting this forum? It will also be a good occasion to create the first github discussion on the caribou repo 😉
12 April 2021 at 04:32 #19139nickljBlockedI think applyElasticityTensor is more tricky than what you described.
Could be, but looking quickly on how it is used, i.e. called 3 times (1 per coordinates), this looks a lot like a kind of “optimization” to compute where is the 6×3 strain variation matrix. It is like the applyElasticityTensor computes the product with one column (one coordinate) of . We could probably check this by comparing/printing it against the caribou forcefield since both of them produce exactly the same stiffness matrix (I validated it).
Thanks for explaining. I think the main problem is the code is a bit difficult to read. The formulation is OK for me, just the detailed implementation is not easy to trace without document. But anyway this is not a big problem. I’ll work it out.
I understand your point 2, but I think the code in TetrahedronHyperelasticityFEMForceField did not compute K_ii in updateTangentMatrix (maybe I’m wrong…).
Yeah it only computes the upper part of the diagonal matrix (K_ij with i!=j). The K_ii coefficients should be the accumulation of each “edges” connected to the node “i”. So no need to compute/store it.
I overlooked. Makes sense. Thanks.
Anyway, maybe there is no need to dig it in more detail, as I think Caribou is an excellent replacement. Actually I’ve read the code of Caribou these days, and the way you did in HyperelasticForcefield is clear and tide. It follows the standard and generic approach and is a very good reference on how to write a decent hyperelastic model in SOFA.
Thanks a lot ! There is still a lot of work to do, but I very happy to learn that it is still useful to some people 🙂
When I compile it with the latest version of SOFA(and in-tree build of SofaPython3), it shows the following errors
Hum I’m not sure, it looks like a SOFA compilation error… Can you re-post your error here so we can look at it together without polluting this forum? It will also be a good occasion to create the first github discussion on the caribou repo 😉
Thanks. I’ll try to figure it out and will turn to the github discussion if I cannot solve it by myself.
-
AuthorPosts
- You must be logged in to reply to this topic.