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

trouble using residual control in pimplefoam

Register Blogs Community New Posts Updated Threads Search

Like Tree15Likes
  • 15 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 1, 2014, 13:45
Default trouble using residual control in pimplefoam
  #1
Member
 
robo
Join Date: May 2013
Posts: 47
Rep Power: 12
robo is on a distinguished road
Hey all,
I am very new to openfoam, but I feel like I must be missing something very obvious. I am running a simple hydrofoil case in pimpleFoam, trying to reach a steady state. I'm using version 2.1.1 in case that helps. I am trying to setup the residual control dictionary within the pimple dictionary, which I have as:
Code:
PIMPLE
{
    nOuterCorrectors 1;
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;
    
    residualControl
    {
        "(U|P|k|omega)"            
        {
            tolerance    1e-1;
            relTol        0;
        }
    }
}
But the simulation does not halt when the initial residual hits these values, it just keeps right on going until the simulation hits its max time. I can see from the log that the initial residuals are well below 1e-1. I also do not see any screen output related to residual control when I start the run.

I understand that this is not a good value to halt the solution at; I am simpling trying to make it work the way I think it should be working. Am I wrong about what residualControl does? or am I missing something in the setup? I at first tried to very the relTol, thinking it might be the problem, but I had no luck with that either...
robo is offline   Reply With Quote

Old   March 1, 2014, 16:24
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

in case of PIMPLE you go to the next time step as soon as your residuals go below given value. If you'd like to get steady state solution and halt simulation, you'd better use SIMPLE family solvers.

Also as you have only one outer corrector, solution will go on even if you do not reach given residual value, as the criterion for the next time step in PIMPLE is whether you reach nOuterCorrectors or reach reasidualControl values.
alexeym is offline   Reply With Quote

Old   March 2, 2014, 11:20
Default
  #3
Member
 
robo
Join Date: May 2013
Posts: 47
Rep Power: 12
robo is on a distinguished road
I'm using pimple as this is a first step towards an interfoam simulation, and interfoam uses pimple. I was under the impression that the tolerances set in the numerical solver dictionaries within fvSolution control the convergence within a timestep, but that residual control controls convergence tolerance for time-like marching (what i'm doing...) between timesteps. I want to make sure I understand what you're saying as it's a bit unclear.

The residual control only determines whether or not pimple will use all of it's corrector loops? There is no way to exit the simulation in pimple based on convergence between timesteps?
robo is offline   Reply With Quote

Old   March 2, 2014, 12:04
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well,

if we take a look at the dictionaries in fvSolution, usually they look like
Code:
    p
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-06;
        relTol          0.05;
    }
so PCG will iteratively solve linear system until whether residual goes below 1e-06 or ratio between tolerances between successive iterations goes below 0.05 (for example if your initial residual was 1 and after 1 iteration of PCG it becomes 0.05, PCG will exit iteration loop).

If we take a look at typical PIMPLE dictionary, it will look like:
Code:
PIMPLE
{
    nOuterCorrectors 50;
    nCorrectors     2;
    nNonOrthogonalCorrectors 2;
    pRefCell        0;
    pRefValue       0;
    turbOnFinalIterOnly no;

    residualControl
    {
        "(p|U|k|epsilon)"
        {
            tolerance 1e-2;
            relTol 0;
        }
    }
}
solver will go to the next time step (t -> t + dt) until whether it does 50 iterations or residuals for p, U, k, and epsilon equations will go below 1e-2.

If you take a look at the source code for pimpleFoam, the main time loop looks like:
Code:
    while (runTime.run())
    {
        #include "readTimeControls.H"
        #include "CourantNo.H"
        #include "setDeltaT.H"

        runTime++;

        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            #include "UEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }
        }

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
as you can see loop halts only when time will reach endTime. While in case of SIMPLE main time loop is a little bit different:
Code:
    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity SIMPLE corrector
        {
            #include "UEqn.H"
            #include "pEqn.H"
        }

        turbulence->correct();

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
in this case loop will halt when either residuals go below given value or time reaches endTime.

Usually I choose time limits for pimpleFoam preset simulation for interFoam using empirical endTime = 3*L/U, where L is channel length and U is inlet velocity. I also successfully used simpleFoam as preset simulation for interFoam. The time needed for simpleFoam to converge was around that 3*L/U.
Fine, achinta, mgg and 12 others like this.
alexeym is offline   Reply With Quote

Reply


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
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 08:35
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 06:37
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24


All times are GMT -4. The time now is 08:06.