Go to the documentation of this file.
35 #define SetResidual(Type) \
36 setResidual<Type>(mesh, solverDict, fieldName, component, canSet, residual);
42 namespace functionObjects
44 namespace runTimeControls
50 equationInitialResidualCondition,
63 ::equationInitialResidualCondition
69 { operatingMode::omMin,
"minimum" },
70 { operatingMode::omMax,
"maximum" },
86 fieldSelection_(obr,
true),
87 value_(
dict.get<scalar>(
"value")),
88 timeStart_(
dict.getOrDefault(
"timeStart", -GREAT)),
89 mode_(operatingModeNames.get(
"mode",
dict))
91 fieldSelection_.read(
dict);
93 if (fieldSelection_.size())
100 <<
"No fields supplied: deactivating" <<
endl;
112 fieldSelection_.updateSelection();
114 bool satisfied =
false;
121 if ((obr_.time().timeIndex() < 3) || (obr_.time().value() < timeStart_))
127 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
130 const auto& selection = fieldSelection_.selection();
135 const auto&
fieldInfo = selection[fieldi];
138 if (solverDict.
found(fieldName))
141 scalar residual = VGREAT;
149 result[fieldi] = residual;
155 if (residual < value_)
163 if (residual > value_)
172 <<
"Unhandled enumeration "
173 << operatingModeNames[mode_]
186 <<
"Initial residual data not found for field "
187 << selection[i].name()
188 <<
". Solver dictionary contains " << solverDict.
sortedToc()
200 <<
"Initial residual data not found for any fields: "
201 <<
"deactivating" <<
endl;
206 if (satisfied && valid)
209 <<
": satisfied using threshold value: " << value_ <<
nl;
213 if (result[resulti] > 0)
215 Log <<
" field: " << selection[resulti].name()
216 <<
", residual: " << result[resulti] <<
nl;
defineTypeNameAndDebug(averageCondition, 0)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Base class for run time conditions.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from Foam::string.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
const wordRe & name() const
Helper class to store a wordRe and label used by Foam::functionObjects::fieldSelection.
static const Enum< operatingMode > operatingModeNames
addToRunTimeSelectionTable(runTimeCondition, averageCondition, dictionary)
const Time & time() const
Return time.
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Base class for function objects, adding functionality to read/write state information (data required ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
virtual void write()
Write.
Registry of regIOobjects.
word name(const complex &c)
Return string representation of complex.
equationInitialResidualCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
virtual bool apply()
Apply the condition.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define SetResidual(Type)
wordList sortedToc() const
Return the sorted table of contents.
#define WarningInFunction
Report a warning using Foam::Warning.