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

pEqn.flux()

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

Like Tree1Likes
  • 1 Post By santiagomarquezd

Reply
 
LinkBack Thread Tools Display Modes
Old   November 17, 2012, 19:09
Default pEqn.flux()
  #1
Member
 
Charlie
Join Date: Dec 2010
Location: 415 Kinross Dr. Newark, DE 19711
Posts: 78
Rep Power: 6
cheng1988sjtu is on a distinguished road
Hi Foamers,


I've got a little confusion here about the pEqn.flux(). So, what does it really mean, say we want to solve the following momentum equation:

ddt(voidfraction*U) + convection_terms == -voidfraction * grad(p) + Other terms.

As the first step, in OpenFOAM, the following UEqn is solved:

ddt(voidfraction*U) + convection_terms == Other terms.

and discretise this equation into linear system, we could obtain the following form, that is:

A() *[U] = H(). and we can define phi = fvc::interpolate (U) & mesh.Sf(); which is the surface mass flux.

and the "real" velocity field should be :

A() *U = H() -voidfraction * grad(p) .

To satisfy the continuity equation, we have:

ddt(voidfraction) + div(voidfraction*U) = 0

Thus the pressure equation becomes:
pEqn ==
{
laplacian(voidfraction*voidfraction/A(), p) = ddt(voidfraction) + div(voidfraction*phi)
}

then, my question is, pEqn.flux() = SnGrad(p) or pEqn.flux() = (voidfraction*voidfraction/A())*SnGrad(p)

how could we update the phi after we solved the pressure equation, which of the following is right?

(1) phi -= pEqn.flux();

(2) phi -= (1/A()) * (voidfraction*pEqn.flux()/(voidfraction*voidfraction/A()));

this could make a big difference is we want to model the flow through a porous media, and I still don't quite get the exact meaning of pEqn.flux(), though it is stated in the following link that The .flux method includes contributions from all implicit terms of the pEqn (the Laplacian)

http://openfoamwiki.net/index.php/IcoFoam

Could anybody help me with this problem? Thanks!
cheng1988sjtu is offline   Reply With Quote

Old   November 21, 2012, 09:46
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Hi, the pEqn you're assembling is:

Code:
fvScalarMatrix pEqn
                (
                    fvm::laplacian(rUA, p) == fvc::div(phi)
                );
which means:

\vec{\nabla}\cdot\left(\Gamma \vec{\nabla} p\right)=\vec{\nabla}\cdot \vec{U}

so that the method pEqn.flux() gives you the discrete version of the flux of p, which is

\Phi=\left(\Gamma \vec{\nabla} p\right)\cdot \vec{S}_f

this is not calculated by explicit operators like fvc::grad but directly using the matrix's coefficients.

Regards.
cheng1988sjtu likes this.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar

Last edited by santiagomarquezd; November 21, 2012 at 16:16.
santiagomarquezd is offline   Reply With Quote

Old   November 21, 2012, 15:08
Default That's great, Thanks!
  #3
Member
 
Charlie
Join Date: Dec 2010
Location: 415 Kinross Dr. Newark, DE 19711
Posts: 78
Rep Power: 6
cheng1988sjtu is on a distinguished road
Hi, Santiago,

Thanks very much for your kind reply.

That's great, it really helps me a lot to understand the code.

According to your explaination, then I guess, my option (2) should be the right way to correct the phi, right?

(2) phi -= (1/A()) * (voidfraction*pEqn.flux()/(voidfraction*voidfraction/A()));

Regards,

Charlie
cheng1988sjtu is offline   Reply With Quote

Old   November 21, 2012, 15:51
Default
  #4
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Looking at the equation you want to solve it seems to be (2), please check lines 78-93 of

https://github.com/OpenFOAM/OpenFOAM...lerFoam/pEqn.H

which is the code for pEqn.H in twoPhaseEulerFoam. This solver has the kind of momentum equations that you dealing with.

Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar

Last edited by santiagomarquezd; November 21, 2012 at 16:16.
santiagomarquezd is offline   Reply With Quote

Old   November 21, 2012, 16:08
Default Thanks!
  #5
Member
 
Charlie
Join Date: Dec 2010
Location: 415 Kinross Dr. Newark, DE 19711
Posts: 78
Rep Power: 6
cheng1988sjtu is on a distinguished road
Thanks!

My first clue of my doubt also comes from the twoPhaseEulerFoam, I think, right now, I have a clear understanding of how the pressure is corrected, Thanks again!

Regards,

Charlie
cheng1988sjtu is offline   Reply With Quote

Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
phi -= pEqn.flux() vs. linearInterpolate(U) & mesh.Sf() santiagomarquezd OpenFOAM Programming & Development 32 June 12, 2014 01:50
pEqn.flux() ata OpenFOAM 6 August 25, 2013 22:31
pEqn.flux() ata OpenFOAM 2 January 24, 2011 23:31


All times are GMT -4. The time now is 05:12.