mapFields: Corrected handling of userTime

Resolves bug-report https://bugs.openfoam.org/view.php?id=3786
This commit is contained in:
Henry Weller
2022-01-18 10:52:06 +00:00
parent c104aac1da
commit ded017b762
10 changed files with 35 additions and 29 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-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -924,8 +924,8 @@ int main(int argc, char *argv[])
runTime++;
}
Info<< "Writing mesh without blockedCells to time " << runTime.value()
<< endl;
Info<< "Writing mesh without blockedCells to time "
<< runTime.userTimeName() << endl;
// Subsetting adds 'subset' prefix. Rename field to be like original.
forAll(scalarFlds, i)
@ -1147,8 +1147,8 @@ int main(int argc, char *argv[])
subsetter.subMesh().movePoints(map().preMotionPoints());
}
Info<< "Writing mesh with split blockedFaces to time " << runTime.value()
<< endl;
Info<< "Writing mesh with split blockedFaces to time "
<< runTime.userTimeName() << endl;
subsetter.subMesh().write();

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
@ -136,11 +136,6 @@ void fieldInterpolator::interpolate()
UIndirectList<word>(timeNames_, indices)()
);
// Info<< "For time " << runTime_.value()
// << " need times " << selectedTimeNames
// << " need weights " << weights << endl;
// Read on the objectRegistry all the required fields
ReadFields<GeoFieldType>
(

View File

@ -1,4 +1,13 @@
{
instantList sourceTimes = runTimeSource.times();
if (sourceTimes.empty())
{
FatalErrorInFunction << "No result times in source "
<< runTimeSource.caseName()
<< exit(FatalError);
}
label sourceTimeIndex = runTimeSource.timeIndex();
if (args.optionFound("sourceTime"))
{
@ -20,12 +29,13 @@
sourceTimeIndex = Time::findClosestTimeIndex
(
sourceTimes,
runTimeTarget.time().value()
runTimeTarget.time().userTimeValue()
);
}
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
Info<< "\nSource time: " << runTimeSource.value()
<< "\nTarget time: " << runTimeTarget.value()
Info<< "\nSource time: " << runTimeSource.userTimeName()
<< "\nTarget time: " << runTimeTarget.userTimeName()
<< endl;
}

View File

@ -29,13 +29,13 @@
sourceTimeIndex = Time::findClosestTimeIndex
(
sourceTimes,
runTimeTarget.time().value()
runTimeTarget.time().userTimeValue()
);
}
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
Info<< "\nSource time: " << runTimeSource.value()
<< "\nTarget time: " << runTimeTarget.value()
Info<< "\nSource time: " << runTimeSource.userTimeName()
<< "\nTarget time: " << runTimeTarget.userTimeName()
<< endl;
}

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-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
Info<< "Excluding all processor patches." << nl << endl;
}
Info<< "Reading mesh from time " << runTime.value() << endl;
Info<< "Reading mesh from time " << runTime.userTimeName() << endl;
#include "createNamedPolyMesh.H"

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-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -324,7 +324,8 @@ int main(int argc, char *argv[])
runTime++;
// Write resulting mesh
Info<< "Writing modified mesh to time " << runTime.value() << endl;
Info<< "Writing modified mesh to time "
<< runTime.userTimeName() << endl;
mesh.write();
}

View File

@ -304,7 +304,7 @@ Foam::instantList Foam::timeSelector::selectIfPresent
1,
instant
(
runTime.timeToUserTime(runTime.value()),
runTime.userTimeValue(),
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) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ void Foam::patchProbes::sampleAndWrite
probeStream
<< setw(w)
<< vField.time().timeToUserTime(vField.time().value());
<< vField.time().userTimeValue();
forAll(values, probei)
{
@ -71,7 +71,7 @@ void Foam::patchProbes::sampleAndWrite
probeStream
<< setw(w)
<< sField.time().timeToUserTime(sField.time().value());
<< sField.time().userTimeValue();
forAll(values, probei)
{

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-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,7 +76,7 @@ void Foam::probes::sampleAndWrite
const unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& os = *probeFilePtrs_[vField.name()];
os << setw(w) << vField.time().timeToUserTime(vField.time().value());
os << setw(w) << vField.time().userTimeValue();
forAll(values, probei)
{
@ -102,7 +102,7 @@ void Foam::probes::sampleAndWrite
const unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& os = *probeFilePtrs_[sField.name()];
os << sField.time().timeToUserTime(sField.time().value());
os << sField.time().userTimeValue();
forAll(values, probei)
{

View File

@ -70,7 +70,7 @@ functions
codeExecute
#{
const Time& runTime = mesh().time();
if (runTime.timeToUserTime(runTime.value()) >= -15.0)
if (runTime.userTimeValue() >= -15.0)
{
const_cast<Time&>(runTime).setDeltaT
(