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

Correctly gather the next time-step

parent af97a961
No related branches found
No related tags found
1 merge request!301New time line
...@@ -972,6 +972,16 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { ...@@ -972,6 +972,16 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
ti_end_min = min(ti_end + ti_new_step, ti_end_min); ti_end_min = min(ti_end + ti_new_step, ti_end_min);
ti_end_max = max(ti_end + ti_new_step, ti_end_max); ti_end_max = max(ti_end + ti_new_step, ti_end_max);
} }
else { /* part is inactive */
const integertime_t ti_end =
get_integer_time_end(ti_current, p->time_bin);
/* What is the next sync-point ? */
ti_end_min = min(ti_end, ti_end_min);
ti_end_max = max(ti_end, ti_end_max);
}
} }
/* Loop over the g-particles in this cell. */ /* Loop over the g-particles in this cell. */
...@@ -980,34 +990,46 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { ...@@ -980,34 +990,46 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the part. */ /* Get a handle on the part. */
struct gpart *restrict gp = &gparts[k]; struct gpart *restrict gp = &gparts[k];
/* If the g-particle has no counterpart and needs to be kicked */ /* If the g-particle has no counterpart */
if (gp->id_or_neg_offset > 0 && gpart_is_active(gp, e)) { if (gp->id_or_neg_offset > 0) {
/* First, finish the force loop */ /* need to be kicked ? */
gravity_end_force(gp, const_G); if (gpart_is_active(gp, e)) {
const integertime_t ti_step = get_integer_timestep(gp->time_bin); /* First, finish the force loop */
const integertime_t ti_begin = gravity_end_force(gp, const_G);
get_integer_time_begin(ti_current, gp->time_bin);
const integertime_t ti_end =
get_integer_time_end(ti_current, gp->time_bin);
/* Finish the time-step with a second half-kick */ const integertime_t ti_step = get_integer_timestep(gp->time_bin);
kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, ti_current, const integertime_t ti_begin =
timeBase); get_integer_time_begin(ti_current, gp->time_bin);
const integertime_t ti_end =
get_integer_time_end(ti_current, gp->time_bin);
/* Get new time-step */ /* Finish the time-step with a second half-kick */
const integertime_t ti_new_step = get_gpart_timestep(gp, e); kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, ti_current,
timeBase);
/* Update particle */ /* Get new time-step */
gp->time_bin = get_time_bin(ti_new_step); const integertime_t ti_new_step = get_gpart_timestep(gp, e);
/* Number of updated g-particles */ /* Update particle */
g_updated++; gp->time_bin = get_time_bin(ti_new_step);
/* What is the next sync-point ? */ /* Number of updated g-particles */
ti_end_min = min(ti_end + ti_new_step, ti_end_min); g_updated++;
ti_end_max = max(ti_end + ti_new_step, ti_end_max);
/* What is the next sync-point ? */
ti_end_min = min(ti_end + ti_new_step, ti_end_min);
ti_end_max = max(ti_end + ti_new_step, ti_end_max);
} else { /* gpart is inactive */
const integertime_t ti_end =
get_integer_time_end(ti_current, gp->time_bin);
/* What is the next sync-point ? */
ti_end_min = min(ti_end, ti_end_min);
ti_end_max = max(ti_end, ti_end_max);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment