High-level overview of meshing for OpenFOAM (and others)
Here, I’ll give a high-level overview of my opinions on open-source meshing for OpenFOAM. This post should help point you in direction of the
During my
In my experience the key meshing options for the user of OpenFOAM are:
- blockMesh (All version of OF)
cfMesh (OF.org <=v4, foam-extend, OF.com V18+)- SnappyHexMesh (All versions of OF)
gmsh (independent)- Salome (independent)
Of these, each meshing software has its own advantages and disadvantages and have types of meshing where they perform the best. I’ll try to break this down based on my experience. Of course, some people will disagree with my views as meshing (somehow) can be a deeply personal adventure.
Structured 2D or Simple 3D Meshes
In this case, the answer is pretty simple: blockMesh
blockMesh has a slightly steep learning curve but all it takes is practice and reminding yourself of the right-hand-rule. If your geometry is easily represented by a reasonable number of points and curves – blockMesh is a good option. You would be surprised what you can mesh in blockMesh – if you have the time… but who has the time! That being said, blockMesh is the ideal OpenFOAM
A major advantage of using the native OpenFOAM

Tetrahedral (Tet-Dominant) Meshes
There are lots of limitations of using tet-dominant meshes in CFD. However, I won’t go into those here. There are many times when a tet-mesh is the most straight-forward to produce. If you don’t have important boundary layer zones to produce, ripping out a quick tet-mesh can have huge time savings.
In these cases, I usually use either Salome’s built-in Netgen module or
Key to the effective generation of tetrahedral dominant meshes is the ability to generate layers at the wall. This can be a challenge in each of these programs. So no matter what you use – prepare to be patient. I have found that the boundary layer generation in Salome is quite robust. However, it occasionally produces some very poor quality regions which you need to be careful of. I have not had much success with layer generation in

Hex-Dominant Meshing
For hex-dominant meshing, your options are blockMesh (if you can create your geometry easily enough), cfMesh, or snappyHexMesh.
snappyHexMesh is a pretty nice tool, and is my mesher of choice for any multi-region meshing (see next section). But compared to cfMesh I find it much less robust. The key area where this is true is in layer generation. There are ways to get consistent layer generation in snappyHexMesh (i.e. providing a separate meshQualityDict where you turn off many of the paraemeters) but even then it can still be challenging. I have found that in almost all cases, I can achieve consistent, high-quality, boundary layers using cfMesh. Not only this, but I have found the workflow using cfMesh to be a breeze. Especially if you use the supplied Salome scripts to produce your geometry file (separate post on this to follow).


Multi-Region Meshing
Multi-region meshing is required for several different applications. The main ones I have encountered are rotating zones (for machinery and turbines), and conjugate heat transfer (for separate solid and fluid regions). For multi-region meshing in OpenFOAM, I almost always use snappyHexMesh. The primary reason for this is that is extremely simple to create in your workflow. As an example, let’s consider the case of a simulation where you plan to have rotating and static zones separated by an arbitrary mesh interface (AMI). When using

A sobering exercise
If you want a sobering exercise, google the Drag Prediction Workshop website, get the geometry, and try to mesh it using open source software and meet their gridding requirements. Here are some of the requirements for the COARSEST MESH:
- Minimum of 8 cells across the trailing edge of the wing
- Y+ < 1.0 (equivalent to dy=0.0006 mm)
- 2 cells close to the wall with no growth
- Growth rate <1.25 for the rest of the layers
The list goes on – and some of the example meshes will have 20+ layers.
Anyway, I hope someone finds this post useful to point them in the direction of a good meshing software for their application!
If you are struggling with CFD, are interested in getting started, or are looking for consulting services, visit www.stfsol.com for information on CFD consulting services including training, development, private webinars and other simulation services.
Happy Open-Source Gridding!
Categories
Uncategorized
I’ve been trying to learn how to generate mesh with Salome. I’m currently using DPW 6 geometry, but everytime I import it to salome I always have this error when trying to generate the surface mesh.
It shows error in triangulation thing after meshing process. I’m completely confused and I don’t know what to do. I wonder if it just the bad geometry or me not knowing how to generate mesh properly and handling these kind of errors? Please enlighten me.