After a quite long absence, I want to share a cylinder mesh with blockMesh. blockMesh is a built in mesher in OpenFOAM®. It uses simple block structured meshes. Basically I was working on meshing a complex geometry for the OpenQBMM®, and once I finished it, I separated this part and now I am making it available to use. I should mention that this work is never been possible without the help of my advisor, Prof. Alberto Passalacqua.
- OpenFOAM dev
m4 file contains some commands that finally will generate the blockMesh dictionary. The advantage of using m4 is its ability of parametrisation the mesh.
- add the complete perl-information into m4 file
define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')])
- labeling the vertices
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
- macro to initialize the blocks easily and more systematic
define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t))
- macro to define the walls and internal surfaces along $z$ direction
define(btQuad, ($1b $2b $2t $1t))
- macro to define the inlet
define(bottomQuad, ($1b $2b $3b $4b))
- macro to define the outlet
define(topQuad, ($1t $4t $3t $2t))
- conversion of size
- number of cells at each side of square
- number of cells between inner square and cylinder in $x$ and $y$ direction
- number of cells along the cylinder height, e.g. $z$ direction
In order to find the defined vertices and blocks easily, I also show them in a figure below with their labels:
Download blockMeshDict.m4 file:
You can download the file from blockMeshDict.m4. .once you downloaded the file move the file to:
Then executing the m4 macro will generate the blockMeshDict in the same folder:
m4 blockMeshDict.m4 > blockMeshDict
As it is obvious, blockMesh should be executed afterwards.
This offering is not approved or endorsed by OpenQBMM, the producer of the OpenFOAM software and owner of the OpenFOAM® and OpenQBMM® trade marks. Ehsan Madadi is not associated to any of these companies and trade marks.