diff --git a/src/cell.c b/src/cell.c index 2d450d289f330c111ef7edb7ecb2c49bbef54d3b..992bc5e65b82af51f2e27b32d05f127bc7162ba9 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2463,8 +2463,10 @@ void cell_activate_star_resort_tasks(struct cell *c, struct scheduler *s) { * * @param c The (top-level) #cell. * @param s The #scheduler. + * @param with_feedback Are we running with feedback? */ -void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { +void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s, + const int with_feedback) { #ifdef SWIFT_DEBUG_CHECKS if (c->depth != 0) error("Function should be called at the top-level only"); @@ -2477,7 +2479,7 @@ void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { scheduler_activate(s, c->hydro.star_formation); /* Activate the star resort tasks at whatever level they are */ - if (task_order_star_formation_before_feedback) { + if (task_order_star_formation_before_feedback && with_feedback) { cell_activate_star_resort_tasks(c, s); } } @@ -3379,12 +3381,12 @@ void cell_activate_subcell_external_grav_tasks(struct cell *ci, int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { struct engine *e = s->space->e; const int nodeID = e->nodeID; + const int with_feedback = e->policy & engine_policy_feedback; const int with_timestep_limiter = (e->policy & engine_policy_timestep_limiter); #ifdef WITH_MPI const int with_star_formation = e->policy & engine_policy_star_formation; - const int with_feedback = e->policy & engine_policy_feedback; #endif int rebuild = 0; @@ -3620,7 +3622,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { #endif if (c->top->hydro.star_formation != NULL) { - cell_activate_star_formation_tasks(c->top, s); + cell_activate_star_formation_tasks(c->top, s, with_feedback); } } diff --git a/src/cell.h b/src/cell.h index c9764d748c2fdc75c7d948e915ea5026b3c72ea3..13621f0cd2a7e82abd70a4e4bb1e8b0a7ff67478 100644 --- a/src/cell.h +++ b/src/cell.h @@ -888,7 +888,8 @@ void cell_drift_all_multipoles(struct cell *c, const struct engine *e); void cell_check_timesteps(struct cell *c); void cell_store_pre_drift_values(struct cell *c); void cell_set_star_resort_flag(struct cell *c); -void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s); +void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s, + const int with_feedback); void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj, struct scheduler *s); void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index fd1cd787dcdb44f61c5819e6275345f54a5d0bfb..b783a248a2b2f6e884f3bd53ebf9fd9ef48da554 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1048,7 +1048,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, (star_resort_cell == NULL) && (c->depth == engine_star_resort_task_depth || c->hydro.super == c)) { - if (with_star_formation && c->hydro.count > 0) { + if (with_feedback && with_star_formation && c->hydro.count > 0) { /* Record this is the level where we re-sort */ star_resort_cell = c; @@ -1152,7 +1152,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, #endif scheduler_addunlock(s, c->stars.stars_out, c->super->timestep); - if (with_star_formation && c->hydro.count > 0) { + if (with_feedback && with_star_formation && c->hydro.count > 0) { task_order_addunlock_star_formation_feedback(s, c, star_resort_cell); } } diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c index 25d27c1b3d231687829fbfd4aeb046f0b3fea873..0229c043206978fb2df68bbbbc79a9e530ce38cc 100644 --- a/src/engine_marktasks.c +++ b/src/engine_marktasks.c @@ -73,9 +73,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, const int with_timestep_limiter = e->policy & engine_policy_timestep_limiter; const int with_timestep_sync = e->policy & engine_policy_timestep_sync; const int with_star_formation = e->policy & engine_policy_star_formation; -#ifdef WITH_MPI const int with_feedback = e->policy & engine_policy_feedback; -#endif for (int ind = 0; ind < num_elements; ind++) { @@ -960,7 +958,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, /* Subgrid tasks: star formation */ else if (t_type == task_type_star_formation) { if (cell_is_active_hydro(t->ci, e)) { - cell_activate_star_formation_tasks(t->ci, s); + cell_activate_star_formation_tasks(t->ci, s, with_feedback); cell_activate_super_spart_drifts(t->ci, s); } }