64 if ((corr_ == 1) || residualControl_.empty() || finalIter())
70 const bool storeIni = this->storeInitialResiduals();
75 const dictionary& solverDict = mesh_.solverPerformanceDict();
76 for (
const entry& solverPerfDictEntry : solverDict)
78 const word& fieldName = solverPerfDictEntry.keyword();
79 const label fieldi = applyToField(fieldName);
83 Pair<scalar> residuals = maxResidual(solverPerfDictEntry);
87 scalar relative = 0.0;
88 bool relCheck =
false;
91 (residuals.
last() < residualControl_[fieldi].absTol);
95 residualControl_[fieldi].initialResidual = residuals.
first();
100 (residualControl_[fieldi].initialResidual + ROOTVSMALL);
102 relative = residuals.
last() / iniRes;
103 relCheck = (relative < residualControl_[fieldi].relTol);
106 achieved = achieved && (absCheck || relCheck);
110 Info<< algorithmName_ <<
" loop:" <<
endl;
112 Info<<
" " << fieldName
113 <<
" PIMPLE iter " << corr_
115 << residualControl_[fieldi].initialResidual
116 <<
", abs tol = " << residuals.
last()
117 <<
" (" << residualControl_[fieldi].absTol <<
")"
118 <<
", rel tol = " << relative
119 <<
" (" << residualControl_[fieldi].relTol <<
")"
125 return checked && achieved;
133 <<
" corrPISO:" << corrPISO_
134 <<
" corrNonOrtho:" << corrNonOrtho_
156 turbOnFinalIterOnly_(true),
157 finalOnLastPimpleIterOnly_(false),
171 Info<<
": no residual control data found. "
173 <<
" corrector loops" <<
nl;
182 <<
": relTol " << ctrl.relTol
183 <<
", tolerance " << ctrl.absTol
190 Info<<
": Operating solver in PISO mode" <<
nl;
208 Info<< algorithmName_ <<
" loop: corr = " << corr_ <<
endl;
213 if (corr_ == nCorrPIMPLE_ + 1)
215 if (!residualControl_.empty() && (nCorrPIMPLE_ != 1))
217 Info<< algorithmName_ <<
": not converged within "
218 << nCorrPIMPLE_ <<
" iterations" <<
endl;
222 mesh_.data::remove(
"finalIteration");
226 bool completed =
false;
227 if (converged_ || criteriaSatisfied())
231 Info<< algorithmName_ <<
": converged in " << corr_ - 1
232 <<
" iterations" <<
endl;
234 mesh_.data::remove(
"finalIteration");
242 Info<< algorithmName_ <<
": iteration " << corr_ <<
endl;
243 storePrevIterFields();
245 mesh_.data::add(
"finalIteration",
true);
253 mesh_.data::add(
"finalIteration",
true);
256 if (corr_ <= nCorrPIMPLE_)
258 Info<< algorithmName_ <<
": iteration " << corr_ <<
endl;
259 storePrevIterFields();
const dictionary & pimpleDict
T & first() noexcept
The first element of the list, position [0].
T & last() noexcept
The last element of the list, position [N-1].
An ordered pair of two objects of type <T> with first() and second() elements.
The TAB Method for Numerical Calculation of Spray Droplet Breakup.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
A keyword and a list of tokens is an 'entry'.
Mesh data needed to do the Finite Volume discretisation.
PIMPLE control class to supply convergence information/checks for the PIMPLE loop.
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
bool finalOnLastPimpleIterOnly_
label nCorrPISO_
Maximum number of PISO correctors.
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
bool solveFlow_
Flag to indicate whether to solve for the flow.
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
virtual bool loop()
PIMPLE loop.
bool ddtCorr_
Flag to indicate that ddtCorr should be applied; default = yes.
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
virtual bool read()
Read controls from fvSolution dictionary.
Base class for solution control classes.
const word algorithmName_
The dictionary name, e.g. SIMPLE, PIMPLE.
List< fieldData > residualControl_
List of residual data per field.
virtual const dictionary dict() const
Return the solution dictionary.
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
virtual bool read()
Read controls from fvSolution dictionary.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const word dictName("faMeshDefinition")
#define DebugInfo
Report an information message using Foam::Info.
bool read(const char *buf, int32_t &val)
Same as readInt32.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void check(const int retVal, const char *what)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char nl
The newline '\n' character (0x0a)
Simple convenient storage of field residuals.