From 6b6eb84c92efce1cdd462032faa310092a492c85 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 8 Oct 2019 10:54:29 +0200
Subject: [PATCH] Minor fixes to the time-step limiting logic.

---
 src/hydro/Minimal/hydro_iact.h | 6 ------
 src/timestep_limiter.h         | 9 +++------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h
index 94a23fff44..628307bc16 100644
--- a/src/hydro/Minimal/hydro_iact.h
+++ b/src/hydro/Minimal/hydro_iact.h
@@ -460,12 +460,6 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
       pj->wakeup = time_bin_awake;
     else if (pj->wakeup > 0)
       pj->wakeup = -pj->wakeup;
-    else {
-#ifdef SWIFT_DEBUG_CHECKS
-      if (pj->wakeup != time_bin_awake)
-        error("Invalid wakeup flag=%d", pj->wakeup);
-#endif
-    }
   }
 }
 
diff --git a/src/timestep_limiter.h b/src/timestep_limiter.h
index e45d288624..7695553801 100644
--- a/src/timestep_limiter.h
+++ b/src/timestep_limiter.h
@@ -53,14 +53,14 @@ __attribute__((always_inline)) INLINE static integertime_t timestep_limit_part(
     old_time_bin = p->time_bin;
   } else {
 
+    message("Relimiting particle %lld wakeup=%d", p->id, p->wakeup);
+
     /* Particle that was limited in the previous step already */
     old_ti_beg = get_integer_time_begin(e->ti_current, -p->wakeup);
     old_ti_end = get_integer_time_end(e->ti_current, p->time_bin);
     old_time_bin = -p->wakeup;
   }
 
-  message("Limiting particle %lld wakeup=%d", p->id, p->wakeup);
-
   const integertime_t old_dti = old_ti_end - old_ti_beg;
 
   /* The new fake time-step the particle will be on */
@@ -139,10 +139,7 @@ __attribute__((always_inline)) INLINE static integertime_t timestep_limit_part(
             new_ti_beg + new_dti / 2);
 
   /* Remember the old time-bin */
-  if (p->wakeup == time_bin_awake)
-    p->wakeup = old_time_bin;
-  else
-    p->wakeup = time_bin_not_awake;
+  p->wakeup = old_time_bin;
 
   /* Update the time bin of this particle */
   p->time_bin = e->min_active_bin;
-- 
GitLab