diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 97372f6ff7..fc40a4d551 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -82,17 +82,17 @@ Foam::word Foam::Time::controlDictName("controlDict"); void Foam::Time::adjustDeltaT() { - const scalar timeToNextWrite = min + const scalar timeToNextAction = min ( max ( 0, (writeTimeIndex_ + 1)*writeInterval_ - (value() - beginTime_) ), - functionObjects_.timeToNextWrite() + functionObjects_.timeToNextAction() ); - const scalar nSteps = timeToNextWrite/deltaT_; + const scalar nSteps = timeToNextAction/deltaT_; // Ensure nStepsToNextWrite does not overflow if (nSteps < labelMax) @@ -101,7 +101,7 @@ void Foam::Time::adjustDeltaT() // to accommodate the next write time before splitting const label nStepsToNextWrite = label(max(nSteps, 1) + 0.99); - deltaT_ = timeToNextWrite/nStepsToNextWrite; + deltaT_ = timeToNextAction/nStepsToNextWrite; } } diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index dd0741850d..00cf5c8139 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -157,7 +157,7 @@ bool Foam::functionObject::end() } -Foam::scalar Foam::functionObject::timeToNextWrite() +Foam::scalar Foam::functionObject::timeToNextAction() { return vGreat; } diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 7439e3b358..68672cb29e 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -69,21 +69,24 @@ Description endTime | End time | no | executeAtStart | Execute at start time switch | no | yes executeControl | See time controls below | no | timeStep - executeInterval | Steps between each execute phase | no | + executeInterval | Steps between each execution | no | + executeTimes | List of execution times | no | writeControl | See time controls below | no | timeStep - writeInterval | Steps between each write phase | no | + writeInterval | Steps between each write | no | + writeTimes | List of write times | no | \endtable Time controls: \table Option | Description timeStep | Execute/write every 'Interval' time-steps - writeTime | Execute/write every 'Interval' output times + writeTime | Execute/write every 'Interval' write times adjustableRunTime | Execute/write every 'Interval' run time period runTime | Execute/write every 'Interval' run time period + runTimes | Execute/write at specified list of run times clockTime | Execute/write every 'Interval' clock time period cpuTime | Execute/write every 'Interval' CPU time period - none | Execute/write every time-step + none | No execution \endtable The sub-dictionary name \c \ is chosen by the user, and @@ -244,7 +247,7 @@ public: //- Called by Time::adjustTimeStep(). Allows the functionObject to // insert a write time earlier than that already in use by the run // time. Returns the write time, or vGreat. - virtual scalar timeToNextWrite(); + virtual scalar timeToNextAction(); //- Update topology using the given map virtual void movePoints(const polyMesh& mesh); diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index d67b6804ab..8276947705 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -278,7 +278,7 @@ bool Foam::functionObjectList::end() } -Foam::scalar Foam::functionObjectList::timeToNextWrite() +Foam::scalar Foam::functionObjectList::timeToNextAction() { scalar result = vGreat; @@ -291,7 +291,7 @@ Foam::scalar Foam::functionObjectList::timeToNextWrite() forAll(*this, oi) { - result = min(result, operator[](oi).timeToNextWrite()); + result = min(result, operator[](oi).timeToNextAction()); } } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 4ce06aaa63..605d25bbf8 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -176,7 +176,7 @@ public: bool end(); //- Return the time to the next write - scalar timeToNextWrite(); + scalar timeToNextAction(); //- Update topology using the given map virtual void movePoints(const polyMesh& mesh); diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index 9ebe9939f0..b33a53f406 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -31,7 +31,7 @@ License namespace Foam { template<> - const char* NamedEnum:: + const char* NamedEnum:: names[] = { "timeStep", @@ -39,13 +39,14 @@ namespace Foam "outputTime", "adjustableRunTime", "runTime", + "runTimes", "clockTime", "cpuTime", "none" }; } -const Foam::NamedEnum +const Foam::NamedEnum Foam::timeControl::timeControlNames_; @@ -63,6 +64,7 @@ Foam::timeControl::timeControl timeControl_(timeControls::timeStep), intervalSteps_(0), interval_(-1), + timeDelta_(0), executionIndex_(0) { read(dict); @@ -81,6 +83,7 @@ void Foam::timeControl::read(const dictionary& dict) { word controlName(prefix_ + "Control"); word intervalName(prefix_ + "Interval"); + const word timesName(prefix_ + "Times"); // For backward compatibility support the deprecated 'outputControl' option // now superseded by 'writeControl' for compatibility with Time @@ -142,6 +145,23 @@ void Foam::timeControl::read(const dictionary& dict) break; } + case timeControls::runTimes: + { + times_ = dict.lookup(timesName); + timeDelta_ = dict.lookupOrDefault("timeDelta", 1e-6); + + forAll(times_, i) + { + timeIndices_.insert + ( + int64_t((times_[i] + timeDelta_/2.0)/timeDelta_) + ); + } + + intervalSteps_ = dict.lookupOrDefault