timeControl Class Reference

Wrapper around functionObjects to add time control. More...

Inheritance diagram for timeControl:
[legend]
Collaboration diagram for timeControl:
[legend]

Public Types

enum  controlMode { TIME, TRIGGER, TIME_OR_TRIGGER, TIME_AND_TRIGGER }
 Control mode. More...
 

Public Member Functions

 TypeName ("timeControl")
 Runtime type information. More...
 
 timeControl (const word &name, const Time &runTime, const dictionary &dict)
 Construct from components. More...
 
const dictionarydict () const
 Return the input dictionary. More...
 
const Foam::timeControlexecuteControl () const
 Return the execute control object. More...
 
const Foam::timeControlwriteControl () const
 Return the write control object. More...
 
const functionObjectfilter () const
 Return the functionObject filter. More...
 
virtual bool execute ()
 Called at each ++ or += of the time-loop. More...
 
virtual bool execute (const label subIndex)
 Execute using the specified subIndex. More...
 
virtual bool write ()
 Called at each ++ or += of the time-loop. More...
 
virtual bool end ()
 Called when Time::run() determines that the time-loop exits. More...
 
virtual bool adjustTimeStep ()
 Called at the end of Time::adjustDeltaT() if adjustTime is true. More...
 
virtual bool filesModified () const
 Did any file get changed during execution? More...
 
virtual bool read (const dictionary &)
 Read and set the function object if its data have changed. More...
 
virtual void updateMesh (const mapPolyMesh &mpm)
 Update for changes of mesh. More...
 
virtual void movePoints (const polyMesh &mesh)
 Update for changes of mesh. More...
 
- Public Member Functions inherited from timeFunctionObject
 timeFunctionObject (const word &name, const Time &runTime)
 Construct from Time. More...
 
virtual ~timeFunctionObject ()=default
 Destructor. More...
 
const Timetime () const
 Return time database. More...
 
objectRegistrystoredObjects ()
 
const objectRegistrystoredObjects () const
 
- Public Member Functions inherited from functionObject
 declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict))
 
 functionObject (const word &name, const bool withNamePrefix=defaultUseNamePrefix)
 Construct from components. More...
 
autoPtr< functionObjectclone () const
 Return clone. More...
 
virtual ~functionObject ()=default
 Destructor. More...
 
virtual const wordtype () const =0
 Runtime type information. More...
 
const wordname () const noexcept
 Return the name of this functionObject. More...
 
bool useNamePrefix () const noexcept
 Return the flag for adding a scoping name prefix. More...
 
bool useNamePrefix (bool on) noexcept
 Modify the flag for adding a scoping name prefix. More...
 

Static Public Member Functions

static bool entriesPresent (const dictionary &dict)
 Helper function to identify if a timeControl object is present. More...
 
- Static Public Member Functions inherited from functionObject
static autoPtr< functionObjectNew (const word &name, const Time &runTime, const dictionary &dict)
 Select from dictionary, based on its "type" entry. More...
 

Static Public Attributes

static const Enum< controlModecontrolModeNames_
 
- Static Public Attributes inherited from functionObject
static int debug
 Flag to execute debug content. More...
 
static bool postProcess
 Global post-processing mode switch. More...
 
static bool defaultUseNamePrefix
 Global default for useNamePrefix. More...
 
static word outputPrefix
 Directory prefix. More...
 

Additional Inherited Members

- Public Attributes inherited from functionObject
bool log
 Flag to write log into Info. More...
 
- Protected Member Functions inherited from timeFunctionObject
void clearOutputObjects (const wordList &objNames)
 Remove specified items from "functionObjectObjects". More...
 
 timeFunctionObject (const timeFunctionObject &)=delete
 No copy construct. More...
 
void operator= (const timeFunctionObject &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from functionObject
word scopedName (const word &name) const
 Return a scoped (prefixed) name. More...
 
- Protected Attributes inherited from timeFunctionObject
const Timetime_
 Reference to the time database. More...
 

Detailed Description

Wrapper around functionObjects to add time control.

Adds

  • timeStart, timeEnd activation
  • deltaT modification to hit writeInterval (note: if adjustableRunTime also in controlDict this has to be an integer multiple)
  • smooth deltaT variation through optional deltaTCoeff parameter
Note
Since the timeIndex is used directly from Foam::Time, it is unaffected by user-time conversions. For example, Foam::engineTime might cause writeInterval to be degrees crank angle, but the functionObject execution interval would still be in timestep.

The function object can be limited to operate within a time range using the timeStart and timEnd options. All objects are read (and the OutputFilter allocated) on construction. However, if a timeEnd is supplied, the object will call the 'end' function of the filter at the timeEnd time and destroy the filter. Any other callback (execute(), write(), timeSet() etc) will only operate if within the timeStart, timeEnd time range. Note that the time range uses 0.5 * deltaT as a comparison tolerance to account for precision errors.

Source files

Definition at line 76 of file timeControlFunctionObject.H.

Member Enumeration Documentation

◆ controlMode

enum controlMode
strong

Control mode.

Enumerator
TIME 
TRIGGER 
TIME_OR_TRIGGER 
TIME_AND_TRIGGER 

Definition at line 85 of file timeControlFunctionObject.H.

Constructor & Destructor Documentation

◆ timeControl()

timeControl ( const word name,
const Time runTime,
const dictionary dict 
)

Construct from components.

Definition at line 446 of file timeControlFunctionObject.C.

Member Function Documentation

◆ TypeName()

TypeName ( "timeControl"  )

Runtime type information.

◆ dict()

const Foam::dictionary & dict ( ) const
inline

Return the input dictionary.

Definition at line 30 of file timeControlFunctionObjectI.H.

◆ executeControl()

const Foam::timeControl & executeControl ( ) const
inline

Return the execute control object.

Definition at line 37 of file timeControlFunctionObjectI.H.

◆ writeControl()

const Foam::timeControl & writeControl ( ) const
inline

Return the write control object.

Definition at line 44 of file timeControlFunctionObjectI.H.

◆ filter()

const Foam::functionObject & filter ( ) const
inline

Return the functionObject filter.

Definition at line 51 of file timeControlFunctionObjectI.H.

◆ entriesPresent()

bool entriesPresent ( const dictionary dict)
static

Helper function to identify if a timeControl object is present.

in the dictionary

Definition at line 473 of file timeControlFunctionObject.C.

References dict, and timeControl::entriesPresent().

Referenced by multiRegion::read(), and functionObjectList::read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute() [1/2]

bool execute ( )
virtual

Called at each ++ or += of the time-loop.

postProcess overrides the usual executeControl behaviour and forces execution (used in post-processing mode)

Implements functionObject.

Definition at line 493 of file timeControlFunctionObject.C.

◆ execute() [2/2]

bool execute ( const label  subIndex)
virtual

Execute using the specified subIndex.

Reimplemented from functionObject.

Definition at line 508 of file timeControlFunctionObject.C.

◆ write()

bool write ( )
virtual

Called at each ++ or += of the time-loop.

postProcess overrides the usual writeControl behaviour and forces writing (used in post-processing mode)

Implements functionObject.

Definition at line 520 of file timeControlFunctionObject.C.

◆ end()

bool end ( )
virtual

Called when Time::run() determines that the time-loop exits.

Reimplemented from functionObject.

Definition at line 538 of file timeControlFunctionObject.C.

◆ adjustTimeStep()

bool adjustTimeStep ( )
virtual

Called at the end of Time::adjustDeltaT() if adjustTime is true.

Reimplemented from functionObject.

Definition at line 549 of file timeControlFunctionObject.C.

References Foam::expressions::patchExpr::debug, TimeState::deltaTValue(), Foam::endl(), Foam::labelMax, Foam::log(), Foam::mag(), Foam::max(), Foam::min(), timeControl::ocAdjustableRunTime, and WarningInFunction.

Here is the call graph for this function:

◆ filesModified()

bool filesModified ( ) const
virtual

Did any file get changed during execution?

Reimplemented from functionObject.

Definition at line 802 of file timeControlFunctionObject.C.

◆ read()

bool read ( const dictionary dict)
virtual

Read and set the function object if its data have changed.

Reimplemented from functionObject.

Definition at line 784 of file timeControlFunctionObject.C.

References dict.

◆ updateMesh()

void updateMesh ( const mapPolyMesh mpm)
virtual

Update for changes of mesh.

Reimplemented from functionObject.

Definition at line 808 of file timeControlFunctionObject.C.

◆ movePoints()

void movePoints ( const polyMesh mesh)
virtual

Update for changes of mesh.

Reimplemented from functionObject.

Definition at line 817 of file timeControlFunctionObject.C.

References mesh.

Member Data Documentation

◆ controlModeNames_

Definition at line 93 of file timeControlFunctionObject.H.


The documentation for this class was generated from the following files: