From 46fc6bd531f3171c1b50bfdff78d7db569b939cd Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Wed, 13 Feb 2019 22:01:19 +0100
Subject: [PATCH] Use the correct minimal limit when computing the alternative
 du/dt derivative in the Lambda and Compton coolin models.

---
 src/cooling/Compton/cooling.h      | 2 +-
 src/cooling/const_lambda/cooling.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cooling/Compton/cooling.h b/src/cooling/Compton/cooling.h
index ddc0f28be1..db4369884b 100644
--- a/src/cooling/Compton/cooling.h
+++ b/src/cooling/Compton/cooling.h
@@ -178,7 +178,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
    * this step 1/2 kick + another 1/2 kick that could potentially be for
    * a time-step twice as big. We hence check for 1.5 delta_t. */
   if (u_old + total_du_dt * 1.5 * dt_therm < u_limit) {
-    total_du_dt = (u_floor - u_old) / (1.5f * dt_therm);
+    total_du_dt = (u_limit - u_old) / (1.5f * dt_therm);
   }
 
   /* Second, check whether the energy used in the prediction could get negative.
diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h
index d11a3780c0..974b055b1f 100644
--- a/src/cooling/const_lambda/cooling.h
+++ b/src/cooling/const_lambda/cooling.h
@@ -156,7 +156,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
    * this step 1/2 kick + another 1/2 kick that could potentially be for
    * a time-step twice as big. We hence check for 1.5 delta_t. */
   if (u_old + total_du_dt * 1.5 * dt_therm < u_limit) {
-    total_du_dt = (u_floor - u_old) / (1.5f * dt_therm);
+    total_du_dt = (u_limit - u_old) / (1.5f * dt_therm);
   }
 
   /* Second, check whether the energy used in the prediction could get negative.
-- 
GitLab