CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   kEpsilon and pisoFoam: when transport equations for k and eps are solved (https://www.cfd-online.com/Forums/openfoam-programming-development/158369-kepsilon-pisofoam-when-transport-equations-k-eps-solved.html)

LuisAlberto August 23, 2015 15:08

kEpsilon and pisoFoam: when transport equations for k and eps are solved
 
Hello everyone!

Looking at pisoFoam solver, I am seeing now that, if I am not mistaken, the transport equations for the turbulent kinetic energy (k) and dissipation rate (epsilon) are solved outside piso algorithm loops, i.e., the sentence turbulence->correct() is called upon only when the velocity and pressure fields have already converged.

This implies that the equations are written using the nut field computed in the previous time step, and when using wall functions, the term kp used is also from the previous time step.

Is this correct or there is something I am not understanding correctly? Could the transport equations be solved inside the loop and checked for convergence too, as in Verteeg and Malasakera?

ssss August 23, 2015 16:58

Then go to pimpleFoam and adjust the nOuterCorrectors and the residualControl in the fvSolution

alexeym August 24, 2015 02:29

Hi,

You should also set turbOnFinalIterOnly to no in PIMPLE dictionary, so turbulent properties transport equations are solved on each outer iteration. Otherwise it will not differ much from pisoFoam.

LuisAlberto August 24, 2015 04:50

Many thanks for your responses, this is clearer now.

However, I have tried that: set nOuterCorrectors to 2 in fvSolutions, and turbOnFinalIterOnly to no in controlDict:

Code:

turbOnFinalIterOnly    no;

DebugSwitches
{
    pimpleControl          1;
}

Code:

PIMPLE
{
    nNonOrthogonalCorrectors 0;
    nCorrectors        2;
    nOuterCorrectors    2;
}

But it still seems to solve for epsilon and k only at the end:

Code:

Courant Number mean: 0.673517 max: 3.12374
deltaT = 0.000142857
Time = 0.0128571

PIMPLE loop: corr = 1
PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.0029383, Final residual = 0.000143759, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.00595536, Final residual = 0.00034865, No Iterations 2
PIMPLE correct: corrPISO = 1
GAMG:  Solving for p, Initial residual = 0.0154173, Final residual = 0.000117566, No Iterations 5
time step continuity errors : sum local = 9.68577e-08, global = -3.98478e-09, cumulative = 8.04357e-09
PIMPLE correct: corrPISO = 2
GAMG:  Solving for p, Initial residual = 0.0099846, Final residual = 7.91935e-05, No Iterations 5
time step continuity errors : sum local = 6.54434e-08, global = 1.00246e-09, cumulative = 9.04603e-09
PIMPLE correct: corrPISO = 3
PIMPLE loop: corr = 2
PIMPLE: iteration 2
smoothSolver:  Solving for Ux, Initial residual = 0.000216099, Final residual = 4.86046e-06, No Iterations 3
smoothSolver:  Solving for Uy, Initial residual = 0.000245147, Final residual = 5.2476e-06, No Iterations 3
PIMPLE correct: corrPISO = 1
GAMG:  Solving for p, Initial residual = 0.0140186, Final residual = 6.54587e-05, No Iterations 6
time step continuity errors : sum local = 5.41333e-08, global = 1.7189e-09, cumulative = 1.07649e-08
PIMPLE correct: corrPISO = 2
GAMG:  Solving for p, Initial residual = 0.0088667, Final residual = 6.87224e-08, No Iterations 15
time step continuity errors : sum local = 5.65003e-11, global = -4.88256e-12, cumulative = 1.076e-08
PIMPLE correct: corrPISO = 3
smoothSolver:  Solving for epsilon, Initial residual = 0.0020472, Final residual = 3.64493e-06, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.00445836, Final residual = 3.36889e-06, No Iterations 5
PIMPLE loop: corr = 3
ExecutionTime = 1.11 s  ClockTime = 1 s

Any ideas of what might I be doing wrong?

P.D.1: ssss comments on adjusting the residualControl in fvSolution. Is there a specific residualControl for this?

P.D.2. By the way, another related question. I am trying to turn on the debug switch in pimpleControl.C that activates this piece of code:

Code:

            if (debug)
            {
                Info<< algorithmName_ << " loop:" << endl;

                Info<< "    " << variableName
                    << " PIMPLE iter " << corr_
                    << ": ini res = "
                    << residualControl_[fieldI].initialResidual
                    << ", abs tol = " << residual
                    << " (" << residualControl_[fieldI].absTol << ")"
                    << ", rel tol = " << relative
                    << " (" << residualControl_[fieldI].relTol << ")"
                    << endl;
            }

I thought it sould be 'pimpleControl' as the file starts by
Code:

defineTypeNameAndDebug(pimpleControl, 0);
. However it does not work, and there is something I am surely not understanding. Any clues?

Many thanks,

alexeym August 24, 2015 05:18

Hi,

1. turbOnFinalIterOnly goes to PIMPLE dictionary in fvSolution file (just like nOuterCorrectors).

2. Either you can use forum search with keyword "residualControl", or "grep -r residualControl *" in tutorial folder. Unfortunately there are lots of examples for SIMPLE family of solvers, yet only one for PIMPLE (in compressible/rhoPimpleFoam/ras/angledDuct/system/fvSolution). Though even the example is from compressible solver, it is quite relevant to your case, you PIMPLE dictionary in fvSolution file should be something like:

Code:

PIMPLE
{
    momentumPredictor no;
    nOuterCorrectors 20;  // solver will make 20 outer iterations, or less if residuals drop below threshold more rapidly
    nCorrectors    2;
    nNonOrthogonalCorrectors 0;  // this value depends on the quality of your mesh

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

    turbOnFinalIterOnly off; // or no if you prefer
}

UPD. This piece:

Code:

DebugSwitches
{
    pimpleControl          1;
}

defines verbosity of pimpleControl class and has nothing to do with relevant behaviour of the solver itself.

LuisAlberto August 24, 2015 05:33

Thanks! I was writting turbOnFinalIterOnly in the wrong place.

I find it strange that the turbulence transport equations are only solved at the end of the loop in pisoFoam, so that the PISO algorithm works with the nut from the previous time step. Of course, it is a matter of modifying it or using pimpleFoam.

Thanks!


All times are GMT -4. The time now is 10:30.