CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   What type return fvcdiv (

su_junwei October 10, 2008 23:23

Hi Ivan fvc::div(...
Hi Ivan

fvc::div(...) return tmp<geometricfield>
you can use set the variable to the type of geometricfield(including the internal and boundary field, and the data are dimensioned) or just use its internal field(undimensioned).

Hope this helps


ivan_cozza October 11, 2008 04:07

Thank you Junwei for your fast
Thank you Junwei for your fast reply!
Ok, maybe I found the error, it is in:

volScalarField rhsRho1 = (- divPhiRho1 - rho0 * divPhiU1) / mesh.V();

In someway it doesn't like / mesh.V(), if I remove it, it compiles without errors. But now, 2 questions:

1) If I set a variable like this:
volScalarField a = b;
where b is a tmp<volscalarfield>,
the = assignment is valid?

2) It says that it find some Foam::tmp<foam::field<double> >, and as the only thing I have removed is mesh.V(), the latter should be the tmp, but in the programmer's guide i read that it's a volScalarField. How it is possible?

su_junwei October 11, 2008 08:23

Hi Ivan It seems that mesh
Hi Ivan

It seems that mesh.V() is a dimensionedField,Try the following code segment
volScalarField rhsRho1.dimensionedInternalField()= (- divPhiRho1 - rho0 * divPhiU1).dimensionedInternalField() / mesh.V();

It seems that there is not a member for volScalarField dividing dimensionedField


su_junwei October 11, 2008 08:26

Hi Ivan A little more,
Hi Ivan

A little more, declare the volScalarField rhsRho1 behand please.


ivan_cozza October 12, 2008 09:36

I'm a little confused, because
I'm a little confused, because the programmer's guide says that the .V() member of mesh should be a volScalarField. Could it be a bug in the programmer's guide?

Moreover, I found out that if I just delete mesh.V() from the right hand side of

df/dt = -div(flux)

it works. The results are coherent! So, the result of fvc::div is already divided by the cell volume?

Have a nice sunday,

hjasak October 12, 2008 15:48

This is a recent change: mesh.
This is a recent change: mesh.V() is now a dimensioned field, ie. it does not have boundary conditions.

Yes, fvc::div(phi) is divided by the cell volume.



ivan_cozza October 13, 2008 07:09

Thank you Prof. Jasak, now I
Thank you Prof. Jasak,
now I catch this part of the problem.

All times are GMT -4. The time now is 05:44.