From 557c472f074ba79792135fe34ed54a5384f5655c Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 9 Aug 2022 10:29:22 +0100 Subject: [PATCH] setDeltaT: Reinstate effect of deltaT setting in controlDict The time step adjustment now starts from the minimum of the deltaT calculated from Courant condition (and other physical limits), and the deltaT specified in the system/controlDict. This means that a small deltaT setting in system/controlDict results in a gradual increase up to the Courant number limited value. This can be useful in maintaining stability at the start of a simulation. This functionality is an accidental side-effect at best. It is being reinstated as existing cases are reliant upon it. If additional control of the time step in the initial stages of a simulation is needed, then that should be achieved with a more explicit user control. --- applications/solvers/modules/foamMultiRun/setDeltaT.C | 2 +- applications/solvers/modules/foamRun/setDeltaT.C | 2 +- .../cfdTools/general/include/setInitialDeltaT.H | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/applications/solvers/modules/foamMultiRun/setDeltaT.C b/applications/solvers/modules/foamMultiRun/setDeltaT.C index 616fd1789d..61faebae71 100644 --- a/applications/solvers/modules/foamMultiRun/setDeltaT.C +++ b/applications/solvers/modules/foamMultiRun/setDeltaT.C @@ -47,7 +47,7 @@ void Foam::setDeltaT(Time& runTime, const PtrList& solvers) if (deltaT != great) { - runTime.setDeltaT(deltaT); + runTime.setDeltaT(min(runTime.deltaTValue(), deltaT)); } } } diff --git a/applications/solvers/modules/foamRun/setDeltaT.C b/applications/solvers/modules/foamRun/setDeltaT.C index bcc554c4ce..6631a31c26 100644 --- a/applications/solvers/modules/foamRun/setDeltaT.C +++ b/applications/solvers/modules/foamRun/setDeltaT.C @@ -36,7 +36,7 @@ void Foam::setDeltaT(Time& runTime, const solver& solver) && runTime.controlDict().lookupOrDefault("adjustTimeStep", false) ) { - runTime.setDeltaT(solver.maxDeltaT()); + runTime.setDeltaT(min(runTime.deltaTValue(), solver.maxDeltaT())); } } diff --git a/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H b/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H index 271d76fa8f..3381f1682f 100644 --- a/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H +++ b/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H @@ -34,7 +34,14 @@ if (adjustTimeStep) { if ((runTime.timeIndex() == 0) && (CoNum > small)) { - runTime.setDeltaT(min(maxCo*runTime.deltaTValue()/CoNum, maxDeltaT)); + runTime.setDeltaT + ( + min + ( + maxCo*runTime.deltaTValue()/CoNum, + min(runTime.deltaTValue(), maxDeltaT) + ) + ); } }