mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Time: time step adjustment not robust. Fixes #414.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -99,12 +99,13 @@ void Foam::Time::adjustDeltaT()
|
|||||||
|
|
||||||
if (adjustTime)
|
if (adjustTime)
|
||||||
{
|
{
|
||||||
scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
|
scalar nSteps = timeToNextWrite/deltaT_;
|
||||||
|
|
||||||
// For tiny deltaT the label can overflow!
|
// For tiny deltaT the label can overflow!
|
||||||
if (nSteps < labelMax)
|
if (nSteps < labelMax)
|
||||||
{
|
{
|
||||||
label nStepsToNextWrite = label(nSteps) + 1;
|
// nSteps can be < 1 so make sure at least 1
|
||||||
|
label nStepsToNextWrite = max(1, round(nSteps));
|
||||||
|
|
||||||
scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
|
scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user