diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 861006bbbf..142da30fa6 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -755,11 +755,7 @@ bool Foam::functionObjectList::read() fo2, "functionObject::" + key + "::new" ); - if - ( - dict.found("writeControl") - || dict.found("outputControl") - ) + if (functionObjects::timeControl::entriesPresent(dict)) { foPtr.set ( diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index 5a41fee6f6..e8647eed49 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -50,6 +50,7 @@ const Foam::NamedEnum Foam::timeControl::timeControlNames_; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::timeControl::timeControl @@ -78,6 +79,23 @@ Foam::timeControl::~timeControl() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::timeControl::entriesPresent +( + const dictionary& dict, + const word& prefix +) +{ + const word controlName(prefix + "Control"); + + if (dict.found(controlName)) + { + return true; + } + + return false; +} + + void Foam::timeControl::read(const dictionary& dict) { word controlName(prefix_ + "Control"); diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H index c592b3d9ca..247ef2d3de 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H @@ -121,6 +121,10 @@ public: // Member Functions + //- Helper function to identify if a timeControl object is present + // in the dictionary + static bool entriesPresent(const dictionary& dict, const word& prefix); + //- Read from dictionary void read(const dictionary&); diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C index 344899ee93..02b174d419 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C @@ -93,6 +93,24 @@ Foam::functionObjects::timeControl::timeControl // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::functionObjects::timeControl::entriesPresent(const dictionary& dict) +{ + if + ( + Foam::timeControl::entriesPresent(dict, "write") + || Foam::timeControl::entriesPresent(dict, "output") // backwards compat + || Foam::timeControl::entriesPresent(dict, "execute") + || dict.found("timeStart") + || dict.found("timeEnd") + ) + { + return true; + } + + return false; +} + + bool Foam::functionObjects::timeControl::execute() { if (active() && (postProcess || executeControl_.execute())) diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H index d019a7e8b6..9108d12f52 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H @@ -157,6 +157,10 @@ public: // Function object control + //- Helper function to identify if a timeControl object is present + // in the dictionary + static bool entriesPresent(const dictionary& dict); + //- Called at each ++ or += of the time-loop. // postProcess overrides the usual executeControl behaviour and // forces execution (used in post-processing mode)