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

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 February 4, 2011, 09:29 fvc::div(phi,rho) vs fvc::div(phi) #1 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 hello could you tell me whats the difference between fvc::div(phi,rho) vs fvc::div(phi) ? thank in advance

February 4, 2011, 10:54
#2
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
Quote:
 Originally Posted by nimasam 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).
Read user guide for more information:
http://www.openfoam.com/docs/user/fv...20-1120004.4.5

Regards,

 October 17, 2012, 02:43 #3 Member   Join Date: Jul 2011 Posts: 92 Rep Power: 6 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:16 #4 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 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

 October 17, 2012, 03:42 #5 Member   Join Date: Jul 2011 Posts: 92 Rep Power: 6 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: 5 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. GerhardHolzinger and sharonyue like this. 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: 4 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: 5 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.

 October 20, 2012, 11:53 #9 Member   Camille Join Date: Oct 2012 Posts: 54 Rep Power: 4 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: Poiseuille flow in a channel

 November 9, 2012, 00:49 #10 New Member   Chad Join Date: Sep 2011 Posts: 16 Rep Power: 5 If alpha = 0.5*Foam::erf(4.0*(T-Tmelt)/(Tl-Ts))+scalar(0.5); Are fvc::div(phi,alpha) and 4.0*exp(-pow(4.0*(T-Tmelt)/(Tl-Ts),2))/Foam::sqrt(pi)/(Tl-Ts)*(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: 5 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.

November 9, 2012, 13:25
#12
New Member

Chad
Join Date: Sep 2011
Posts: 16
Rep Power: 5
Quote:
 Originally Posted by meindert 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.

 November 9, 2012, 13:48 #13 Member   Meindert de Groot Join Date: Jun 2012 Location: Netherlands Posts: 34 Rep Power: 5 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 on-topic 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: 4 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 Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

All times are GMT -4. The time now is 04:13.

 Contact Us - CFD Online - Top