Commit 60084daa authored by Josh Borrow's avatar Josh Borrow
Browse files

Added timestep limiter for maximal u change

parent 09d36187
......@@ -283,7 +283,12 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
const float dt_cfl = 2.f * kernel_gamma * CFL_condition * cosmo->a * p->h /
(cosmo->a_factor_sound_speed * p->force.v_sig);
return dt_cfl;
/* Limit maximum change in u */
const float dt_u_change =
(p->u_dt != 0.0f) ? fabsf(const_max_u_change * p->u / p->u_dt)
: FLT_MAX;
return fminf(dt_cfl, dt_u_change);
}
/**
......
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