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

SimpleFoam convergence criterion?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree7Likes
  • 4 Post By alberto
  • 3 Post By alberto

Reply
 
LinkBack Thread Tools Display Modes
Old   August 13, 2011, 09:57
Default SimpleFoam convergence criterion?
  #1
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 271
Rep Power: 9
phsieh2005 is on a distinguished road
Hi,

I am running a simpleFoam case. The print out messages said that, there is no convergence criterion. The case will run for 1000 steps. What is the reason behind it?

Thanks!

Pei
phsieh2005 is offline   Reply With Quote

Old   August 14, 2011, 23:46
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
This happens because the convergence criterion is not specified in fvSolution.

If you use OpenFOAM 1.7.x, you need to specify it in the SIMPLE sub-dictionary:

Code:
SIMPLE
{
  nNonOrthogonalCorrectors 0;

  // Residual here (all residuals must go below this)
  convergenceCriterion 1.0e-6;
}
If you use OpenFOAM 2.0.x, the syntax is:

Code:
SIMPLE
{
    nNonOrthogonalCorrectors 0;

    // Residuals here (one per variable)
    // If one variable is not specified, zero is assumed as
    // desired residual (iterations will not stop)
    residualControl
    {
        p               1e-2;
        U               1e-3;
        "(k|epsilon|omega)" 1e-3;
    }
}
I hope this helps.
atg, hawkeye321, JR22 and 1 others like this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   August 16, 2011, 09:12
Default
  #3
Member
 
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 7
bigbang is on a distinguished road
Thanks Alberto, this has helped me.

When I run simpleFoam, I now get this:

Code:
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model realizableKE
realizableKECoeffs
{
    Cmu             0.09;
    A0              4;
    C2              1.9;
    sigmak          1;
    sigmaEps        1.2;
}


SIMPLE: convergence criteria
    field p	 tolerance 1e-06
    field U	 tolerance 1e-06
    field k	 tolerance 1e-06
    field epsilon	 tolerance 1e-06


Starting time loop

Time = 1
bigbang is offline   Reply With Quote

Old   September 19, 2011, 09:01
Default
  #4
New Member
 
Join Date: May 2011
Posts: 8
Rep Power: 6
rgarcia is on a distinguished road
Hi all,

I would like to know what exactly happens if you introduce

SIMPLE
{
nNonOrthogonalCorrectors 0;

// Residual here (all residuals must go below this)
convergenceCriterion 1.0e-6;
}

Does the simulation stop when all the variables has a residual lower than 1.0e-6?


Do you know if it's possible to stop the simulation when the residuals are lower of 1.0e-4 for 50 consecutive iterations instead of loooking just one iteration?

Thanks in advance!

Roger
rgarcia is offline   Reply With Quote

Old   June 20, 2012, 16:36
Default
  #5
New Member
 
Join Date: Oct 2011
Posts: 14
Rep Power: 5
cfddwarf is on a distinguished road
In my Log file it also says:

SIMPLE: no convergence criteria found. Calculations will run for 2000 steps.

In the fvSolution file entry looks as follows:

SIMPLE
{
nNonOrthogonalCorrectors 0;
}

so my question is, whether the solver is now trying to reach zero as the desired residual? Are my simulations still correct??

Thanks for any answer...
cfddwarf is offline   Reply With Quote

Old   June 20, 2012, 16:39
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Your results will simply have the residuals the solution gives after 2000 iterations. If such a number of iterations is sufficient for your case, the solution will be correct.

You can store the output of the solver in a text file and then examine them using foamLog.

Alternatively, you can specify residuals (see tutorials).
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   June 20, 2012, 16:46
Default
  #7
New Member
 
Join Date: Oct 2011
Posts: 14
Rep Power: 5
cfddwarf is on a distinguished road
At approximately timestep 500 the no of iterations change to zero.

Time = 572

DILUPBiCG: Solving for Ux, Initial residual = 8.02058e-06, Final residual = 8.02058e-06, No Iterations 0
DILUPBiCG: Solving for Uy, Initial residual = 9.42366e-06, Final residual = 9.42366e-06, No Iterations 0
DILUPBiCG: Solving for Uz, Initial residual = 8.13976e-06, Final residual = 8.13976e-06, No Iterations 0
DICPCG: Solving for p, Initial residual = 1.09339e-05, Final residual = 9.86413e-07, No Iterations 70
time step continuity errors : sum local = 0.000183096, global = -8.98498e-07, cumulative = 0.00553493
ExecutionTime = 5461.38 s ClockTime = 5489 s

Does this mean it converged? How come the other entries in the fvSolution file dont play a role for the convergence criterion? I mean the entries "tolerance" and "reltol"??

p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.01;
}

U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.1;
}
cfddwarf is offline   Reply With Quote

Old   June 20, 2012, 16:55
Default
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
They actually played a role. If you want convergence with a specified residual specify your criteria in fvSolution / SIMPLE

Code:
SIMPLE
{
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;

    residualControl
    {
        p               1e-5;
        U               1e-5;
        // Add other variables here
    }
}
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   July 20, 2012, 08:26
Default a recommandable convergence criterium?
  #9
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 5
despaired student is on a distinguished road
Hi,

how do you specify your convergence criteria? I mean how do you know that the residual must be below e.g. 10^-5 to definitely reach convergence? I first was looking at my residuals to not fluctuate any more (ideal case would be a horizontal line but I've never reached that) but the chief-engineer told me that I must reach a convergence criteria of 10^-5 at least. He said that it is a normally used criteria... but why...???
Can you help me with this question???

Attached are some pictures of my residuals. I would like to read your opinion - does these pictures proof convergence or not?

This is kind of important for my graduating thesis...


Thank you
Attached Images
File Type: jpg 10°.jpg (41.0 KB, 312 views)
File Type: jpg 26°.jpg (40.9 KB, 213 views)
File Type: jpg 65°.jpg (41.4 KB, 191 views)
File Type: jpg 60Miocells_reference.jpg (43.5 KB, 230 views)
despaired student is offline   Reply With Quote

Old   July 20, 2012, 16:48
Default
  #10
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Hi Soren,

your plot show the solution behaviour is correct, and the solution is converging. However, for a steady-state solution, residuals are usually required to be very small (ideally close to machine precision) to declare the solution is converged.

Also, note that at convergence, residual curves should be flat. In your case their slope is not negligible, indicating that the solution convergence can be further improved.

I usually set convergence criteria to a very small number (1.0e-12), let the simulation run for a good number (depends on the case) of iterations, and then check the residual curves. If residuals reach 1.0e-12 or if they decreased many orders of magnitude and they stopped changing for a certain number of iterations, then I consider the solution converged.

Best,
Claudio87, JR22 and wayne14 like this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   March 3, 2015, 06:56
Default Simple Foam stops before reaching the end iteration
  #11
Member
 
Naresh Yathuru
Join Date: Feb 2015
Posts: 54
Rep Power: 2
Naresh yathuru is on a distinguished road
Hi can some one help me out.
1. the simple foam stops in the middle with out any error.
tolerance= 1 e^-09
reltol= 1 e^-o9

There is a huge difference between my initial and final residuals. is it ok?
(approx) initial residuals= 2.4 e--4
final residuals= 6.2 e-10

so still the initial residuals are higher than the tolerance but why does the simulation stops? By stop i mean it gets stuck at a itereation and its not proceeding any further. i waited for almost an hour.

can some one help me.

Thank you

Regards,
Naresh
Naresh yathuru is offline   Reply With Quote

Old   March 3, 2015, 07:29
Default
  #12
New Member
 
Andrew Smith
Join Date: Jan 2015
Location: North Dakota
Posts: 18
Rep Power: 2
Andrew_Sm is on a distinguished road
Quote:
Originally Posted by Naresh yathuru View Post
Hi can some one help me out.
1. the simple foam stops in the middle with out any error.
tolerance= 1 e^-09
reltol= 1 e^-o9

There is a huge difference between my initial and final residuals. is it ok?
(approx) initial residuals= 2.4 e--4
final residuals= 6.2 e-10

so still the initial residuals are higher than the tolerance but why does the simulation stops? By stop i mean it gets stuck at a itereation and its not proceeding any further. i waited for almost an hour.

can some one help me.

Thank you

Regards,
Naresh
Running OpenFoam successfully is not everyone's cup of tea

You gave very less information so I suggest you to first refer the "User guide of OF" and try some basic tutorials before jumping on to anything

Advice:
For tutorials refer the following post:

Running OpenFOAM successfully with Chalmers
Andrew_Sm is offline   Reply With Quote

Old   March 3, 2015, 08:44
Default
  #13
Member
 
Naresh Yathuru
Join Date: Feb 2015
Posts: 54
Rep Power: 2
Naresh yathuru is on a distinguished road
Thank Andrew or your quick reply.

I m trying to simulate a room with inlet and outlet and a box inside in simple foam.

This is my FVscheme
ddtSchemes
{
default steadyState;
}

gradSchemes
{
default leastSquares;//Gauss linear
}

divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind grad(U); // was bounded Gauss upwind which is first order but linearupwind is second order
div(phi,k) bounded Gauss upwind;
div(phi,epsilon) bounded Gauss upwind;
div(phi,omega) bounded Gauss upwind;
div(phi,R) bounded Gauss upwind;
div(R) Gauss linear;
div(phi,nuTilda) bounded Gauss upwind;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
default Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}

fluxRequired
{
default no;
p ;
}



And this is my FVsolution

solvers
{
p
{
solver GAMG;
tolerance 1e-12;
relTol 1e-12;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
}

"(U|k|epsilon|omega|R|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-12;
relTol 1e-12;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 0;

/* residualControl
{
p 1e-2;
U 1e-3;
"(k|epsilon|omega)" 1e-3;
}*/ //as of we do not need
}

relaxationFactors
{
fields
{
p 0.7; // Before 0.3 :it means that 30 percentage of the ew value and 70 % of old value weighted to gether foe the next iteration.
} // It helps in stability but takes longer for convergence.
equations
{
U 0.3;
k 0.7;
epsilon 0.7;
omega 0.7;
R 0.7;
nuTilda 0.7;
}
}

1. i ran the simulation for 5000 iterations but with no sucess for convergence.
then i changed the relaxation factor for p and u.
before :
p= 0.3
u=0.7
now:
p= 0.7
u= 0.3

The simulation runs for some 50 iterations and the iteration get stuck at some point and its not going further.

Interesting is that the Initial residuals are lesser than the specified tolerance.
Time = 5517

smoothSolver: Solving for Ux, Initial residual = 0.00026747233, Final residual = 4.3957841e-14, No Iterations 7
smoothSolver: Solving for Uy, Initial residual = 0.00035219196, Final residual = 5.6268315e-14, No Iterations 7
smoothSolver: Solving for Uz, Initial residual = 0.000529688, Final residual = 8.2691583e-14, No Iterations 7
GAMG: Solving for p, Initial residual = 0.0062565687, Final residual = 9.9888366e-13, No Iterations 143
time step continuity errors : sum local = 2.4610067e-14, global = 5.1314876e-17, cumulative = 1.6021426e-16
smoothSolver: Solving for omega, Initial residual = 0.00023592505, Final residual = 7.3934347e-13, No Iterations 17
smoothSolver: Solving for k, Initial residual = 0.0003149381, Final residual = 9.8133224e-13, No Iterations 18
ExecutionTime = 943.83 s ClockTime = 951 s

Time = 5518

smoothSolver: Solving for Ux, Initial residual = 0.00026770097, Final residual = 4.3982852e-14, No Iterations 7
smoothSolver: Solving for Uy, Initial residual = 0.00035250148, Final residual = 5.6302256e-14, No Iterations 7
smoothSolver: Solving for Uz, Initial residual = 0.00053021843, Final residual = 8.2741381e-14, No Iterations 7
GAMG: Solving for p, Initial residual = 0.0062455933, Final residual = 9.9992215e-13, No Iterations 150
time step continuity errors : sum local = 2.4576868e-14, global = 5.0798341e-17, cumulative = 2.110126e-16
smoothSolver: Solving for omega, Initial residual = 0.00023601326, Final residual = 7.3802878e-13, No Iterations 17
smoothSolver: Solving for k, Initial residual = 0.00031391878, Final residual = 9.7660363e-13, No Iterations 18

where would i have possibly gone wrong. Thank you for your help in advance .

Regards,
Naresh
Naresh yathuru is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convergence Centurion2011 FLUENT 24 May 9, 2015 08:02
problem with Min/max rho tH3f0rC3 OpenFOAM 7 February 23, 2013 06:37
Definition of convergence criterion in simpleFoam titio OpenFOAM Running, Solving & CFD 1 February 6, 2010 02:34
convergence criterion Dominique FLUENT 5 November 24, 2006 03:36
Setting convergence criterion Vidya FLUENT 5 August 6, 2006 16:46


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