CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   should Courant number always be kept below 1? (https://www.cfd-online.com/Forums/openfoam-solving/130621-should-courant-number-always-kept-below-1-a.html)

wc34071209 March 1, 2014 11:09

should Courant number always be kept below 1?
 
Hello everyone,

We all know courant n.o. blow one is a general rule for transient simulation. However, I am wondering if implicit temporal discretization scheme or some transient SIMPLE methods is used, courant number in principle doesn't need to be kept below one. Am I correct?

in a simple buoyancy case of mine, it is just a box with all the walls fixed temperature, I use buoyantPimpleFoam. when I used a time step corresponding to Co=0.3, however, Co increased time step by time step and finally blew up.

Therefore I used a very small time step dT=1e-4 corresponding to Co < 0.005 then it worked. After a few time steps, I gradually increased time step to dT=1e-3. However, when I continued to increase it to 2e-3, it blew up again.

So I got confused.

alexeym March 1, 2014 12:39

Hi,

if you say you're using pimpleBuoyantFoam, show your PIMPLE dictionary from fvSolution (if you'd like to hear something about simulation blowing up). Maybe your settings lead to diverging solution.

Or if you'd like to hear obvious answer: in general, Courant number can be larger than 1 ;)

wc34071209 March 3, 2014 08:30

Quote:

Originally Posted by alexeym (Post 477446)
Hi,

if you say you're using pimpleBuoyantFoam, show your PIMPLE dictionary from fvSolution (if you'd like to hear something about simulation blowing up). Maybe your settings lead to diverging solution.

Or if you'd like to hear obvious answer: in general, Courant number can be larger than 1 ;)

Thank you.

Below is my fvSolution. And concerning the fvScheme, expcept that div(phi,U) is linearUpwind, all others are upwind.

Code:

solvers
{
    p_rgh
    {

        solver          GAMG;
        agglomerator    faceAreaPair;
        mergeLevels    1;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 200;
        tolerance      1e-05;
        relTol          0.01;
        smoother        GaussSeidel;
        nPreSweeps      0;
        nPostSweeps    2;
        nFinestSweeps  2;
     
        minIter        1;
        maxIter        15;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-05;
        relTol          0.1;
        minIter        1;
        maxIter        5;
    }

    "(h|e|T|k|epsilon|omega)"
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-06;
        relTol          0.1;
        minIter        1;
        maxIter        5;

    }

    G
    {
        $p_rgh;
        tolerance      1e-05;
        relTol          0.1;
    }


    p_rghFinal
    {
        $p_rgh;
        relTol          0;
    }

    UFinal
    {
        $U;
        relTol          0;
    }

    "(h|e|T|k|epsilon|omega|R)Final"
    {
        $k;
        relTol          0;
    }

    "rho.*"
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance      0;
        relTol          0;
    }
}



PIMPLE
{
    momentumPredictor yes;
    nOuterCorrectors 3;
    nCorrectors    2;
    nNonOrthogonalCorrectors 0;
}

relaxationFactors
{
    fields
    {
        rho            1.0;
        "(p|p_rgh)"    0.3;
    }
    equations
    {
        U              0.6;
        "(h|e|T)"      0.7;
        "(k|epsilon|omega|R)" 0.4;
        G              0.7;
    }
}


alexeym March 3, 2014 08:48

Hi,

as I don't know your initial conditions my suggestions will be more or less general:

1. You're limiting number of iterations for linear solvers. I guess you know what you're doing.

2. You're using fixed number of outer correctors, I'd suggest you to switch to residualControl for limiting number of outer correctors, i.e.

Code:

PIMPLE
{
    momentumPredictor yes;
    nOuterCorrectors 100;
    nCorrectors      2;
    nNonOrthogonalCorrectors 0;

    residualControl
    {
        "(p_rgh|U|T|h|e|k|omega|epsilon)"
        {
            tolerance 1e-4;
            relTol 0;
        }
    }
}

Initially it can use more outer iterations, while after flow settles, number of outer iterations can drop to 2 or 3.

3. Again initially in your simulation heat transfer can be limiting factor, i.e. you have to check not only Courant number but also Fourier number.

wc34071209 March 3, 2014 08:55

Quote:

Originally Posted by alexeym (Post 477734)
Hi,

as I don't know your initial conditions my suggestions will be more or less general:

1. You're limiting number of iterations for linear solvers. I guess you know what you're doing.

2. You're using fixed number of outer correctors, I'd suggest you to switch to residualControl for limiting number of outer correctors, i.e.

Code:

PIMPLE
{
    momentumPredictor yes;
    nOuterCorrectors 100;
    nCorrectors      2;
    nNonOrthogonalCorrectors 0;

    residualControl
    {
        "(p_rgh|U|T|h|e|k|omega|epsilon)"
        {
            tolerance 1e-4;
            relTol 0;
        }
    }
}

Initially it can use more outer iterations, while after flow settles, number of outer iterations can drop to 2 or 3.

3. Again initially in your simulation heat transfer can be limiting factor, i.e. you have to check not only Courant number but also Fourier number.

Thank you very much.

1. The reason why I limit the number of linear solvers is that for U and turbulence variables, maxIter = 5 is quite enough (usually one or two to satisfy relTol = 0.1 or even 0.01). However, for pressure p, the initial residual is of order 0.1, it is very hard to get absTol below 1e-5 even if I increase the maxIter to a very big number.

2.Could you please explain a little bit Fourier number? It is my first time to hear of it.

Regarding initial condition, I started from steady solution of buoyancySimpleFoam.

alexeym March 3, 2014 09:13

Quote:

Originally Posted by wc34071209 (Post 477736)
1. The reason why I limit the number of linear solvers is that for U and turbulence variables, maxIter = 5 is quite enough (usually one or two to satisfy relTol = 0.1 or even 0.01). However, for pressure p, the initial residual is of order 0.1, it is very hard to get absTol below 1e-5 even if I increase the maxIter to a very big number.

Default value for maxIter is 1000, why limit it? Velocity equation indeed usually converge in 1 iteration, while pressure equation is not so good at it. I wasn't able to find any log file with GAMG for pressure equation but PCG sometimes needs up to 200 iterations (well, GAMG should converge faster).

Quote:

Originally Posted by wc34071209 (Post 477736)
2.Could you please explain a little bit Fourier number? It is my first time to hear of it.

You can read about it for example here - http://www3.nd.edu/~amoukasi/CBE358_...%20NUMBERS.pdf (actually second Google result for 'Fourier number').
It is used in a stability criterion when solving heat conductivity equation. In OpenFOAM it is called Diffusion Number and you can find definition and usage in chtMultiRegionFoam (solid/solidRegionDiffNo.H).

wc34071209 March 3, 2014 09:25

Quote:

Originally Posted by alexeym (Post 477740)
Default value for maxIter is 1000, why limit it? Velocity equation indeed usually converge in 1 iteration, while pressure equation is not so good at it. I wasn't able to find any log file with GAMG for pressure equation but PCG sometimes needs up to 200 iterations (well, GAMG should converge faster).



You can read about it for example here - http://www3.nd.edu/~amoukasi/CBE358_...%20NUMBERS.pdf (actually second Google result for 'Fourier number').
It is used in a stability criterion when solving heat conductivity equation. In OpenFOAM it is called Diffusion Number and you can find definition and usage in chtMultiRegionFoam (solid/solidRegionDiffNo.H).

Thanks!

The reason that I limit it is that I want to save the computational time. If the initial residual is of the order 0.1, then it is easier to fulfill relTol = 0.01 within 20 iterations but hard to get absTol < 1e-5.

In the beginning, I did use more inner iterations.

Below I post the residual log.

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.2.2-9240f8b967db
Exec  : buoyantPimpleFoam -parallel
Date  : Feb 28 2014
Time  : 23:17:28
Host  : "cong-XXXX"
PID    : 2391
Case  : /home/cong/OpenFOAM/closedRoom/hotRoom_no2_2nd
nProcs : 4
Slaves :
3
(
"cong-XXXX.2392"
"cong-XXXX.2393"
"cong-XXXX.2394"
)

Pstream initialized with:
    floatTransfer      : 0
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 1400.05


Reading g
Reading thermophysical properties

Selecting thermodynamics package
{
    type            heRhoThermo;
    mixture        pureMixture;
    transport      const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type RASModel
Selecting RAS turbulence model kOmegaSST
kOmegaSSTCoeffs
{
    alphaK1        0.85034;
    alphaK2        1;
    alphaOmega1    0.5;
    alphaOmega2    0.85616;
    Prt            1;
    gamma1          0.5532;
    gamma2          0.4403;
    beta1          0.075;
    beta2          0.0828;
    betaStar        0.09;
    a1              0.31;
    b1              1;
    c1              10;
    F3              false;
}

Calculating field g.h

Reading field p_rgh

Creating field dpdt

Creating field kinetic energy K

No finite volume options present

Selecting radiationModel none
Courant Number mean: 0.00148837580644629 max: 0.0647853339161001

PIMPLE: no residual control data found. Calculations will employ 5 corrector loops


Starting time loop

Courant Number mean: 0.00148837580644629 max: 0.0647853339161001
Time = 1400.051

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.000247647843867614, Final residual = 3.999270574318e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 0.000128107979661795, Final residual = 1.83112475255285e-07, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.000160633659578868, Final residual = 2.5594269628695e-07, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 0.000242875086126735, Final residual = 8.06141666995819e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0861737029966527, Final residual = 0.000820116649469887, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 7.52141562698942e-08, global = 4.91926028910357e-09, cumulative = 4.91926028910357e-09
GAMG:  Solving for p_rgh, Initial residual = 0.0537872793715646, Final residual = 0.000486045277443569, No Iterations 12
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 5.97065178341836e-08, global = 4.91556833568525e-09, cumulative = 9.83482862478882e-09
PIMPLE: iteration 2
smoothSolver:  Solving for Ux, Initial residual = 0.000166011564280937, Final residual = 2.11871972688141e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 7.58215157742506e-05, Final residual = 9.17281666372826e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 8.86027249173873e-05, Final residual = 1.20533099842053e-07, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 1.60874106858657e-05, Final residual = 4.08319969850189e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0572096993313344, Final residual = 0.000502857597070764, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 4.31876336329513e-08, global = 2.52631031818182e-09, cumulative = 1.23611389429706e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0368248923460351, Final residual = 0.000339433400191968, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.47307813854051e-08, global = 2.5250908689926e-09, cumulative = 1.48862298119632e-08
PIMPLE: iteration 3
smoothSolver:  Solving for Ux, Initial residual = 0.000127060259818226, Final residual = 1.52156840121415e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 5.29445921737536e-05, Final residual = 6.47499018761379e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 6.13777747041193e-05, Final residual = 7.94535741646234e-08, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 1.50228683475912e-05, Final residual = 3.68357616927878e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0387085517464596, Final residual = 0.000372039926636581, No Iterations 10
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.00267437329372e-08, global = 1.60359089444357e-09, cumulative = 1.64898207064068e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0249814364256056, Final residual = 0.000225602225554279, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.27332812053539e-08, global = 1.60485248005295e-09, cumulative = 1.80946731864598e-08
PIMPLE: iteration 4
smoothSolver:  Solving for Ux, Initial residual = 9.60615477701421e-05, Final residual = 1.17134347180524e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 3.81082635478471e-05, Final residual = 4.86568514367135e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 4.49272447238318e-05, Final residual = 5.86706411039353e-08, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 1.46807751471808e-05, Final residual = 3.4972415280223e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0266292373137, Final residual = 0.000263811980331065, No Iterations 10
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.17169044295473e-08, global = 1.12895991579024e-09, cumulative = 1.922363310225e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0172409016064815, Final residual = 0.000158769948607733, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.62404184000881e-08, global = 1.12977978909374e-09, cumulative = 2.03534128913438e-08
PIMPLE: iteration 5
smoothSolver:  Solving for Ux, Initial residual = 0.000121658069251048, Final residual = 2.58614338218384e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 4.71089146736597e-05, Final residual = 1.04253715545996e-07, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 5.65301129919658e-05, Final residual = 1.26714166596492e-07, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 2.08831375673703e-05, Final residual = 7.12911275334731e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0538928262424893, Final residual = 0.000505463810804564, No Iterations 10
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.18557717387552e-08, global = 3.50284999781456e-10, cumulative = 2.07036978911252e-08
GAMG:  Solving for p_rgh, Initial residual = 0.00981819390577786, Final residual = 3.97373360009254e-05, No Iterations 20
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.43352807596734e-09, global = 9.07244129651977e-14, cumulative = 2.07037886155382e-08
smoothSolver:  Solving for omega, Initial residual = 7.77330670381549e-06, Final residual = 7.77330670381549e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 0.000258689105128507, Final residual = 1.04875993446461e-06, No Iterations 1
ExecutionTime = 46.12 s  ClockTime = 47 s

fieldMinMax volumeMinMax output:
    min(p_rgh) = 99822.7698641411 at position (3.06161558808532 3.09883989107467 2.46163835228888) on processor 0
    max(p_rgh) = 99824.6394908518 at position (0.0141310859195548 -3.11630672402005e-19 2.48585301973776) on processor 2
    min(p) = 99794.9901934314 at position (2.6125 3.063995781 2.5) on processor 0
    max(p) = 99823.7800526305 at position (0.337499959210686 0.0119815945437022 -1.59919139963239e-18) on processor 2
    min(mag(U)) = 0 at position (1.2125 1.4125 -4.119968255e-18) on processor 0
    max(mag(U)) = 0.416412587990551 at position (1.2125 0.00221421732635518 2.4858609322995) on processor 2
    min(T) = 288.044594020099 at position (1.93749041958236 0.00246888773684411 0.0377276627556582) on processor 1
    max(T) = 307.487743237085 at position (3.06161558808532 3.09883989107467 2.46163835228888) on processor 0
    min(CourantNo) = 0 at position (1.21250123476994 1.41249998568824 0.0355901324009811) on processor 0
    max(CourantNo) = 0 at position (1.21250123476994 1.41249998568824 0.0355901324009811) on processor 0
    min(k) = 7.62163093808797e-10 at position (1.7125 2.66249999574979 0.00049999997664166) on processor 0
    max(k) = 0.0114244577497563 at position (0.712498589379656 0.0936305427194292 2.40577599472035) on processor 2
    min(omega) = 0.203468468793083 at position (1.74994867345548 2.64178641415844 1.15026142133692) on processor 0
    max(omega) = 13536.6610183235 at position (3.08539796524394 3.09969118274481 2.48540329051224) on processor 0

Courant Number mean: 0.00148804420017873 max: 0.0647436726007384
Time = 1400.052

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.000567342333754088, Final residual = 8.69305596971399e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 0.000245458850194731, Final residual = 3.68077009226284e-07, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.000289979601241606, Final residual = 4.48543840988609e-07, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 0.000296698844680786, Final residual = 6.63764884766414e-07, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0740550343777385, Final residual = 0.000725044945148411, No Iterations 13
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 1.08536056806946e-07, global = 3.64075710261366e-09, cumulative = 2.43445457181518e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0440861554067758, Final residual = 0.000393569738811597, No Iterations 14
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 9.04665810010334e-08, global = 3.6443093999305e-09, cumulative = 2.79888551180823e-08
PIMPLE: iteration 2
smoothSolver:  Solving for Ux, Initial residual = 0.000169605500762894, Final residual = 2.22207399157954e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 7.50330166453704e-05, Final residual = 9.4961785984081e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 9.11322901598886e-05, Final residual = 1.22360390214789e-07, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 2.28734541067651e-05, Final residual = 4.83134584065602e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0466962325250491, Final residual = 0.000428205297265179, No Iterations 12
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.94241628736469e-08, global = 4.31108721873244e-09, cumulative = 3.22999423368148e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0296053687505284, Final residual = 0.000273806614049499, No Iterations 12
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.06278115018435e-08, global = 4.30888049571482e-09, cumulative = 3.66088228325296e-08
PIMPLE: iteration 3
smoothSolver:  Solving for Ux, Initial residual = 9.36392744378687e-05, Final residual = 1.06721902570643e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 4.05381191346271e-05, Final residual = 4.81158602848071e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 4.71266158880704e-05, Final residual = 5.75414949027222e-08, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 1.8707283656409e-05, Final residual = 4.14839197574438e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0303789257000367, Final residual = 0.00028952817806014, No Iterations 10
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.97905019564598e-08, global = 3.77192915447232e-09, cumulative = 4.03807519870019e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0196994622428568, Final residual = 0.000180796878584002, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.49826706395044e-08, global = 3.77031775813945e-09, cumulative = 4.41510697451414e-08
PIMPLE: iteration 4
smoothSolver:  Solving for Ux, Initial residual = 6.57658865567465e-05, Final residual = 7.44857582239132e-08, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 2.79973513496785e-05, Final residual = 3.38144522082809e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 3.11005630639183e-05, Final residual = 3.77439739040657e-08, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 1.72392202540561e-05, Final residual = 3.82872230698463e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.0207323494005721, Final residual = 0.000192916158545086, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.70441030958769e-08, global = 3.04867138122196e-09, cumulative = 4.71997411263633e-08
GAMG:  Solving for p_rgh, Initial residual = 0.0136122301209514, Final residual = 0.000131685494725376, No Iterations 11
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.37448318224414e-08, global = 3.04971502997717e-09, cumulative = 5.02494561563405e-08
PIMPLE: iteration 5
smoothSolver:  Solving for Ux, Initial residual = 7.68948138911585e-05, Final residual = 1.33500514434639e-07, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 3.40276188770903e-05, Final residual = 6.42473722745575e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 3.51279835293852e-05, Final residual = 6.60143270214444e-08, No Iterations 1
smoothSolver:  Solving for h, Initial residual = 2.37990891762838e-05, Final residual = 7.68148021791493e-08, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.055789102927055, Final residual = 0.000504421961352279, No Iterations 10
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 3.12535425574358e-08, global = -2.38263857305886e-10, cumulative = 5.00111922990346e-08
GAMG:  Solving for p_rgh, Initial residual = 0.00952195362129172, Final residual = 3.83661907765528e-05, No Iterations 20
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 2.30631834598393e-09, global = 1.59539024230693e-13, cumulative = 5.00113518380589e-08
smoothSolver:  Solving for omega, Initial residual = 3.85169919171067e-06, Final residual = 3.85169919171067e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 0.000215175969522929, Final residual = 8.68436227091422e-07, No Iterations 1
ExecutionTime = 85.53 s  ClockTime = 86 s


alexeym March 3, 2014 09:43

Here's a fragment of SolverPerformance.C's checkConvergence:

Code:

    if
    (
        finalResidual_ < Tolerance
    || (
            RelTolerance
          > small_*pTraits<Type>::one
        && finalResidual_ < cmptMultiply(RelTolerance, initialResidual_)
        )
    )
    {
        converged_ = true;
    }
    else
    {
        converged_ = false;
    }

So a linear solver will halt its iterations either when residual goes below tolerance, or ratio of residuals between successive iterations goes below relTol. As all your settings include relTol (except .*Final) there's actually no need for maxIter limiting. But if you like it, why not ;)

Concerning number of outer iterations - well, for example, during initial stage of melting I need up to 70 outer iterations depending on the problem.

wc34071209 March 3, 2014 10:04

Quote:

Originally Posted by alexeym (Post 477751)
Here's a fragment of SolverPerformance.C's checkConvergence:

Code:

    if
    (
        finalResidual_ < Tolerance
    || (
            RelTolerance
          > small_*pTraits<Type>::one
        && finalResidual_ < cmptMultiply(RelTolerance, initialResidual_)
        )
    )
    {
        converged_ = true;
    }
    else
    {
        converged_ = false;
    }

So a linear solver will halt its iterations either when residual goes below tolerance, or ratio of residuals between successive iterations goes below relTol. As all your settings include relTol (except .*Final) there's actually no need for maxIter limiting. But if you like it, why not ;)

Concerning number of outer iterations - well, for example, during initial stage of melting I need up to 70 outer iterations depending on the problem.

Thanks!

70 outercorrector? that seems to me a lot. Do you think it is of real significance to set such a big number in the beginning?

alexeym March 3, 2014 10:17

It depends. Surely there is a possibility that starting from not fully converged solution in the beginning you will get to more or less correct steady state (or the simulation will blow up if you're not lucky enough ;)).

But if you're interested in transient state you must have converged solution on every time step. For example in case of melting problems the shape of a melting/solidification front during transience will be different if you go with solution which is not converged.

alexeym March 3, 2014 10:26

I've found a log of the simulation (rather slow melting, final time is 2500 sec). So number of outer iterations was ~60 during first 2 seconds, then it falls to 10-12 during 3-20 sec, then it falls to 6 between 20 and 70 seconds, and then it settles at 2 outer iterations for the rest of simulation.

wc34071209 March 4, 2014 08:20

Quote:

Originally Posted by alexeym (Post 477765)
I've found a log of the simulation (rather slow melting, final time is 2500 sec). So number of outer iterations was ~60 during first 2 seconds, then it falls to 10-12 during 3-20 sec, then it falls to 6 between 20 and 70 seconds, and then it settles at 2 outer iterations for the rest of simulation.

Thank you Alex.

I used to think that for a quasi-steady case (or period case) it is not so necessary to get really converged at the first several time steps.

Anyway, your comments are of much help.

wc34071209 March 4, 2014 15:20

Quote:

Originally Posted by alexeym (Post 477765)
I've found a log of the simulation (rather slow melting, final time is 2500 sec). So number of outer iterations was ~60 during first 2 seconds, then it falls to 10-12 during 3-20 sec, then it falls to 6 between 20 and 70 seconds, and then it settles at 2 outer iterations for the rest of simulation.


Hello Alex,

Do you have any ideas why in this buoyancy dominant case the residual of pressure is so high and it is very hard to decrease?

I would think (probably I am wrong) that the pressure variation is very small (order of 10) compared with the pressure value (101325). What is your idea about this?

alexeym March 4, 2014 15:42

Hi,

can you describe a case in more details (ideally post case files)? As currently we've discussed PIMPLE dictionary but if your initial or boundary conditions are not so meaningful you won't get easily converging solution. The second thing is the mesh and fvSchemes. If your mesh is awful and you'd like to use third order schemes then it is also not so easy to get convergence.

wc34071209 March 4, 2014 16:08

Quote:

Originally Posted by alexeym (Post 478107)
Hi,

can you describe a case in more details (ideally post case files)? As currently we've discussed PIMPLE dictionary but if your initial or boundary conditions are not so meaningful you won't get easily converging solution. The second thing is the mesh and fvSchemes. If your mesh is awful and you'd like to use third order schemes then it is also not so easy to get convergence.

Hi Alex,

I have tried various cases including the tutorial case (buoyantSimpleFoam - hotRoom) with the default settings. It seems it is very hard to get pressure residual below 1E-6. You can also try the tutorial case yourself.

And also the finer the mesh is, the higher the residual is

alexeym March 4, 2014 16:58

1 Attachment(s)
I've attached modified tutorial case 'hotRoom' ($FOAM_TUTORIALS/heatTransfer/buoyantPimpleFoam/hotRoom).

The only modifications I've made:
1. added residualControl to fvSolution
2. reduced initial deltaT from 2 to 1e-3 (as, obviously, the higher initial time step the larger initial residuals, the harder it is to converge). Then it increases but still stays below 2.
3. Allrun script do not run buoyantPimpleFoam itself, you need to run it yourself with 'foamJob buoyantPimpleFoam'.

Case is running OK I guess (I waited till 1500 s). It takes 20-12 outer iterations for tolerance 1e-4, and 3-4 outer iterations for tolerance 1e-2.

It is possible to run the simulation with Courant number higher than 1, though you need more outer corrector iterations and finally it leads to the problems with equation of state.

huangxianbei March 9, 2014 19:31

I think it depends on the case you are doing.A better way is firstly using a larger timestep, when the calculation becomes steady, turn to use a smaller timstep to reach a more accurate result.
The case I'm running now is of Courant number=0.5(mean),max=1.5, now the calculation is steady, so I switch to a smaller timestep


All times are GMT -4. The time now is 11:16.