48 mesh_(control.mesh()),
49 corrResidualControl_()
66 control_.dict().subOrEmptyDict(loopName_ +
"ResidualControl")
73 const word& fName = iter().keyword();
77 <<
"Corrector loop convergence criteria specified in "
78 << control_.algorithmName() <<
'.' << residualDict.
dictName()
79 <<
" must be given as dictionaries containing \"tolerance\" "
80 <<
"and \"relTol\" entries. Solution convergence criteria are "
81 <<
"specified as single numbers in " << control_.algorithmName()
96 rd.
name = fName.c_str();
112 if (control_.debug > 1)
114 forAll(corrResidualControl_, i)
118 <<
" name : " << rd.
name <<
nl
135 Info<< control_.algorithmName() <<
": "
136 << (corrResidualControl_.empty() ?
"No c" :
"C")
137 <<
"orrector convergence criteria found" <<
nl;
139 forAll(corrResidualControl_, i)
141 Info<< control_.algorithmSpace() <<
" "
142 << corrResidualControl_[i].name <<
": tolerance "
143 << corrResidualControl_[i].absTol <<
", relTol "
144 << corrResidualControl_[i].relTol <<
nl;
147 Info<< control_.algorithmSpace() <<
" Calculations will do " <<
n
148 <<
" corrections" << (corrResidualControl_.empty() ?
"" :
149 " if the convergence criteria are not met") <<
nl <<
endl;
156 return !corrResidualControl_.empty();
163 if (!hasCorrResidualControls())
168 bool achieved =
true;
169 bool checked =
false;
173 Info<< control_.algorithmName() <<
": Correction residuals" <<
endl;
189 scalar firstResidual, residual;
194 solveIndex_.found(fieldName) ? solveIndex_[fieldName] : 0,
198 const scalar relativeResidual =
201 const bool absCheck =
202 residual < corrResidualControl_[fieldi].absTol;
203 const bool relCheck =
204 relativeResidual < corrResidualControl_[fieldi].relTol;
207 achieved = achieved && (absCheck || relCheck);
211 Info<< control_.algorithmSpace() <<
" " << fieldName
212 <<
": tolerance " << residual <<
" ("
213 << corrResidualControl_[fieldi].absTol <<
")"
214 <<
", relTol " << relativeResidual <<
" ("
215 << corrResidualControl_[fieldi].relTol <<
")"
216 << (absCheck || relCheck ?
" CONVERGED" :
"") <<
endl;
221 return checked && achieved;
243 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.
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 ...
Database for solution and other reduced data.
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....
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.
bool readCorrResidualControls()
Read residual controls.
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.
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.
Single-region-specific derivation of the solution control class.
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.