ENH: Adding finalOnLastPimpleIterOnly to allow Final solver in PIMPLE

The PIMPLE option finalOnLastPimpleIterOnly allows the call the Final
solver only in the last PIMPLE loop. The default is false which is
the present behavior.
This commit is contained in:
Sergio Ferraris
2020-06-08 15:42:52 +01:00
committed by Andrew Heather
parent 95c675428d
commit 775fe1d596
4 changed files with 23 additions and 5 deletions

View File

@ -50,6 +50,8 @@ bool Foam::pimpleControl::read()
SIMPLErho_ = pimpleDict.getOrDefault("SIMPLErho", false); SIMPLErho_ = pimpleDict.getOrDefault("SIMPLErho", false);
turbOnFinalIterOnly_ = turbOnFinalIterOnly_ =
pimpleDict.getOrDefault("turbOnFinalIterOnly", true); pimpleDict.getOrDefault("turbOnFinalIterOnly", true);
finalOnLastPimpleIterOnly_ =
pimpleDict.getOrDefault("finalOnLastPimpleIterOnly", false);
return true; return true;
} }
@ -153,7 +155,8 @@ Foam::pimpleControl::pimpleControl
corrPISO_(0), corrPISO_(0),
SIMPLErho_(false), SIMPLErho_(false),
turbOnFinalIterOnly_(true), turbOnFinalIterOnly_(true),
converged_(false) converged_(false),
finalOnLastPimpleIterOnly_(false)
{ {
read(); read();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -94,6 +94,10 @@ protected:
//- Converged flag //- Converged flag
bool converged_; bool converged_;
//- Flag to indicate wheter the final solver is used only on the
// final pimple iter
bool finalOnLastPimpleIterOnly_;
// Protected Member Functions // Protected Member Functions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -96,9 +97,18 @@ inline bool Foam::pimpleControl::finalIter() const
inline bool Foam::pimpleControl::finalInnerIter() const inline bool Foam::pimpleControl::finalInnerIter() const
{ {
return bool finalInnerIter =
corrPISO_ == nCorrPISO_ corrPISO_ == nCorrPISO_
&& corrNonOrtho_ == nNonOrthCorr_ + 1; && corrNonOrtho_ == nNonOrthCorr_ + 1;
if (finalOnLastPimpleIterOnly_)
{
return finalInnerIter && finalIter();
}
else
{
return finalInnerIter;
}
} }

View File

@ -58,6 +58,7 @@ PIMPLE
momentumPredictor yes; momentumPredictor yes;
nOuterCorrectors 1; nOuterCorrectors 1;
nCorrectors 2; nCorrectors 2;
finalOnLastPimpleIterOnly true;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
pMax 1.2e5; pMax 1.2e5;