38 namespace functionObjects
40 namespace runTimeControls
46 equationMaxIterCondition,
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_)
99 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
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;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
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...
label startIter_
Start checking from iteration - always skips first iteration.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void write()
Write.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual bool apply()
Apply the condition.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
Base class for run time conditions.
equationMaxIterCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
defineTypeNameAndDebug(averageCondition, 0)
addToRunTimeSelectionTable(runTimeCondition, averageCondition, dictionary)
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh data needed to do the Finite Volume discretisation.
bool active_
On/off switch.
Base class for function objects, adding functionality to read/write state information (data required ...
Registry of regIOobjects.
const wordList fieldNames_
Field name.
virtual void reset()
Reset.