diff --git a/applications/solvers/modules/functions/functions.C b/applications/solvers/modules/functions/functions.C index 76a1c77573..8fa1244653 100644 --- a/applications/solvers/modules/functions/functions.C +++ b/applications/solvers/modules/functions/functions.C @@ -52,9 +52,30 @@ Foam::solvers::functions::functions(fvMesh& mesh) : runTime.controlDict().lookup("solver") ); + Time& time(const_cast(runTime)); + const TimeState ts(time); + bool startTimeChanged = false; + + if (runTime.controlDict().found("subSolverTime")) + { + const scalar subSolverTime + ( + runTime.controlDict().lookup("subSolverTime") + ); + + time.setTime(subSolverTime, 0); + + startTimeChanged = true; + } + // Instantiate the selected solver solverPtr = (solver::New(solverName, mesh)); + if (startTimeChanged) + { + time.setTime(ts, ts.timeIndex()); + } + // Set all registered objects to NO_WRITE // so only those created by the functionObjects are written for diff --git a/applications/solvers/modules/functions/functions.H b/applications/solvers/modules/functions/functions.H index aff28709d6..2b32a0ceba 100644 --- a/applications/solvers/modules/functions/functions.H +++ b/applications/solvers/modules/functions/functions.H @@ -39,6 +39,11 @@ Description should not be written out each write-time. Fields and other objects created and changed by the execution of the functionObjects are written out. + When restarting from a time directory which does contain the \c subSolver + fields the optional \c controlDict entry \c subSolverTime may be provided to + specify which time the \c subSolver should be instantiated for, after which + time is reset to \c startTime for the restart. + SourceFiles functions.C