CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   How to get the volume of a cell (

dbxmcf March 19, 2007 01:35

Hi, all: I searched the for
Hi, all:

I searched the forum and doxygen, found a function mag and the following comments:
// When one wants to access the cell centre and magnitude, the
// functionality on the mesh level should be used in preference to the
// functions provided here. They do not rely to the functionality
// implemented here, provide additional checking and are more efficient.
// The cell::centre and cell::mag functions may be removed in the future.

// WARNING! See cell::centre

// first calculate the aproximate cell centre as the average of all
// face centres

I am just confused how to use it and what is the best way to find the cell volume? What I am trying to do is something like:

Thanks a lot!

eugene March 19, 2007 06:57


nimasam August 1, 2010 03:09

hi friend
i want to access volume of cells in volScalarField but in openFoam there is two ways to access to the mesh volume and none of them are volScalarField:
const DimensionedField<scalar, volMesh>& V() const;
const scalarField& cellVolumes() const;

fisch June 9, 2011 07:15

nimasam, did you found a solution?
I have the same problem now...

thanks, rupert

l_r_mcglashan June 9, 2011 09:40

mesh.V() is a scalarField, not a volScalarField. Why would you have volumes at patches?

fisch June 9, 2011 10:11

thanks for the quick reply, l_r_mcglashan

i used it without thinking because it's written like this in the programmersGuide P33.

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