
[Sponsors] 
PIMPLE – the value of the final underrelaxation factor 

LinkBack  Thread Tools  Search this Thread  Display Modes 
June 23, 2016, 08:02 
PIMPLE – the value of the final underrelaxation factor

#1 
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 10 
Dear all,
There has been discussion about the value of the underrelaxation 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 lastiteration UF would be marked with pFinal, UFinal, kFinal. I have seen an opinion that the last iteration must not be underrelaxed due to “time consistency”. Even the default OF value for the lastiteration 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.48509e07, Final residual = 2.48509e07, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.90502e07, Final residual = 2.90502e07, No Iterations 0 smoothSolver: Solving for Uz, Initial residual = 2.50854e07, Final residual = 2.50854e07, No Iterations 0 GAMG: Solving for p, Initial residual = 0.000116384, Final residual = 4.94205e07, No Iterations 3 time step continuity errors : sum local = 1.36392e09, global = 3.16301e20, cumulative = 1.36197e17 GAMG: Solving for p, Initial residual = 8.24636e05, Final residual = 3.60451e07, No Iterations 3 time step continuity errors : sum local = 9.95819e10, global = 6.18473e20, cumulative = 1.35579e17 smoothSolver: Solving for epsilon, Initial residual = 5.73302e07, Final residual = 5.73302e07, No Iterations 0 smoothSolver: Solving for k, Initial residual = 9.80517e07, Final residual = 9.80517e07, No Iterations 0 PIMPLE: iteration 21 smoothSolver: Solving for Ux, Initial residual = 2.90552e07, Final residual = 2.90552e07, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 3.22285e07, Final residual = 3.22285e07, No Iterations 0 smoothSolver: Solving for Uz, Initial residual = 2.93459e07, Final residual = 2.93459e07, 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.76923e06, global = 6.82179e20, cumulative = 1.34897e17 GAMG: Solving for p, Initial residual = 0.0232006, Final residual = 9.25998e07, No Iterations 11 time step continuity errors : sum local = 2.97542e09, global = 2.01702e20, cumulative = 1.35098e17 smoothSolver: Solving for epsilon, Initial residual = 0.00025318, Final residual = 6.89581e07, No Iterations 7 smoothSolver: Solving for k, Initial residual = 0.000149306, Final residual = 5.97512e07, 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.24269e05, No Iterations 2 smoothSolver: Solving for Uy, Initial residual = 0.00389133, Final residual = 4.25448e05, No Iterations 2 smoothSolver: Solving for Uz, Initial residual = 0.00273149, Final residual = 4.22099e05, 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.27246e06, global = 2.98695e20, cumulative = 1.348e17 GAMG: Solving for p, Initial residual = 0.110798, Final residual = 0.000846695, No Iterations 3 time step continuity errors : sum local = 2.25067e06, global = 2.73183e20, cumulative = 1.35073e17 smoothSolver: Solving for epsilon, Initial residual = 0.000560519, Final residual = 9.70594e06, No Iterations 2 smoothSolver: Solving for k, Initial residual = 0.00166756, Final residual = 1.84326e05, No Iterations 2 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 35 iterations is then needed to achieve convergence: Code:
PIMPLE: iteration 2 smoothSolver: Solving for Ux, Initial residual = 8.83725e07, Final residual = 8.83725e07, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 4.87132e07, Final residual = 4.87132e07, No Iterations 0 smoothSolver: Solving for Uz, Initial residual = 9.01065e07, Final residual = 9.01065e07, No Iterations 0 GAMG: Solving for p, Initial residual = 4.35643e05, Final residual = 6.65981e07, No Iterations 3 time step continuity errors : sum local = 2.21862e10, global = 1.32988e21, cumulative = 1.63295e17 GAMG: Solving for p, Initial residual = 2.93937e06, Final residual = 5.2287e07, No Iterations 1 time step continuity errors : sum local = 1.74055e10, global = 3.24268e21, cumulative = 1.63327e17 smoothSolver: Solving for epsilon, Initial residual = 7.36589e07, Final residual = 7.36589e07, No Iterations 0 smoothSolver: Solving for k, Initial residual = 1.13054e06, Final residual = 1.19297e07, No Iterations 1 PIMPLE: iteration 3 smoothSolver: Solving for Ux, Initial residual = 3.87867e08, Final residual = 3.87867e08, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.45475e08, Final residual = 2.45475e08, No Iterations 0 smoothSolver: Solving for Uz, Initial residual = 3.89763e08, Final residual = 3.89763e08, No Iterations 0 GAMG: Solving for p, Initial residual = 3.40665e06, Final residual = 5.40481e07, No Iterations 1 time step continuity errors : sum local = 1.79655e10, global = 6.24958e21, cumulative = 1.6339e17 GAMG: Solving for p, Initial residual = 6.27098e07, Final residual = 6.27098e07, No Iterations 0 time step continuity errors : sum local = 2.0842e10, global = 9.63238e21, cumulative = 1.63486e17 smoothSolver: Solving for epsilon, Initial residual = 7.73138e07, Final residual = 7.73138e07, No Iterations 0 smoothSolver: Solving for k, Initial residual = 1.61397e07, Final residual = 1.61397e07, 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.25592e07, No Iterations 2 smoothSolver: Solving for Uy, Initial residual = 0.000118215, Final residual = 1.89876e07, No Iterations 2 smoothSolver: Solving for Uz, Initial residual = 0.000178618, Final residual = 4.35256e07, No Iterations 2 GAMG: Solving for p, Initial residual = 0.00017442, Final residual = 1.47911e06, No Iterations 4 time step continuity errors : sum local = 4.91535e10, global = 1.10429e20, cumulative = 1.63376e17 GAMG: Solving for p, Initial residual = 2.16852e05, Final residual = 6.38506e07, No Iterations 3 time step continuity errors : sum local = 2.12229e10, global = 1.63335e21, cumulative = 1.63359e17 smoothSolver: Solving for epsilon, Initial residual = 3.89249e05, Final residual = 3.7618e07, No Iterations 2 smoothSolver: Solving for k, Initial residual = 0.000103168, Final residual = 3.83274e07, No Iterations 2 I ran the same case in Fluent, with basically the same settings. Underrelaxation 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 lastiteration UF factors equal to 1 are questionable. I would appreciate any input on this topic. Best, Zbynek 

June 24, 2016, 04:43 

#2 
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 10 
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 abovedescribed 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 reappearing in the forums and maybe someone will bring up a decent explanation of the problem sooner or later. 

June 24, 2016, 04:54 

#3 
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29 
Did you compare actual results in your tests? Ultimately that's the only thing that matters.
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. 

June 24, 2016, 05:43 

#4 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 
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.
__________________
Keep foaming, Tobias Holzmann 

June 24, 2016, 10:42 

#5 
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 10 
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. 

June 24, 2016, 11:12 

#6 
Member
Sören Sander
Join Date: Sep 2012
Location: Germany
Posts: 43
Rep Power: 13 
Hi Zbynek,
the iteration loop with underrelaxation 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 steadystate 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". 

December 21, 2018, 00:04 

#7 
Senior Member
Ruiyan Chen
Join Date: Jul 2016
Location: Hangzhou, China
Posts: 162
Rep Power: 9 
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, OpenFOAM4.x. 

January 20, 2020, 10:38 

#8  
New Member
frozen midnight
Join Date: Jun 2011
Posts: 3
Rep Power: 14 
Quote:
Maybe increasing your nOuterCorrectors parameter in fvSolution helps. 

December 22, 2023, 05:08 

#9 
New Member
Ali Berk Kahraman
Join Date: Dec 2015
Location: Braunschweig, Germany
Posts: 13
Rep Power: 10 
Hi All,
I have been wondering the same thing too. I am not even sure what I can add to the discussion, but here is my take anyway because I have stumbled across this problem recently and I am in general somewhat cranky when it comes to explanations of the "art" of running simulations. I totally appreciate them anyway though, do not get me wrong. So, the simplified versoin of the PIMPLE algorithm is a SIMPLE algorithm for every time step. It is SORT OF (correction needed if I am wrong): velocity_change_in_timestep = Navier_Stokes_by_SIMPLE_algorithm(U,p,k,etc.) (eqn. 1) whereas a steady state SIMPLE algorithm would be 0 = Navier_Stokes_by_SIMPLE_algorithm(U,p,k,etc.) (eqn. 2) Now, I agree the SIMPLE algorithm will have errors. We all agreed to that fact when we realized we could not solve our NavierStokes equations exactly. I also agree that the convergence is slower if the underrelaxation factors (UF) is lower and the error of the algorithm at a given SIMPLE iteration is higher compared to a UF closer to 1.0 at the same number of iterations. Now there is another piece of information here: the iterations of the SIMPLE algorithm does not have a "timestep" meaning for a steady case, i.e. we cannot imagine the iterations of SIMPLE as an evolving flow field. Rather, that is the convergence of the solution in the predictorcorrector operation approximating the nonlinear Navier Stokes equations, i.e. the distance of the solution_vector to the exact solution of the NavierStokes_operator(solution_vector) = 0. According to this, I do not see the reason why the last iteration, say iteration 20, of SIMPLE is more important than an iteration in the middle, say iteration 13, in equation 1. Every SIMPLE iteration denotes mathematical convergence, not physical evolution of the flow, hence the overall convergence of SIMPLE to the transient Navier Stokes operator should be the relevant quantity. I do not see how there is a mathematical difference between obtaining SIMPLE convergence to the Navier Stokes equations using UF=0.7 in say 20 iterations compared to UF=0.6 in 29 iterations and UF=1.0 in the 30th iteration (totally made up numbers, but you get the point). Best Regards, Ali 

December 22, 2023, 05:26 

#10 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 
1. In my blog there is a explanation of PIMPLE and how to use it
2. In my book there is also an explanation with more information 3. Depending on your underrelaxation, you are may not be timespace consistent anymore, e.g., doing 50 outerloops with 0.1 underrelaxation. After thinking it should be clear 4. Identifying the problem why it diverges even with high outerloops and underrelaxation will potentially resolve your issue. 5. Numerical settings such as nonortho correction is something to consider as well (also in the discretisation) 6. Solver settings might support your calculation
__________________
Keep foaming, Tobias Holzmann 

Tags 
openfoam, pimple, residual, underrelaxation factor 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
simpleFoam error  "Floating point exception"  mbcx4jc2  OpenFOAM Running, Solving & CFD  12  August 4, 2015 02:20 
Cannot run the code properly: very large time step continuity error  crst15  OpenFOAM Running, Solving & CFD  9  December 14, 2014 18:17 
Moving mesh  Niklas Wikstrom (Wikstrom)  OpenFOAM Running, Solving & CFD  122  June 15, 2014 06:20 
pimpleFoam: turbulence>correct(); is not executed when using residualControl  hfs  OpenFOAM Running, Solving & CFD  3  October 29, 2013 08:35 
calculation stops after few time steps  sivakumar  OpenFOAM Running, Solving & CFD  7  March 17, 2013 06:37 