CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Write the cell area of a patch (http://www.cfd-online.com/Forums/openfoam/84403-write-cell-area-patch.html)

Andrea_85 January 28, 2011 05:11

Write the cell area of a patch
 
Hi all,

I am using the sample Dictionary to get the value of the color function alpha1 (using interFoam) on a particular patch (wall for my problem). Is possible to let OF prints not only the value of the color function but also the area of the surface (in m^2) for each cell on the patch wall??

I did not need the area of all cells but only those that are on the patch wall..

Thanks

Andrea

niklas January 28, 2011 05:30

const scalarField& Ap = mesh.magSf().boundaryField()[i];

scalar patchArea = sum(Ap);

Andrea_85 January 28, 2011 05:41

Thanks for the quick response niklas. Sorry but i'm very new user on OF...where i have to put those line? and how can I specify the patch (wall for my problem) on which I want to calculate the area?

thanks

andrea

claco July 21, 2011 10:46

Dear All,

I would like to know if there is a C++ script (also a piece of code, or the post of the needed code lines would be appreciated) that can allow me to store in a file the coordinates of cell centres along with the areas of each cells, for every patch (or the one user specified) of my mesh. In fact, I need these informations for post processing purposes.

I thank You in advance.

Yours Sincerely.

Claudio

Andrea_85 July 21, 2011 11:31

Hi Claudio,
For the cell centres i guess that you can simply use writeCellCentres
(under OpenFOAM/OpenFOAM-1.7.1/applications/utilities/postProcessing/miscellaneous/writeCellCentres). You will get the coordinates of the centers of all the mesh cells, including cells close to the boundary.

Then, if "areas of each cells, for every patch" means areas of each FACES that belong to a patch, take a look here (post #21)
http://www.cfd-online.com/Forums/ope...tml#post297002

Hope this help

best
andrea

claco July 27, 2011 08:29

Thank You Andrea. It was just what I needed.

I have another question for you.

I would like to split cyclic patches in OF 1.7.1, in order to have two patches, namely patch_half0 and patch_half1, like can be done in OF 2.0.0.
Is there an utility to do so, in Openfoam 1.7.1?

As a matter of fact, when I try to calculate mass flow rate trough a cyclic patch in OF 1.7.1, the command "patchIntegrate phi cyclic_patch" returns me a near 0 value, whereas the same command given in OF 2.0.0 ("patchIntegrate phi cyclic_patch_half0") returns me a non zero (and correct) value.

Thank You in advance.

Claudio


All times are GMT -4. The time now is 16:35.