CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   PIMPLE – the value of the final under-relaxation factor (https://www.cfd-online.com/Forums/openfoam/173616-pimple-value-final-under-relaxation-factor.html)

Zbynek June 23, 2016 08:02

PIMPLE – the value of the final under-relaxation factor
 
Dear all,

There has been discussion about the value of the under-relaxation factors (UF) in the last iteration (OuterCorrector) of the PIMPLE algorithm. At the same time, many people have complained about high values of the pressure initial residual. As far as I understood from my test runs, these two factors are closely related.

In PIMPLE, let’s assume that you set nOuterCorrectors (number of iterations within one time step) to 20 and nCorrectors to 2. The first 19 iterations will be calculated with UF marked in relaxationFactors dictionary in fvSolution file as p, U, k etc. The last-iteration UF would be marked with pFinal, UFinal, kFinal. I have seen an opinion that the last iteration must not be under-relaxed due to “time consistency”. Even the default OF value for the last-iteration UF is 1. However, I must admit that I do not understand this point. Within the time step we gradually iterate towards the final value via 20 iterations – in other words, it is gradual approaching towards the final value within the time step. The iteration number 1 would bring us a bit closer to the final result, iteration 2 takes values from iteration 1 and brings us even closer and so on. So why having the UF equal to 1 in the last iteration would do anything with “time consistency” or whatever else?

Just to show a few examples. I have a mixing tank case. If I run with UF equal to 0.3 for p and 0.5 for k, epsilon and U, and UFFinal equal to 1 for all, I typically get the following output:

Code:

PIMPLE: iteration 20
smoothSolver:  Solving for Ux, Initial residual = 2.48509e-07, Final residual = 2.48509e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 2.90502e-07, Final residual = 2.90502e-07, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 2.50854e-07, Final residual = 2.50854e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 0.000116384, Final residual = 4.94205e-07, No Iterations 3
time step continuity errors : sum local = 1.36392e-09, global = 3.16301e-20, cumulative = -1.36197e-17
GAMG:  Solving for p, Initial residual = 8.24636e-05, Final residual = 3.60451e-07, No Iterations 3
time step continuity errors : sum local = 9.95819e-10, global = 6.18473e-20, cumulative = -1.35579e-17
smoothSolver:  Solving for epsilon, Initial residual = 5.73302e-07, Final residual = 5.73302e-07, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 9.80517e-07, Final residual = 9.80517e-07, No Iterations 0
PIMPLE: iteration 21
smoothSolver:  Solving for Ux, Initial residual = 2.90552e-07, Final residual = 2.90552e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 3.22285e-07, Final residual = 3.22285e-07, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 2.93459e-07, Final residual = 2.93459e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 0.152209, Final residual = 0.0010664, No Iterations 3
time step continuity errors : sum local = 3.76923e-06, global = 6.82179e-20, cumulative = -1.34897e-17
GAMG:  Solving for p, Initial residual = 0.0232006, Final residual = 9.25998e-07, No Iterations 11
time step continuity errors : sum local = 2.97542e-09, global = -2.01702e-20, cumulative = -1.35098e-17
smoothSolver:  Solving for epsilon, Initial residual = 0.00025318, Final residual = 6.89581e-07, No Iterations 7
smoothSolver:  Solving for k, Initial residual = 0.000149306, Final residual = 5.97512e-07, No Iterations 7
PIMPLE: converged in 21 iterations
ExecutionTime = 971.13 s  ClockTime = 1006 s

Courant Number mean: 0.167838 max: 3.8467
Time = 0.46

PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.00272357, Final residual = 4.24269e-05, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.00389133, Final residual = 4.25448e-05, No Iterations 2
smoothSolver:  Solving for Uz, Initial residual = 0.00273149, Final residual = 4.22099e-05, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.165065, Final residual = 0.00127416, No Iterations 3
time step continuity errors : sum local = 3.27246e-06, global = 2.98695e-20, cumulative = -1.348e-17
GAMG:  Solving for p, Initial residual = 0.110798, Final residual = 0.000846695, No Iterations 3
time step continuity errors : sum local = 2.25067e-06, global = -2.73183e-20, cumulative = -1.35073e-17
smoothSolver:  Solving for epsilon, Initial residual = 0.000560519, Final residual = 9.70594e-06, No Iterations 2
smoothSolver:  Solving for k, Initial residual = 0.00166756, Final residual = 1.84326e-05, No Iterations 2

You can see that the pressure initial residual is low in the second to last iteration, 10e-4. However, in the last iteration it jumps up to 10e-1 due to the UF equal to 1. This is then transferred to the next step that starts with a high residual value and that’s why about 20 iterations are needed to achieve convergence. The initial residual value is high.

If I set final and "normal" UF the same, i.e. the p/pFinal is 0.3 and U/UFinal, k/kFinal, epsillon/epsilonFinal are 0.5, the initial residual value drops significantly in the last step. Only about 3-5 iterations is then needed to achieve convergence:

Code:

PIMPLE: iteration 2
smoothSolver:  Solving for Ux, Initial residual = 8.83725e-07, Final residual = 8.83725e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 4.87132e-07, Final residual = 4.87132e-07, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 9.01065e-07, Final residual = 9.01065e-07, No Iterations 0
GAMG:  Solving for p, Initial residual = 4.35643e-05, Final residual = 6.65981e-07, No Iterations 3
time step continuity errors : sum local = 2.21862e-10, global = 1.32988e-21, cumulative = -1.63295e-17
GAMG:  Solving for p, Initial residual = 2.93937e-06, Final residual = 5.2287e-07, No Iterations 1
time step continuity errors : sum local = 1.74055e-10, global = -3.24268e-21, cumulative = -1.63327e-17
smoothSolver:  Solving for epsilon, Initial residual = 7.36589e-07, Final residual = 7.36589e-07, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 1.13054e-06, Final residual = 1.19297e-07, No Iterations 1
PIMPLE: iteration 3
smoothSolver:  Solving for Ux, Initial residual = 3.87867e-08, Final residual = 3.87867e-08, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 2.45475e-08, Final residual = 2.45475e-08, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.89763e-08, Final residual = 3.89763e-08, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.40665e-06, Final residual = 5.40481e-07, No Iterations 1
time step continuity errors : sum local = 1.79655e-10, global = -6.24958e-21, cumulative = -1.6339e-17
GAMG:  Solving for p, Initial residual = 6.27098e-07, Final residual = 6.27098e-07, No Iterations 0
time step continuity errors : sum local = 2.0842e-10, global = -9.63238e-21, cumulative = -1.63486e-17
smoothSolver:  Solving for epsilon, Initial residual = 7.73138e-07, Final residual = 7.73138e-07, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 1.61397e-07, Final residual = 1.61397e-07, No Iterations 0
PIMPLE: converged in 3 iterations
ExecutionTime = 3067.08 s  ClockTime = 4586 s

Courant Number mean: 0.0504345 max: 0.784236
Time = 2.238

PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.000178306, Final residual = 4.25592e-07, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.000118215, Final residual = 1.89876e-07, No Iterations 2
smoothSolver:  Solving for Uz, Initial residual = 0.000178618, Final residual = 4.35256e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.00017442, Final residual = 1.47911e-06, No Iterations 4
time step continuity errors : sum local = 4.91535e-10, global = 1.10429e-20, cumulative = -1.63376e-17
GAMG:  Solving for p, Initial residual = 2.16852e-05, Final residual = 6.38506e-07, No Iterations 3
time step continuity errors : sum local = 2.12229e-10, global = 1.63335e-21, cumulative = -1.63359e-17
smoothSolver:  Solving for epsilon, Initial residual = 3.89249e-05, Final residual = 3.7618e-07, No Iterations 2
smoothSolver:  Solving for k, Initial residual = 0.000103168, Final residual = 3.83274e-07, No Iterations 2

In my case, I was able to run the simulations with all UF set to 1 as well since PISO was able to handle that. And the convergence was still fast. So the main problem to me seems to have different UF values in the final and previous iterations. The results may not be damaged but you definitely need to perform many more iterations to achieve convergence.

I ran the same case in Fluent, with basically the same settings. Under-relaxation was applied as well and I can say that the residuals (or convergence behavior if you wish) I was getting were very similar to what I can get from OF in case I use the same UF factors in all iterations. So from my point of view the last-iteration UF factors equal to 1 are questionable.

I would appreciate any input on this topic.

Best,

Zbynek

Zbynek June 24, 2016 04:43

A short update: if I set the relaxation factor for p/pFinal as 0.5/0.5 or 0.5/1, the convergence is good in both cases. If I set k/kFinal or epsilon/epsilonFinal to 0.7/0.7 or 0.7/1.0, the convergence is good again. However, U/UFinal seems to be the place where the culprit is hidden. It needs to have the same value for both U and UFinal. If I set it as 0.7/0.7 or 1/1, it works just fine. However, if the settings is 0.7/1 or 0.5/0.7 or anything else where U != UFinal, then the above-described problem occurs.

I do not know what exactly causes the problem since I am not a mathematician and I am not able to see deep enough in the code. However, I hope that this observation will help someone to solve the convergence issue that keeps re-appearing in the forums and maybe someone will bring up a decent explanation of the problem sooner or later.

akidess June 24, 2016 04:54

Did you compare actual results in your tests? Ultimately that's the only thing that matters.

Tobi June 24, 2016 05:43

As akidess said, the important thing is that the results should be achieved. In a mathematic point of view the last iteration has to be 1 to be sure to go to the value we need during time. However this can lead to instability as you mentioned and even if you have 5 iterations and the residuals are very low you can go on. There should not be a need to have *Final = 1 but in the mathematic point of view we would miss some information. If you have problems with the momentum predictor, just turn it off an check it again. Sometimes the momentum predictor leads to some instability (I do not know why but you can try it too).

In some development of a college , we are forced to unset the momentum predictor. Otherwise the results are complete unphysical.

Zbynek June 24, 2016 10:42

Guys,

I appreciate your input. I compared the results for both cases just by quickly looking at the contours and vectors and I would say that they are basically the same. The difference is just in the convergence behavior and therefore also in the computation speed. If one uses different values for U and UFinal, the solution is kind of "destabilized" at the end of the time step and the initial residual jumps up. The solver then needs to do more iterations in the next time step -> slower computation.

@Tobi

I tried to turn off the momentum predictor but unfortunately it did not do the trick.

Sören Sander June 24, 2016 11:12

Hi Zbynek,

the iteration loop with under-relaxation yields time step dependent errors, if UF are used. The reason is, that e.g. assuming a linear fall in velocity with a UF of 0.5 the velocity after 50% of the time step are calculated. The remaining error is 50%. Multiple iterations decrease this time step error, e.g. after 2 iterations the error falls to 25% and so on. (UF^No._of_Iterations).
This is important for transient flow behaviour, because then you do have a difference in velocity at each time step. If your flow behaves steady-state even transient calculations will not change the resulting flow, if you do not use UF=1 in your final step (each iteration improves your solution further). For highly alternating flow UF should be "as close to 1, as stability allows".

cryabroad December 21, 2018 00:04

This is an old post, but does anybody have a good explanation?

If I set my p and pFinal to the same value, the simulation runs smoothly. However, if p is set to something like 0.7 and pFinal 1.0, the simulation diverges. Any thoughts?

I'm using a modified rhoPimpleFoam solver with added passive scalars, OpenFOAM-4.x.

frozz_night January 20, 2020 10:38

Quote:

Originally Posted by cryabroad (Post 719785)
This is an old post, but does anybody have a good explanation?

If I set my p and pFinal to the same value, the simulation runs smoothly. However, if p is set to something like 0.7 and pFinal 1.0, the simulation diverges. Any thoughts?

I'm using a modified rhoPimpleFoam solver with added passive scalars, OpenFOAM-4.x.

I am starting to use pimpleFoam recently.
Maybe increasing your nOuterCorrectors parameter in fvSolution helps.


All times are GMT -4. The time now is 02:36.