diff --git a/examples/SedovBlast_1D/sedov.yml b/examples/SedovBlast_1D/sedov.yml index 16b5cf9bc5351931d0ae318a5b690c262eff176d..b4252581d6eb3b2932a074e7545b2d308be51865 100644 --- a/examples/SedovBlast_1D/sedov.yml +++ b/examples/SedovBlast_1D/sedov.yml @@ -21,7 +21,7 @@ Snapshots: # Parameters governing the conserved quantities statistics Statistics: - delta_time: 1e-2 # Time between statistics output + delta_time: 1e-3 # Time between statistics output # Parameters for the hydrodynamics scheme SPH: diff --git a/src/cell.c b/src/cell.c index e3ac72519ffe457449dc6b7751a861c32738d12b..0c8d81289c040a5a5226d5a05b9ffed7865cde4b 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1633,7 +1633,10 @@ void cell_activate_drift_part(struct cell *c, struct scheduler *s) { for (struct cell *parent = c->parent; parent != NULL && !parent->hydro.do_sub_drift; parent = parent->parent) { + + /* Mark this cell for drifting */ parent->hydro.do_sub_drift = 1; + if (parent == c->hydro.super) { #ifdef SWIFT_DEBUG_CHECKS if (parent->hydro.drift == NULL) @@ -1705,19 +1708,30 @@ void cell_activate_limiter(struct cell *c, struct scheduler *s) { /* If this cell is already marked for drift, quit early. */ if (c->hydro.do_limiter) return; - /* Mark this cell for drifting. */ + /* Mark this cell for limiting. */ c->hydro.do_limiter = 1; /* Set the do_sub_limiter all the way up and activate the super limiter if this has not yet been done. */ if (c == c->super) { +#ifdef SWIFT_DEBUG_CHECKS + if (c->timestep_limiter == NULL) + error("Trying to activate un-existing c->timestep_limiter"); +#endif scheduler_activate(s, c->timestep_limiter); } else { for (struct cell *parent = c->parent; parent != NULL && !parent->hydro.do_sub_limiter; parent = parent->parent) { + + /* Mark this cell for limiting */ parent->hydro.do_sub_limiter = 1; + if (parent == c->super) { +#ifdef SWIFT_DEBUG_CHECKS + if (parent->timestep_limiter == NULL) + error("Trying to activate un-existing parent->timestep_limiter"); +#endif scheduler_activate(s, parent->timestep_limiter); break; } @@ -2791,7 +2805,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { /* Activate hydro drift */ if (t->type == task_type_self) { if (ci_nodeID == nodeID) cell_activate_drift_part(ci, s); - if (ci->nodeID == nodeID && with_limiter) cell_activate_limiter(ci, s); + if (ci_nodeID == nodeID && with_limiter) cell_activate_limiter(ci, s); } /* Set the correct sorting flags and activate hydro drifts */ @@ -2807,8 +2821,8 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { if (cj_nodeID == nodeID) cell_activate_drift_part(cj, s); /* Activate the limiter tasks. */ - if (ci->nodeID == nodeID && with_limiter) cell_activate_limiter(ci, s); - if (cj->nodeID == nodeID && with_limiter) cell_activate_limiter(cj, s); + if (ci_nodeID == nodeID && with_limiter) cell_activate_limiter(ci, s); + if (cj_nodeID == nodeID && with_limiter) cell_activate_limiter(cj, s); /* Check the sorts and activate them if needed. */ cell_activate_hydro_sorts(ci, t->flags, s); diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index d9b1a4cd345b725c442018836487b77c30169325..3a26dbb2f47f9503aa0b93fa28d679f5eebaeede 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -241,10 +241,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements, if (cj_nodeID == nodeID) cell_activate_drift_part(cj, s); /* And the limiter */ - if (ci->nodeID == nodeID && with_limiter) - cell_activate_limiter(ci, s); - if (cj->nodeID == nodeID && with_limiter) - cell_activate_limiter(cj, s); + if (ci_nodeID == nodeID && with_limiter) cell_activate_limiter(ci, s); + if (cj_nodeID == nodeID && with_limiter) cell_activate_limiter(cj, s); /* Check the sorts and activate them if needed. */ cell_activate_hydro_sorts(ci, t->flags, s); @@ -580,11 +578,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, scheduler_activate(s, t); } - /* Time-step limiter? */ - else if (t->type == task_type_timestep) { - if (cell_is_active_hydro(t->ci, e)) scheduler_activate(s, t); - } - /* Subgrid tasks */ else if (t_type == task_type_cooling) { if (cell_is_active_hydro(t->ci, e) || cell_is_active_gravity(t->ci, e)) diff --git a/src/runner.c b/src/runner.c index 01df46ed6eb8128cb9fc67a4d3a9a9c1e77ee8fa..330c9cbc2f473b46f1818213d94197e7164c073a 100644 --- a/src/runner.c +++ b/src/runner.c @@ -2349,6 +2349,15 @@ void runner_do_limiter(struct runner *r, struct cell *c, int force, int timer) { /* Limit irrespective of cell flags? */ force |= c->hydro.do_limiter; + /* Early abort? */ + if (c->hydro.count == 0) { + + /* Clear the limiter flags. */ + c->hydro.do_limiter = 0; + c->hydro.do_sub_limiter = 0; + return; + } + /* Loop over the progeny ? */ if (c->split && (force || c->hydro.do_sub_limiter)) { for (int k = 0; k < 8; k++) { diff --git a/src/space.c b/src/space.c index 40cbd10688c65a4c93685894732d18c6ce178e2a..0b3caac788d19d1098f5bf3496581bdf43d2c87d 100644 --- a/src/space.c +++ b/src/space.c @@ -245,6 +245,8 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, c->stars.do_sub_sort = 0; c->grav.do_sub_drift = 0; c->hydro.do_sub_drift = 0; + c->hydro.do_sub_limiter = 0; + c->hydro.do_limiter = 0; c->hydro.ti_end_min = -1; c->hydro.ti_end_max = -1; c->grav.ti_end_min = -1; @@ -2677,6 +2679,8 @@ void space_split_recursive(struct space *s, struct cell *c, cp->stars.do_sub_sort = 0; cp->grav.do_sub_drift = 0; cp->hydro.do_sub_drift = 0; + cp->hydro.do_sub_limiter = 0; + cp->hydro.do_limiter = 0; #ifdef WITH_MPI cp->mpi.tag = -1; #endif // WITH_MPI @@ -4282,7 +4286,9 @@ void space_check_limiter_mapper(void *map_data, int nr_parts, /* Verify that all limited particles have been treated */ for (int k = 0; k < nr_parts; k++) { - if (parts[k].wakeup == time_bin_awake) error("Particle still woken up!"); + if (parts[k].wakeup == time_bin_awake) + error("Particle still woken up! id=%lld", parts[k].id); + if (parts[k].gpart != NULL) if (parts[k].time_bin != parts[k].gpart->time_bin) error("Gpart not on the same time-bin as part");