38 Foam::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" },
56 Foam::timeControl::timeControl
64 timeControl_(ocAlways),
71 Foam::timeControl::timeControl
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
static bool entriesPresent(const dictionary &dict, const word &prefix)
Identify if a timeControl object is present in the dictionary.
void clear()
Reset control to 'always' - ie, no intervention.
Inter-processor communication reduction functions.
void read(const dictionary &dict)
Read from dictionary.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
timeControls
The time control options.
bool execute()
Flag to indicate whether to execute.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
A class for handling words, derived from Foam::string.
errorManip< error > abort(error &err)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
General time dependent execution controller. The execution parameters are given by the "Control" and ...