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

pisoFoam - Momentum equation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By backscatter

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2019, 12:00
Default pisoFoam - Momentum equation
  #1
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Hi,

Earlier today I noticed a detail in the UEqn file in the pisoFoam folder (OF 5.0), the code is below:

Code:
MRF.correctBoundaryVelocity(U);

fvVectorMatrix UEqn
(
    fvm::ddt(U) + fvm::div(phi, U)
  + MRF.DDt(U)
  + turbulence->divDevReff(U)
 ==
    fvOptions(U)
);

UEqn.relax();

fvOptions.constrain(UEqn);

if (piso.momentumPredictor())
{
    solve(UEqn == -fvc::grad(p));

    fvOptions.correct(U);
}
Why is there such a term of relaxation (UEqn.relax()) in the PISO solver? If I do not add anything in the fvSolution file, what happens? Can I remove this line from the original code?

Thanks
gu1 is offline   Reply With Quote

Old   March 19, 2019, 02:15
Default
  #2
Member
 
Anonymous
Join Date: Aug 2016
Posts: 75
Rep Power: 9
backscatter is on a distinguished road
Hi,

There are two types of relaxations:

1) Field relaxation: modifies the field directly by limiting the amount by which a variable changes from iteration to iteration. If you look at fvSolution, you can find that there is a "relaxationFactors" sub-dict under which you can mention the relaxation factors for each field you are solving for. Please note that only steady-state simulations can benefit from relaxation. This type of relaxation is explicit.

2) Equation relaxation: In this case, you can directly modify the solution matrix before next iteration. UEqn.relax() refers to relaxing the equation in this way. You can use any value between 0 and 1 in the paranthesis after UEqn.relax. This helps increase the diagonal dominance of the system of equations and thus improves stability. This is implicit.
rezaeimahdi likes this.
backscatter is offline   Reply With Quote

Old   March 19, 2019, 07:38
Default
  #3
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Quote:
Originally Posted by backscatter View Post
Hi,

There are two types of relaxations:

1) Field relaxation:... .This type of relaxation is explicit.

2) Equation relaxation:... . This is implicit.
Hi,

Thanks for your reply, it was quite enlightening, but I still have some doubts.

I will add a piece of my code and make a comment, I would like you to comment if I understood your explanation well. Because I did simulations using the PISO solver (LES simulation) and left the term relaxationFactors within my fvSolution, so I was afraid that this might have affected the results.

Code:
PISO
{
    momentunPredictor	     no;
    nCorrectors     2;
    nNonOrthogonalCorrectors 1;
    pRefCell        0;
    pRefValue       0;
}

SIMPLE
{
    nNonOrthogonalCorrectors    1;
    pRefCell        		0;
    pRefValue       		0;
    consistent                    yes;	
    residualControl
    {
         p              1e-6;
         U              1e-6;
    }
}

relaxationFactors
{
    fields //Field relaxation;
    {
      p 		0.8;
    }
    equations //Equation relaxation;
    {
      U 		0.8;
    }
}
Based on this piece of code, I believe that the PISO solver interpreted the relaxation value (for UEqn) that I supposedly added only if I were to use the SIMPLE algorithm, right?

Could this amount have negatively affected the results of my simulation? or, is there an ideal value to consider?

Thanks

*One note I'd like to put. In the codes it is visible the term UEqn.relax(), kEqn.ref().Relax()... and among others, these terms refer to relaxation of the equation. But what about the FIELD?! I believe that in newer versions of OF this does not exist anymore... In previous versions it was used:

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

// Explicitly relax pressure for momentum corrector
p.relax();
gu1 is offline   Reply With Quote

Old   March 19, 2019, 14:02
Default
  #4
Member
 
Anonymous
Join Date: Aug 2016
Posts: 75
Rep Power: 9
backscatter is on a distinguished road
Your first question about relaxing p or U in an LES simulation: there is no point in relaxing a transient simulation. It yields a wrong instantaneous representation of the flow field, if you relax in transient simulation. In these cases, you can just decrease the timestep to stabilize your simulation.
In other words, relaxing a transient simulation is totally out of place.
About your second question that in OF5, they have removed eqn.relax(). In the relaxation factors subdict in fvSolution, you have both types of relaxations - field and equation. So if you don't use eqn.relax, you can still do that in the relaxationFactors subdict.

Thanks,
backscatter is offline   Reply With Quote

Old   March 20, 2019, 06:12
Default
  #5
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Quote:
Originally Posted by backscatter View Post
In other words, relaxing a transient simulation is totally out of place.
Yes I agree with you. What happened was really a glitch from my understanding of OpenFOAM. I left the relaxation term in the fvSolution file believing that the PISO solver would not use it (only SIMPLE). Sad.
gu1 is offline   Reply With Quote

Old   April 14, 2019, 08:47
Default
  #6
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
You can use relaxation in transient simulations if you use the PIMPLE algorithm to increase stability, if you want to increase your time step. Look for examples in the tutorial directory of OpenFOAM using any of the *Pimple solvers.
jherb 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
Need help in adding terms to momentum equation of interFoam behzad-cfd OpenFOAM Programming & Development 2 April 18, 2020 14:52
Domain Reference Pressure and mass flow inlet boundary AdidaKK CFX 75 August 20, 2018 05:37
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Comparing residuals of momentum and energy equation skarma FLUENT 4 November 25, 2017 22:03
Coefficients discretized momentum equation michujo Main CFD Forum 4 June 20, 2012 01:33


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