47 solutionDict.getOrDefault<label>(
"nNonOrthogonalCorrectors", 0);
62 for (
const entry& dEntry : residualDict)
64 const word& fName = dEntry.keyword();
69 fd.name = fName.c_str();
73 fd.absTol = residualDict.get<scalar>(fName);
75 fd.initialResidual = -1;
77 else if (dEntry.isDict())
80 fd.absTol = fieldDict.get<scalar>(
"tolerance");
81 fd.relTol = fieldDict.get<scalar>(
"relTol");
82 fd.initialResidual = 0.0;
87 <<
"Residual data for " << dEntry.keyword()
88 <<
" must be specified as a dictionary" 99 fd.absTol = residualDict.get<scalar>(fName);
101 else if (dEntry.isDict())
104 fd.absTol = fieldDict.get<scalar>(
"tolerance");
105 fd.relTol = fieldDict.get<scalar>(
"relTol");
110 <<
"Residual data for " << dEntry.keyword()
111 <<
" must be specified as a dictionary" 124 Info<<
"residualControl[" << i <<
"]:" <<
nl 125 <<
" name : " << fd.name <<
nl 126 <<
" absTol : " << fd.absTol <<
nl 127 <<
" relTol : " << fd.relTol <<
nl 128 <<
" iniResid : " << fd.initialResidual <<
endl;
144 const word& fieldName,
148 forAll(residualControl_, i)
150 if (residualControl_[i].
name.
match(fieldName, !useRegEx))
163 storePrevIter<scalar>();
164 storePrevIter<vector>();
165 storePrevIter<sphericalTensor>();
166 storePrevIter<symmTensor>();
167 storePrevIter<tensor>();
173 const entry& solverPerfDictEntry
176 return maxResidual(mesh_, solverPerfDictEntry);
187 <<
"solutionControl: force:" << force
188 <<
" check: " <<
check 189 <<
" corr: " << corr_
190 <<
" corrNonOrtho:" << corrNonOrtho_
193 if (force || (
check && corr_ <= 1 && corrNonOrtho_ == 0))
195 DebugInfo<<
"solutionControl: set firstIteration flag" <<
endl;
196 mesh_.data().setFirstIteration(
true);
200 DebugInfo<<
"solutionControl: remove firstIteration flag" <<
endl;
201 mesh_.data().setFirstIteration(
false);
220 const entry& solverPerfDictEntry,
226 const word& fieldName = solverPerfDictEntry.
keyword();
232 residuals.
first() =
cmptMax(sp.first().initialResidual());
233 residuals.
last() =
cmptMax(sp.last().initialResidual());
244 const fvMesh& fvmesh,
245 const entry& solverPerfDictEntry
248 Pair<scalar> residuals(0,0);
253 maxTypeResidual<scalar>(fvmesh, solverPerfDictEntry, residuals)
254 || maxTypeResidual<vector>(fvmesh, solverPerfDictEntry, residuals)
255 || maxTypeResidual<sphericalTensor>(fvmesh, solverPerfDictEntry, residuals)
256 || maxTypeResidual<symmTensor>(fvmesh, solverPerfDictEntry, residuals)
257 || maxTypeResidual<tensor>(fvmesh, solverPerfDictEntry, residuals)
262 Info<<
"no residual for " << solverPerfDictEntry.keyword()
263 <<
" on mesh " << fvmesh.name() <<
nl;
272 Foam::solutionControl::solutionControl(
fvMesh&
mesh,
const word& algorithmName)
287 algorithmName_(algorithmName),
289 momentumPredictor_(true),
const T & first() const noexcept
Access the first element.
virtual bool writeData(Ostream &) const
Dummy write for regIOobject.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
List< fieldData > residualControl_
List of residual data per field.
constexpr char nl
The newline '\n' character (0x0a)
Base class for solution control classes.
fvSolution solutionDict(runTime)
virtual label applyToField(const word &fieldName, const bool useRegEx=true) const
Return index of field in residualControl_ if present.
label nNonOrthCorr_
Maximum number of non-orthogonal correctors.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Generic GeometricField class.
bool match(const std::string &text) const
Test for equality.
bool read(const char *buf, int32_t &val)
Same as readInt32.
#define forAll(list, i)
Loop across all elements in list.
static Pair< scalar > maxResidual(const fvMesh &fvmesh, const entry &dataDictEntry)
Extract maximum residual for the solver performance entry, provided the corresponding volume field is...
void fieldData(vtk::formatter &fmt, label nFields)
Emit "FIELD FieldData <n>".
const keyType & keyword() const noexcept
Return keyword.
An ordered pair of two objects of type <T> with first() and second() elements.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from Foam::string.
virtual bool read()
Read controls from fvSolution dictionary.
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
bool transonic_
Flag to indicate to solve using transonic algorithm.
#define DebugInfo
Report an information message using Foam::Info.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
virtual const dictionary dict() const
Return the solution dictionary.
static void check(const int retVal, const char *what)
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary. ...
virtual void storePrevIterFields() const
Store previous iteration fields.
T & last() noexcept
Access last element of the list, position [N-1] - back()
Mesh data needed to do the Finite Volume discretisation.
bool momentumPredictor_
Flag to indicate to solve for momentum.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
bool frozenFlow_
Flag to indicate that the flow system of equations should not.
static bool maxTypeResidual(const fvMesh &fvmesh, const entry &solverPerfDictEntry, Pair< scalar > &residuals)
Initial and final residual of the specified field-name, provided that the corresponding volume field ...
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
bool consistent_
Flag to indicate to relax pressure using the.
A keyword and a list of tokens is an 'entry'.