The advice to a user writing a mesh converter is that once you have the capability
to write lists of points, faces, cells and boundary in the format described in the
next paragraph, contact Nabla Ltd. and we will be able to assist finishing the
converter using the polyMesh class constructor in OpenFOAM. We strongly recommend
that you do not try to write the mesh files yourself for two reasons: 1) we already
have the necessary code to do this; 2) polyMesh reorganizes the point, face cell and
boundary ordering to ensure efficient running of the solver. In particular, the
faces in the mesh will be reordered in the upper triangular order, i.e.
the ordering of the faces depends on the ordering of the cells. Writing
the files yourself will not guarantee that the ordering is optimised for
OpenFOAM.
The format of the lists that you should be able to write are described below
and should adhere to the validity constraints in 6.1.1.
Points
A list of vectors. <x/y/z-coord> are floating point numbers.
<number of points> ( (<x-coord> <y-coord> <z-coord>) ... )
Faces
Ordering of points in a face is crucial. <point label> is a positive integer,
including zero. All faces must be either internal to the mesh, i.e.
belonging to two cells, or belong to both a cell and a boundary patch.
<number of faces> ( <number of points in face> ( <point label1> <point label2> ... ) ... )
Cells
Ordering of faces in a cell is not important. <face label> is a positive
integer, including zero.
<number of cells> ( <number of faces in cell> ( <face label1> <face label2> ... ) ... )
Boundary
A list of patches where a patch is itself a list of face labels, where all
faces will share the same boundary condition. Ordering of patches or faces in
the patch is not important.
<number of patches> ( <number of faces in patch 0> ( <face label1> <face label2> ... ) <number of faces in patch 1> ( <face label1> <face label2> ... ) ... )
The format described above is very close to the OpenFOAM file format and we
reiterate that once a user develops a mesh converter to this point, the
existing library functions of OpenFOAM should be used to complete the job.
An example set of lists for a simple mesh consisting of 4 hexahedra and
4 boundary patches is given below to provide final confirmation of the
format.