From bd8ac24a9f014619f08a337266057bb20e62780e Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sat, 10 Feb 2018 16:23:11 +0100 Subject: [PATCH] Do not allow particles to take a time-step smaller than the minimum. --- src/timestep.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/timestep.h b/src/timestep.h index efc1b09aef..309a0b1407 100644 --- a/src/timestep.h +++ b/src/timestep.h @@ -83,7 +83,9 @@ __attribute__((always_inline)) INLINE static integertime_t get_gpart_timestep( /* Limit timestep within the allowed range */ new_dt = min(new_dt, e->dt_max); - new_dt = max(new_dt, e->dt_min); + if (new_dt < e->dt_min) + error("gpart (id=%lld) wants a time-step (%e) below dt_min (%e)", + gp->id_or_neg_offset, new_dt, e->dt_min); /* Convert to integer time */ const integertime_t new_dti = make_integer_timestep( @@ -139,7 +141,9 @@ __attribute__((always_inline)) INLINE static integertime_t get_part_timestep( /* Limit timestep within the allowed range */ new_dt = min(new_dt, e->dt_max); - new_dt = max(new_dt, e->dt_min); + if (new_dt < e->dt_min) + error("part (id=%lld) wants a time-step (%e) below dt_min (%e)", p->id, + new_dt, e->dt_min); /* Convert to integer time */ const integertime_t new_dti = make_integer_timestep( @@ -170,7 +174,9 @@ __attribute__((always_inline)) INLINE static integertime_t get_spart_timestep( /* Limit timestep within the allowed range */ new_dt = min(new_dt, e->dt_max); - new_dt = max(new_dt, e->dt_min); + if (new_dt < e->dt_min) + error("spart (id=%lld) wants a time-step (%e) below dt_min (%e)", sp->id, + new_dt, e->dt_min); /* Convert to integer time */ const integertime_t new_dti = make_integer_timestep( -- GitLab