CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   fvc::div(phi,rho) vs fvc::div(phi) (http://www.cfd-online.com/Forums/openfoam/84642-fvc-div-phi-rho-vs-fvc-div-phi.html)

 nimasam February 4, 2011 09:29

fvc::div(phi,rho) vs fvc::div(phi)

hello
could you tell me whats the difference between
fvc::div(phi,rho) vs fvc::div(phi) ?

 maysmech February 4, 2011 10:54

Quote:
 Originally Posted by nimasam (Post 293659) hello could you tell me whats the difference between fvc::div(phi,rho) vs fvc::div(phi) ? thank in advance
Hi Nima,
phi is rho*U so div(phi)=divergence of ((rho)U) and div (phi,U)=divergence of ((rho)UU)
I haven't seen div(phi,rho) but it should be divergence of ((rho)(rho)U).
http://www.openfoam.com/docs/user/fv...20-1120004.4.5

Regards,:)

 haze_1986 October 17, 2012 02:43

Hi, may I also ask, in icoFoam I noticed that
fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U)
why is phi used in convective div() term when nu (I suppose kinematic viscosity) is used in the laplacian term? shouldn't left hand side be divided by rho?

 nimasam October 17, 2012 03:16

phi = Uf & Sf, which Sf is face area , and Uf is velocity at face center
so its a volume flux {m.s}
and
nu = mu/rho :)

 haze_1986 October 17, 2012 03:42

Please correct me if I am wrong.

ddt(U) [m/s2]

laplacian(nu,U) [m/s2] I assume nu here = mu/rho

grad(p) [m/s2] I assume pressure here has been divided by rho as well?

However, div(phi, U)

If phi = rho * U, then the unit will be different?

 meindert October 17, 2012 04:59

Hi,

You should realise that the definition of phi is different for an incompressible flow solver (e.g. icoFoam) than for an compressible flow solver.
For an incompressible flow solver phi = U, for a compressible flow solver phi = rho*U. Thus, the face flux for an incompressible flow solver is (S_f · phi_f) = (S_f · U_f), which is exactly what Nima was trying to tell you.

To be honest, the notation in OpenFOAM is a bit sloppy. The face flux is given the name phi, which is confusing if you write

fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U).

I suggest you have a look at section 2.4 of the Programmer's Guide, which is located in the \$WM_PROJECT_DIR/doc/Guides-a4 directory.

 camille131 October 20, 2012 09:20

Hello and thank you for the precision .
I am actually trying to run a poiseuille case in channel with cyclic conditions.
I don't know If I have to choose icoFoam or channelFoam solver.

Actually in the channelFoam code I don't know what represents
sgsModel->divDevBeff(U) in the equation? see http://foam.sourceforge.net/docs/cpp/a02641_source.html on line 63

Camille

 meindert October 20, 2012 10:40

Hi Camille,

First, I think it would have been more appropriate to open a new thread for this. My guess is that a little searching on the forum would have gotten you a long way as well.

To answer your question, go with the channelFoam solver. It has been developed to do exactly what you want. Have a look at the chan395 tutorial.
The definition of divDevBeff depends on the particular subgrid-scale model that you use. For most subgrid-scale models this term is defined in GenEddyVisc.C.

http://foam.sourceforge.net/docs/cpp...ce.html#l00096

Use Doxygen to find out more about the different subgrid-scale models. Doxygen is there for a reason.

 camille131 October 20, 2012 11:53

Thank you for your answer actually I also have to kearn how to search correctly on the help guide ^^

but so , what s the difference between nuEff and nu? and what does the temperature T have to do here? it because the problem is coupled? in laminar case we don't care?

thank you
sorry it s not so easy to come from nowhere ..

I have then introduced a new subject for other questions about Poiseuille. here: http://www.cfd-online.com/Forums/ope...tml#post387650

 chaolian November 9, 2012 00:49

If alpha = 0.5*Foam::erf(4.0*(T-Tmelt)/(Tl-Ts))+scalar(0.5);
Are fvc::div(phi,alpha)
the same?
From the results, they are not quite the same. Why? Is there anything different other than a simple algebraic transformation?

 meindert November 9, 2012 10:04

No, those are not the same. The most important difference is the location at which the expressions are evaluated.

If fvc::div(phi,alpha) is used, alpha is evaluated at the cell face according to equation (2.16) in the Programmer's Guide. For a central difference scheme this value is obtained by linear interpolation of the cell center values.

If 4.0*exp(-pow(4.0*(T-Tmelt)/(Tl-Ts),2))/Foam::sqrt(pi)/(Tl-Ts)*(U & fvc::grad(T)) is used, the whole expression is evaluated at the cell center.

You could write out the seperate discretisations and you will see that they are not the same. I would recommend you to use fvc::div(phi,alpha), since it maintains the conservative form of the convection term.

 chaolian November 9, 2012 13:25

Quote:
 Originally Posted by meindert (Post 391267) Hi Chad, No, those are not the same. The most important difference is the location at which the expressions are evaluated. If fvc::div(phi,alpha) is used, alpha is evaluated at the cell face according to equation (2.16) in the Programmer's Guide. For a central difference scheme this value is obtained by linear interpolation of the cell center values. If 4.0*exp(-pow(4.0*(T-Tmelt)/(Tl-Ts),2))/Foam::sqrt(pi)/(Tl-Ts)*(U & fvc::grad(T)) is used, the whole expression is evaluated at the cell center. You could write out the seperate discretisations and you will see that they are not the same. I would recommend you to use fvc::div(phi,alpha), since it maintains the conservative form of the convection term.
Hello, Meindert,Thanks for the reply. I agree with you about the conservative aspect. But I am confused since the results are not correct. Say, a 2D cavity is initially solid and starts melt from the left side. The initial internal temperature is 301.45, and BC is left:311.15 and right: 301.45, up and down insulated. melting temperature is 302.
But at t=120s, temperature field is: (
309.228
306.009
302.865
303.179
.
.
.
)
As you can see, the temperature field is not monotone which is not correct.

 meindert November 9, 2012 13:48