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

Implementing an Equation

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 4 Post By chegdan
  • 1 Post By chegdan
  • 1 Post By anishtain4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2013, 01:25
Default Implementing an Equation
  #1
New Member
 
Join Date: Apr 2012
Posts: 21
Rep Power: 14
Yahoo is on a distinguished road
Hi FOAMERS

Do you know the simplest way to implement equation "dC/dt + grad(CL).V = 0", where C and CL are scalar and V is the velocity vector?
Yahoo is offline   Reply With Quote

Old   March 3, 2013, 17:02
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
This could be done as

Code:
fvScalarMatrix CEqn
(
       fvm::ddt(C) 
     + U & fvc::grad(CL)
);

CEqn.solve();
But the two variables C and CL are going to be explicitly coupled since grad is explicit. If in fact CL was actually some other variable related to C, say C+C0 then you could be more clever and do something like

Code:
fvScalarMatrix CEqn
(
       fvm::ddt(C) 
     + fvm::div(phi,C)
     + fvm::SuSp(-fvc::div(phi),C)
     + U & fvc::grad(C0)
);

CEqn.solve();
where this is a more conservative form of your original equation, that of course will work if CL is actually C plus something else. I'm not sure what you are working on....so I'm just throwing things out there at this point .
wyldckat, Yahoo, sharonyue and 1 others like this.
chegdan is offline   Reply With Quote

Old   March 5, 2013, 13:44
Default
  #3
New Member
 
Join Date: Apr 2012
Posts: 21
Rep Power: 14
Yahoo is on a distinguished road
Daniel
Thanks for your answer.

In my case C = (gL + kp*(1-gL))CL, where gL is a volScalaerField and kp is constant. You have any ideas of the best way to implement this?

By the way, can you explain why adding term "fvm::SuSp(-fvc::div(phi),C)" makes it more conservative?

Last edited by Yahoo; March 5, 2013 at 14:01.
Yahoo is offline   Reply With Quote

Old   March 5, 2013, 14:33
Default
  #4
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
By the way, can you explain why adding term "fvm::SuSp(-fvc::div(phi),C)" makes it more conservative?
The conservative (strong) form of the advection operator is

\qquad\nabla\cdot\left(\vec{U}C\right)=\vec{U}\cdot\nabla C + C\left(\nabla\cdot\vec{U}\right)

the

Code:
fvm::SuSp(-fvc::div(phi),C)
is just

- C\left(\nabla\cdot\vec{U}\right)

If there is incomplete convergence in your momentum portion of your solver, this will account for that fact. For a completely converged velocity field, this term will approach zero for an incompressible fluid (i.e. by the nature of continuity). Take a look at the thread http://www.cfd-online.com/Forums/ope...silon-eqn.html and the post http://www.cfd-online.com/Forums/ope...tml#post280210. This is also implemented in the k-epsilon turbulence models if you would like to look at them.
Yahoo likes this.

Last edited by chegdan; March 5, 2013 at 15:13.
chegdan is offline   Reply With Quote

Old   March 6, 2013, 02:35
Default
  #5
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
Dear chegdan,

I believe the left side of your equation is conservative form, the right side is called primitive form. The reason for the name comes from gas dynamics and passing through the shocks. When you use the left hand side (consider C as as rho) passing through the shock your momentum will remain constant, however on your right hand side every term experiences a severe gradient which makes numerical instabilities in presence of shock.
PS: I'm speaking in the context of gas dynamics, please let me know if I'm wrong.
chegdan likes this.
anishtain4 is offline   Reply With Quote

Old   March 12, 2013, 13:08
Default
  #6
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
I believe the left side of your equation is conservative form, the right side is called primitive form. The reason for the name comes from gas dynamics and passing through the shocks. When you use the left hand side (consider C as as rho) passing through the shock your momentum will remain constant, however on your right hand side every term experiences a severe gradient which makes numerical instabilities in presence of shock.
Thanks! Nice to learn some new lingo.
chegdan is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
error message cuteapathy CFX 14 March 20, 2012 07:45
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
Implementing additional equation? Pratap FLUENT 1 December 4, 2004 21:32


All times are GMT -4. The time now is 23:06.