Commit d847056c authored by Bert Vandenbroucke's avatar Bert Vandenbroucke Committed by Matthieu Schaller
Browse files

Added debug check on particle drift distance.

parent b403c0fa
......@@ -2405,6 +2405,15 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
drift_part(p, xp, dt_drift, dt_kick_hydro, dt_kick_grav, dt_therm,
ti_old_part, ti_current);
/* Make sure the particle does not drift by more than a box length. */
if (fabsf(xp->v_full[0] * dt_drift) > e->s->dim[0] ||
fabsf(xp->v_full[1] * dt_drift) > e->s->dim[1] ||
fabsf(xp->v_full[2] * dt_drift) > e->s->dim[2]) {
error("Particle drifts by more than a box length!");
/* Limit h to within the allowed range */
p->h = min(p->h, hydro_h_max);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment