- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Convergence in OpenFoam**
(*https://www.cfd-online.com/Forums/openfoam-solving/73365-convergence-openfoam.html*)

Convergence in OpenFoamHi everybody!
I'm starting using Openfoam and i'd like to know some stuff about convergence criteria. I saw that the simulation ends once it reases the ending time. however i'd like to run it after a convergence criteria such as maximum value of residuals, just like FLUENT does. is it possible in OpenFoam? and my last question is about simpleFoam? is it just a version of OpenFoam or what? i don't understand very well the difference between them... Thanks a lot in advance...any help is welcome!! Lottar. |

Quote:
I answer at your second question first. OpenFOAM(r) is mainly a library that allows CFD applications and tools to be written with a high level syntax. The OF distribution contains many applications, and among these, a good number of CFD solvers, to deal with different problems. simpleFoam is one of them, and it deals with steady, incompressible flows. You find the description of each solver in the corresponding main .C file. About convergence criteria, some solver checks for the maximum residual, and simpleFoam is among them. You can specify the value of the maximum residual at convergence in the fvSolution dictionary of your case, in the SIMPLE subdictionary. Add "convergence 10^-3" to specify, for example, the convercence criterion is a max residual of 10^-3. Best, |

Hi Alberto,
thanks a lot for ur reply, it helped me a lot! ;) |

Hello, everybody....
I'd like some help from the more experienced in CFD and OpenFOAM, because I'm getting a little bit confused about the convergence issue.... In very basic terms, this is what I've understood about convergence and residuals in steady state simulations: since in this case one is only interested in the steady state converged solution, the residuals at a given time (iteration) step is not really important. The important thing is that, after a number of iteration, the residuals are reduced of several orders of magnitude (say, 10^-4). OK, I know that this is neither sufficient nor necessary condition, and other properties must be checked (like integral values of calculated variables, etc...), but as a first approximation I can claim that my simulation is converged. For example, with simpleFoam, I monitor the residuals (the "initial residuals" in the OpenFoam log output, am I right?) of all the variables and when they are all below my termination criterion, I'll have the converged solution.My question is: how should I proceed for unsteady simulations? For example when using a transient solver, like pisoFoam.If I've understood correctly, in this case I cannot expect the "initial residuals" to keep decreasing, because the values of my variables change at every time step. In fact this is what I've observed in my RSM simulations with pisoFoam. I was never able to get the p initial residuals below ~1e-03 (and this arises also another question: should I check p or pFinal, in the case of pisoFoam?). So, how can I be confident that my simulation is converged? Please help... I know, this may be really a silly question... but I am a CFD newbie.. Thank you in advance Matteo |

Quote:
Quote:
In the PISO algorithm you simply assume that one solution step + pressure correctors are enough to obtain convergence. Read it as in "you've to use a time step small enough to have convergence". Best, |

1 Attachment(s)
Thanks, Alberto, for the very quick reply.
Quote:
For example: in attachment you'll see the residuals plot for one of my simulations with pisoFoam [RSM turbulence, boundary-layer flow over an array of buildings]. As you can see the p value is still high. I tried every solution I could think of, without success. I can only obtain some improvement by reducing the time step, but in order to make the residual lower than 1e-04 I must decrease the time step A LOT. ...I was thinking that, perhaps, because of the unsteadiness, that result wouldn't be too bad, after all.... Matteo |

Quote:
each time-step.Quote:
You could use pimpleFoam instead than pisoFoam to be able to perform sub-iterations (outer corrector steps) to ensure convergence and being able to use an acceptable time-step. Best, |

Quote:
Thank you for the hint. I'll try pimpleFoam and see what happens. Cheers Matteo |

Usually in unsteady runs the criterion is fixed to 1e-3 in commercial codes. It doesn't mean much, but it gives you an indication of what to expect.
Best, |

Hello Alberto and Matteo,
Your comments are being very useful for me. Matteo: Were you able to improve your convergence by using pimpleFoam settings? Alberto: What settings do you use for pimpleFoam? I'm using using 3 nOuterCorrectors (NonLinearity correctors) and 3 nCorrectors (PISO correctors) and 1 nNonOrthogonalCorrectors for transient simulations of incompressible flow around a cylinder. My simulations are 2D so the increase in the calculation time is still manageble. But I'm planning to go 3D soon and I need to optimize my settings but I do not want to loose too much accuracy. Do you always use the 1e-3 residual criteria? Thanks a lot, Alexis |

Quote:
Let me give some guideline. Your case is quite simple: single-phase, I assume in operating conditions that are not particularly challenging, simple geometry (you can mesh it well, so if you have convergence difficulties, re-mesh). Under there assumptions, use the pisoFoam with a sufficiently small Courant number (if you do well resolved simulations in time, or LES you need this anyway), and save your time. You will notice that the convergence is good, and the efficiency improves quite a bit, without loss of accuracy. Best, |

Thanks Alberto,My question was in a general sense, but now I understand that criteria is more specific to the application. I have not started yet the intended simulations (hopefully next week). Trying to be more specific: My cases are low Re so I am planning to solve the the 3D flow with a DNS or a LES for Re up to 700 of the flow around a cylinder. |

Quote:
Happy holiday! |

Yes, my case is as simple as you described it. So, I understand from your answer that the basic settings of pisoFoam should be enough if I use sufficiently small Co. OK, I will do that.
Anyway, I would like to still ask you the "general" question about your usual settings for pimpleFoam (if there is possibility of generalization) and about your usual criteria of convergence? |

Quote:
You can easily check these things with pyFoam (i.e: pyFoamPlotRunner pisoFoam). Best, |

Hi Alexis,
sorry for the long delay, but I haven't been checking this forum lately. To answer to your question, I wasn't able to get a converged calculation even with pimpleFoam, and it made really little difference. The only way I was able to get convergence was by reducing (...a lot...) the time step. After that, I stopped trying because it took 2 weeks to have suitable results with a sensible averaging time on my 8-core workstation, and it wasn't a viable option for me. So I reduced my expectations and... used k-epsilon model instead. Cheers Matteo |

Hi,
I'm using the interFoam solver and OF 1.6-ext for flow (water) in a 3D channel, with fixed U boundary conditions with log profiles. Looking at the residuals, I ask myself which p residuals I have to monitor. Below is a snippet from the log file: Quote:
1. Do the three logged GAMG and GAMGPCG residuals stand for pdFinal? 2. The first initial pd residuals never fall below a value of approx. 0.003. The second and third initial residuals (GAMG and GAMGPCG) are always below 1e-5. Which ones do I have to monitor, in order to know if the solution converges? 3. What could be a good convergence value? You said something about 0.0001 for p, and 1e-3 in commercial codes. But for which of the above mentioned values? Greetings, Arne |

Quote:
Quote:
To be safe, check also the continuity error instead of the residual. If the continuity error is of the order of machine zero, your continuity constraint is satisfied. Check the literature on incompressible solvers on co-located grids about this. Best, |

Ok, thanks for the explanation alberto.
I'm not sure what exactly machine zero is, but the time step continuity errors are normally in the order of Quote:
Arne |

Machine zero (or machine epsilon http://en.wikipedia.org/wiki/Machine_epsilon ) depends on the machine. As reference, 1.0 x 10^-12 is what I use as reference. Someone uses smaller numbers.
Best, |

All times are GMT -4. The time now is 07:48. |