CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   f_centroid and c_centroid definition (https://www.cfd-online.com/Forums/fluent/109826-f_centroid-c_centroid-definition.html)

Balti November 27, 2012 14:14

f_centroid and c_centroid definition
 
Hi

I used F_CENTROID(x,f,t) and C_CENTROID(cell,c,t) but I want to obtain
- in one hand, simple centres (average of vertices)
- in other hand, barycentric/geometric centres

who can explain me how do the cell centroid(c_centroid) and f_centroid functions of Fluent work? Is it barycentric/geometric centres or just average of vertices ?


Thanks

sbaffini November 27, 2012 16:28

What a FV method needs as face (volume) centroid is the point around which the first order moments of the face (volume) are nullified, in order for the approximation made in using it being 2nd order. By definition, this points are the centroids of the face (volume) and not the averages of the vertices; indeed, for general polygonal faces and polyhedral volumes, the two are different. For more information, refer to this:

http://www.public.iastate.edu/~zjw/p...1999-AIAAJ.pdf

If you need averages of vertex coordinates than you need to compute them by yourselves.

Balti November 28, 2012 08:58

Dear Sbaffini, Thanks a lot for your very fast answer.

I read the paper and if I well understand:
- to obtain the centroid of a face, it is decomposed into triangle and the center of the face is equal to
SUM_triangle ( the center of triangle x area of the triangle )
-----------------------------------------------------------------------
SUM_triangle area of Triangle

- but for the calculation of the centroid of a cell, it is more complicated, I don't understand very well, but is it correct to say
to obtain the centroid of a cell, it is decomposed into tetrahedra (not pyramid) and the center of the cell is equal to
SUM_tetra ( the center of the tetra x Volume of the tetra )
-----------------------------------------------------------------------
SUM_tetra Volume of Tetra


C_centroid do that ?

Thanks again

sbaffini November 28, 2012 09:22

Yeah, you are correct, but the idea of the proposed algorithm is to avoid computing the volumes of all the tetrahedra, which can be a lot.

Take also a look at how Code_Saturne (EDF open code) does it:

http://code-saturne.org/cms/sites/de...ry-3.0-b_0.pdf

under Mesh Handling Algorithms (pag. 352).

Balti November 29, 2012 05:39

Thanks again.

For the center of face I obtain the same results that F_CENTROID method (thanks)

But for the center of cell, I have some problems
To calculate the centroid I implemented
- the (new) Saturn Code method: SUM_i AreaSurf_i VectorCente_i / SUM_i AreaSurf_i
- the (old) Saturn Code method: 1/N*SUM_i CoordinateVertex_i
- the WANG (AIAA Vol 37) method
- the method that I described above
- also a simple average of the vertices (to test it)
- also a simple average of the face center (to test it)

First the results are all different and none of these methods give the same result that C_CENTROID...

So I wonder what is the definition of C_CENTROID used by Fluent ?
I'm very frustated to use C_CENTROID without understand what this method calculate really !

sbaffini November 29, 2012 06:27

Dear Balti,

welcome to the Fluent users club!!!

Jokes apart, i never tried this test (i did it for the mass fluxes and the results is as astonishing as yours for the cell centroid).

What i can say is:

1) Try first with a regular cartesian mesh, where they should be all equal (i think)

2) The Wang method is the only exact one from the above ones. Consider that, in applying it, you should first split every face in triangles and apply it over them. Also, as i remember, these triangles can't be oriented randomly but such that, going over them, you go trough the face perimeter in one sense and this sense is in accordance with the right hand rule and the face outward normal... that is, signs matter.

3) The methods we discussed above are, by no means, inclusive of all the possible approaches to compute the cell centroid. As also discussed in the Code_Saturne manual, they were also using a different (incorrect) method before switching to the present one. As a matter of fact, in FV methods, cell centroids are only useful to know the location of the variables; the second order accuracy is obtained if it is the real centroid but if an incorrect method worked for Code_Saturne (which still was proved to be 2nd order) than i guess it can work for Fluent too.

Balti December 5, 2012 09:55

Dear sbaffini,

Thanks a lot for your advices. I generate some trivial mesh with two cells and planar faces (and also some more complicated meshes). I found some error in my code and my conclusion is:
to find the center of the cell closest to the result given by C_CENTROID(...) I need to

- for TETRA, I directly calculated it
- for other cells:
- decomposed into tetrahedra (not pyramid) using
* a common apex equal to the average of vertices of the cell (first estimation of the center)
* the (not triangular) faces are shared into triangle using a first estimation of the center of face given by the average of vertices of the face

- and the center of the cell is equal to
SUM_tetra ( the center of the tetra x Volume of the tetra )
-----------------------------------------------------------------------
SUM_tetra Volume of Tetra


All times are GMT -4. The time now is 10:54.