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

Adding a Source Term to Pressure equation pEqn in SimpleFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 1 Post By oscar_urri
  • 8 Post By oscar_urri

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 22, 2012, 22:22
Default Adding a Source Term to Pressure equation pEqn in SimpleFoam
  #1
New Member
 
Oscar Urbina
Join Date: Nov 2011
Location: Montréal
Posts: 16
Rep Power: 15
oscar_urri is on a distinguished road
Hello foamers,

i'm trying to add a source term in the pressure equation pEqn in SimpleFoam,

the way that i'm doing it is :

while (simple.correctNonOrthogonal())
{


fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) + rAU*source == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);

pEqn.solve();

if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux() ;
}
}


the pressure seem to go ok, but the velocity is completely wrong, instead of slowing down it accelerates right after the discontinuity and then slows down. (i'm attaching 2 images)

can anyone tell me why this is?

also how should i treat a source term for the pressure equation?

is there a way to make it implicit?

i've been looking around the forum and i couldn't find a post about anyone trying to insert a source term in pEqn.

any help would be greatly appreciated

thansk to all

Oscar
Attached Images
File Type: jpg pressure openfoam.jpg (13.5 KB, 171 views)
File Type: jpg velocity openfoam.jpg (20.0 KB, 176 views)
Kummi likes this.
oscar_urri is offline   Reply With Quote

Old   December 23, 2012, 00:38
Default
  #2
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19
fumiya is on a distinguished road
Hi Oscar,

Could you tell me what your UEqn looks like?
Is your source term included in the a)UEqn or b)solve?

a)
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
+ source
);

b)
solve(UEqn() == -fvc::grad(p) -source);

Best regards,
fumiya
fumiya is offline   Reply With Quote

Old   December 28, 2012, 05:52
Post Hello,
  #3
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
How the source term added in the PEqn??
Have you specified the term "source" in the project directory?
can you please upload your case? So, that one can have better glance to it...
Tushar@cfd is offline   Reply With Quote

Old   January 3, 2013, 19:44
Default
  #4
New Member
 
Oscar Urbina
Join Date: Nov 2011
Location: Montréal
Posts: 16
Rep Power: 15
oscar_urri is on a distinguished road
Hi Tushar,

thanks for the quick response,

i'm attaching my case and the solver so you can take a look at it,

basically what i'm trying to do is insert a source term in pEqn to generate a pressure jump and velocity discontinuity, kind of the same way you would instert a volume force in uEqn but for some reason i get an acceleration right after my source term and then a deceleration as suppose to just a deceleration like when i insert a volume force and i don't understand why.

any ideas would be really helpfull, thanks

Oscar
Attached Files
File Type: zip Case.zip (22.9 KB, 94 views)
File Type: zip simpleFoamPressure.zip (11.2 KB, 148 views)
oscar_urri is offline   Reply With Quote

Old   January 4, 2013, 07:58
Post
  #5
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 18
Tushar@cfd is on a distinguished road
Hello,

Since you are using SIMPLE approach, so why don't you try using

// Store pressure for under-relaxation
p.storePrevIter();

in PEqn. after the "adjustPhi(phi, U, p);".

Everything appears OK to me, try checking the "system" files.

Redefine the relaxationfactors.. for equations...

Hope this will resolve your problem...
Tushar@cfd is offline   Reply With Quote

Old   January 29, 2013, 10:35
Default
  #6
Senior Member
 
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15
mm.abdollahzadeh is on a distinguished road
Quote:
Originally Posted by oscar_urri View Post
Hi Tushar,

thanks for the quick response,

i'm attaching my case and the solver so you can take a look at it,

basically what i'm trying to do is insert a source term in pEqn to generate a pressure jump and velocity discontinuity, kind of the same way you would instert a volume force in uEqn but for some reason i get an acceleration right after my source term and then a deceleration as suppose to just a deceleration like when i insert a volume force and i don't understand why.

any ideas would be really helpfull, thanks

Oscar
Hi Oscar

one easy way to avoid adding the contribution of source to pressure equation is to add source in UEqn directly. then u don't need to do nth.

Cheers
Mahdi
mm.abdollahzadeh is offline   Reply With Quote

Old   January 30, 2013, 11:45
Default
  #7
New Member
 
Oscar Urbina
Join Date: Nov 2011
Location: Montréal
Posts: 16
Rep Power: 15
oscar_urri is on a distinguished road
hi Mahdi,

thanks for the answer,

i have already done the source term in UEqn, my questions is why doesn't a similar term in pEqn work?

cause in UEqn i add a pressure gradient source term, and in pEqn i add the divergence of that gradient which should give me the same result but it doesn't and i don't understand why cause the pressure seems to be fine is just the velocity that doesn't work.

thanks
oscar_urri is offline   Reply With Quote

Old   March 10, 2014, 05:47
Default
  #8
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Hi all,

Could you tell me what the difference is if the source term is included in the UEqn or in the solve (UEqn == ) line? Fumiya's post mentioned it but I would like a detailed explanation.

Thank you in advance.
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   March 11, 2014, 10:46
Default
  #9
New Member
 
Oscar Urbina
Join Date: Nov 2011
Location: Montréal
Posts: 16
Rep Power: 15
oscar_urri is on a distinguished road
Hi Srivaths,

if you include the source term lets call it force in the UEqn equation,

tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U) +Force
//+ turbulence->divDevReff(U)

==
fvOptions(U)
);

it will be included in the matrix and carried to the pressure equation.


if you put it in (UEqn == ) like this:

solve(UEqn() == -fvc::grad(p) - force );

it won't be included in the matrix and you have to add the same term in

U = HbyA - rAU*fvc::grad(p) - rAU*Force ;

for it to have the same effect.


if you read all the line codes in Ueqn and pEqn it'll make sense,

hope it helps,

Oscar
oscar_urri is offline   Reply With Quote

Old   March 11, 2014, 12:22
Default
  #10
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Thank you Oscar. That was very clear.
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   June 4, 2014, 13:01
Default
  #11
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 155
Rep Power: 17
be_inspired is on a distinguished road
Hi Oscar,

When using the first method some wiggles are founded in the solution because forces are applied directly over cell centers. It seems like this is not so good for pressure equation.

http://www.cfd-online.com/Forums/ope...l-wiggles.html

Here it is potential solution for this issue where forces are included in a different way.

http://www.cfd-online.com/Forums/ope...tml#post315788

Did you see this U and p variation near your source location?
be_inspired is offline   Reply With Quote

Old   February 22, 2018, 18:52
Default
  #12
Member
 
Join Date: May 2017
Posts: 44
Rep Power: 9
bbita is on a distinguished road
Dear All,

I add a source term to pEqn.H in compressibleMultiphaseInterFoam (between interface of two phases). I am not sure why I am getting the attached profile. Half of the container fills with fluid 1 and I am assuming both of the phases have similar properties.

Thanks.
Attached Images
File Type: jpg Pressure at time1.jpg (42.5 KB, 41 views)
bbita is offline   Reply With Quote

Reply

Tags
openfoam, peqn, pressure equation, source term


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
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44
Source Term on Scalar Transport Equation - crashing simulation alessio.nz OpenFOAM 19 February 8, 2011 08:38
Adding a momentum source term segersson OpenFOAM Running, Solving & CFD 5 March 3, 2006 00:06
Hydrostatic pressure in 2-phase flow modeling (CFX4.2) HB &DS CFX 0 January 9, 2000 14:19


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