CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Adding a Source Term to Pressure equation pEqn in SimpleFoam (http://www.cfd-online.com/Forums/openfoam/110863-adding-source-term-pressure-equation-peqn-simplefoam.html)

oscar_urri December 22, 2012 22:22

Adding a Source Term to Pressure equation pEqn in SimpleFoam
 
2 Attachment(s)
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

fumiya December 23, 2012 00:38

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

Tushar@cfd December 28, 2012 05:52

Hello,
 
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...

oscar_urri January 3, 2013 19:44

2 Attachment(s)
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

Tushar@cfd January 4, 2013 07:58

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...

mm.abdollahzadeh January 29, 2013 10:35

Quote:

Originally Posted by oscar_urri (Post 400012)
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

oscar_urri January 30, 2013 11:45

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

Sherlock_1812 March 10, 2014 05:47

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.

oscar_urri March 11, 2014 10:46

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

Sherlock_1812 March 11, 2014 12:22

Thank you Oscar. That was very clear.

be_inspired June 4, 2014 12:01

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?


All times are GMT -4. The time now is 10:01.