51 if (residualControl_.empty())
59 const dictionary& solverDict = mesh_.data().solverPerformanceDict();
60 for (
const entry& solverPerfDictEntry : solverDict)
62 const word& fieldName = solverPerfDictEntry.keyword();
63 const label fieldi = applyToField(fieldName);
67 Pair<scalar> residuals = maxResidual(solverPerfDictEntry);
71 (residuals.first() < residualControl_[fieldi].absTol);
73 achieved = achieved && absCheck;
77 Info<< algorithmName_ <<
" solution statistics:" <<
endl;
79 Info<<
" " << fieldName <<
": tolerance = "
81 <<
" (" << residualControl_[fieldi].absTol <<
")"
87 return checked && achieved;
93Foam::simpleControl::simpleControl
111 const scalar duration =
115 Info<<
": no convergence criteria found. "
116 <<
"Calculations will run for " << duration <<
" steps."
121 Info<<
": convergence criteria" <<
nl;
125 <<
" tolerance " << ctrl.absTol
142 Time&
runTime =
const_cast<Time&
>(mesh_.time());
148 <<
" solution converged in "
157 storePrevIterFields();
An ordered pair of two objects of type <T> with first() and second() elements.
const T & first() const noexcept
Access the first element.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual dimensionedScalar startTime() const
Return start time.
virtual bool loop()
Return true if run should continue and if so increment time.
virtual dimensionedScalar endTime() const
Return end time.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const noexcept
Return const reference to value.
A keyword and a list of tokens is an 'entry'.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
bool initialised_
Initialised flag.
virtual bool loop()
SIMPLE loop.
bool read()
Read controls from fvSolution dictionary.
Base class for solution control classes.
const word algorithmName_
The dictionary name, e.g. SIMPLE, PIMPLE.
List< fieldData > residualControl_
List of residual data per field.
fvMesh & mesh_
Reference to the mesh database.
virtual void storePrevIterFields() const
Store previous iteration fields.
virtual label applyToField(const word &fieldName, const bool useRegEx=true) const
Return index of field in residualControl_ if present.
static Pair< scalar > maxResidual(const fvMesh &fvmesh, const entry &dataDictEntry)
Extract maximum residual for the solver performance entry, provided the corresponding volume field is...
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
virtual bool read()
Read controls from fvSolution dictionary.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const word dictName("faMeshDefinition")
Namespace for handling debugging switches.
bool read(const char *buf, int32_t &val)
Same as readInt32.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char nl
The newline '\n' character (0x0a).
static bool initialised_(false)
Simple convenient storage of field residuals.