# Unstructured mesh preprocessing

For solving PDE with self written code it is needed to preprocess the data from mesh generators. I recently started shifting from cartesian grid to unstructured.

I finished reading up to FVM part of the book by the author - S.Mazumder, suggests extracting the following information:

Geometry-related information:

• Whether the geometry is 2D or 3D: geom_type

• Total number of cells: ncells

• Total number of faces: nfaces

• Total number of boundary faces: nbfaces

• Total number of vertices (or nodes): nnodes

• Cell center coordinates: xc(ncells), yc(ncells), zc(ncells) (only in 3D)

• Face center coordinates: xf(nfaces), yf(nfaces), zf(nfaces) (only in 3D)

• Vertex or nodal coordinates: xv(nnodes), yv(nnodes), zv(nnodes) (only in 3D)

• Surface normal: sn(nfaces,2) (in 2D) or sn(nfaces,3) (in 3D)

• Cell volumes: vol(ncells)

• Face areas: areaf(nfaces)

Connectivity information:

• Number of faces of given cell: nface(ncells)

• Number of vertices (or nodes) of given face: nfnode(nfaces)

• Number of vertices (or nodes) of given cell: ncnode(ncells)

• Link from cell to face: link_cell_to_face(ncells,nface)

• Link from face to cell: link_face_to_cell(nfaces,2)

• Link from face to vertex (or node): link_face_to_node(nfaces,nfnode) • Link from cell to vertex (or node): link_cell_to_node(ncells,ncnode)

• Link from face to boundary face: link_face_to_bface(nfaces)

• Link from boundary face to face: link_bface_to_face(nbfaces)

Tried using different mesh output formats from PointWise, none of them had such data. It would be great and interesting to self write the scripts for preprocessing the grid (even the grid generator itself), however only interested in the actual FVM methods.

Could one recommend the literature for preprocessing the unstructured grids into nice and clean arrays/matrices with connectivity information? Or useful parsing scripts for popular mesh formats?

Trying to write own FVM script for N-S in C/MatLab.

It is my first post here and surprisingly it coincides with my birthday. Thank you.

• The book "Lohner, Applied CFD Techniques" gives algorithms for constructing such information. Usual mesh generators only give some topological information, what are the nodes and how are they joined to form elements and maybe boundary faces. If you use PETSc then DMPlex can construct such info for you. Commented Mar 8, 2021 at 7:27
• Dear @cfdlab thank you for your response and recommendations. Commented Mar 9, 2021 at 4:10