From 19dae51a8dd18a1e314e75bec28ad94b69f8911b Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Fri, 11 Nov 2016 18:36:33 +0000
Subject: [PATCH] When not drifting because the cell has already drifted this
 step, keep the h_max and dx_max, don't reset to zero

---
 src/runner.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/runner.c b/src/runner.c
index 9952d54e19..b3c8a03e97 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -799,7 +799,7 @@ static void runner_do_drift(struct cell *c, struct engine *e, int drift) {
   if (!c->split) {
 
     /* Check that we are actually going to move forward. */
-    if (ti_current >= ti_old) {
+    if (ti_current > ti_old) {
 
       /* Loop over all the g-particles in the cell */
       const size_t nr_gparts = c->gcount;
@@ -843,6 +843,12 @@ static void runner_do_drift(struct cell *c, struct engine *e, int drift) {
       dx_max = sqrtf(dx2_max);
 
     } /* Check that we are actually going to move forward. */
+
+    else {
+      /* ti_old == ti_current, just keep the current cell values. */
+      h_max = c->h_max;
+      dx_max = c->dx_max;
+    }
   }
 
   /* Otherwise, aggregate data from children. */
-- 
GitLab