Meaning of "fvc::div(phi)"
Hi Foamers,
When I look at pEqn.C in the "twoPhaseEulerFoam" solver, I don't really understand the following codes. ....... for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pEqn ( fvm::laplacian(Dp, p) == fvc::div(phi) ); ..... Speaking of div(phi), divergence of any scalar is zero mathematically. Divergence reduce the order rank of maxtrix. For an example, let's say, velcotiy vector u=(ux, uy) div(u)=ux/dx + uy/dy > scalar quantity But, scalar phi=phi(x,y) div(phi)=0 So what is the meaning of div(phi) and what's a mathematical formulation for the term in openfoam? 
Hi Kim,
This problem happens to me in the same time!http://www.cfdonline.com/Forums/ope...equation.html Did you find a solution? 
Isn't phi simply the mass flux rho*U*A ? check this
HTML Code:
http://openfoamwiki.net/index.php/Uguide_table_of_fields HTML Code:
http://openfoamwiki.net/index.php/Main_FAQ#What_is_the_field_phi_that_the_solver_is_writing Cheers, Felipe 
Hi Felipre,
Thanks for your prompt reply, Quote:

No, because U is the cell centre value, and the divergence is obtained from the face values, i.e. phi.

Hi Bernhard,
Could you explain more? 
Can you be more specific?

The book are correct, but http://www.cfdonline.com/Forums/vbL...5ac33fb31.gif is valid without a mesh. If you integrate this equation over a control volume, this converts to a summation over the faces of the velocity times the area ( http://en.wikipedia.org/wiki/Divergence_theorem ). phi is nothing less then the velocity at the face (times the density and the face area).

Quote:
For incompressible flow, you have Plug this into continuity And you get 
Quote:
I know this, but phi is a scalar, what is div(scalar)..... Felipe. Yeah, you are right~ 
Quote:


You apply the divergence theorem.
You can't integrate face values over a volume as you are posting. The difference between a volScalarField and a surfaceScalarField, is that for a volScalarField, there is a value stored per control volume or cell. For a surfaceScalarField there is a value stored per face. You can of course interpolate from the one to the other, but this is only accurate to some order. 
Quote:
Does it mean fvc::div(phi)=0 equals to sum(phi)=0 in OpenFOAM? Why doesnt it use sum(phi)=0 instead. At last,I think I need to clear my head. Thanks for you patience. Really thankful.:) 
1 Attachment(s)
Im still confused!!!!!!
div(u)=0 I know its meaning. 1) If via continuity, we have div(phi)=0, then we make an intergration on this equation like this: [LaTeX Error: Syntax error] Is this weird? 
Yes, this is extremely weird. phi only lives in the discretized domain on faces of cells. The is no way you can do a volume integral over such a variable.
Do you know how to derive the equation ? You can do this using a massmicrobalanse. This has not yet anything to do with a mesh, but if you understand this, it is easily translated. 
Quote:
Code:
fvScalarMatrix pEqn Anyway thanks bro. BTW, the unit of fvc::div(u) and fvc::div(phi) is the same: Code:
fvc::div(HbyA):dimensions [0 0 1 0 0 0 0]; 
Take into account that mathematical and OpenFOAM's languages are different.
Originally, mathematical divergence is vector operation that gives you source or sink at a point. When you use finite volume method to discretize differential equation, you get linear form of diff. equation and volumes to store discrete variables. That's why in order to get divergence you should firstly compute fluxes at volume faces. In OF there are two ways to compute divergence: 1) take fvc::div( of volVectorField ). You can see in sources, it calls for fvc::surfaceIntegrate ( volVectorField & mesh.Sf() ). 2) make first step manually (i.e. phi = U&mesh.Sf()) and call for fvc::div( surfaceScalarField phi ). Again, OF will make fvc::surfaceIntegrate ( surfaceScalarField ). Mathematically div(scalar phi) has no sense. Because you think of variables as continuous fields, but in OF variables are discrete fields. You are partially right, there is no "SUM", but "surfaceIntegrate" called by OF to compute div. And again, phi = U & mesh.Sf(). div(phi) = div(U) = div(U&mesh.Sf()). That's why you get same dimensions. 
Quote:
1. volVectorField U; fvc::div(U); 2. volVectorField U; phi = U & mesh.Sf(); fvc::div(phi); So these two functions are the same rite? fvc::div(u)=fvc::div(phi). Looks like div() has been overloaded. I make a testify: Code:
fvc::div(HbyA)dimensions [0 0 1 0 0 0 0]; 
All times are GMT 4. The time now is 13:11. 