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();
111 corrResidualControl_.transfer(data);
113 if (control_.debug > 1)
115 forAll(corrResidualControl_, i)
118 Info<< residualDict.dictName() <<
'[' << i <<
"]:" <<
nl 119 <<
" name : " << rd.
name <<
nl 136 Info<< control_.algorithmName() <<
": " 137 << (corrResidualControl_.empty() ?
"No c" :
"C")
138 <<
"orrector convergence criteria found" << nl;
140 forAll(corrResidualControl_, i)
142 Info<< control_.algorithmSpace() <<
" " 143 << corrResidualControl_[i].name <<
": tolerance " 144 << corrResidualControl_[i].absTol <<
", relTol " 145 << corrResidualControl_[i].relTol <<
nl;
148 Info<< control_.algorithmSpace() <<
" Calclations will do " << n
149 <<
" corrections" << (corrResidualControl_.empty() ?
"" :
150 " if the convergence criteria are not met") << nl <<
endl;
157 return !corrResidualControl_.empty();
164 if (!hasCorrResidualControls())
169 bool achieved =
true;
170 bool checked =
false;
174 Info<< control_.algorithmName() <<
": Correction residuals" <<
endl;
177 const dictionary& solverDict = mesh_.solverPerformanceDict();
180 const word& variableName = iter().keyword();
189 scalar firstResidual, residual;
194 corrResidualControl_[fieldi].solveIndex,
199 const scalar relativeResidual =
202 const bool absCheck =
203 residual < corrResidualControl_[fieldi].absTol;
204 const bool relCheck =
205 relativeResidual < corrResidualControl_[fieldi].relTol;
208 achieved = achieved && (absCheck || relCheck);
212 Info<< control_.algorithmSpace() <<
" " << variableName
213 <<
": tolerance " << residual <<
" (" 214 << corrResidualControl_[fieldi].absTol <<
")" 215 <<
", relTol " << relativeResidual <<
" (" 216 << corrResidualControl_[fieldi].relTol <<
")" 217 << (absCheck || relCheck ?
" CONVERGED" :
"") <<
endl;
222 return checked && achieved;
228 forAll(corrResidualControl_, i)
230 corrResidualControl_[i].solveIndex = 0;
237 const dictionary& solverDict = mesh_.solverPerformanceDict();
240 const word& variableName = iter().keyword();
254 corrResidualControl_[fieldi].solveIndex
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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, ITstream &data, scalar &r0, scalar &r)
Get the initial residuals for the first and the i-th solves in this.
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.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
const fvMesh & mesh() const
Return the mesh.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual bool hasCorrResidualControls() const
Return true if corrector residual controls are present.
defineTypeNameAndDebug(combustionModel, 0)
Database for solution data, solver performance 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.
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.