Skip to content
Snippets Groups Projects
Commit a723dfd8 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Limit the time-step size such that the smoothing length does not change by...

Limit the time-step size such that the smoothing length does not change by more than a pre-defined constant.
parent d9db5d13
Branches
Tags
2 merge requests!136Master,!90Improved multi-timestep SPH
......@@ -28,12 +28,7 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
struct part* p, struct xpart* xp) {
/* CFL condition */
float dt_cfl = const_cfl * p->h / p->force.v_sig;
/* Limit change in h */
float dt_h_change = (p->h_dt != 0.0f)
? fabsf(const_ln_max_h_change * p->h / p->h_dt)
: FLT_MAX;
float dt_cfl = 2.f * const_cfl * kernel_gamma * p->h / p->force.v_sig;
/* Limit change in u */
float dt_u_change = (p->force.u_dt != 0.0f)
......
......@@ -871,7 +871,14 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
const float new_dt_grav = gravity_compute_timestep(p, xp);
new_dt = fminf(new_dt_hydro, new_dt_grav);
/* Limit change in h */
const float dt_h_change = (p->h_dt != 0.0f)
? fabsf(const_ln_max_h_change * p->h / p->h_dt)
: FLT_MAX;
new_dt = fminf(new_dt, dt_h_change);
/* Recover the current timestep */
const float current_dt = p->t_end - p->t_begin;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment