From 562df25d13a724770d0369327a23672859b092a7 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 21 May 2021 11:50:40 +0100 Subject: [PATCH] functionObjects::timeControl: Updated to use beginTime for consistency with the handling of restarts in Time. See commit 7aca9bfa782c33e3e71894ab746b63964e334200 Author: Henry Weller Date: Fri Dec 11 13:37:16 2020 +0000 Time: Added beginTime used to rationalise the write times when restarting Now if a case is restarted from an arbitrary time, for example one generated at a premature stop condition, or with an increased writeInterval, the subsequent time directories written are referenced to the original start time of the case rather than the restart time. --- src/OpenFOAM/db/functionObjects/timeControl/timeControl.C | 4 ++-- .../functionObjects/timeControl/timeControlFunctionObject.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index 6ec5439750..07e584f5d1 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -168,7 +168,7 @@ bool Foam::timeControl::execute() label executionIndex = label ( ( - (time_.value() - time_.startTime().value()) + (time_.value() - time_.beginTime().value()) + 0.5*time_.deltaTValue() ) /interval_ diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C index fe31465b08..0cc0b9045f 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C @@ -165,7 +165,7 @@ Foam::scalar Foam::functionObjects::timeControl::timeToNextWrite() ( 0.0, (writeTimeIndex + 1)*writeInterval - - (time_.value() - time_.startTime().value()) + - (time_.value() - time_.beginTime().value()) ); }