fileOperation, timeSelector: Correct handling of negative time directories

Resolves bug-report https://bugs.openfoam.org/view.php?id=3784
This commit is contained in:
Henry Weller
2022-01-15 21:15:41 +00:00
parent 8c0dd22f83
commit aab660450a
2 changed files with 16 additions and 4 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -299,7 +299,15 @@ Foam::instantList Foam::timeSelector::selectIfPresent
else
{
// No timeSelector option specified. Do not change runTime.
return instantList(1, instant(runTime.value(), runTime.timeName()));
return instantList
(
1,
instant
(
runTime.timeToUserTime(runTime.value()),
runTime.timeName()
)
);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -759,7 +759,11 @@ Foam::IOobject Foam::fileOperation::findInstance
for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
{
if (ts[instanceI].value() <= startValue)
if
(
ts[instanceI].name() == time.constant()
|| ts[instanceI].value() <= startValue
)
{
break;
}