From e4af484f59b064bd6a5269e7877f1bd5eb295aa3 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 11 May 2018 18:11:44 +0100
Subject: [PATCH] Add a workaround for the cosmological RMS time-step size in
 the case where gravity is not computed.

---
 src/engine.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index e6e0acc3a9..077946a158 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -6229,8 +6229,11 @@ void engine_recompute_displacement_constraint(struct engine *e) {
   const float vel_norm_b = vel_norm[0] + vel_norm[4];
 
   /* Mesh forces smoothing scale */
-  const float a_smooth =
-      e->gravity_properties->a_smooth * e->s->dim[0] / e->s->cdim[0];
+  float a_smooth;
+  if((e->policy & engine_policy_self_gravity) && e->s->periodic == 1)
+    a_smooth = e->gravity_properties->a_smooth * e->s->dim[0] / e->s->cdim[0];
+  else
+    a_smooth = FLT_MAX;
 
   float dt_dm = FLT_MAX, dt_b = FLT_MAX;
 
-- 
GitLab