From 5e77dece8b18558457480f87594a9b112c1db9c0 Mon Sep 17 00:00:00 2001
From: podlesny <podlesny@zedat.fu-berlin.de>
Date: Tue, 14 Sep 2021 00:27:09 +0200
Subject: [PATCH] add minTau as minimal time step threshold

---
 dune/tectonic/time-stepping/adaptivetimestepper.cc | 9 ++++++++-
 dune/tectonic/time-stepping/adaptivetimestepper.hh | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dune/tectonic/time-stepping/adaptivetimestepper.cc b/dune/tectonic/time-stepping/adaptivetimestepper.cc
index d9ef1c5a..d8b00908 100644
--- a/dune/tectonic/time-stepping/adaptivetimestepper.cc
+++ b/dune/tectonic/time-stepping/adaptivetimestepper.cc
@@ -43,9 +43,11 @@ AdaptiveTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::AdaptiveTime
         Updaters &current,
         double relativeTime,
         double relativeTau,
+        double minTau,
         std::function<bool(Updaters &, Updaters &)> mustRefine)
     : relativeTime_(relativeTime),
       relativeTau_(relativeTau),
+      minTau_(minTau),
       stepBase_(stepBase),
       contactNetwork_(contactNetwork),
       current_(current),
@@ -133,6 +135,11 @@ int AdaptiveTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::refine(U
     const auto& currentNBodyAssembler = contactNetwork_.nBodyAssembler();
 
     while (true) {
+        if (relativeTau_ / 2.0 <= minTau_) {
+          std::cout << "Sufficiently refined!" << std::endl;
+          break;
+        }
+
         setDeformation(current_);
         //auto F1_linearSolver = makeLinearSolver();
         auto F1_Step = Step(stepBase_, current_, currentNBodyAssembler, relativeTime_, relativeTau_ / 2.0, iterationRegister_);
@@ -236,7 +243,7 @@ int AdaptiveTimeStepper<Factory, ContactNetwork, Updaters, ErrorNorms>::determin
 
         F1 = F1_Step.get();
 
-        if (strategy>-1) {
+        if (strategy>-1 && relativeTau_ / 2.0 > minTau_) {
             setDeformation(F1.updaters);
             //auto F2_linearSolver = makeLinearSolver();
             auto&& nBodyAssembler = step(currentNBodyAssembler);
diff --git a/dune/tectonic/time-stepping/adaptivetimestepper.hh b/dune/tectonic/time-stepping/adaptivetimestepper.hh
index 2d11dd9d..43b16ec6 100644
--- a/dune/tectonic/time-stepping/adaptivetimestepper.hh
+++ b/dune/tectonic/time-stepping/adaptivetimestepper.hh
@@ -51,6 +51,7 @@ class AdaptiveTimeStepper {
                       Updaters &current,
                       double relativeTime,
                       double relativeTau,
+                      double minTau,
                       std::function<bool(Updaters &, Updaters &)> mustRefine);
 
   bool reachedEnd();
@@ -59,6 +60,7 @@ class AdaptiveTimeStepper {
 
   double relativeTime_;
   double relativeTau_;
+  const double minTau_;
 
 private:
   void setDeformation(const Updaters& updaters);
-- 
GitLab