From 78ee6c2abb17713297ce89188c65cb2904c01b1e Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Fri, 3 Feb 2017 14:27:38 +0000 Subject: [PATCH] Time: When increasing precision check if the time name is unchanged Patch contributed by Mattijs Janssens --- src/OpenFOAM/db/Time/Time.C | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 9a306d7eac4..5738f5f4dda 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,6 +184,8 @@ void Foam::Time::setControls() int oldPrecision = precision_; int requiredPrecision = -1; bool found = false; + word oldTime(timeName()); + for ( precision_ = maxPrecision_; @@ -194,6 +196,14 @@ void Foam::Time::setControls() // Update the time formatting setTime(startTime_, 0); + // Check that the time name has changed otherwise exit loop + word newTime(timeName()); + if (newTime == oldTime) + { + break; + } + oldTime = newTime; + // Check the existence of the time directory with the new format found = exists(timePath(), false); -- GitLab