Home › Forum › SOFA › Getting Started › Wrong msh file
Tagged: 64_bits, MacOS, msh FEM liver-demo MacOS, Plugin_other, SOFA_other
- This topic has 10 replies, 2 voices, and was last updated 4 years, 7 months ago by Hugo.
-
AuthorPosts
-
10 March 2020 at 10:38 #15385MFitBlocked
Hi all,
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:
https://filesender.surf.nl/?s=download&token=4ce2f7e3-59c5-43dd-adab-996d7307dc99I 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.
Kind regards,
M*Edit:
The password for the link:
KidneySOFA17 March 2020 at 14:47 #15419MFitBlockedHi guys,
Could I get a heads up? Ive increased the possible download time of the STL/OBJ/MSH files by 5 days.
Thanks in advance,
MFit
17 March 2020 at 18:18 #15426HugoKeymasterWelcome 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
Cheers,
Hugo
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:36 #15479MFitBlockedHi Hugo,
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.
Kind regards,
MatFit
18 March 2020 at 16:23 #1550025 March 2020 at 16:39 #15559MFitBlockedIve 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 08:01 #15563MFitBlockedHeres a picture of the scene for further explanation:
Kidney in gray, QR rigid square in red.
Kind regards,
MatFit
26 March 2020 at 09:01 #15562MFitBlockedHeres a picture of the scene for further explanation:
QR rigid square in red, kidney in gray.
Kind regards,
MatFit
31 March 2020 at 09:25 #15588HugoKeymasterHi @matfit
Before providing an answer, which object is driving which other object?
Is the QR code square just passive and following the kidney?
Is it the inverse way around?Best,
Hugo
31 March 2020 at 09:47 #15589MFitBlockedThe QR is passive, yet the kidney should be following the QR code square. In a further project, the position of the QR code will determine the position of the kidney.
Right now Im thinking of implementing it as a BilateralInteractionConstraint. The mass of the square will act as a force going against the kidney, which makes sense.
Any feedback is welcome.
31 March 2020 at 10:41 #15591HugoKeymasterHi @matfit
Yes you are perfectly right with the BilateralInteractionConstraint!
This way the QR and the kidney will influence one another.Since the BilateralInteractionConstraint implements the constraint on one template and since you kidney is deformable, it has to be Vec3d. But your QR code is actually just a rigid with a visual square mapped on it. So, you might end up with:
– a Vec3 kidney
– a rigid particle (corresponding to the QR code frame) with a Vec3 child node + RigidMapping, and finally a visual node with the squareThe example scene is available in examples/Components/constraint/BilateralInteractionConstraint.scn
I hope this will help.
Best,Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.