From b64b0b9eaa6e2f8d7cba1ec0cdd48fed821b6b8a Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 1 Aug 2018 12:25:14 +0200
Subject: [PATCH] [timeloop] Adjust timeStepSize on setMaxTimeStepSize

---
 dumux/common/timeloop.hh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh
index c683c8292e..a2a97532c4 100644
--- a/dumux/common/timeloop.hh
+++ b/dumux/common/timeloop.hh
@@ -221,7 +221,11 @@ public:
      * \param maxDt The new value for the maximum time step size \f$\mathrm{[s]}\f$
      */
     void setMaxTimeStepSize(Scalar maxDt)
-    { maxTimeStepSize_ = maxDt; }
+    {
+        using std::min;
+        maxTimeStepSize_ = maxDt;
+        timeStepSize_ = min(timeStepSize_, maxDt);
+    }
 
     /*!
      * \brief Returns the suggested time step length \f$\mathrm{[s]}\f$ so that we
@@ -333,7 +337,6 @@ public:
 
 private:
     //! Computes the maximum timestep size respecting end time
-    //! and possibly episodes (TODO)
     void computeMaxTimeStepSize_()
     {
         if (finished())
@@ -345,7 +348,6 @@ private:
         using std::max;
         using std::min;
 
-        // TODO check for episodes if there is an episode manager
         maxTimeStepSize_ = min(maxTimeStepSize_, max<Scalar>(0.0, endTime_ - time_));
     }
 
-- 
GitLab