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();
110 corrResidualControl_.
transfer(data);
112 if (control_.debug > 1)
114 forAll(corrResidualControl_, i)
117 Info<< residualDict.dictName() <<
'[' << i <<
"]:" <<
nl 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;
180 const word& fieldName = fieldNames[i];
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;
237 const word& fieldName = fieldNames[i];
243 solveIndex_(fieldName)
Residual correction data structure.
virtual void resetCorrSolveIndex()
Reset the solve index in the correction residual control data.
void printCorrResidualControls(const label n) const
Print the residual controls.
Single-region-specific derivation of the solution control class.
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static DynamicList< word > getFieldNames(const fvMesh &mesh)
Get the list of names of the fields.
Corrector convergence control class. Provides methods to check the convergence of an inner iteration ...
static const scalar ROOTVSMALL
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 List< word > fieldNames
bool readCorrResidualControls()
Read residual controls.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
virtual void updateCorrSolveIndex()
Update the solve index in the correction residual control data.
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
const fvMesh & mesh() const
Return the mesh.
virtual bool hasCorrResidualControls() const
Return true if corrector residual controls are present.
defineTypeNameAndDebug(combustionModel, 0)
Database for solution and other reduced data.
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.
virtual bool corrCriteriaSatisfied() const
Return true if all correction convergence checks are satisfied.
virtual ~singleRegionCorrectorConvergenceControl()
Destructor.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
singleRegionCorrectorConvergenceControl(const singleRegionSolutionControl &control, const word &loopName)
Construct from a solution control and the loop name.