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" },
57Foam::timeControl::timeControl
72Foam::timeControl::timeControl
93 const word controlName(prefix +
"Control");
95 return dict.found(controlName);
113 timeControl_ = ocTimeStep;
117 word controlName(prefix_ +
"Control");
118 word intervalName(prefix_ +
"Interval");
120 if (prefix_ ==
"write")
124 if (
dict.found(
"outputControl"))
129 controlName =
"outputControl";
130 intervalName =
"outputInterval";
133 <<
"Found deprecated 'outputControl'" <<
nl
134 <<
" Use 'writeControl' with 'writeInterval'"
141 timeControl_ = controlNames_.getOrDefault(controlName,
dict, timeControl_);
143 switch (timeControl_)
148 intInterval_ =
dict.getOrDefault<label>(intervalName, 0);
149 interval_ = intInterval_;
156 case ocAdjustableRunTime:
158 const scalar userTime =
dict.
get<scalar>(intervalName);
159 interval_ = time_.userTimeToTime(userTime);
173 switch (timeControl_)
192 || !(time_.timeIndex() % intInterval_)
199 if (time_.writeTime())
205 || !(executionIndex_ % intInterval_)
212 case ocAdjustableRunTime:
214 label executionIndex = label
217 (time_.value() - time_.startTime().value())
218 + 0.5*time_.deltaTValue()
223 if (executionIndex > executionIndex_)
225 executionIndex_ = executionIndex;
233 label executionIndex = label
238 if (executionIndex > executionIndex_)
240 executionIndex_ = executionIndex;
248 label executionIndex = label
253 if (executionIndex > executionIndex_)
255 executionIndex_ = executionIndex;
263 return time_.timeIndex() == 1;
269 scalar endTime = time_.endTime().value() - 0.5*time_.deltaTValue();
270 return time_.value() > endTime;
277 <<
"Undefined time control: "
278 << 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...
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
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
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.
@ ocClockTime
Use clock time for execution.
@ ocOnStart
Execute on first step of run.
@ ocAlways
Always execute.
@ ocCpuTime
Use CPU time for execution.
@ ocRunTime
Use run-time for execution.
@ ocOnEnd
Execute on end of run.
@ ocAdjustableRunTime
Currently identical to "runTime".
@ ocWriteTime
Execution coupled to write-time.
@ ocTimeStep
Execution coupled to time-step (default).
void clear()
Reset control to 'always' - ie, no intervention.
label executionIndex() const
Return the index of the previous execution.
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.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).