ENH: setTimeStep: adjust timestep for adjustableRunTime writeInterval. Fixes #268.

This commit is contained in:
mattijs
2016-10-24 13:07:51 +01:00
parent e24917a7af
commit 196a4ea4e5
2 changed files with 16 additions and 3 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -103,7 +103,16 @@ bool Foam::setTimeStepFunctionObject::adjustTimeStep()
// Wanted timestep
scalar newDeltaT = timeStepPtr_().value(time_.timeOutputValue());
const_cast<Time&>(time()).setDeltaT(newDeltaT, false);
static label index = -1;
if (time().timeIndex() != index)
{
// Store current time so we don't get infinite recursion (since
// setDeltaT calls adjustTimeStep() again)
index = time().timeIndex();
// Set time, allow deltaT to be adjusted for writeInterval purposes
const_cast<Time&>(time()).setDeltaT(newDeltaT, true);
}
return true;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,6 +34,10 @@ Description
functionObjects. Supports 'enabled' flag but none of the other options
'timeStart', 'timeEnd', 'outputControl' etc.
Note that any 'writeControl adjustableRunTime' will still be in
operation and will limit the wanted time step to account for the
- write interval and - timestep adjustment speed (time step cannot
change too quickly).
Example of function object specification to manipulate the time step:
\verbatim