
[Sponsors] 
February 4, 2011, 09:29 
fvc::div(phi,rho) vs fvc::div(phi)

#1 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,216
Blog Entries: 1
Rep Power: 17 
Sponsored Links
could you tell me whats the difference between fvc::div(phi,rho) vs fvc::div(phi) ? thank in advance 

Sponsored Links 
February 4, 2011, 10:54 

#2  
Senior Member

Quote:
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). Read user guide for more information: http://www.openfoam.com/docs/user/fv...201120004.4.5 Regards, 

October 17, 2012, 02:43 

#3 
Senior Member
Join Date: Jul 2011
Posts: 109
Rep Power: 8 
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? 

October 17, 2012, 03:42 

#5 
Senior Member
Join Date: Jul 2011
Posts: 109
Rep Power: 8 
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? 

October 17, 2012, 04:59 

#6 
Member
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 7 
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/Guidesa4 directory. Last edited by meindert; October 17, 2012 at 05:19. 

October 20, 2012, 09:20 

#7 
Member
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 6 
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 Thank tou for your answer. Camille 

October 20, 2012, 10:40 

#8 
Member
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 7 
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 subgridscale model that you use. For most subgridscale 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 subgridscale models. Doxygen is there for a reason. 

October 20, 2012, 11:53 

#9 
Member
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 6 
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.cfdonline.com/Forums/ope...tml#post387650 

November 9, 2012, 00:49 

#10 
New Member
Chad
Join Date: Sep 2011
Posts: 16
Rep Power: 7 
If alpha = 0.5*Foam::erf(4.0*(TTmelt)/(TlTs))+scalar(0.5);
Are fvc::div(phi,alpha) and 4.0*exp(pow(4.0*(TTmelt)/(TlTs),2))/Foam::sqrt(pi)/(TlTs)*(U & fvc::grad(T)) the same? From the results, they are not quite the same. Why? Is there anything different other than a simple algebraic transformation? 

November 9, 2012, 10:04 

#11 
Member
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 7 
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*(TTmelt)/(TlTs),2))/Foam::sqrt(pi)/(TlTs)*(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. 

November 9, 2012, 13:25 

#12  
New Member
Chad
Join Date: Sep 2011
Posts: 16
Rep Power: 7 
Quote:
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. 

November 9, 2012, 13:48 

#13 
Member
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 7 
Hi Chad,
It is hard to tell what the source of your problem is, because you are not giving any details about the simulation itself. I suggest you open a new thread about your problem, so we stay ontopic here. Try to give as much details about your simulation as possible. You could think of boundary conditions, grid resolution, numerical schemes, etc. Perhaps it is a good idea to post a part of the solver output aswell. 

March 12, 2013, 04:59 

#14 
New Member
Alessandro
Join Date: Feb 2013
Location: Italia
Posts: 15
Rep Power: 6 
Maysam,
Do you know if does exist a tutorial or guide that list side to side the mathematical equations on one side and on the other side how they are written in the openFoam code. I have found something here http://www.foamcfd.org/Nabla/guides/UserGuidese14.html, but I was searching for something with some practical examples for a newbie. 

Tags 
divergence, phi 
Thread Tools  
Display Modes  


Sponsored Links 