62 stateFunctionObject& state
65 runTimeCondition(
name, obr,
dict, state),
67 threshold_(
dict.get<label>(
"threshold")),
68 startIter_(
dict.getOrDefault(
"startIter", 2))
73 <<
"No fields supplied: deactivating" << endl;
86 bool satisfied =
false;
93 if (obr_.time().timeIndex() < startIter_)
100 const dictionary& solverDict =
mesh.data().solverPerformanceDict();
104 forAll(fieldNames_, fieldi)
106 const word& fieldName = fieldNames_[fieldi];
108 if (solverDict.
found(fieldName))
111 const label nIterations = sp.first().nIterations();
112 result[fieldi] = nIterations;
114 if (nIterations > threshold_)
127 <<
"Number of iterations data not found for field "
128 << fieldNames_[i] <<
endl;
139 <<
"Number of iterations data not found for any fields: "
140 <<
"deactivating" <<
endl;
145 if (satisfied && valid)
148 <<
": satisfied using threshold value: " << threshold_ <<
nl;
152 if (result[resulti] != -1)
154 Log <<
" field: " << fieldNames_[resulti]
155 <<
", iterations: " << result[resulti] <<
nl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An ordered pair of two objects of type <T> with first() and second() elements.
const T & first() const noexcept
Access the first element.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return an entry data stream. FatalIOError if not found, or not a stream.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Maximum number of equation iterations run time condition.
const wordList fieldNames_
Field name.
virtual bool apply()
Apply the condition.
equationMaxIterCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
virtual void write()
Write.
const label threshold_
Threshold for maximum number of iterations.
label startIter_
Start checking from iteration - always skips first iteration.
virtual void reset()
Reset.
Base class for run time conditions.
bool active_
On/off switch.
const objectRegistry & obr_
Reference to the object registry.
word name_
Condition name.
runTimeCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
virtual const word & name() const
Return the condition name.
Base class for function objects, adding functionality to read/write state information (data required ...
Mesh data needed to do the Finite Volume discretisation.
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.