Write OpenFOAM meshes
(adapted from http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?1/1507)
- All meshes are 3D. Use single layer of cells with empty front and back patches to create a 2D simulation.
- Meshes are defined by five files:
points (x y z) point locations
owner, neighbour for every face the (labels of the) cells on either side. The owner cell should be the lowest numbered cell. Boundary faces have -1 as neighbour (1.4.1) or neighbour list is truncated to only the internal faces (1.5)
faces for each face an ordered list of point labels. The normal (righthand rule) should point away from the owner cell (so the boundary faces point out of the domain)
The face ordering is quite intricate:
- internal faces get ordered such that when stepping through the higher numbered neighbouring cells in incremental order one also steps through the corresponding faces in incremental order (upper-triangular ordering)
- boundary faces are bunched per patch. The boundary file then tells where the start and size of the patch are in the faces list. For coupled faces there is an additional ordering inside the patch:
- cyclics: should be ordered such that face 'i' is coupled to face 'i + size()/2' where size() is the number of faces of the patch. Additionally the 0th point of a face is considered coupled to the 0th point of its coupled face.
- processor: should be ordered such that face 'i' on one processor is coupled to face 'i' on the neighbouring processor. Same additional constraint on the order of the points in a face as cyclics.
For decomposed meshes there are additional files (labelIOLists) that refer back to the undecomposed mesh:
faceProcAddressing for every face the original face in the undecomposed mesh. Also codes whether the face has been reversed. If procFaceI is the local face index and globalFaceI the index in the undecomposed mesh:
- faceProcAddressing[procFaceI] == 0 : not allowed
- faceProcAddressing[procFaceI] >0 : globalFaceI = mag(faceProcAddressing[procFaceI])-1 and orientation same as undecomposed mesh
- faceProcAddressing[procFaceI] <0 : globalFaceI = mag(faceProcAddressing[procFaceI])-1 and orientation opposite to undecomposed mesh.
pointProcAddressing, cellProcAddressing, boundaryProcAddressing for every point/cell/patch index the index in the undecomposed mesh.