Pre-processing in openfoam,
mesh generation.
OpenFOAM kurs 2011 Håkan Nilsson Olivier Petit
Chalmers University of Technology
Different ways of creating the mesh.
Outline
Using SnappyHexMesh,
SnappyHexMesh an OpenFOAM mesh generation
tool.
Using blockMesh.
blockMesh
Importing the mesh from external software.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
A tutorial for snappyHexMesh.
SnappyHexMesh generates a 3D mesh from a .stl file.
( triangulated surface geometry)
For this tutorial, a simplified pump geometry is chosen.
For more simplicity in computations, the
symmetry of the geometry is used, and
only one quarter of the pump is meshed.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
A tutorial for snappyHexMesh.
Download the tutorial from Håkan’s webpage.
Source OpenFOAM 2.0.x with alias or
. /chalmers/sw/unsup64/OpenFOAM/OpenFOAM-2.0.x/etc/bashrc
To check if the right OpenFOAM was called:
which SimpleFoam
It should point to simpleFoam in OpenFOAM-2.0.x
In the tutorial case, you should find:
1. The .stl file located in constant/triSurface.
2. A dictionnary called snappyHexMeshDict in system/.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
snappyHexMesh: step 1
Creation of a grid surrounding the stl surface..
Characteristics of the grid:
The aspect ratio of the grid cells should be around 1.
More than one cell in the z direction.
At least on cell’s edge should intersect the surface.
There can not be empty patches, it is a 3D mesher.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
SnappyHexMesh: step 1
Starting the splitting process.
• Start the splitting from locationInMesh feature. • Splitting the cells around the surface according
•This edge must be inside the region to be to :
refinementSurfaces
meshed and must no coincide with a cell {
face. file.stl
{
level (2 2); // default (min max) refinement for surface
}
}
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Snappyhexmesh: step 1
Cell removal process, and refinement of specified regions
• Keep the side of the mesh defined by The region refined is specified by:
locationInMesh. inside: inside the volume region.
• Remove all cells that have above outside: outside the volume region.
distance: according to distance to the
50% of their volumes in the meshed
surface.
region. The region is defined first as geometry.
This first step is saved into the time folder 1.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Snappyhexmesh: step 2
Snapping to surface.
The steps to snap to surface are:
1. Snap the vertices onto the STL surface.
2. Solve for relaxation of the internal mesh.
3. Iterate using the snapControls in
SnappyHexMeshDict.
This second step is saved into the time folder 2.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Snappyhexmesh: step 3
Boundary layer addition.
The boundary are applied on patches,
not on surface!!
Mesh projection back from the surface using a specified thickness normal to the surface.
Solve for relaxation of the internal mesh with the latest projected boundary vertices.
Check if validation criteria are validated.
If the validation criteria can be satisfied, insert mesh layers.
This last step is saved into the time folder 3.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Snappyhexmesh: pros and cons.
Possibilities of multiple refinements that make it very robust.
It runs in parallel.
Need of a good quality STL surface, with more than one region/patch.
The feature line is now available, but is still very weak.
A Boundary Layer mesh is not easy to obtain, it requires experience and trial
and error method.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
blockMesh/m4: a short tutorial.
m4: allow a parametrization of the case, easy to change.
rUt
rStatUt
rStatIn
rRotUt
rRotIn α2- α1
rIn
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
blockMesh/m4: pros and cons.
Very easy way to create an simple geometry.
The parametrization with m4 allow to create
different geometry from the same m4 file.
Not enough precision in the meshing
parameters.
Easy to go wrong on the orientation of the faces
and blocks.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Import the mesh: pros and cons
Need of an other software to create the mesh.
Few converters:
fluentMeshToFoam,
fluentMeshToFoam fluent3DMeshToFoam for Gambit
mesh types.
starToFoam for STAR-CD mesh types.
ideasToFoam for I-DEAS mesh types
cfx4ToFoam for CFX mesh types.
CGNSToFoam for CGNS files (can import more than
meshes), developped by users.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
Conclusion
SnappyHexMesh is an easy tool to generate a
mesh, but is still young and lacks some
important features.
m4/blockMesh is a perfect tool when it comes
to simple geometries, but is not enough
developped to deal with real type geometries.
The most common solution is to import a mesh
from an external software.
Svensk Vattenkraft Centrum - SVC
Chalmers University of Technology
EXTERNAL LINKS FOR SNAPPYHEXMESH
http://www.hydroniumion.de/allgemein/snapp
yhexmesh-tutorial/
http://www.hydroniumion.de/studium/snappyh
exmesh-tutorial-part-2/
http://www.openfoam.com/docs/user/snappy
HexMesh.php#x26-1510005.4
Svensk Vattenkraft Centrum - SVC