Mesh Generation

Mesh Generation

OpenFOAM supports unstructured meshes of cells of any shape; cells in OpenFOAM can have any number of faces and faces can have any number of edges. Such complete freedom on cell shape gives greater flexibility for the generation of meshes around complex shapes, embedded refinement, etc.

There is a need in CFD for multiple meshing tools that cover a range of complexity of meshing task. At one extreme, there is meshing software that allows the user to define simple geometries and mesh to those geometries. At the other extreme, there is software that meshes to highly complex CAD surfaces. In between, there is room for one or two tools that generate optimal meshes for moderately complex surfaces.


At present, OpenFOAM has meshing software that operate at the extremes of geometry complexity. For simple geometries, there is blockMesh, a multi-block mesh generator that generates meshes of hexahedra from a text configuration file. The OpenFOAM distribution contains numerous example configuration files for blockMesh to generate meshes for flows around simple geometries, e.g. a cylinder, a wedge, etc.


For complex geometries, there is snappyHexMesh that meshes to surfaces from CAD, but also allows the user to define simple geometric entities such as boxes, spheres, planes, etc. The snappyHexMesh utility can run in parallel, so can generate meshes of 100s of millions of cells, given a sufficient number of CPUs and memory. It performs automatic load balancing when generating a mesh in parallel, i.e. redistributes cells across the CPUs, so the final mesh has approximately the same number cells per processor, for optimal performance during simulation.

Other mesh generation tools

There are some other tools that can be used to generate meshes in OpenFOAM:

  • extrudeMesh: Generates a mesh by extruding cells from a patch of an existing mesh, or from a surface mesh; can do a range of extrusions to produce linear, wedge or spherical meshes.
  • polyDualMesh: Creates the dual of a polyMesh, e.g. can be used to generate a “honeycomb” polyhedral mesh from a tetrahedral mesh.