Generate a Background Mesh for SnappyHexMesh using SALOME

@Runmin ZHAO  July 23, 2018

SnappyHexMesh is a convenient tool to generate high-quality meshes for complex geometries. Before using snappyHexMesh, a background mesh should be ready, which could be generated using blockMesh or external meshers like ICEM CFD, SALOME and Gmsh. The background mesh must consist purely of hexes, with cell aspect ratio being approximately 1, and at least one edge intersecting the STL surface.
Today I tried using the opensource software SALOME to generate the mesh, which I regard as more convenient than using ICEM.

Import The STL of the background

  • Enter the Geometry module in SALOME, and import the STL file by choosing File>Import>STL from the drop-down menu.
  • Press the Fit All button to see the geometry and the Interaction Style Switch button to rotate.

Create a Box and Assign Patches

  • Press the Create a Box button to open the Box Construction window.
  • In the window, click the box construction method on the left, give it a name, and then choose two points on the geometry to define the box. Apply and close.
  • Find the box we just created in the Object Browser, right click it, click the Create Group item and see the Create Group window.
  • Choose face as the shape type, give the patch a name, select the face to assign and click the Add button.
  • Right-click the patches in the Object Browser and click show only to check whether they are correctly assigned.

Generate the Mesh

  • Enter the Meshmodule and click the create mesh bottom.
  • Give the mesh a name, choose the box we just created in the Object Browser and then assign 3D: Automatic Hexahedralization the set of hypothesis, where gFortran is needed in the system.
  • In the 1D tag, set the hypothesis as local length and input a required step length like 0.2. Apply and Close.
  • Right-click the mesh in the Object Browser and click Compute.
  • Right-click the mesh in the Object Browser, click Create Groups from Geometry and choose all the patches in the box we created. Apply and Close.

Export the Mesh and convert to blockMesh files

  • Right-click the mesh in the Object Browser and then Export>UNV file to the OpenFOAM working directory.
  • In the Terminal, use command ideasUnvToFoam filename.unv to convert it into blockMesh files.

Add a New Comment