From 0d73ea36d04fa6c11015b0bbf337aa866aa831aa Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 1 Feb 2017 14:09:35 +0000
Subject: [PATCH] Don't divide by time-step if time-step is zero in the
 hydro_kick

---
 src/hydro/Gadget2/hydro.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h
index eaeecbffbc..160a2d8b5d 100644
--- a/src/hydro/Gadget2/hydro.h
+++ b/src/hydro/Gadget2/hydro.h
@@ -377,7 +377,7 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
     struct part *restrict p, struct xpart *restrict xp, float dt) {
 
   /* Do not decrease the entropy by more than a factor of 2 */
-  if (p->entropy_dt < -0.5f * xp->entropy_full / dt) {
+  if (dt > 0. && p->entropy_dt * dt < -0.5f * xp->entropy_full) {
     /* message("Warning! Limiting entropy_dt. Possible cooling error.\n
      * entropy_full = %g \n entropy_dt * dt =%g \n", */
     /* 	     xp->entropy_full,p->entropy_dt * dt); */
-- 
GitLab