How to generating a mesh in OpenFOAM?

blockMesh

generating simple meshes of blocks of hexahedral cells

snappyHexMesh

generating complex meshes of hexahedral and split-hexahedral cells automatically from triangulated surface geometries

foamyHexMesh

producing low-non-orthogonal hex-dominant meshes which align well with surface geometry and captures features accurately

foamyQuadMesh

producing 2D foamyHexmesh

Where mesh is located? What is the format of the mesh?

The OpenFOAM mesh is stored in the constant/polyMesh sub-directory of a case; this polyMesh directory contains files that provide all the information above a mesh consists of:

• List of points

• List of faces

• List of cells OR owner-neighbour addressing

• List of boundary patches, grouping external faces

File polyMesh/points is a list of vectors describing the cell vertices in 3D coordinate:

number_of_points((x0 y0 z0) // point coordination (x y z) - pointID=0(x1 y1 z1) // pointID=1(x2 y2 z2) // pointID=2)

the first vector in the list represents point 0, the second vector represents point 1 and so on

File polyMesh/points contains list of faces, each face is defined by number of point and point index which has been prescribed in point list:

number_of_faces(number_of_points_of_face(pointID_1 pointID_2 ...) // faceID = 04(103 709 710 104) // faceID = 15(4 105 711 610 712) // faceID = 2)

Similar to point list, the first entry in the list represents face 0

File polyMesh/owner a list of faces in arbitrary order. The direction of the face normal vector is defined by the right-hand rule. Owner indicates the cell which has the center in the same direction with the normal vector.


number_of_faces(0 // cell ID)

File polyMesh/neighbour gives the cell index of the neighbour cell for each face.

number_of_faces(0 // cell ID)

Internal faces connects 2 different cell while boundary faces are only connected to one cell .

File polyMesh/boundary is a list of patches, each of which is associated with a boundary condition.

number_of_boundary( boudary_name { type wall; inGroups number_of_groups(group_name1 group_name2 ...); // can put in any group you want nFaces number_of_faces; startFace faceID_of_startface; } ...)

More details on the OpenFOAM mesh format can be found at: https://www.openfoam.com