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

Convergence in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree26Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 5, 2010, 15:14
Default Convergence in OpenFoam
  #1
Member
 
Jorge Muņoz
Join Date: Apr 2009
Posts: 56
Rep Power: 17
L3munoz is on a distinguished road
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.
y_jiang likes this.
L3munoz is offline   Reply With Quote

Old   March 6, 2010, 03:14
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by L3munoz View Post
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.
Hi,

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,
mizzou likes this.
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 8, 2010, 05:24
Default
  #3
Member
 
Jorge Muņoz
Join Date: Apr 2009
Posts: 56
Rep Power: 17
L3munoz is on a distinguished road
Hi Alberto,

thanks a lot for ur reply, it helped me a lot!
L3munoz is offline   Reply With Quote

Old   April 9, 2010, 12:34
Default
  #4
New Member
 
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 17
mcarpe is on a distinguished road
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
mcarpe is offline   Reply With Quote

Old   April 9, 2010, 13:15
Default
  #5
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by mcarpe View Post
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.
Yes, you have to monitor the initial residual. In steady-state simulations it's easy to just fix a very restrictive requirement and check when the residuals stop changing after for a long number of iterations, after they reduced of several order of magnitude. As you said, it would be better to monitor some physical property too.

Quote:
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
In general, in unsteady simulations you should check that the initial residual of each variable goes below a certain value too.
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   April 9, 2010, 13:48
Default
  #6
New Member
 
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 17
mcarpe is on a distinguished road
Thanks, Alberto, for the very quick reply.

Quote:
Originally Posted by alberto View Post
In general, in unsteady simulations you should check that the initial residual of each variable goes below a certain value too.
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".
So, you are saying that, if my convergence criteria is 1e-04, I should check that the initial residuals of all the variables are below that limit, even in the case of transient simulation?

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
Attached Images
File Type: png residuals.png (7.4 KB, 1853 views)
mcarpe is offline   Reply With Quote

Old   April 9, 2010, 14:34
Default
  #7
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by mcarpe View Post
Thanks, Alberto, for the very quick reply.

So, you are saying that, if my convergence criteria is 1e-04, I should check that the initial residuals of all the variables are below that limit, even in the case of transient simulation?
Yes, in principle this should be verified at each time-step.

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.
What is your Courant number?

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,
vsammartano and arsalan.dryi like this.
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   April 9, 2010, 15:51
Default
  #8
New Member
 
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 17
mcarpe is on a distinguished road
Quote:
Originally Posted by alberto View Post
Yes, in principle this should be verified at each time-step.


What is your Courant number?

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,
Max Co is usually ~0.6; I tried to reduce the time step until I had MaxCo ~0.1, but p initial residuals were still above the threshold, then I stopped trying.

Thank you for the hint. I'll try pimpleFoam and see what happens.

Cheers
Matteo
mcarpe is offline   Reply With Quote

Old   April 9, 2010, 15:56
Default
  #9
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
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,
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 23, 2010, 02:06
Default
  #10
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
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
alexisespinosa is offline   Reply With Quote

Old   December 23, 2010, 02:22
Default
  #11
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by alexisespinosa View Post
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?
To answer I would need to know what level of accuracy you need. Do you need a steady state solution, a time resolved solution? Are you doing LES?

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,
enginpower likes this.
__________________
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 open-source implementation of quadrature-based 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.
alberto is offline   Reply With Quote

Old   December 23, 2010, 02:43
Default
  #12
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
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.
alexisespinosa is offline   Reply With Quote

Old   December 23, 2010, 02:53
Default
  #13
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by alexisespinosa View Post
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.
Perfect. You can use pisoFoam without any problem, and since your mesh will be probably very good since you do LES and DNS, you probably won't need orthogonal correctors (Check with 3, and look at the initial residual of p. If it decreases quickly, reduce the correctors or disable them). Since you want high quality results, keep Co a bit smaller than usual. I would say Co < 0.5.

Happy holiday!
arsalan.dryi likes this.
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 23, 2010, 02:58
Default
  #14
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
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?
alexisespinosa is offline   Reply With Quote

Old   December 23, 2010, 03:13
Default
  #15
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by alexisespinosa View Post
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?
It depends. I usually have at least 0.001 for U, k, epsilon and other secondary variables, but I want a better convergence of p (0.0001 at least), and I check the mass conservation (which should be at machine precision).

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

Best,
arsalan.dryi and Aaron_L like this.
__________________
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 open-source implementation of quadrature-based 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.
alberto is offline   Reply With Quote

Old   February 10, 2011, 10:55
Default
  #16
New Member
 
Matteo Carpentieri
Join Date: Mar 2009
Posts: 28
Rep Power: 17
mcarpe is on a distinguished road
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
mcarpe is offline   Reply With Quote

Old   June 23, 2011, 06:54
Default
  #17
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18
Arnoldinho is on a distinguished road
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:
MULES: Solving for alpha1
Liquid phase volume fraction = 0.6249798 Min(alpha1) = -3.903281e-29 Max(alpha1) = 1.0000077
MULES: Solving for alpha1
Liquid phase volume fraction = 0.6249798 Min(alpha1) = -1.8463853e-27 Max(alpha1) = 1.0000158
GAMG: Solving for pd, Initial residual = 0.0031014169, Final residual = 1.847409e-05, No Iterations 3
GAMG: Solving for pd, Initial residual = 7.7653421e-05, Final residual = 8.0713147e-07, No Iterations 3
GAMGPCG: Solving for pd, Initial residual = 3.3507074e-06, Final residual = 5.1273501e-07, No Iterations 1
time step continuity errors : sum local = 2.217054e-08, global = -5.4684563e-10, cumulative = -1.3187716e-07
ExecutionTime = 312.2 s ClockTime = 314 s

Courant Number mean: 0.011130861 max: 0.42974913 velocity magnitude: 1.3537097
deltaT = 0.015873016
Time = 135.63492
I'm using GAMG solver for pd and PCG with GAMG preconditioner for pcorr and pdFinal. In PISO I use three correctors (nCorrectors 3). My questions:

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

Last edited by Arnoldinho; June 23, 2011 at 08:38.
Arnoldinho is offline   Reply With Quote

Old   June 23, 2011, 12:38
Default
  #18
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by Arnoldinho View Post
1. Do the three logged GAMG and GAMGPCG residuals stand for pdFinal?
The "Final" option in linear solvers is used only for the last iteration, but you will see "pd" in the log anyway.

Quote:
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?
You are using a PISO approach, so the residuals don't tell you a lot on the convergence, since there is no loop over the whole set of equations. If you residual value is stable (not increasing), I'd say it's OK.
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,
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   June 25, 2011, 11:01
Default
  #19
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18
Arnoldinho is on a distinguished road
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:
time step continuity errors : sum local = 2.3154534e-11, global = -6.891574e-14, cumulative = 9.3749989e-05
which I think should be ok.

Arne
Arnoldinho is offline   Reply With Quote

Old   June 25, 2011, 17:21
Default
  #20
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
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,
SailorLiu likes this.
__________________
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 open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto 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
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 06:56
Convergence of CFX field in FSI analysis nasdak CFX 2 June 29, 2009 02:17
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 14:50


All times are GMT -4. The time now is 05:42.