solvers::functions: Added optional subSolverTime controlDict entry
Class
Foam::solvers::functions
Description
Solver module to execute the \c functionObjects for a specified solver
The solver specified by either the \c subSolver or if not present the \c
solver entry in the \c controlDict is instantiated to provide the physical
fields needed by the \c functionObjects. The \c functionObjects are then
instantiated from the specifications are read from the \c functions entry in
the \c controlDict and executed in a time-loop also controlled by entries in
\c controlDict and the \c maxDeltaT() returned by the sub-solver.
The fields and other objects registered by the sub-solver are set to
NO_WRITE as they are not changed by the execution of the functionObjects and
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.
This commit is contained in:
@ -52,9 +52,30 @@ Foam::solvers::functions::functions(fvMesh& mesh)
|
||||
: runTime.controlDict().lookup("solver")
|
||||
);
|
||||
|
||||
Time& time(const_cast<Time&>(runTime));
|
||||
const TimeState ts(time);
|
||||
bool startTimeChanged = false;
|
||||
|
||||
if (runTime.controlDict().found("subSolverTime"))
|
||||
{
|
||||
const scalar subSolverTime
|
||||
(
|
||||
runTime.controlDict().lookup<scalar>("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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user