CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Stopping run when converged. (

kprzysowagmailcom August 22, 2009 10:59

Stopping run when converged.
I have noticed that simleFoam doesn't automatically stop the run when converged (after having residuals with lower values than specified by tolerances in fvSolution). It just doesn't make any iterations to any parameter. The next

Is there any way to stop the run, when converged?

Most intuitive place should be controlDict but I could not find anything else than "stopAt endTime;", which is obviously not applicable.

I have seen as well convergenceCheck but its not compiled from the box so I did not check it yet. I could not find any documentation for that.

There is as well pyFoamRunner,
But I don't want to use it on the cluster.

For sure there is very simple default way of doing it.

kprzysowagmailcom August 22, 2009 12:18

I have found solution by myself.
I have found solution googling the web.

Its in german, so few words of explanations:
You need to recompile the simpleFoam (wmake for newbies), using the contents of the convergenceCheck.H, initConvergenceCheck.H, pEqn.H, UEqn.H from mentioned file.

I have changed ("Div" -> "div") in this files since compiler returned error for "Div".

Do not forget to make backup of these files before starting to compile.

mina.basta August 5, 2013 06:25

Dear Krzysztof Przysowa,

I am a new OF user, and I realized that even I set convergence criterion in fvSolution (tolerances), hhe run didn't stop. So how can i know using simpleFOam that the run is converged ? each time i put the run till 3000 and it took a lot of time to calculate. Also after 3000 I don't know if the run is well converged or not !!!! Could you explain for me how it works on OF?

mina.basta August 5, 2013 06:27

* the run didn't stop

gillimaniac August 6, 2013 02:47

Hey its a lot easier. Just add:

p 1e-2;
U 1e-3;
"(k|epsilon|omega)" 1e-3;

in your fvsolution - file. Then you can set the convergence criteria for any variable.
With the entry "tolerance" in the specific solvers (smoothSolver, GAMG, etc.) you only specify when the solver should stop iterating "within one outer iteration".
The "outer iterations" convergence criteria (per timestep) are controlled by the "residualControl" keyword within the SIMPLE brackets (see upper).


mina.basta August 6, 2013 03:44

1 Attachment(s)
Dear Stefan Gaerling,

Attached is my fvSolustion. I already added the residual control, but my problem didn't been solved. The run stops only with the number of iterations which is fixed in the controlDict which means that if I put endTime:2000, the run will stop at 2000 and if I put endTime: 50000 the run will stop after 50000 even if I set the residualControl. Could you explain to me with more details?

Thanks in advance,

gillimaniac August 6, 2013 08:11


the reason why simpleFoam is running your specified number of maximum iterations is because it is not able to reach the specified convergence level within these iterations.

The numbers specified within residualControl only says: stop if the initial residuals fall below these values.
If they do not (because of divergence, instationary behaviour or bad mesh initialized instabilities) it will not stop because the residuals wont reach your convergence level.

You will have to take a look at your residuals' behaviour/ boundary conditions etc.


mina.basta August 6, 2013 08:32

Thanks a lot Stefan for your quick response

All times are GMT -4. The time now is 19:24.