CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Data Structure for the unstructured finite volume method (http://www.cfd-online.com/Forums/main/508-data-structure-unstructured-finite-volume-method.html)

Anthony February 2, 1999 00:56

Data Structure for the unstructured finite volume method
 
Hi ! I am working for developing an unstrucutred collocated cell-center finite volume code. I know that an edge-based data structure for the edges connectivity information is necessary. I wonder that if it is necessary for an additional cell-based data strucuture for the cells topology ? Also, the edge-based loop is used to accumulate the contribution of fluxes for each cells, but how can i assign the calculated corresponding coefficients to the two adjacent cells sharing the same edge via such a data strucuture ?

Does any one out there know how to do this ? your any suggestion will be appreciated. Many thanks!


Jeff Franklin February 2, 1999 08:07

Re: Data Structure for the unstructured finite volume method
 
One method would be to include the neighbor cell indexs for each cell face. Then when you loop over faces to determine fluxes the neighbor index can be used for loading/solving the linear system.

R.Krishnakumar February 2, 1999 16:03

Re: Data Structure for the unstructured finite volume method
 
Why don't you try using object-oriented methods. You can define three classes... 1) Point : containing three floating point datas... and the member functions to do the necessary actions. 2) Surface : ( or edge for 2d) containing a set of points forming the surface. The order of the points might be quite important here for calculating inward and outward normals. 3) Cells : Consists of surfaces forming the boundary of the cells... the order might be important here too.

At first sight, these might look very inefficient in terms of the memory storage, though the hierachy looks very elegant indeed. But then, when you do calculations for actual memory utilised by this and the adjacency matrix type of data structure, it actually seems to save memory for large no of points. But you will most probably be working in fortran, but I do think that the representations like the one above can be quite elegant and powerful.

Jeff Franklin February 2, 1999 17:58

Re: Data Structure for the unstructured finite volume method
 
Object-oriented methods do lend themselves to this type of problem. But as you have said one must be careful what is placed in a class and what is just stored in memory. Classes have additional addressing for values in the structure and if it is bearied too deep this addressing may become an issue. Also one must be carefull about virtual functions. They also have addressing to them because the address of these functions are not known until the program is run rather than when it is compiled.

I suggest using at least C for the coding of this type of software if not C++.

Anthony Yang February 2, 1999 20:24

Re: Data Structure for the unstructured finite volume method
 
Thanks a lot, Jeff and Mr.Krishnakumar Acutally, I am coding in C with Fortran style. But I think that the implementation of Struct or even Classes is a good idea in developing such a code. As has been discussed, what kind of information is to be included in the Struct or Classes is a key point. In addition, in my opinion, how many Structs or Classes(e.g. individual data structures for geometry or solver)are needed may be also an issue to be addressed.


All times are GMT -4. The time now is 21:38.