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

Why is pimpleFoam not stopping when desired residual is reached?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2020, 12:47
Default Why is pimpleFoam not stopping when desired residual is reached?
  #1
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 9
Illmatic is on a distinguished road
Hi,

I am trying to use the residual control feature of pimpleFoam. To do so I set my nOuterCorrectors to a large number (50) and added a residualControl dictionary to the PIMPLE dictionary.

However for some reason pimpleFoam runs all 50 outer corrector loops instead of stopping earlier when reaching the residuals that are specified in residualControl

Code:
PIMPLE: Iteration 49
smoothSolver:  Solving for Ux, Initial residual = 1.7138e-09, Final residual = 1.7138e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 1.23965e-10, Final residual = 1.23965e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.13221e-10, Final residual = 3.13221e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 2.92413e-07, Final residual = 2.11863e-09, No Iterations 4
time step continuity errors : sum local = 7.28902e-14, global = -1.81969e-14, cumulative = 7.11654e-08
GAMG:  Solving for p, Initial residual = 2.05131e-07, Final residual = 2.05131e-07, No Iterations 0
time step continuity errors : sum local = 7.05742e-12, global = -4.9383e-14, cumulative = 7.11653e-08
PIMPLE: Iteration 50
smoothSolver:  Solving for Ux, Initial residual = 2.20554e-09, Final residual = 2.20554e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 1.588e-10, Final residual = 1.588e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 4.01691e-10, Final residual = 4.01691e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 0.897462, Final residual = 0.0052241, No Iterations 3
time step continuity errors : sum local = 1.35599e-07, global = -8.79393e-10, cumulative = 7.02859e-08
GAMG:  Solving for p, Initial residual = 0.0628147, Final residual = 9.87277e-07, No Iterations 13
time step continuity errors : sum local = 2.82111e-12, global = -4.26893e-13, cumulative = 7.02855e-08
ExecutionTime = 7084.84 s  ClockTime = 7196 s

Courant Number mean: 0.0100155 max: 1.21183
deltaT = 0.002
Time = 0.078
The complete fvSolution file looks like this:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    pcorrFinal
    {
    solver GAMG;
    tolerance 0.02;
    relTol 0;
    smoother GaussSeidel;
    nPreSweeps 0;
    nPostSweeps 2;
    cacheAgglomeration no;
    nCellsInCoarsestLevel 10;
    agglomerator faceAreaPair;
    mergeLevels 1;
    }

    p
    {
    solver GAMG;
    tolerance 0;
    relTol 0.01;
    smoother GaussSeidel;
    nPreSweeps 0;
    nPostSweeps 2;
    cacheAgglomeration no;
    nCellsInCoarsestLevel 10;
    agglomerator faceAreaPair;
    mergeLevels 1;
    }

    pFinal
    {
    $p;
    tolerance 1e-06;
    relTol 0;
    }

    U
    {
    solver smoothSolver;
    smoother symGaussSeidel;
    tolerance 1e-05;
    relTol 0.1;
    }

    "(U|k|omega)"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-06;
        relTol          0.1;
    }

    "(U|k|omega)Final"
    {
        $U;
        tolerance       1e-06;
        relTol          0;
    }

    cellDisplacement
    {
        solver          GAMG;
        tolerance       1e-5;
        relTol          0;
        smoother        GaussSeidel;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels     1;
    }
}

PIMPLE
{
    correctPhi          no;
    nOuterCorrectors    50;
    nCorrectors         2;
    nNonOrthogonalCorrectors 0;
    residualControl
    {
        U   1e-5;
        p   1e-3;
    }
}

relaxationFactors
{
    fields
    {
        p               0.3;
        pFinal          1.0;
    }
    equations
    {
        "(U|k|S|omega)"   0.7;
        "(U|k|S|omega)Final" 1.0;
    }
}


// ************************************************************************* //
How can I make pimpleFoam stopping outer correctors when it reaches the specifed residuals instead of keep running until the maximum number of outer correctors is reached?
Illmatic is offline   Reply With Quote

Old   March 8, 2020, 23:56
Default
  #2
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
Pressure initial residual show large jump from 49 to 50th iteration. Is the trend same for previous iterations?
ybapat is offline   Reply With Quote

Old   March 9, 2020, 11:01
Default
  #3
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 9
Illmatic is on a distinguished road
Hi ybapat,

thanks for your reply! I didn't even notice this.

So if I look at a few loops then this jump seems only to appear in the last one. How can this be explained?

Code:
PIMPLE: Iteration 41
smoothSolver:  Solving for Ux, Initial residual = 4.09821e-09, Final residual = 4.09821e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 7.31785e-10, Final residual = 7.31785e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 7.09859e-10, Final residual = 7.09859e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 6.72052e-07, Final residual = 4.58509e-09, No Iterations 4
time step continuity errors : sum local = 1.18113e-13, global = -4.35361e-14, cumulative = 1.63738e-08
GAMG:  Solving for p, Initial residual = 4.70794e-07, Final residual = 4.70794e-07, No Iterations 0
time step continuity errors : sum local = 1.21277e-11, global = -9.16023e-14, cumulative = 1.63737e-08
PIMPLE: Iteration 42
smoothSolver:  Solving for Ux, Initial residual = 3.60249e-09, Final residual = 3.60249e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 6.5494e-10, Final residual = 6.5494e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 6.25585e-10, Final residual = 6.25585e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 6.08686e-07, Final residual = 4.15026e-09, No Iterations 4
time step continuity errors : sum local = 1.06911e-13, global = -3.89635e-14, cumulative = 1.63737e-08
GAMG:  Solving for p, Initial residual = 4.26422e-07, Final residual = 4.26422e-07, No Iterations 0
time step continuity errors : sum local = 1.09847e-11, global = -8.39604e-14, cumulative = 1.63736e-08
PIMPLE: Iteration 43
smoothSolver:  Solving for Ux, Initial residual = 3.17227e-09, Final residual = 3.17227e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 5.86625e-10, Final residual = 5.86625e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 5.51957e-10, Final residual = 5.51957e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 5.51378e-07, Final residual = 3.75597e-09, No Iterations 4
time step continuity errors : sum local = 9.67543e-14, global = -3.48606e-14, cumulative = 1.63735e-08
GAMG:  Solving for p, Initial residual = 3.86293e-07, Final residual = 3.86293e-07, No Iterations 0
time step continuity errors : sum local = 9.95097e-12, global = -7.68566e-14, cumulative = 1.63735e-08
PIMPLE: Iteration 44
smoothSolver:  Solving for Ux, Initial residual = 2.79689e-09, Final residual = 2.79689e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 5.25585e-10, Final residual = 5.25585e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 4.87377e-10, Final residual = 4.87377e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 4.99553e-07, Final residual = 3.39867e-09, No Iterations 4
time step continuity errors : sum local = 8.75501e-14, global = -3.11823e-14, cumulative = 1.63734e-08
GAMG:  Solving for p, Initial residual = 3.49997e-07, Final residual = 3.49997e-07, No Iterations 0
time step continuity errors : sum local = 9.01596e-12, global = -7.0269e-14, cumulative = 1.63734e-08
PIMPLE: Iteration 45
smoothSolver:  Solving for Ux, Initial residual = 2.46883e-09, Final residual = 2.46883e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 4.70952e-10, Final residual = 4.70952e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 4.30642e-10, Final residual = 4.30642e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 4.52814e-07, Final residual = 3.07493e-09, No Iterations 4
time step continuity errors : sum local = 7.92107e-14, global = -2.78865e-14, cumulative = 1.63733e-08
GAMG:  Solving for p, Initial residual = 3.17251e-07, Final residual = 3.17251e-07, No Iterations 0
time step continuity errors : sum local = 8.17242e-12, global = -6.41737e-14, cumulative = 1.63733e-08
PIMPLE: Iteration 46
smoothSolver:  Solving for Ux, Initial residual = 2.18214e-09, Final residual = 2.18214e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 4.22015e-10, Final residual = 4.22015e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.80768e-10, Final residual = 3.80768e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 4.10607e-07, Final residual = 2.7816e-09, No Iterations 4
time step continuity errors : sum local = 7.16544e-14, global = -2.49349e-14, cumulative = 1.63732e-08
GAMG:  Solving for p, Initial residual = 2.8769e-07, Final residual = 2.8769e-07, No Iterations 0
time step continuity errors : sum local = 7.41093e-12, global = -5.85452e-14, cumulative = 1.63732e-08
PIMPLE: Iteration 47
smoothSolver:  Solving for Ux, Initial residual = 1.93072e-09, Final residual = 1.93072e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 3.78169e-10, Final residual = 3.78169e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.36907e-10, Final residual = 3.36907e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.72391e-07, Final residual = 2.51584e-09, No Iterations 4
time step continuity errors : sum local = 6.48083e-14, global = -2.22925e-14, cumulative = 1.63732e-08
GAMG:  Solving for p, Initial residual = 2.60925e-07, Final residual = 2.60925e-07, No Iterations 0
time step continuity errors : sum local = 6.72146e-12, global = -5.33575e-14, cumulative = 1.63731e-08
PIMPLE: Iteration 48
smoothSolver:  Solving for Ux, Initial residual = 1.71012e-09, Final residual = 1.71012e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 3.38883e-10, Final residual = 3.38883e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 2.9831e-10, Final residual = 2.9831e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.37758e-07, Final residual = 2.27511e-09, No Iterations 4
time step continuity errors : sum local = 5.86071e-14, global = -1.99279e-14, cumulative = 1.63731e-08
GAMG:  Solving for p, Initial residual = 2.3667e-07, Final residual = 2.3667e-07, No Iterations 0
time step continuity errors : sum local = 6.09664e-12, global = -4.85844e-14, cumulative = 1.6373e-08
PIMPLE: Iteration 49
smoothSolver:  Solving for Ux, Initial residual = 1.5165e-09, Final residual = 1.5165e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 3.0368e-10, Final residual = 3.0368e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 2.64332e-10, Final residual = 2.64332e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 3.06366e-07, Final residual = 2.05708e-09, No Iterations 4
time step continuity errors : sum local = 5.29907e-14, global = -1.78126e-14, cumulative = 1.6373e-08
GAMG:  Solving for p, Initial residual = 2.14683e-07, Final residual = 2.14683e-07, No Iterations 0
time step continuity errors : sum local = 5.53027e-12, global = -4.41998e-14, cumulative = 1.6373e-08
PIMPLE: Iteration 50
smoothSolver:  Solving for Ux, Initial residual = 1.93382e-09, Final residual = 1.93382e-09, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 3.89304e-10, Final residual = 3.89304e-10, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.35584e-10, Final residual = 3.35584e-10, No Iterations 0
GAMG:  Solving for p, Initial residual = 0.930871, Final residual = 0.00720703, No Iterations 3
time step continuity errors : sum local = 1.38566e-07, global = -9.03646e-10, cumulative = 1.54693e-08
GAMG:  Solving for p, Initial residual = 0.100811, Final residual = 7.13608e-07, No Iterations 14
time step continuity errors : sum local = 1.19524e-12, global = -1.76552e-13, cumulative = 1.54692e-08
ExecutionTime = 3426.79 s  ClockTime = 3505 s

Courant Number mean: 0.00563426 max: 0.984294
deltaT = 0.0013125
Time = 0.0134375
Illmatic is offline   Reply With Quote

Old   March 9, 2020, 23:11
Default
  #4
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
Noticed that you are changing URF to 1.0 for final iteration. I do not think it is required. Regarding convergence it is not clear why loop is not stopping before.
ybapat is offline   Reply With Quote

Old   March 10, 2020, 03:03
Default
  #5
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 57
Rep Power: 9
Diro7 is on a distinguished road
Hi Axel!

May not be resolving and I'm still trying to figure it out, but I recently noticed that PIMPLE dictionary in fvSolution in recent OF releases also accepts a different keyword, outerCorrectorResidualControl.

In OF6 you can find it used in the compressible/rhoPimpleFoam/RAS/angledDuct/ tutorial:
Code:
PIMPLE
{
    momentumPredictor   yes;
    transonic           no;
    nOuterCorrectors    50;
    nCorrectors         1;
    nNonOrthogonalCorrectors 0;
    consistent          yes;
    simpleRho           yes;

    pMaxFactor          1.5;
    pMinFactor          0.9;

    outerCorrectorResidualControl
    {
        "(U|k|epsilon)"
        {
            relTol          0;
            tolerance       0.0001;
        }
    }

    turbOnFinalIterOnly no;
}
My guess is that the residualControl keyword was changed at some time. Still not sure about what difference exists now between residualControl and outerCorrectorResidualControl, but you can try to have a look.

Hope it helps!

Andrea
Diro7 is offline   Reply With Quote

Old   March 10, 2020, 09:50
Default
  #6
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 9
Illmatic is on a distinguished road
Hi Andrea,

yes, that solved the issue. Thank you! Using outerCorrectorResidualControl the loop is stopped as expected.

Code:
PIMPLE: Iteration 23
smoothSolver:  Solving for Ux, Initial residual = 1.82295e-05, Final residual = 8.33261e-14, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 6.45035e-06, Final residual = 6.45035e-06, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 3.31901e-06, Final residual = 3.31901e-06, No Iterations 0
GAMG:  Solving for p, Initial residual = 1.83423e-06, Final residual = 1.22556e-08, No Iterations 4
time step continuity errors : sum local = 1.18399e-12, global = -2.94581e-13, cumulative = -5.23841e-09
GAMG:  Solving for p, Initial residual = 1.28691e-06, Final residual = 1.29429e-07, No Iterations 1
time step continuity errors : sum local = 1.25039e-11, global = -1.27086e-12, cumulative = -5.23968e-09
PIMPLE: Iteration 24
smoothSolver:  Solving for Ux, Initial residual = 1.44058e-05, Final residual = 6.32736e-14, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 4.70901e-06, Final residual = 4.70901e-06, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 2.63949e-06, Final residual = 2.63949e-06, No Iterations 0
GAMG:  Solving for p, Initial residual = 1.275e-06, Final residual = 8.80647e-09, No Iterations 4
time step continuity errors : sum local = 8.50782e-13, global = -2.07543e-13, cumulative = -5.23989e-09
GAMG:  Solving for p, Initial residual = 8.94593e-07, Final residual = 8.94593e-07, No Iterations 0
time step continuity errors : sum local = 8.64257e-11, global = -1.82023e-12, cumulative = -5.24171e-09
PIMPLE: Iteration 25
smoothSolver:  Solving for Ux, Initial residual = 7.53999e-06, Final residual = 7.53999e-06, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 2.29805e-06, Final residual = 2.29805e-06, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 1.40777e-06, Final residual = 1.40777e-06, No Iterations 0
GAMG:  Solving for p, Initial residual = 1.14894e-06, Final residual = 7.73808e-09, No Iterations 4
time step continuity errors : sum local = 7.47566e-13, global = -1.81834e-13, cumulative = -5.24189e-09
GAMG:  Solving for p, Initial residual = 8.06083e-07, Final residual = 8.06083e-07, No Iterations 0
time step continuity errors : sum local = 7.78749e-11, global = -1.55066e-12, cumulative = -5.24344e-09
PIMPLE: Converged 
        Doing final iteration
PIMPLE: Iteration 26
smoothSolver:  Solving for Ux, Initial residual = 7.21982e-06, Final residual = 5.87077e-14, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 2.06676e-06, Final residual = 2.38317e-15, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 1.36745e-06, Final residual = 9.47398e-15, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.00153052, Final residual = 1.2177e-05, No Iterations 3
time step continuity errors : sum local = 1.6783e-09, global = -1.30711e-11, cumulative = -5.25651e-09
GAMG:  Solving for p, Initial residual = 1.71743e-05, Final residual = 9.55375e-07, No Iterations 3
time step continuity errors : sum local = 1.31499e-10, global = -1.6181e-11, cumulative = -5.27269e-09
PIMPLE: Converged in 26 iterations
ExecutionTime = 57.25 s  ClockTime = 58 s

Courant Number mean: 6.00521e-05 max: 0.0158798
deltaT = 1.43712e-05
Time = 2.63616e-05
Illmatic is offline   Reply With Quote

Reply

Tags
pimplefoam, residual control


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
laplacianFoam with source term Herwig OpenFOAM Running, Solving & CFD 17 November 19, 2019 13:47
Segmentation fault when using reactingFOAM for Fluids Tommy Floessner OpenFOAM Running, Solving & CFD 4 April 22, 2018 12:30
chtMultiRegionSimpleFoam turbulent case Aditya Patil OpenFOAM Running, Solving & CFD 6 April 24, 2017 22:13
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 06:37


All times are GMT -4. The time now is 13:32.