# Why we subtract continuity Eqn into momentum Eqn instead of adding it?

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

 April 27, 2015, 03:14 Why we subtract continuity Eqn into momentum Eqn instead of adding it? #1 Senior Member   Dongyue Li Join Date: Jun 2012 Location: Torino, Italy Posts: 710 Rep Power: 8 Hey guys, This piece of code is quite common in OpenFOAM； Code:  fvm::ddt(alpha1, U1) //mom eqn -fvm::Sp(fvc::ddt(alpha1),U1) //continuity eqn + fvm::div(alpha1, U1) //mom eqn - fvm::Sp(fvc::div(alpha1), U1) ////continuity eqn Why dont we add continuity eqn?...like this:.. Code:  fvm::ddt(alpha1, U1) //mom eqn +fvm::Sp(fvc::ddt(alpha1),U1) //continuity eqn + fvm::div(alpha1, U1) //mom eqn +fvm::Sp(fvc::div(alpha1), U1) ////continuity eqn continuity is zero right?

 April 27, 2015, 05:38 #2 Member   ali alkebsi Join Date: Jan 2012 Location: Strasbourg, France Posts: 77 Rep Power: 6 I dont really know normally we seek diagnal dominance, so i would say so but thats the contrary of what is done here ??????

 April 27, 2015, 11:31 #3 Senior Member   Dongyue Li Join Date: Jun 2012 Location: Torino, Italy Posts: 710 Rep Power: 8 Yep...Wish someone who can explain this. lol

April 27, 2015, 12:32
#4
Senior Member

Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 240
Rep Power: 9
Quote:
 Originally Posted by sharonyue Yep...Wish someone who can explain this. lol
Hi,

Actually, we subtract a momentum transfer term because the real equation (left hand side of NS) we want to solve is

which is written in a non-conservative form. In FVM, however, we prefer conservative form,

These two equations are not the same if the fluid is not incompressible or if there is phase change. You can notice that you can switch from non-conservative to conservative form with,

So adding the continuity equation do not have any sense.

Cheers,

April 28, 2015, 02:21
#5
Senior Member

Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 710
Rep Power: 8
Quote:
 Originally Posted by Cyp Hi, Actually, we subtract a momentum transfer term because the real equation (left hand side of NS) we want to solve is which is written in a non-conservative form. In FVM, however, we prefer conservative form, These two equations are not the same if the fluid is not incompressible or if there is phase change. You can notice that you can switch from non-conservative to conservative form with, So adding the continuity equation do not have any sense. Cheers,
hey Cyprien,

Yeah, The problem is why we want to solve the first Eqn in your posts. The reason why I ask this kind of problem is that: "openfoam22x is solving non-conservative equations but 23x is solving conservative eqns."for two-fluid model.

So I think the thing deeper is :

1. Why we solve Eqn 2 instead of Eqn 1. I saw some posts that Hrv and Henry explain this, They just said the conservative eqn is stable and good. I dont know the reason.

2. Eqn 2 and Eqn 1 should predicts the same results rite? But sometimes it does not.

Best,

 April 28, 2015, 11:39 #6 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 240 Rep Power: 9 Hi Dongyue, Eq 1 and Eq 2 are equivalent only if the continuity equation (equal to zero) is satisfy. I guess that since we deal with an operator-splitting scheme (first we solve the momentum, then the pressure, then the correction, then we iterate), the continuity equation is not fully respected, and that why we add to add this term, to avoid spurious momentum transfer due to an ill-evaluation of the continuity. Cheers,

June 3, 2015, 12:00
#7
Member

Bruno Blais
Join Date: Sep 2013
Posts: 32
Rep Power: 4
Quote:
 Originally Posted by sharonyue hey Cyprien, Yeah, The problem is why we want to solve the first Eqn in your posts. The reason why I ask this kind of problem is that: "openfoam22x is solving non-conservative equations but 23x is solving conservative eqns."for two-fluid model. So I think the thing deeper is : 1. Why we solve Eqn 2 instead of Eqn 1. I saw some posts that Hrv and Henry explain this, They just said the conservative eqn is stable and good. I dont know the reason. 2. Eqn 2 and Eqn 1 should predicts the same results rite? But sometimes it does not. Best,

Equation 1 and 2 are not equivalent numerically because they do not allow for the same Riemann invariant. If you take the example of a shockwave or any other type of discontinuity, as a Cauchy-Riemann classical problem, you find that the wave propagation / shock propagation/ discontinuity propagation will be at the wrong velocity if you do not formulate your problem using the conserved variables.

I am not familiar with these issues in the context of two phases flows, but for compressible flows this is an extremely critical issue and you always need to formulate the problem in conservative variables (rho, rho * u, rho * e). I believe that since these multiphase flows contain large amount of discontinuity in the phases (like air on top of water or whatever), a conservative formulation is a lot more appropriate if you want to obtain the right propagation of the interface.

There is a very very nice book by Euleterio Toro on hyperbolic systems that discusses these issues if I remember.

 June 4, 2015, 05:20 #8 Senior Member   Daniel Witte Join Date: Nov 2011 Posts: 139 Rep Power: 6 Hi, I am confused with these statements. Sharonyue refers to the alpha1Eq, not the momentum equation. In interDymFoam, I have the following code: Code:  fvScalarMatrix alpha1Eqn ( #ifdef LTSSOLVE fv::localEulerDdtScheme(mesh, rDeltaT.name()).fvmDdt(alpha1) #else fv::EulerDdtScheme(mesh).fvmDdt(alpha1) #endif + fv::gaussConvectionScheme ( mesh, phiCN, upwind(mesh, phiCN) ).fvmDiv(phiCN, alpha1) ); which is the same, no? I changed to: Code:  fvScalarMatrix alpha1Eqn ( #ifdef LTSSOLVE fv::localEulerDdtScheme(mesh, rDeltaT.name()).fvmDdt(alpha1) #else fv::EulerDdtScheme(mesh).fvmDdt(alpha1) #endif + fv::gaussConvectionScheme ( mesh, phiCN, upwind(mesh, phiCN) ).fvmDiv(phiCN, alpha1) - fvc::div(phi)*fvm::Sp(1,alpha1) ); It does not make a whole lot of difference in my case, but the idea is that there are large areas, where alpha1 does not change (only around the interface). In those domains I want interFoam to behave like a single phase solver, so any incosistency in mass conservation should not affect alpha1Eq (d alpha1/dt is 0 if there is no alpha change in space). If alpha1 is constant, the last 2 terms become equivalent. Because div(phi) has to be 0, the ultimate result should be identical. You basically eliminate solving alpha1Eq, where it is not needed (the equation system is overdetermined). By the way, for compressible solvers, this code is wrong (div phi is not zero, but div rho phi. Regards, Daniel

 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

 Similar Threads Thread Thread Starter Forum Replies Last Post gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58 xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03 msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58 liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07

All times are GMT -4. The time now is 08:30.