10 March 2020 at 10 h 38 min #15385
I am rather new to SOFA, having just worked through most of the demos. I am aiming to achieve something similar to the liver demo with my own meshes from a kidney.
Now when I run the liver demo, runSOFA runs fine. However, if I adjust the .scn and add my own meshes to the file, runSOFA crashes and shuts down. I have troubleshot the problem, and it crashes every time I add the BarycentricMapping. This crashes because the tetrahedral force field calculation doesn’t work (in the GUI I noticed a red warning sign in other demos using my .msh file). Through the tutorials I’ve seen I understand that you need mapping in order to map the different nodes (vis, FEM, etc) with each other so it makes sense that it crashes if the FEM doesn’t work. The .OBJ works fine with MeshObjLoader, as I can get the visuals working. However, the .msh seems to be the problem.
So now I ask, how do I generate a working FEM?
My original STL is an export from Meshmixer after solidification and with a reduced amount of meshes, exported as STL and OBJ. The STL is loaded inside Gmsh and exported as .msh with ASCII version 2 as recommended in an earlier forum post. The OBJ is used for the visualization.
The .STL,.OBJ and .msh can be downloaded here:
I run SOFA v19.12 on MacOS.
As I am very new to this, I get a sense that I am missing something important or I’ve not started out right. I am grateful for any help given.
The password for the link:
KidneySOFA17 March 2020 at 14 h 47 min #15419
Could I get a heads up? Ive increased the possible download time of the STL/OBJ/MSH files by 5 days.
Thanks in advance,
MFit17 March 2020 at 18 h 18 min #15426HugoKeymaster
- SOFA Consortium
Welcome on the forum @matfit
Indeed changing just one mesh in the liver demo scene will not work. This is due to the fact that in SOFA, one object (e.g. a kidney) can have different representations/topologies:
- a mechanical model (e.g. a volumetric mesh on which will be computed the FEM)
- a visual model (e.g. surface mesh used only for the rendering)
- a collision model (e.g. surface mesh used to compute discrete collision)
The mapping creates links these different representations to keep them coherent (e.g. when the mechanical model deforms, we want the visual model to move accordingly).
By changing the visual mesh in the liver demo, the visual model was the one of the kidney while the mechanical model was the liver volumetric mesh. Both can not be linked.
As you understood, you need to create a volumetric mesh from your STL for the mechanics. For this purpose, you can use any mesh generator of your choice (MeshLab, CGAL or others). FYI, we have a CGAL plugin in SOFA. We have also a basic tool mesh generating volumetric tetra-meshes from surfaces: MeshTetraStuffing. Check out the examples: examples/Components/misc/MeshTetraStuffing.scn
PS: for your info, we also provide dedicated training sessions on SOFA, if you need more background on physics, maths, numerical analysis and simulation.18 March 2020 at 10 h 36 min #15479
Thanks for the response. This has helped out a lot. I will work on fine-tuning the mechanical properties of the model for now and see where that gets me. The training does sound interesting, I will definitely take a look.
MatFit18 March 2020 at 16 h 23 min #15500HugoKeymaster
- SOFA Consortium
Great to hear @matfit
In anyway keep us updated if you need assistance.
Hugo25 March 2020 at 16 h 39 min #15559
Ive got a follow up question, @Hugo.
I got the mesh working, and now included a rigid 3D square (its the base for a future QR code). Ive used the GenerateRigidMass engine for this purpose. Now I want to “glue” the rigid square with the earlier mentioned kidney. The square needs to stay on the exact location in relationship to the kidney. The kidney should be able to move anywhere except for through the square. The kidney should be “hanging” on the rigid element.
Ive come up with a couple of ideas, but thus far Ive had no luck implementing them, probably for some arbitrary mistake:
1. Create a fixed plane constraint to the kidney at the exact location of the square OR something like a ProjectToPlaneConstraint and link it to the topology of the square?
2. Use submultisetmapping to map the square’s mechanics to the kidney mechanics.
3. Use AttachConstraint to attach the rigid mechanics to the kidney mechanics. (This makes most sense to me, as you Attach the rigid mechanics and use it as a constraint for the deformation of the kidney)
4. DeformableOnRigidFrameMapping, using a rigid frame build with the size and position of the square (this doesnt seem like the right way to go).
Have you got any tips or directions which way to go? I can share the current .scn if you like (with OBJs) for further explanation. Might be a beginners question, but slowly but surely Ill get the hang of it. 😉
Kind regards and thanks in advance,
MatFit26 March 2020 at 8 h 01 min #15563
Heres a picture of the scene for further explanation:
Kidney in gray, QR rigid square in red.
MatFit26 March 2020 at 9 h 01 min #15562
- You must be logged in to reply to this topic.