51 const word& fName = iter().keyword();
55 <<
"Corrector loop convergence criteria specified in "
57 <<
" must be given as dictionaries containing \"tolerance\" "
58 <<
"and \"relTol\" entries. Solution convergence criteria are "
74 rd.
name = fName.c_str();
96 <<
" name : " << rd.
name <<
nl
116 mesh_(control.mesh()),
117 corrResidualControl_()
139 Info<< control_.algorithmName() <<
": "
140 << (corrResidualControl_.empty() ?
"No c" :
"C")
141 <<
"orrector convergence criteria found" <<
nl;
143 forAll(corrResidualControl_, i)
145 Info<< control_.algorithmSpace() <<
" "
146 << corrResidualControl_[i].name <<
": tolerance "
147 << corrResidualControl_[i].absTol <<
", relTol "
148 << corrResidualControl_[i].relTol <<
nl;
151 Info<< control_.algorithmSpace() <<
" Calculations will do " <<
n
152 <<
" corrections" << (corrResidualControl_.empty() ?
"" :
153 " if the convergence criteria are not met") <<
nl <<
endl;
160 return !corrResidualControl_.empty();
167 if (!hasCorrResidualControls())
172 bool achieved =
true;
173 bool checked =
false;
177 Info<< control_.algorithmName() <<
": Correction residuals" <<
endl;
193 scalar firstResidual, residual;
198 solveIndex_.found(fieldName) ? solveIndex_[fieldName] : 0,
202 const scalar relativeResidual =
205 const bool absCheck =
206 residual < corrResidualControl_[fieldi].absTol;
207 const bool relCheck =
208 relativeResidual < corrResidualControl_[fieldi].relTol;
211 achieved = achieved && (absCheck || relCheck);
215 Info<< control_.algorithmSpace() <<
" " << fieldName
216 <<
": tolerance " << residual <<
" ("
217 << corrResidualControl_[fieldi].absTol <<
")"
218 <<
", relTol " << relativeResidual <<
" ("
219 << corrResidualControl_[fieldi].relTol <<
")"
220 << (absCheck || relCheck ?
" CONVERGED" :
"") <<
endl;
225 return checked && achieved;
247 solveIndex_(fieldName)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
static DynamicList< word > getFieldNames(const fvMesh &mesh)
Get the list of names of the fields.
static void getInitialResiduals(const fvMesh &mesh, const word &fieldName, const label solvei, scalar &r0, scalar &r)
Get the initial residuals for the first and the i-th solves in this.
static label residualControlIndex(const word &fieldName, const List< ResidualData > &residualControl, const bool useRegEx=true)
Return the index of the named field in residual control data, or -1.
Corrector convergence control class. Provides methods to check the convergence of an inner iteration ...
const solutionControl & control_
Reference to the solution control.
const word loopName_
Name of the corrector loop.
const word dictName() const
Return the local dictionary name (final part of scoped name)
A list of keyword definitions, which are a keyword followed by any number of values (e....
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Single-region-specific derivation of the corrector convergence control class.
void printCorrResidualControls(const label n) const
Print the residual controls.
virtual ~singleRegionCorrectorConvergenceControl()
Destructor.
virtual bool hasCorrResidualControls() const
Return true if corrector residual controls are present.
virtual void resetCorrSolveIndex()
Reset the solve index in the correction residual control data.
virtual void updateCorrSolveIndex()
Update the solve index in the correction residual control data.
List< corrResidualData > corrResidualControl_
List of residual data per field.
virtual bool corrCriteriaSatisfied() const
Return true if all correction convergence checks are satisfied.
singleRegionCorrectorConvergenceControl(const singleRegionSolutionControl &control, const word &loopName)
Construct from a solution control and the loop name.
virtual bool read()
Read controls.
Single-region-specific derivation of the solution control class.
const word & algorithmName() const
Return the name of the algorithm.
virtual const dictionary & dict() const =0
Return the dictionary.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const scalar ROOTVSMALL
defineTypeNameAndDebug(combustionModel, 0)
Residual correction data structure.