From 30512ec12da9c5f9a435750e0e061596f3bec4d1 Mon Sep 17 00:00:00 2001
From: mattijs <m.janssens@opencfd.co.uk>
Date: Fri, 25 Jul 2008 12:45:22 +0100
Subject: [PATCH] correcting interval dumping when changing dump interval

---
 src/OpenFOAM/db/Time/TimeIO.C | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C
index fc3ad8857cc..c74b6743898 100644
--- a/src/OpenFOAM/db/Time/TimeIO.C
+++ b/src/OpenFOAM/db/Time/TimeIO.C
@@ -44,6 +44,7 @@ void Foam::Time::readDict()
         );
     }
 
+    scalar oldWriteInterval = writeInterval_;
     if (controlDict_.readIfPresent("writeInterval", writeInterval_))
     {
         if (writeControl_ == wcTimeStep && label(writeInterval_) < 1)
@@ -58,6 +59,22 @@ void Foam::Time::readDict()
         controlDict_.lookup("writeFrequency") >> writeInterval_;
     }
 
+    if (oldWriteInterval != writeInterval_)
+    {
+        switch(writeControl_)
+        {
+            case wcRunTime:
+            case wcAdjustableRunTime:
+                // Recalculate outputTimeIndex_ to be in units of current
+                // writeInterval.
+                outputTimeIndex_ *= oldWriteInterval/writeInterval_;
+            break;
+
+            default:
+            break;
+        }
+    }
+
     if (controlDict_.readIfPresent("purgeWrite", purgeWrite_))
     {
         if (purgeWrite_ < 0)
-- 
GitLab