38namespace functionObjects
40namespace runTimeControls
56Foam::functionObjects::runTimeControls::equationMaxIterCondition::
57equationMaxIterCondition
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;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
T & first()
Return the first element of the list.
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
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for 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.
virtual void write()
Write.
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.
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.
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 INVALID.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.