From 01f1b23d06a2a5cde1aab8f1dd4ce1113af2330e Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 30 Nov 2020 17:09:00 +0100
Subject: [PATCH] Fix small typo in the kick2 integration of the mesh forces.
 An incorrect time-step length was used for one half time-step in the very
 rare case where the mesh time-step length decreases

---
 src/runner_time_integration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/runner_time_integration.c b/src/runner_time_integration.c
index bfb2611e5f..4dcb4d25f1 100644
--- a/src/runner_time_integration.c
+++ b/src/runner_time_integration.c
@@ -396,7 +396,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, const int timer) {
     if (periodic && e->mesh->ti_end_mesh_last == e->ti_current) {
 
       const integertime_t ti_step =
-          e->mesh->ti_end_mesh_next - e->mesh->ti_beg_mesh_next;
+          e->mesh->ti_end_mesh_last - e->mesh->ti_beg_mesh_last;
       ti_begin_mesh = e->mesh->ti_beg_mesh_last + ti_step / 2;
       ti_end_mesh = e->mesh->ti_end_mesh_last;
 
-- 
GitLab