0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – cfdlab
    Mar 8 at 7:27
  • $\begingroup$ Dear @cfdlab thank you for your response and recommendations. $\endgroup$
    – 2Napasa
    Mar 9 at 4:10
2
$\begingroup$

I would leave out a few things to make it more simple. This is how we do it for our code which is capable of using polyhedral meshes: https://github.com/nikola-m/freeCappuccino-dev/blob/master/src/mesh/geometry.f90

It is so called face based data structure.

We use divergence theorem to compute geometrical data like volumes and cell center coordinates. This approach is described in a paper by Wang ( Z.J. Wang, Improved Formulation for Geometrical Properties of Arbitrary Polyhedra, AIAA Journal 37(11) 1999. ) which is also cited in Fluent documentation.

Because of general way how data is usually formated in most mesh formats (often better suited for FEM or for vertex based FVM) we need to do some preprocessing in order to find cell neighbours trough a face. We have a tool in the form of mesh format converter also available to fit this purpose

$\endgroup$
2
  • 2
    $\begingroup$ Could you add the complete citation to the paper? $\endgroup$
    – nicoguaro
    Mar 12 at 22:49
  • $\begingroup$ managed to parse the .ucd file into nice and clean data structure via Matlab, thnx to your git provided, will stick to it for now. can post the script if necessary. $\endgroup$
    – 2Napasa
    Mar 16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.