blockMesh parametrisation with m4
BlockMesh is a built in mesher in OpenFOAM®. It has capabilities for creating simple block structured meshes, not meshes for complex geometries. The usage of blockMesh is described here.
This example shows how to parametrize my o-grid example. For parametrisation the m4 macro language will be used ( m4 homepage ), therefore it is required that you have m4 installed. A description of using m4 with blockMesh is also available on the OpenFOAM® Wiki page here.
About the m4 file:
The m4 file will generate the a similar blockMeshDict file as my blockMesh example.
Parametrisation of the mesh:
cornerStretch sets the position of the core rectangle corners. If this value is specified as 1.0 than the core rectangle will be an exact rectangle. Examples:
Usually the cornerStretch shall be specified to a value lower than 1.
arcStretch has an impact on the shape of the sides of the core rectangle corners. In the blockMeshDict file these sides are defined as arcs. In blockMesh the definition of arc a third "ghost point" shall be defined: the arc will cross this point. The arcStretch variable is defined to have straight core rectangle sides when its value is 1.0. Examples:
Last example shows a good set up for both stretch factors.
The m4 macro will simply substitute the calculated value of the variables at the place where the variable is called. E.g.:
( 0 0 zLength ) //1
( 0 0 100 ) //1
Executing the m4 macro file will create the output to the screen, this should be redirected preferably to the blockMeshDict file.
m4 blockMeshDict.m4 > blockMeshDict
Of course blockMesh should be executed afterwards
Download blockMeshDict.m4 file:
Put the file here: <case>/constant/polyMesh/blockMeshDict.m4
Version: 1.2, 2012-05-18