CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (
-   -   best mesh generator (

vitorspadeto January 28, 2014 15:26

best mesh generator
what's the best mesh generation software for OpenFOAM?!

I have Ubuntu. My computer is 32 bits. I tried install salome, but it is 64 bits.

chegdan January 28, 2014 15:35


what's the best mesh generation software for OpenFOAM?!
snappyHexMesh of course! There are some presentations on the subject located at

There is also some official explanation located here and then a few GUIs to do some setup for you:

If you aren't keen on snappyHexmesh, there are also a few other mesh generation tools that I suggest

Other than that, OpenFOAM can import many formats and you can use pretty much any tool to generate meshes.

GerhardHolzinger January 29, 2014 04:25

1 Attachment(s)
Depending on your ability to enjoy a good days pain in the brain, it can also be blockMesh in conjunction with m4 or Python.

This is the parametric mesh of a stirred tank with a Rushton impeller.

The features are

  • A variable number of stator baffles (1,2,4,6,12)
  • A variable number of rotor blades (1,2,4,6,12)
  • The geometry is parametrized (Tank diameter, height, etc.)

thomasnwalshiii February 14, 2014 14:24


Very nice tank model you have created. Curious if you could post an example of how to implement an m4 or python script to generate the blockmesh and baffle files?

Tom Walsh

GerhardHolzinger February 17, 2014 13:52

1 Attachment(s)

I stopped using m4 for my meshes because Python is much better to read and it is also much more flexible. However, the attached image of a small pipe joining a larger cylinder was created with m4.

I won't post my mesh creation script - sorry for that, but I can elaborate on the workflow.

  1. Draw a sketch of the geometry. If you can draw the geometry using only quads you can build the mesh with blockMesh
  2. Identify a logical structure between the vertices in your geometry
  3. Find a naming scheme that obeys the logical relations.
    1. E.g. the vertices that made up the tank had a four character name 'RThH'. The 'R' is the radial identifier, the outermost vertices were named 'a???'. The vertices of the next inner layer were named 'b???', and so forth.
    2. The second character is the tangential coordinate. The vertices on the x-axis were named '?0??', the next ones in angular direction were named '?1??'.
    3. The third character is only a seperator
    4. The last character is the vertical coordinate. E.g. 'a2h0' lies in the x-y plane, 'c3h2' has a non-zero height.
  4. Translate the logical relations between the vertices in code, e.g. when computing the coordinates.
  5. Use the naming scheme to access the point coordinates using a map in Python, that's a very handy thing m4 is not able of.
  6. Write methods that receive vertex names as an argument and return e.g. a valid OF-block definition as a string.
  7. Put everything together in a script that:
    1. computes the coordinates of the vertices based on input parameters and other relations
    2. writes a valid blockMeshDict including vertex definition, block definition, boundary definition and if necessary edge definition (don't forget to compute the interpolation points).
My current stirred tank mesh-generation script is at around 1200 lines of code.

All times are GMT -4. The time now is 23:03.