35 namespace functionObjects
44 void Foam::functionObjects::timeControl::readControls()
46 dict_.readIfPresent(
"timeStart", timeStart_);
47 dict_.readIfPresent(
"timeEnd", timeEnd_);
48 dict_.readIfPresent(
"nStepsToStartTimeChange", nStepsToStartTimeChange_);
52 bool Foam::functionObjects::timeControl::active()
const 55 time_.value() >= timeStart_
56 && time_.value() <= timeEnd_;
62 Foam::functionObjects::timeControl::timeControl
74 nStepsToStartTimeChange_
78 executeControl_(t, dict,
"execute"),
79 writeControl_(t, dict,
"write"),
90 if (active() && (postProcess || executeControl_.execute()))
101 if (active() && (postProcess || writeControl_.execute()))
112 if (active() && (executeControl_.execute() || writeControl_.execute()))
127 && writeControl_.control()
131 const label writeTimeIndex = writeControl_.executionIndex();
132 const scalar writeInterval = writeControl_.interval();
134 scalar timeToNextWrite =
max 137 (writeTimeIndex + 1)*writeInterval
138 - (time_.value() - time_.startTime().value())
141 scalar deltaT = time_.deltaTValue();
143 scalar nSteps = timeToNextWrite/deltaT - SMALL;
148 if (nSteps < nStepsToStartTimeChange_)
152 scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
155 if (newDeltaT < deltaT)
157 deltaT =
max(newDeltaT, 0.2*deltaT);
158 const_cast<Time&
>(time_).setDeltaT(deltaT,
false);
176 writeControl_.read(dict);
177 executeControl_.read(dict);
196 foPtr_->updateMesh(mpm);
208 foPtr_->movePoints(mesh);
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual bool execute()
Called at each ++ or += of the time-loop.
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
virtual bool write()
Called at each ++ or += of the time-loop.
A class for handling words, derived from string.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
static autoPtr< functionObject > New(const word &name, const Time &, const dictionary &)
Select from dictionary, based on its "type" entry.
Adjust time step for execution.
virtual bool adjustTimeStep()
Called at the end of Time::adjustDeltaT() if adjustTime is true.
Mesh consisting of general polyhedral cells.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.