mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: setTimeStep: adjust timestep for adjustableRunTime writeInterval. Fixes #268.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user