CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By meindert

Reply
 
LinkBack Thread Tools Display Modes
Old   February 4, 2011, 09:29
Default 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
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
hello
could you tell me whats the difference between
fvc::div(phi,rho) vs fvc::div(phi) ?

thank in advance
nimasam is offline   Reply With Quote

Old   February 4, 2011, 10:54
Default
  #2
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
maysmech is on a distinguished road
Quote:
Originally Posted by nimasam View Post
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,
maysmech is offline   Reply With Quote

Old   October 17, 2012, 02:43
Default
  #3
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
haze_1986 is on a distinguished road
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?
haze_1986 is offline   Reply With Quote

Old   October 17, 2012, 03:16
Default
  #4
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
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
nimasam is offline   Reply With Quote

Old   October 17, 2012, 03:42
Default
  #5
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
haze_1986 is on a distinguished road
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?
haze_1986 is offline   Reply With Quote

Old   October 17, 2012, 04:59
Default
  #6
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 5
meindert is on a distinguished road
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.

Last edited by meindert; October 17, 2012 at 05:19.
meindert is offline   Reply With Quote

Old   October 20, 2012, 09:20
Default
  #7
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 4
camille131 is on a distinguished road
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
camille131 is offline   Reply With Quote

Old   October 20, 2012, 10:40
Default
  #8
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 5
meindert is on a distinguished road
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.
meindert is offline   Reply With Quote

Old   October 20, 2012, 11:53
Default
  #9
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 4
camille131 is on a distinguished road
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
camille131 is offline   Reply With Quote

Old   November 9, 2012, 00:49
Default
  #10
New Member
 
Chad
Join Date: Sep 2011
Posts: 16
Rep Power: 5
chaolian is on a distinguished road
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?
chaolian is offline   Reply With Quote

Old   November 9, 2012, 10:04
Default
  #11
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 5
meindert is on a distinguished road
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.
meindert is offline   Reply With Quote

Old   November 9, 2012, 13:25
Default
  #12
New Member
 
Chad
Join Date: Sep 2011
Posts: 16
Rep Power: 5
chaolian is on a distinguished road
Quote:
Originally Posted by meindert View Post
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.
chaolian is offline   Reply With Quote

Old   November 9, 2012, 13:48
Default
  #13
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 5
meindert is on a distinguished road
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.
meindert is offline   Reply With Quote

Old   March 12, 2013, 04:59
Default
  #14
New Member
 
woodwick's Avatar
 
Alessandro
Join Date: Feb 2013
Location: Italia
Posts: 15
Rep Power: 4
woodwick is on a distinguished road
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.
woodwick is offline   Reply With Quote

Reply

Tags
divergence, phi

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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