Time: Added run-time selectable userTime option

replacing the virtual functions overridden in engineTime.

Now the userTime conversion function in Time is specified in system/controlDict
such that the solver as well as all pre- and post-processing tools also operate
correctly with the chosen user-time.

For example the user-time and rpm in the tutorials/combustion/XiEngineFoam/kivaTest case are
now specified in system/controlDict:

userTime
{
    type     engine;
    rpm      1500;
}

The default specification is real-time:

userTime
{
    type     real;
}

but this entry can be omitted as the real-time class is instantiated
automatically if the userTime entry is not present in system/controlDict.
This commit is contained in:
Henry Weller
2021-10-19 09:09:01 +01:00
parent 0a54efe189
commit 3ef3e96c3f
129 changed files with 849 additions and 198 deletions

View File

@ -139,7 +139,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
autoPtr<polyMeshFilter> meshFilterPtr;

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-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -448,7 +448,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
polyMesh::readUpdateState state = mesh.readUpdate();

View File

@ -47,7 +47,7 @@ adaptiveLinear::adaptiveLinear
relaxationModel(typeName, relaxationDict, runTime),
relaxationStart_(coeffDict().lookup<scalar>("relaxationStart")),
relaxationEnd_(coeffDict().lookup<scalar>("relaxationEnd")),
lastTimeValue_(runTime_.time().userTime()),
lastTimeValue_(runTime_.time().userTimeValue()),
relaxation_(relaxationStart_)
{}
@ -56,7 +56,7 @@ adaptiveLinear::adaptiveLinear
scalar adaptiveLinear::relaxation()
{
if (runTime_.time().userTime() > lastTimeValue_)
if (runTime_.time().userTimeValue() > lastTimeValue_)
{
scalar currentRelaxation = relaxation_;
@ -65,13 +65,13 @@ scalar adaptiveLinear::relaxation()
/(
(
runTime_.time().endTime().value()
- runTime_.time().userTime()
- runTime_.time().userTimeValue()
)
/(runTime_.time().userTime() - lastTimeValue_)
/(runTime_.time().userTimeValue() - lastTimeValue_)
+ 1
);
lastTimeValue_ = runTime_.time().userTime();
lastTimeValue_ = runTime_.time().userTimeValue();
return currentRelaxation;
}

View File

@ -62,7 +62,7 @@ rampHoldFall::rampHoldFall
scalar rampHoldFall::relaxation()
{
scalar t = runTime_.time().userTime();
scalar t = runTime_.time().userTimeValue();
scalar tStart = runTime_.time().startTime().value();
scalar tEnd = runTime_.time().endTime().value();

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-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
runTime++;
}
Info<< "Time = " << runTime.timeName() << nl
Info<< "Time = " << runTime.userTimeName() << nl
<< "Attaching sliding interface" << endl;
attachPolyTopoChanger(mesh).attach();

View File

@ -188,7 +188,7 @@ int main(int argc, char *argv[])
|| state == polyMesh::TOPO_PATCH_CHANGE
)
{
Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// Reconstruct globalMeshData
mesh.globalData();
@ -238,7 +238,7 @@ int main(int argc, char *argv[])
}
else if (state == polyMesh::POINTS_MOVED)
{
Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
label nFailedChecks = checkGeometry
(

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(Times[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
typeIOobject<volVectorField> Uheader
(

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
while (pimple.loop())
{

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
mesh.movePoints(motionPtr->newPoints());

View File

@ -115,7 +115,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
// Search for list of objects for this time
IOobjectList objects(mesh, runTime.timeName());

View File

@ -221,7 +221,7 @@ int main(int argc, char *argv[])
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timei], timei);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
// Optionally re-read mesh
meshReadUpdate(mesh);