CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   The new SIMPLE/PIMPLE loop control structure in OF 2.1 (http://www.cfd-online.com/Forums/openfoam/99724-new-simple-pimple-loop-control-structure-2-1-a.html)

linch April 10, 2012 09:23

The new SIMPLE/PIMPLE loop control structure in OF 2.1
 
Hi guys,

since OF 2.1 there is a new control structure for SIMPLE & PIMPLE loops. So now the outer PIMPLE loop looks just like:
Code:

while (pimple.loop())        {...}
I would like to know how to use it properly. I mean, how can one define convergence criteria for the outer iteration loop?

I tried to look into the pimpleControl.C and hier it is:
Code:

bool Foam::pimpleControl::loop()
00174 {
00175    read();
00176
00177    corr_++;
00178
00179    if (debug)
00180    {
00181        Info<< algorithmName_ << " loop: corr = " << corr_ << endl;
00182    }
00183
00184    if (corr_ == nCorrPIMPLE_ + 1)
00185    {
00186        if ((!residualControl_.empty()) && (nCorrPIMPLE_ != 1))
00187        {
00188            Info<< algorithmName_ << ": not converged within "
00189                << nCorrPIMPLE_ << " iterations" << endl;
00190        }
00191
00192        corr_ = 0;
00193        mesh_.data::remove("finalIteration");
00194        return false;
00195    }
00196
00197    bool completed = false;
00198    if (converged_ || criteriaSatisfied())
00199    {
00200        if (converged_)
00201        {
00202            Info<< algorithmName_ << ": converged in " << corr_ - 1
00203                << " iterations" << endl;
00204
00205            mesh_.data::remove("finalIteration");
00206            corr_ = 0;
00207            converged_ = false;
00208
00209            completed = true;
00210        }
00211        else
00212        {
00213            Info<< algorithmName_ << ": iteration " << corr_ << endl;
00214            storePrevIterFields();
00215
00216            mesh_.data::add("finalIteration", true);
00217            converged_ = true;
00218        }
00219    }
00220    else
00221    {
00222        if (finalIter())
00223        {
00224            mesh_.data::add("finalIteration", true);
00225        }
00226
00227        if (corr_ <= nCorrPIMPLE_)
00228        {
00229            if (nCorrPIMPLE_ != 1)
00230            {
00231                Info<< algorithmName_ << ": iteration " << corr_ << endl;
00232                storePrevIterFields();
00233            }
00234
00235            completed = false;
00236        }
00237    }
00238
00239    return !completed;
00240 }

the first check is done to see if the maximum number of iterations is exceeded
Code:

if (corr_ == nCorrPIMPLE_ + 1)
if so,
Code:

mesh_.data::remove("finalIteration");
what does it mean?

Then convergence is checked
Code:

if (converged_ || criteriaSatisfied())
my question here is, why are there two different indicators of convergence "converged_" and "criteriaSatisfied()"? Where can one provide the criteria to be satisfied? I also looked on the bool Foam::pimpleControl::criteriaSatisfied(), but it also wasn't easy to understand, what is being done there.

I would really appreciate, if someone takes some time and explains it for such noobs as me.

Best regards,
Illya


All times are GMT -4. The time now is 07:09.