Tetrahedral Mesh

The tetrahedral mesh is the basis for most simulated object types in Mesh Deformations.

MAGES uses tetrahedral meshes stored in .msh files. If you already have an .msh file, drag and drop it into the project’s Assets folder. The mesh will be imported automatically and will be ready to use in the next steps of the workflow.

Warning

At the moment, only Version 2 ASCII .msh files are supported.

If your starting point is an .stl file, you must first convert the surface mesh into a tetrahedral volumetric mesh. In our current workflow this is done with third-party tools such as Salome-Meca and Gmsh.

Note

The tetrahedralization examples below are based on the Salome-Meca workflow. Gmsh is used afterwards to convert the exported mesh into a Unity-compatible .msh file.

Before You Start

For tetrahedralization, the input .stl should be:

  • enclosed (watertight)

  • triangulated

  • free of self-intersections

The result of this process is a tetrahedral volumetric mesh that can be exported as an .msh file and imported into Unity.

Tetrahedralizing a Single Region

Use this workflow when the model should become one tetrahedral volume.

  1. Open Salome-Meca.

  2. Switch to the Geometry module.

    ../../_images/switch_to_geometry.gif
  3. Import the .stl file.

    ../../_images/import_stl.gif
  4. Click New Entity > Build > Solid and create a solid from the imported STL geometry.

    ../../_images/new_entity_build_solid.gif
  5. Switch to the Mesh module.

    ../../_images/Switch_to_mesh.gif
  6. Click Mesh > Create Mesh.

    ../../_images/create_new_mesh.gif
  7. For Geometry, select the solid you created.

    ../../_images/pick_geometry.png
  8. Set the algorithm to NetGen 1D-2D-3D and create a hypothesis with the default values and click Apply and Close.

    ../../_images/create_hypothesis.gif
  9. In the Object Browser, right-click the created mesh and select Compute Mesh.

The tetrahedral mesh may appear with a warning icon before computation. This is expected.

If you need a finer or coarser result:

  1. Right-click the hypothesis and select Edit Hypothesis.

  2. Adjust the values and click OK.

  3. Right-click the mesh and select Clear Mesh Data.

  4. Right-click the mesh again and select Compute Mesh.

Tetrahedralizing Multiple Regions

Use this workflow when the model contains multiple regions that you want to preserve in the tetrahedral mesh.

  1. Open Salome-Meca.

  2. Switch to the Geometry module.

    ../../_images/switch_to_geometry.gif
  3. Import the .stl file.

    ../../_images/import_stl.gif
  4. Click New Entity > Build > Solid and create solids from the imported geometry.

    ../../_images/new_entity_build_solid.gif
  5. Select the objects that should be combined and click Operations > Partition.

    ../../_images/operation_partition.gif
  6. Use Explode with Solid as the type so the partitioned result is split into separate solid regions.

  7. Switch to the Mesh module.

    ../../_images/Switch_to_mesh.gif
  8. Click Mesh > Create Mesh.

    ../../_images/create_new_mesh.gif
  9. For Geometry, select the solid or partitioned result you want to tetrahedralize.

  10. Set the algorithm to NetGen 1D-2D-3D and create a hypothesis with the default values and click Apply and Close.

    ../../_images/create_hypothesis.gif
  11. In the Object Browser, right-click the created mesh and select Compute Mesh.

You can refine the result in the same way as in the single-region workflow by editing the hypothesis, clearing the mesh data, and computing the mesh again.

Exporting for Unity

After tetrahedralization is complete, export the mesh from Salome-Meca and then convert it in Gmsh.

Salome-Meca

  1. In Salome-Meca, right-click the mesh and select Export Mesh.

  2. Export the mesh as either GMF or MED.

  3. Close Salome-Meca once the export is complete.

Gmsh

  1. Open Gmsh.

  2. Click File > Open and load the exported mesh.

  3. Click File > Export and export it as an .msh file.

  4. When exporting from Gmsh, choose Version 2 ASCII.

  5. Drag and drop the resulting .msh file into your Unity project’s Assets folder.

Note

Salome-Meca and Gmsh are only used to prepare the tetrahedral mesh. Once the .msh file is imported into Unity, you can continue with the normal Mesh Deformations workflow.