CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   ground area (

Katl January 11, 2012 11:16

ground area
How can I get the horizontal area of a cell?
As far as I know does magSf() give you the vertical face area. Or is there any way to indicate the direction of the cell face vector?

I need this value in order to get the ground area of the cells at a patch. Another option would be deviding the volume of the cells by the cell hight. But I couldn't find a way to get this value either.


marupio January 12, 2012 12:35

magSf() gives you the magnitude of surface area... Sf() gives you the area vector, pointing away from the owner cell. Get a unit vector of your "ground" surface, pointing up, and dot product the Sf()... I think that should do it.

Katl January 19, 2012 10:54

Thanks David for your reply.
I finally went back to my case and tried your suggestion. The thing is just that the ground is perpendicular to the patch so the dot product becomes zero.

I did it like this:

scalar groundArea = gSum( normalVector & patch().Sf() );


marupio January 19, 2012 11:17

Oh, sorry, I thought you wanted to find the projected area of a single surface on to the ground. You want the projected area of the entire cell volume? Well, you could do what I suggested for all its bounding surfaces, sum the answers and divide by two. This would work assuming the surfaces overlap only once, which is the case for tetrahedral and hexahedral cell volumes.

All times are GMT -4. The time now is 04:47.