
[Sponsors] 
March 5, 2010, 15:14 
Convergence in OpenFoam

#1 
Member
Jorge Muņoz
Join Date: Apr 2009
Posts: 56
Rep Power: 10 
Hi 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. 

March 6, 2010, 03:14 

#2  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
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,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

March 8, 2010, 05:24 

#3 
Member
Jorge Muņoz
Join Date: Apr 2009
Posts: 56
Rep Power: 10 
Hi Alberto,
thanks a lot for ur reply, it helped me a lot! 

April 9, 2010, 11:34 

#4 
New Member
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 10 
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 ~1e03 (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 

April 9, 2010, 12:15 

#5  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
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,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

April 9, 2010, 12:48 

#6  
New Member
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 10 
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, boundarylayer 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 1e04 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 

April 9, 2010, 13:34 

#7  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
Quote:
Quote:
You could use pimpleFoam instead than pisoFoam to be able to perform subiterations (outer corrector steps) to ensure convergence and being able to use an acceptable timestep. Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

April 9, 2010, 14:51 

#8  
New Member
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 10 
Quote:
Thank you for the hint. I'll try pimpleFoam and see what happens. Cheers Matteo 

April 9, 2010, 14:56 

#9 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
Usually in unsteady runs the criterion is fixed to 1e3 in commercial codes. It doesn't mean much, but it gives you an indication of what to expect.
Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 23, 2010, 02:06 

#10 
New Member
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 14
Rep Power: 10 
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 1e3 residual criteria? Thanks a lot, Alexis 

December 23, 2010, 02:22 

#11  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
Quote:
Let me give some guideline. Your case is quite simple: singlephase, I assume in operating conditions that are not particularly challenging, simple geometry (you can mesh it well, so if you have convergence difficulties, remesh). 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,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. Last edited by alberto; December 23, 2010 at 02:42. 

December 23, 2010, 02:43 

#12 
New Member
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 14
Rep Power: 10 
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. Last edited by alexisespinosa; December 23, 2010 at 02:59. 

December 23, 2010, 02:53 

#13  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
Quote:
Happy holiday!
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 23, 2010, 02:58 

#14 
New Member
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 14
Rep Power: 10 
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? 

December 23, 2010, 03:13 

#15  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
Quote:
You can easily check these things with pyFoam (i.e: pyFoamPlotRunner pisoFoam). Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. Last edited by alberto; December 23, 2010 at 03:44. 

February 10, 2011, 10:55 

#16 
New Member
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 10 
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 8core workstation, and it wasn't a viable option for me. So I reduced my expectations and... used kepsilon model instead. Cheers Matteo 

June 23, 2011, 05:54 

#17  
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 11 
Hi,
I'm using the interFoam solver and OF 1.6ext 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 1e5. 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 1e3 in commercial codes. But for which of the above mentioned values? Greetings, Arne Last edited by Arnoldinho; June 23, 2011 at 07:38. 

June 23, 2011, 11:38 

#18  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
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 colocated grids about this. Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

June 25, 2011, 10:01 

#19  
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 11 
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 

June 25, 2011, 16:21 

#20 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,911
Rep Power: 28 
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,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Superlinear speedup in OpenFOAM 13  msrinath80  OpenFOAM Running, Solving & CFD  18  March 3, 2015 06:36 
Modified OpenFOAM Forum Structure and New MailingList  pete  Site News & Announcements  0  June 29, 2009 05:56 
Convergence of CFX field in FSI analysis  nasdak  CFX  2  June 29, 2009 01:17 
64bitrhel5 OF installation instructions  mirko  OpenFOAM Installation  2  August 12, 2008 18:07 
OpenFOAM Debian packaging current status problems and TODOs  oseen  OpenFOAM Installation  9  August 26, 2007 13:50 