diff --git a/src/cell.c b/src/cell.c index af4edc6a92dd8ed84dd4cd8cc869b8c32c4f81e8..9fd32ed8c6402d51358bcdc888aefaad16abe7c2 100644 --- a/src/cell.c +++ b/src/cell.c @@ -3596,11 +3596,15 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s) { * * @param c The top-level #cell to play with. * @param super Pointer to the deepest cell with tasks in this part of the tree. + * @param with_hydro Are we running with hydrodynamics on? + * @param with_grav Are we running with gravity on? */ -void cell_set_super(struct cell *c, struct cell *super) { +void cell_set_super(struct cell *c, struct cell *super, const int with_hydro, + const int with_grav) { /* Are we in a cell which is either the hydro or gravity super? */ - if (super == NULL && (c->hydro.super != NULL || c->grav.super != NULL)) + if (super == NULL && ((with_hydro && c->hydro.super != NULL) || + (with_grav && c->grav.super != NULL))) super = c; /* Set the super-cell */ @@ -3609,7 +3613,8 @@ void cell_set_super(struct cell *c, struct cell *super) { /* Recurse */ if (c->split) for (int k = 0; k < 8; k++) - if (c->progeny[k] != NULL) cell_set_super(c->progeny[k], super); + if (c->progeny[k] != NULL) + cell_set_super(c->progeny[k], super, with_hydro, with_grav); } /** @@ -3668,6 +3673,10 @@ void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data) { const struct engine *e = (const struct engine *)extra_data; + const int with_hydro = (e->policy & engine_policy_hydro); + const int with_grav = (e->policy & engine_policy_self_gravity) || + (e->policy & engine_policy_external_gravity); + for (int ind = 0; ind < num_elements; ind++) { struct cell *c = &((struct cell *)map_data)[ind]; @@ -3677,15 +3686,13 @@ void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data) { #endif /* Super-pointer for hydro */ - if (e->policy & engine_policy_hydro) cell_set_super_hydro(c, NULL); + if (with_hydro) cell_set_super_hydro(c, NULL); /* Super-pointer for gravity */ - if ((e->policy & engine_policy_self_gravity) || - (e->policy & engine_policy_external_gravity)) - cell_set_super_gravity(c, NULL); + if (with_grav) cell_set_super_gravity(c, NULL); /* Super-pointer for common operations */ - cell_set_super(c, NULL); + cell_set_super(c, NULL, with_hydro, with_grav); } } diff --git a/src/cell.h b/src/cell.h index b13889abda54f77ec2030bf2262dca30440bdc4e..baae12e4a5797e3b1e00eee144635e41b52c157e 100644 --- a/src/cell.h +++ b/src/cell.h @@ -747,7 +747,6 @@ void cell_reset_task_counters(struct cell *c); int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s); int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s); int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s); -void cell_set_super(struct cell *c, struct cell *super); void cell_drift_part(struct cell *c, const struct engine *e, int force); void cell_drift_gpart(struct cell *c, const struct engine *e, int force); void cell_drift_spart(struct cell *c, const struct engine *e, int force); diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index 6340cb17eb574822957aa4a7e6180cda9a14b5d7..d1858f87ff0bfdfee878f2e53b81e100812fd0a5 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -2066,7 +2066,7 @@ void engine_make_hydroloop_tasks_mapper(void *map_data, int num_elements, struct cell *ci = &cells[cid]; /* Skip cells without hydro or star particles */ - if ((ci->hydro.count == 0) && (with_feedback && ci->stars.count == 0)) + if ((ci->hydro.count == 0) && (!with_feedback || ci->stars.count == 0)) continue; /* If the cell is local build a self-interaction */ @@ -2096,7 +2096,7 @@ void engine_make_hydroloop_tasks_mapper(void *map_data, int num_elements, /* Is that neighbour local and does it have gas or star particles ? */ if ((cid >= cjd) || ((cj->hydro.count == 0) && - (with_feedback && cj->stars.count == 0)) || + (!with_feedback || cj->stars.count == 0)) || (ci->nodeID != nodeID && cj->nodeID != nodeID)) continue; diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h index cbf3065f1db09d60215f6e9a02783de958418ab5..0a9fa7f792527b44c46ff950ba82b1708ed410ff 100644 --- a/src/stars/Default/stars_iact.h +++ b/src/stars/Default/stars_iact.h @@ -81,7 +81,7 @@ runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj, struct part *restrict pj, float a, float H) { const float mj = hydro_get_mass(pj); - const float rhoj = pj->rho; + const float rhoj = hydro_get_comoving_density(pj); const float r = sqrtf(r2); const float ri = 1.f / r;