View Issue Details

IDProjectCategoryView StatusLast Update
0004070OpenFOAMContributionpublic2024-04-10 12:45
Reporterblttkgl Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Summary0004070: add userTime support to timeStep function object
DescriptiontimeStep function object writes the real time step into the disk, but not the userTime when userTime is used. The attached diff includes this optional functionality, following the "perTimeStep" functionality in the time function object.

Steps To Reproduceadd the following to the system/functions inside the kivaTest tutorial:

#includeFunc timeStep(userTime=yes)
TagsNo tags attached.

Activities

blttkgl

2024-04-10 11:37

reporter  

userTime.diff (2,076 bytes)   
diff --git a/src/functionObjects/utilities/timeStep/timeStepFunctionObject.C b/src/functionObjects/utilities/timeStep/timeStepFunctionObject.C
index 5249054..da6295a 100644
--- a/src/functionObjects/utilities/timeStep/timeStepFunctionObject.C
+++ b/src/functionObjects/utilities/timeStep/timeStepFunctionObject.C
@@ -55,7 +55,8 @@ Foam::functionObjects::timeStep::timeStep
 )
 :
     regionFunctionObject(name, runTime, dict),
-    logFiles(obr_, name)
+    logFiles(obr_, name),
+    userTime_(false)
 {
     read(dict);
 }
@@ -73,6 +74,8 @@ bool Foam::functionObjects::timeStep::read(const dictionary& dict)
 {
     functionObject::read(dict);
 
+    dict.readIfPresent("userTime", userTime_);
+
     resetName(typeName);
 
     return true;
@@ -85,8 +88,12 @@ void Foam::functionObjects::timeStep::writeFileHeader(const label i)
     {
         writeHeader(file(), "Time step");
         writeCommented(file(), "Time");
+        writeTabbed(file(), "deltaT");
 
-        file() << tab << "deltaT";
+        if (userTime_)
+        {
+            writeTabbed(file(), "userDeltaT");
+        }
 
         file() << endl;
     }
@@ -109,6 +116,11 @@ bool Foam::functionObjects::timeStep::write()
 
         file() << tab << time_.deltaTValue();
 
+        if (userTime_)
+        {
+            file() << tab << time_.timeToUserTime(time_.deltaTValue()) ;
+        }
+
         file() << endl;
     }
 
diff --git a/src/functionObjects/utilities/timeStep/timeStepFunctionObject.H b/src/functionObjects/utilities/timeStep/timeStepFunctionObject.H
index 79a9ba1..072978f 100644
--- a/src/functionObjects/utilities/timeStep/timeStepFunctionObject.H
+++ b/src/functionObjects/utilities/timeStep/timeStepFunctionObject.H
@@ -37,6 +37,7 @@ Description
 
         writeControl    timeStep;
         writeInterval   1;
+        userTime        no;
     }
     \endverbatim
 
@@ -74,6 +75,10 @@ class timeStep
     public regionFunctionObject,
     public logFiles
 {
+    // Private member data
+
+    //- Additionally write userTime to the log
+    Switch userTime_;
 
 protected:
 
userTime.diff (2,076 bytes)   

blttkgl

2024-04-10 11:55

reporter   ~0013221

What would also be nice is to have userDeltaT in the main solver output as well, along with the real deltaT.

henry

2024-04-10 12:45

manager   ~0013222

To be discussed with and funded by the reporter.

Issue History

Date Modified Username Field Change
2024-04-10 11:37 blttkgl New Issue
2024-04-10 11:37 blttkgl File Added: userTime.diff
2024-04-10 11:55 blttkgl Note Added: 0013221
2024-04-10 12:45 henry Assigned To => henry
2024-04-10 12:45 henry Status new => closed
2024-04-10 12:45 henry Resolution open => no change required
2024-04-10 12:45 henry Note Added: 0013222