CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)

 Yuri Almeida September 13, 2012 21:42

Dear all,

The momentum equation in icoFoam.C (OF21) is the following:

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

If I understood right, the equation would be:

d(U)/dt + div(rho*U*U) - laplacian((mu/rho)*U) = -grad(p) (1)

But the equation found in books is:

d(rho*U)/dt + div(rho*U*U) - laplacian(mu*U) = -grad(p) (2)

or, dividing by rho:

d(U)/dt + div(U*U) - laplacian((mu/rho)*U) = -(1/rho)*grad(p) (3)

My question is: Why are equation 2 and 3 different from 1? Probably they are not, but, where is "rho" in -fvc::grad(p) and why is it present in div(phi, U)??

 GerhardHolzinger September 14, 2012 03:51

Hello,

in (1) you have rho in the convective term

Quote:
 d(U)/dt + div(rho*U*U) - laplacian((mu/rho)*U) = -grad(p) (1)
Maybe that's because you misinterpreted phi. phi is the flux of a variable, rho does not come into it. So, (1) should read

d(U)/dt + div(U*U) - laplacian((mu/rho)*U) = -grad(p) (1.1)

Quote:
 But the equation found in books is: d(rho*U)/dt + div(rho*U*U) - laplacian(mu*U) = -grad(p) (2) or, dividing by rho: d(U)/dt + div(U*U) - laplacian((mu/rho)*U) = -(1/rho)*grad(p) (3)
If you now compare (1.1) with (3) the only difference is in p. If you check the dimensions of p in an icoFoam case (look at the file ./0/p) you will see, that with icoFoam the pressure does not have the dimension of a pressure (Force divided by area).

In an icoFoam case, the dimension of pressure is

dimensions [0 2 -2 0 0 0 0];

So, although in eq (1.1) and eq (3) the symbol p is used, the meaning of p is not the same in this equations.

In icoFoam p is a pressure that's been divided by rho.

 Yuri Almeida September 14, 2012 08:34

Hi Gerhard,

Now I got it, I knew that the equation was right, but I didn't understand how. So, phi is flux, this makes sense, however, I saw that phi = rho*U from here:

http://www.openfoam.org/docs/user/fvSchemes.php

"The divSchemes sub-dictionary contains divergence terms. Let us discuss the syntax of the entry in reference to a typical convection term found in fluid dynamics div(rhoUU), which in OpenFOAM applications is commonly given the identifier div(phi,U), where phi refers to the flux phi = rhoU."

Thanks for the attention, Gerhard.

 GerhardHolzinger September 14, 2012 09:04

I see, maybe that is the case for compressible solvers. In an incomressible case rho is eliminated.

 All times are GMT -4. The time now is 03:27.