Go to the documentation of this file.
34 void Foam::loopControl::clear()
48 void Foam::loopControl::read(
const dictionary&
dict)
59 timeStart = time_.userTimeToTime(timeStart);
64 && time_.value() >= (timeStart - 0.5*time_.deltaTValue())
71 timeEnd = time_.userTimeToTime(timeEnd);
76 && time_.value() <= (timeEnd + 0.5*time_.deltaTValue())
97 bool Foam::loopControl::checkConverged()
const
99 if (convergenceDict_.empty())
104 HashTable<const fvMesh*>
meshes = time_.lookupClass<
const fvMesh>();
106 bool achieved =
true;
107 bool checked =
false;
111 const fvMesh& regionMesh = *(meshIter.val());
113 const dictionary& solverDict = regionMesh.solverPerformanceDict();
117 const entry& dataDictEntry = *iter;
119 const word& variableName = dataDictEntry.keyword();
121 const scalar absTol =
122 convergenceDict_.getOrDefault<scalar>(variableName, -1);
128 Pair<scalar> residuals =
136 achieved = achieved && (residuals.first() < absTol);
141 return checked && achieved;
147 Foam::loopControl::loopControl
165 Foam::loopControl::loopControl
185 Foam::loopControl::loopControl
188 const word& algorithmName,
225 bool active = (index_ < total_);
231 converged_ = checkConverged();
235 time_.functionObjects().execute(onConverged_, index_);
241 interval_ && !(index_ % interval_)
245 time_.functionObjects().execute(onLoop_, index_);
252 if (!converged_ && !onEnd_.empty())
254 time_.functionObjects().execute(onEnd_, index_);
266 os << ctrl.
name() <<
": ";
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
wordRes onLoop_
Function object names to fire during the loop (at executeInterval)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
bool read(const char *buf, int32_t &val)
Same as readInt32.
wordRes onConverged_
Function object names to fire on convergence.
const word dictName("blockMeshDict")
A class for managing arbitrary loops with the ability to invoke function object execution.
~loopControl()
Destructor.
dictionary convergenceDict_
Dictionary for checking convergence (all regions)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
label nCycles() const
The total number of cycles.
const word & name() const
Name of the loop control.
Selector class for finite volume solution solution. fvMesh is derived from fvSolution so that all fie...
PtrList< fvMesh > meshes(regionNames.size())
static Pair< scalar > maxResidual(const fvMesh &fvmesh, const entry &dataDictEntry)
A class for managing sub-loops referencing Time.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
bool converged_
Convergence tests passed.
const dictionary & solutionDict() const
Return the selected sub-dictionary of solvers if the "select".
label index() const
The current cycle index.
forAllConstIters(mixture.phases(), phase)
void clear()
Clear the list, i.e. set size to zero.
label total_
The total number of cycles in the sub-cycle.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
void clear()
Clear the dictionary.
label interval_
The interval to execute onLoop function-objects.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const