# Algorithm for face based data-structure - CFD

Good morning

I'm trying to develop an unstructured CFD code to solve Euler equations in a finite-volume (cell-centered) context (learning purposes). I was able to build from a cgns file some basic information for the code. What I have now are:

• Node index and its 'x' 'y' coordinates.
• Element index and nodes (indexes) that build these elements.
• Boundary conditions.

Since the code is 2D every element is actually a cell and every face is actually a line forming this cell.

The basic data-structures I build right now are: + Node array where I put the node index and choose between the x and y coordinates. + Element/node connectivity (anti-clockwise manner) where (for Quad):

connec(1,nelem) = node 1
connec(2,nelem) = node 2
connec(3,nelem) = node 3
connec(4,nelem) = node 4


These data-structures were very simple to build but the next one is very obscure for me. I need a face based data-structure where each face "knows" the nodes that forms it the left element index and the right element index.

The end result would be:

faces(1,face_index) = node 1 of the face.
faces(2,face_index) = node 2 of the face.
faces(3,face_index) = left element.
faces(4,face_index) = right element.


I searched a lot but could not find a reference that explains me the algorithms to build this face data-structure. Lohner's book about Finite-elements have very nice explanations about node-based datas-tructures but not about face-based ones.

Anyone has a good reference that explains these algorithms or even the algorithm itself ?

Thank you ! cheers

• My answer to this question may help: scicomp.stackexchange.com/questions/21163/… – BrunoLevy Nov 4 '16 at 20:09
• I know a code that has done a very similar procedure which collects face data from unstructured mesh output from GMSH (gmsh.info). Here is it: dolfyn.net/dolfyn/downloads_en.html Authors wrote the code in Fortran90 and the code is quite simple to be read. Hope it's helpful. – tqviet Nov 7 '16 at 8:56
• Thank you all for the answers ! I'll try to follow the procedures. I haven't fount the "thumbs up" bottom to thank you guys for the answers. – LM_O Nov 9 '16 at 11:08