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

@ -24,7 +24,5 @@ stroke stroke [0 1 0 0 0 0 0] 0.08423;
clearance clearance [0 1 0 0 0 0 0] 0.00115;
rpm rpm [0 0 -1 0 0 0 0] 1500;
// ************************************************************************* //

View File

@ -50,6 +50,12 @@ maxCo 0.2;
maxDeltaT 1;
userTime
{
type engine;
rpm 1500;
}
functions
{
setDeltaT

View File

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
const scalar LOGvGreat = ::log(vGreat);
while (!runTime.end())
{
scalar t = runTime.userTime()/lambda;
scalar t = runTime.userTimeValue()/lambda;
forAll(A, i)
{
if (bk[i]*t < LOGvGreat)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Info<< "Time = " << runTime.userTimeName() << endl;
// Check for new mesh
mesh.readUpdate();