38Foam::timeControl::controlNames_
40 { timeControl::ocNone,
"none" },
41 { timeControl::ocAlways,
"always" },
42 { timeControl::ocTimeStep,
"timeStep" },
43 { timeControl::ocWriteTime,
"writeTime" },
44 { timeControl::ocWriteTime,
"outputTime" },
45 { timeControl::ocRunTime,
"runTime" },
46 { timeControl::ocAdjustableRunTime,
"adjustable" },
47 { timeControl::ocAdjustableRunTime,
"adjustableRunTime" },
48 { timeControl::ocClockTime,
"clockTime" },
49 { timeControl::ocCpuTime,
"cpuTime" },
50 { timeControl::ocOnEnd,
"onEnd" },
64 timeControl_(ocAlways),
92 const word controlName(prefix +
"Control");
102 timeControl_ = ocAlways;
112 timeControl_ = ocTimeStep;
116 word controlName(prefix_ +
"Control");
117 word intervalName(prefix_ +
"Interval");
119 if (prefix_ ==
"write")
128 controlName =
"outputControl";
129 intervalName =
"outputInterval";
132 <<
"Found deprecated 'outputControl'" <<
nl
133 <<
" Use 'writeControl' with 'writeInterval'"
140 timeControl_ = controlNames_.getOrDefault(controlName,
dict, timeControl_);
142 switch (timeControl_)
148 interval_ = intInterval_;
155 case ocAdjustableRunTime:
157 const scalar userTime =
dict.
get<scalar>(intervalName);
158 interval_ = time_.userTimeToTime(userTime);
172 switch (timeControl_)
191 || !(time_.timeIndex() % intInterval_)
198 if (time_.writeTime())
204 || !(executionIndex_ % intInterval_)
211 case ocAdjustableRunTime:
213 label executionIndex = label
216 (time_.value() - time_.startTime().value())
217 + 0.5*time_.deltaTValue()
222 if (executionIndex > executionIndex_)
224 executionIndex_ = executionIndex;
232 label executionIndex = label
237 if (executionIndex > executionIndex_)
239 executionIndex_ = executionIndex;
247 label executionIndex = label
252 if (executionIndex > executionIndex_)
254 executionIndex_ = executionIndex;
262 scalar endTime = time_.endTime().value() - 0.5*time_.deltaTValue();
263 return time_.value() > endTime;
270 <<
"Undefined time control: "
271 << controlNames_[timeControl_] <<
nl
Inter-processor communication reduction functions.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
T getOrDefault(const word &keyword, const T &deflt, 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.
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
General time dependent execution controller. The execution parameters are given by the "Control" and ...
static bool entriesPresent(const dictionary &dict, const word &prefix)
Identify if a timeControl object is present in the dictionary.
void read(const dictionary &dict)
Read from dictionary.
timeControls
The time control options.
void clear()
Reset control to 'always' - ie, no intervention.
bool execute()
Flag to indicate whether to execute.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
constexpr char nl
The newline '\n' character (0x0a)