Please read OpenFOAM - Basics before reading this post
blockMesh is a mesh generation utility supplied with OpenFOAM. In simple word it generates mesh for the CFD analysis. In the last post it was said that the basic OpenFOAM case directory consists of three folders namely 0, constant and system. The blockMeshDict file in the constant/polyMesh directory of the case file contains the parameter of the geometry and the parameters required for meshing the surface. Now go to the forwardStep directory which is discussed in the previous post and open the blockMeshDict file. In the file u scan see may sections like FoamFile, vertices, blocks, edges, etc.,
The FoamFile section : helps OpenFOAM to detect which file it is and for which version of OpenFOAM it is written, format and class ,in this case it is a blocMeshDict file so the object is 'blockMeshDict'. Let's forget about the other for now.
The principle behind blockMesh is to decompose the domain geometry into a set of 1 or more three dimensional, hexahedral blocks. Edges of the blocks can be straight lines, arcs or splines. The mesh is ostensibly specified as a number of cells in each direction of the block, sufficient information for blockMesh to generate the mesh data. - Taken from link
Lets start to write the blockMeshDict with a simple example
Assume the geometry to be meshed is a cube with side 1 m located in the first quadrant with origin at one of the vertex as shown in the figure below
The vertices section can be written as follows:
vertices
(
(0 0 0) //0
(1 0 0) //1
(1 1 0) //2
(0 1 0) //3
(0 0 1) //4
(1 0 1) //5
(1 1 1) //6
(0 1 1) //7
);
The zeroth point is the reference point (can be any vertex of the block)
Then define a plane using the first vertex and other 3 points such that their normal is outward, these make up the first four points. As for now two dimensions are defined (Here x ,y). The fourth point and first point together specify the third dimension (here the z direction). Using the fourth, fifth, sixth and seventh points construct the opposite parallel plane. This will create the basic wire mesh.
There after the the wire is then partition based on the number of cells needed this is a basic geometry and the problem that i am going to explain is quite simple and linear so no many cell are needed (unnecessarily giving a large cell count only increases the computing time) so a 10 x 10 x 10 mesh is quite enough
blocks
(
hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1)
);
hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1)
);
This will divide the edges (wire) in 10 parts in all directions.
This will constitute the basic blockMesh file.
Type blockMesh in the respective folder where the whole project is located to create the mesh file.
The mesh can be seen by typing paraFoam.
Will be posting the next one on solvers.
No comments :
Post a Comment