blockMesh is a meshing engine used to create hex meshes in elementary geometrical shapes:
It is included with OpenFOAM and requires that the environment has been properly set. On a default installation, this can be done by executing the following command in the working terminal:
. /usr/lib/openfoam/openfoam2006/etc/bashrc
It is also possible to create assemblies of these elementary shapes using an input dictionary via the "Input Dict File"
keyword. For more information, see the OpenFOAM User Guide.
Generic code for blockMesh:
{ "Program Type": "Mesh Generation", "Mesh File Options": { "Output Mesh File": "filename.vtu" }, "Mesh Generation Options": { "Mesh Generation Engine": "blockMesh", "blockMesh Parameters": { "Input Dict File": false, "scaleToMeters": 1, "NumCells": [40, 40, 40], "<SHAPE> Parameters": { ... } } } }
where "<SHAPE>"
can be replaced with "Block"
, "Sphere"
, or "Cylinder/Tapered_Cone"
Input Dict File
: Specifies the input file, if any false
indicates no input dict should be used.scaleToMeters
: Scales all input lengths from the default of meters.To set to millimeters, set to 0.001NumCells
: Number of cells in each direction [x, y, z].For 40 cells in every direction, set to [40, 40, 40]Optionally, "Cell_Size"
can be provided within the "blockMesh Parameters"
block. Then, the number of cells in each direction will be determined with \(\frac{side length}{cell size}\). Note that this will override any specified values for "NumCells"
.
The "blockMesh Parameters"
block should contain exactly one of "Block Parameters"
, "Sphere Parameters"
, or "Cylinder/Tapered_Cone Parameters"
.
"Block Parameters": { "InitialPoint": [0., 0., 0.], "Length": [1., 1., 1.], "Grading": [1., 1., 1.] }
InitialPoint
: Location of reference point, [x, y, z]For an initial point at the origin, set to [0., 0., 0.]Length
: Side length in each direction [Lx, Ly, Lz].For a 1x1x1 cube, set to [1., 1., 1.]Grading
: Ratio between the widths of the ending cell and the starting cell in each direction [Gx, Gy, Gz].For uniform cells, set to [1., 1., 1.] "Sphere Parameters": { "Center": [1., 1., 1.], "Radius": 1., "Grading": [1.5, 1.5, 1.5] }
Center
: Location of center point, [x, y, z]Radius
: Radius of the sphere.Grading
: Ratio between the widths of the ending cell and the starting cell in each direction [Gx, Gy, Gz]. "Cylinder/Tapered_Cone"
in the source code, and should be specified as shown in the input file. Nevertheless, what is meant is truncated, not tapered."Cylinder/Tapered_Cone Parameters": { "Center": [1., 1., 1.], "Radius1": 1.5, "Radius2": 0.6, "Height": 2.5 "Grading": [1., 1., 1.] }
Center
: Location of center point, [x, y, z] This refers to the center of the base circle.Radius1
: The bottom radius of the cylinder/truncated cone. For a cylinder, the two radii should be the same.Radius2
: The top radius of the cylinder/truncated cone. For a cylinder, the two radii should be the same.Height
: The height of the cylinder/truncated cone.Grading
: Ratio between the widths of the ending cell and the starting cell in each direction [Gx, Gy, Gz].For uniform cells, set to [1., 1., 1.]See the header file for source.