Commit b3d15f19 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'master' into FOF

parents 2eab57f5 08d81da1
......@@ -519,13 +519,12 @@ int main(int argc, char *argv[]) {
#ifdef WITH_MPI
if (with_mpole_reconstruction && nr_nodes > 1)
error("Cannot reconstruct m-poles every step over MPI (yet).");
if (with_star_formation && with_feedback)
error("Can't run with star formation and feedback over MPI (yet)");
if (with_limiter) error("Can't run with time-step limiter over MPI (yet)");
#endif
/* Temporary early aborts for modes not supported with hand-vec. */
#if defined(WITH_VECTORIZATION) && !defined(CHEMISTRY_NONE)
#if defined(WITH_VECTORIZATION) && defined(GADGET2_SPH) && \
!defined(CHEMISTRY_NONE)
error(
"Cannot run with chemistry and hand-vectorization (yet). "
"Use --disable-hand-vec at configure time.");
......
......@@ -496,6 +496,28 @@ __attribute__((always_inline)) INLINE static int cell_is_starting_stars(
return (c->stars.ti_beg_max == e->ti_current);
}
/**
* @brief Does a cell contain any b-particle starting their time-step now ?
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int cell_is_starting_black_holes(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->black_holes.ti_beg_max > e->ti_current)
error(
"cell in an impossible time-zone! c->ti_beg_max=%lld (t=%e) and "
"e->ti_current=%lld (t=%e, a=%e)",
c->black_holes.ti_beg_max, c->black_holes.ti_beg_max * e->time_base,
e->ti_current, e->ti_current * e->time_base, e->cosmology->a);
#endif
return (c->black_holes.ti_beg_max == e->ti_current);
}
/**
* @brief Is this particle starting its time-step now ?
*
......
......@@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void black_holes_prepare_feedback(
4. * M_PI * G * BH_mass * proton_mass / (epsilon_r * c * sigma_Thomson);
/* Limit the accretion rate to the Eddington fraction */
const double accr_rate = max(Bondi_rate, f_Edd * Eddington_rate);
const double accr_rate = min(Bondi_rate, f_Edd * Eddington_rate);
bp->accretion_rate = accr_rate;
/* Factor in the radiative efficiency */
......
This diff is collapsed.
......@@ -253,6 +253,26 @@ struct pcell_step_black_holes {
float dx_max_part;
};
/**
* @brief Cell information to propagate the new counts of star particles.
*/
struct pcell_sf {
/*! Stars variables */
struct {
/* Distance by which the stars pointer has moved since the last rebuild */
ptrdiff_t delta_from_rebuild;
/* Number of particles in the cell */
int count;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
} stars;
};
/** Bitmasks for the cell flags. Beware when adding flags that you don't exceed
the size of the flags variable in the struct cell. */
enum cell_flags {
......@@ -521,6 +541,9 @@ struct cell {
/*! Pointer to the #spart data. */
struct spart *parts;
/*! Pointer to the #spart data at rebuild time. */
struct spart *parts_rebuild;
/*! The star ghost task itself */
struct task *ghost;
......@@ -802,6 +825,8 @@ int cell_unpack_end_step_black_holes(struct cell *c,
struct pcell_step_black_holes *pcell);
int cell_pack_multipoles(struct cell *c, struct gravity_tensors *m);
int cell_unpack_multipoles(struct cell *c, struct gravity_tensors *m);
int cell_pack_sf_counts(struct cell *c, struct pcell_sf *pcell);
int cell_unpack_sf_counts(struct cell *c, struct pcell_sf *pcell);
int cell_getsize(struct cell *c);
int cell_link_parts(struct cell *c, struct part *parts);
int cell_link_gparts(struct cell *c, struct gpart *gparts);
......@@ -822,7 +847,8 @@ void cell_check_spart_drift_point(struct cell *c, void *data);
void cell_check_multipole_drift_point(struct cell *c, void *data);
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_stars_tasks(struct cell *c, struct scheduler *s,
const int with_star_formation);
int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s);
int cell_unskip_gravity_tasks(struct cell *c, struct scheduler *s);
void cell_drift_part(struct cell *c, const struct engine *e, int force);
......@@ -838,7 +864,8 @@ void cell_activate_subcell_hydro_tasks(struct cell *ci, struct cell *cj,
void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s);
void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s);
struct scheduler *s,
const int with_star_formation);
void cell_activate_subcell_black_holes_tasks(struct cell *ci, struct cell *cj,
struct scheduler *s);
void cell_activate_subcell_external_grav_tasks(struct cell *ci,
......@@ -856,7 +883,9 @@ void cell_clear_limiter_flags(struct cell *c, void *data);
void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data);
void cell_check_spart_pos(const struct cell *c,
const struct spart *global_sparts);
void cell_clear_stars_sort_flags(struct cell *c);
void cell_check_sort_flags(const struct cell *c);
void cell_clear_stars_sort_flags(struct cell *c, const int unused_flags);
void cell_clear_hydro_sort_flags(struct cell *c, const int unused_flags);
int cell_has_tasks(struct cell *c);
void cell_remove_part(const struct engine *e, struct cell *c, struct part *p,
struct xpart *xp);
......
......@@ -316,11 +316,14 @@ INLINE static double bisection_iter(
eagle_cooling_rate(log10(u_next_cgs), redshift, n_H_cgs,
abundance_ratio, n_H_index, d_n_H,
He_index, d_He, cooling);
// Debugging
#ifdef SWIFT_DEBUG_CHECKS
if (u_next_cgs <= 0)
error("u_next_cgs %.5e u_upper %.5e u_lower %.5e Lambda %.5e", u_next_cgs,
u_upper_cgs, u_lower_cgs, LambdaNet_cgs);
error(
"Got negative energy! u_next_cgs=%.5e u_upper=%.5e u_lower=%.5e "
"Lambda=%.5e",
u_next_cgs, u_upper_cgs, u_lower_cgs, LambdaNet_cgs);
#endif
/* Where do we go next? */
if (u_next_cgs - u_ini_cgs - LambdaNet_cgs * ratefact_cgs * dt_cgs > 0.0) {
u_upper_cgs = u_next_cgs;
......
......@@ -2117,7 +2117,8 @@ void engine_allocate_foreign_particles(struct engine *e) {
}
/* For stars, we just use the numbers in the top-level cells */
count_sparts_in += e->proxies[k].cells_in[j]->stars.count;
count_sparts_in +=
e->proxies[k].cells_in[j]->stars.count + space_extra_sparts;
/* For black holes, we just use the numbers in the top-level cells */
count_bparts_in += e->proxies[k].cells_in[j]->black_holes.count;
......@@ -2208,7 +2209,8 @@ void engine_allocate_foreign_particles(struct engine *e) {
/* For stars, we just use the numbers in the top-level cells */
cell_link_sparts(e->proxies[k].cells_in[j], sparts);
sparts = &sparts[e->proxies[k].cells_in[j]->stars.count];
sparts =
&sparts[e->proxies[k].cells_in[j]->stars.count + space_extra_sparts];
/* For black holes, we just use the numbers in the top-level cells */
cell_link_bparts(e->proxies[k].cells_in[j], bparts);
......@@ -2563,6 +2565,8 @@ void engine_rebuild(struct engine *e, int repartitioned,
for (int k = 0; k < e->s->nr_local_cells; k++)
cell_check_foreign_multipole(&e->s->cells_top[e->s->local_cells_top[k]]);
}
space_check_sort_flags(e->s);
#endif
/* Run through the tasks and mark as skip or not. */
......@@ -3333,7 +3337,8 @@ void engine_skip_force_and_kick(struct engine *e) {
t->subtype == task_subtype_tend_gpart ||
t->subtype == task_subtype_tend_spart ||
t->subtype == task_subtype_tend_bpart ||
t->subtype == task_subtype_rho || t->subtype == task_subtype_gpart)
t->subtype == task_subtype_rho || t->subtype == task_subtype_gpart ||
t->subtype == task_subtype_sf_counts)
t->skip = 1;
}
......@@ -3850,6 +3855,7 @@ void engine_step(struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
/* Make sure all woken-up particles have been processed */
space_check_limiter(e->s);
space_check_sort_flags(e->s);
#endif
/* Collect information about the next time-step */
......
......@@ -232,11 +232,14 @@ void engine_addtasks_send_hydro(struct engine *e, struct cell *ci,
* @param ci The sending #cell.
* @param cj Dummy cell containing the nodeID of the receiving node.
* @param t_feedback The send_feed #task, if it has already been created.
* @param t_sf_counts The send_sf_counts, if it has been created.
* @param t_ti The recv_ti_end #task, if it has already been created.
* @param with_star_formation Are we running with star formation on?
*/
void engine_addtasks_send_stars(struct engine *e, struct cell *ci,
struct cell *cj, struct task *t_feedback,
struct task *t_ti) {
struct task *t_sf_counts, struct task *t_ti,
const int with_star_formation) {
#ifdef WITH_MPI
......@@ -244,6 +247,19 @@ void engine_addtasks_send_stars(struct engine *e, struct cell *ci,
struct scheduler *s = &e->sched;
const int nodeID = cj->nodeID;
if (t_sf_counts == NULL && with_star_formation && ci->hydro.count > 0) {
#ifdef SWIFT_DEBUG_CHECKS
if (ci->depth != 0)
error(
"Attaching a sf_count task at a non-top level c->depth=%d "
"c->count=%d",
ci->depth, ci->hydro.count);
#endif
t_sf_counts = scheduler_addtask(s, task_type_send, task_subtype_sf_counts,
ci->mpi.tag, 0, ci, cj);
scheduler_addunlock(s, ci->hydro.star_formation, t_sf_counts);
}
/* Check if any of the density tasks are for the target node. */
for (l = ci->stars.density; l != NULL; l = l->next)
if (l->t->ci->nodeID == nodeID ||
......@@ -279,13 +295,17 @@ void engine_addtasks_send_stars(struct engine *e, struct cell *ci,
engine_addlink(e, &ci->mpi.send, t_feedback);
engine_addlink(e, &ci->mpi.send, t_ti);
if (with_star_formation && ci->hydro.count > 0) {
engine_addlink(e, &ci->mpi.send, t_sf_counts);
}
}
/* Recurse? */
if (ci->split)
for (int k = 0; k < 8; k++)
if (ci->progeny[k] != NULL)
engine_addtasks_send_stars(e, ci->progeny[k], cj, t_feedback, t_ti);
engine_addtasks_send_stars(e, ci->progeny[k], cj, t_feedback,
t_sf_counts, t_ti, with_star_formation);
#else
error("SWIFT was not compiled with MPI support.");
......@@ -459,14 +479,30 @@ void engine_addtasks_recv_hydro(struct engine *e, struct cell *c,
* @param e The #engine.
* @param c The foreign #cell.
* @param t_feedback The recv_feed #task, if it has already been created.
* @param t_sf_counts The recv_sf_counts, if it has been created.
* @param t_ti The recv_ti_end #task, if it has already been created.
* @param with_star_formation Are we running with star formation on?
*/
void engine_addtasks_recv_stars(struct engine *e, struct cell *c,
struct task *t_feedback, struct task *t_ti) {
struct task *t_feedback,
struct task *t_sf_counts, struct task *t_ti,
const int with_star_formation) {
#ifdef WITH_MPI
struct scheduler *s = &e->sched;
if (t_sf_counts == NULL && with_star_formation && c->hydro.count > 0) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->depth != 0)
error(
"Attaching a sf_count task at a non-top level c->depth=%d "
"c->count=%d",
c->depth, c->hydro.count);
#endif
t_sf_counts = scheduler_addtask(s, task_type_recv, task_subtype_sf_counts,
c->mpi.tag, 0, c, NULL);
}
/* Have we reached a level where there are any stars tasks ? */
if (t_feedback == NULL && c->stars.density != NULL) {
......@@ -481,11 +517,20 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c,
t_ti = scheduler_addtask(s, task_type_recv, task_subtype_tend_spart,
c->mpi.tag, 0, c, NULL);
if (with_star_formation && c->hydro.count > 0) {
/* Receive the stars only once the counts have been received */
scheduler_addunlock(s, t_sf_counts, t_feedback);
}
}
if (t_feedback != NULL) {
engine_addlink(e, &c->mpi.recv, t_feedback);
engine_addlink(e, &c->mpi.recv, t_ti);
if (with_star_formation && c->hydro.count > 0) {
engine_addlink(e, &c->mpi.recv, t_sf_counts);
}
#ifdef SWIFT_DEBUG_CHECKS
if (c->nodeID == e->nodeID) error("Local cell!");
......@@ -507,7 +552,8 @@ void engine_addtasks_recv_stars(struct engine *e, struct cell *c,
if (c->split)
for (int k = 0; k < 8; k++)
if (c->progeny[k] != NULL)
engine_addtasks_recv_stars(e, c->progeny[k], t_feedback, t_ti);
engine_addtasks_recv_stars(e, c->progeny[k], t_feedback, t_sf_counts,
t_ti, with_star_formation);
#else
error("SWIFT was not compiled with MPI support.");
......@@ -614,6 +660,7 @@ void engine_addtasks_recv_gravity(struct engine *e, struct cell *c,
scheduler_addunlock(s, l->t, t_ti);
}
}
/* Recurse? */
if (c->split)
for (int k = 0; k < 8; k++)
......@@ -2410,7 +2457,7 @@ void engine_addtasks_send_mapper(void *map_data, int num_elements,
void *extra_data) {
struct engine *e = (struct engine *)extra_data;
// const int with_limiter = (e->policy & engine_policy_limiter);
const int with_star_formation = (e->policy & engine_policy_star_formation);
struct cell_type_pair *cell_type_pairs = (struct cell_type_pair *)map_data;
for (int k = 0; k < num_elements; k++) {
......@@ -2428,7 +2475,9 @@ void engine_addtasks_send_mapper(void *map_data, int num_elements,
/* Add the send tasks for the cells in the proxy that have a stars
* connection. */
if ((e->policy & engine_policy_feedback) && (type & proxy_cell_type_hydro))
engine_addtasks_send_stars(e, ci, cj, /*t_feedback=*/NULL, /*t_ti=*/NULL);
engine_addtasks_send_stars(e, ci, cj, /*t_feedback=*/NULL,
/*t_sf_counts=*/NULL, /*t_ti=*/NULL,
with_star_formation);
/* Add the send tasks for the cells in the proxy that have a black holes
* connection. */
......@@ -2449,7 +2498,7 @@ void engine_addtasks_recv_mapper(void *map_data, int num_elements,
void *extra_data) {
struct engine *e = (struct engine *)extra_data;
// const int with_limiter = (e->policy & engine_policy_limiter);
const int with_star_formation = (e->policy & engine_policy_star_formation);
struct cell_type_pair *cell_type_pairs = (struct cell_type_pair *)map_data;
for (int k = 0; k < num_elements; k++) {
......@@ -2459,12 +2508,15 @@ void engine_addtasks_recv_mapper(void *map_data, int num_elements,
/* Add the recv tasks for the cells in the proxy that have a hydro
* connection. */
if ((e->policy & engine_policy_hydro) && (type & proxy_cell_type_hydro))
engine_addtasks_recv_hydro(e, ci, NULL, NULL, NULL, NULL);
engine_addtasks_recv_hydro(e, ci, /*t_xv=*/NULL, /*t_rho=*/NULL,
/*t_gradient=*/NULL, /*t_ti=*/NULL);
/* Add the recv tasks for the cells in the proxy that have a stars
* connection. */
if ((e->policy & engine_policy_feedback) && (type & proxy_cell_type_hydro))
engine_addtasks_recv_stars(e, ci, NULL, NULL);
engine_addtasks_recv_stars(e, ci, /*t_feedback=*/NULL,
/*t_sf_counts=*/NULL, /*t_ti=*/NULL,
with_star_formation);
/* Add the recv tasks for the cells in the proxy that have a black holes
* connection. */
......@@ -2476,7 +2528,7 @@ void engine_addtasks_recv_mapper(void *map_data, int num_elements,
* connection. */
if ((e->policy & engine_policy_self_gravity) &&
(type & proxy_cell_type_gravity))
engine_addtasks_recv_gravity(e, ci, NULL, NULL);
engine_addtasks_recv_gravity(e, ci, /*t_grav=*/NULL, /*t_ti=*/NULL);
}
}
......
......@@ -70,6 +70,10 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
struct engine *e = (struct engine *)((size_t *)extra_data)[0];
const int nodeID = e->nodeID;
const int with_limiter = e->policy & engine_policy_limiter;
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++) {
......@@ -84,11 +88,18 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Local pointer. */
struct cell *ci = t->ci;
#ifdef SWIFT_DEBUG_CHECKS
if (ci->nodeID != nodeID) error("Non-local self task found");
#endif
const int ci_active_hydro = cell_is_active_hydro(ci, e);
const int ci_active_gravity = cell_is_active_gravity(ci, e);
const int ci_active_black_holes = cell_is_active_black_holes(ci, e);
const int ci_active_stars = cell_is_active_stars(ci, e) ||
(with_star_formation && ci_active_hydro);
/* Activate the hydro drift */
if (t_type == task_type_self && t_subtype == task_subtype_density) {
if (cell_is_active_hydro(ci, e)) {
if (ci_active_hydro) {
scheduler_activate(s, t);
cell_activate_drift_part(ci, s);
if (with_limiter) cell_activate_limiter(ci, s);
......@@ -98,7 +109,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_density) {
if (cell_is_active_hydro(ci, e)) {
if (ci_active_hydro) {
scheduler_activate(s, t);
cell_activate_subcell_hydro_tasks(ci, NULL, s);
if (with_limiter) cell_activate_limiter(ci, s);
......@@ -106,37 +117,37 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
}
else if (t_type == task_type_self && t_subtype == task_subtype_force) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_force) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
else if (t->type == task_type_self &&
t->subtype == task_subtype_limiter) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
else if (t->type == task_type_sub_self &&
t->subtype == task_subtype_limiter) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
else if (t_type == task_type_self && t_subtype == task_subtype_gradient) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_gradient) {
if (cell_is_active_hydro(ci, e)) scheduler_activate(s, t);
if (ci_active_hydro) scheduler_activate(s, t);
}
/* Activate the star density */
else if (t_type == task_type_self &&
t_subtype == task_subtype_stars_density) {
if (cell_is_active_stars(ci, e)) {
if (ci_active_stars) {
scheduler_activate(s, t);
cell_activate_drift_part(ci, s);
cell_activate_drift_spart(ci, s);
......@@ -146,28 +157,28 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_stars_density) {
if (cell_is_active_stars(ci, e)) {
if (ci_active_stars) {
scheduler_activate(s, t);
cell_activate_subcell_stars_tasks(ci, NULL, s);
cell_activate_subcell_stars_tasks(ci, NULL, s, with_star_formation);
}
}
else if (t_type == task_type_self &&
t_subtype == task_subtype_stars_feedback) {
if (cell_is_active_stars(ci, e)) {
if (ci_active_stars) {
scheduler_activate(s, t);
}
}
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_stars_feedback) {
if (cell_is_active_stars(ci, e)) scheduler_activate(s, t);
if (ci_active_stars) scheduler_activate(s, t);
}
/* Activate the black hole density */
else if (t_type == task_type_self &&
t_subtype == task_subtype_bh_density) {
if (cell_is_active_black_holes(ci, e)) {
if (ci_active_black_holes) {
scheduler_activate(s, t);
cell_activate_drift_part(ci, s);
cell_activate_drift_bpart(ci, s);
......@@ -177,7 +188,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_bh_density) {
if (cell_is_active_black_holes(ci, e)) {
if (ci_active_black_holes) {
scheduler_activate(s, t);
cell_activate_subcell_black_holes_tasks(ci, NULL, s);
}
......@@ -185,19 +196,19 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
else if (t_type == task_type_self &&
t_subtype == task_subtype_bh_feedback) {
if (cell_is_active_black_holes(ci, e)) {
if (ci_active_black_holes) {
scheduler_activate(s, t);
}
}
else if (t_type == task_type_sub_self &&
t_subtype == task_subtype_bh_feedback) {
if (cell_is_active_black_holes(ci, e)) scheduler_activate(s, t);
if (ci_active_black_holes) scheduler_activate(s, t);
}
/* Activate the gravity drift */
else if (t_type == task_type_self && t_subtype == task_subtype_grav) {
if (cell_is_active_gravity(ci, e)) {
if (ci_active_gravity) {
scheduler_activate(s, t);
cell_activate_subcell_grav_tasks(t->ci, NULL, s);
}
......@@ -206,7 +217,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Activate the gravity drift */
else if (t_type == task_type_self &&
t_subtype == task_subtype_external_grav) {
if (cell_is_active_gravity(ci, e)) {
if (ci_active_gravity) {
scheduler_activate(s, t);
cell_activate_drift_gpart(t->ci, s);
}
......@@ -238,12 +249,14 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
const int ci_active_gravity = cell_is_active_gravity(ci, e);
const int cj_active_gravity = cell_is_active_gravity(cj, e);
const int ci_active_stars = cell_is_active_stars(ci, e);
const int cj_active_stars = cell_is_active_stars(cj, e);
const int ci_active_black_holes = cell_is_active_black_holes(ci, e);
const int cj_active_black_holes = cell_is_active_black_holes(cj, e);
const int ci_active_stars = cell_is_active_stars(ci, e) ||
(with_star_formation && ci_active_hydro);
const int cj_active_stars = cell_is_active_stars(cj, e) ||
(with_star_formation && cj_active_hydro);
/* Only activate tasks that involve a local active cell. */
if ((t_subtype == task_subtype_density ||
t_subtype == task_subtype_gradient ||
......@@ -338,7 +351,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else if (t_type == task_type_sub_pair &&
t_subtype == task_subtype_stars_density) {
cell_activate_subcell_stars_tasks(ci, cj, s);
cell_activate_subcell_stars_tasks(ci, cj, s, with_star_formation);
}
}
......@@ -492,6 +505,20 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
scheduler_activate_send(s, cj->mpi.send, task_subtype_tend_part,
ci_nodeID);
/* Propagating new star counts? */
if (with_star_formation && with_feedback) {
if (ci_active_hydro && ci->hydro.count > 0) {
scheduler_activate_recv(s, ci->mpi.recv, task_subtype_sf_counts);
scheduler_activate_recv(s, ci->mpi.recv, task_subtype_tend_spart);
}
if (cj_active_hydro && cj->hydro.count > 0) {
scheduler_activate_send(s, cj->mpi.send, task_subtype_sf_counts,
ci_nodeID);
scheduler_activate_send(s, cj->mpi.send, task_subtype_tend_spart,
ci_nodeID);
}
}
} else if (cj_nodeID != nodeID) {
/* If the local cell is active, receive data from the foreign cell. */
......@@ -538,6 +565,20 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if (ci_active_hydro)
scheduler_activate_send(s, ci->mpi.send, task_subtype_tend_part,
cj_nodeID);
/* Propagating new star counts? */
if (with_star_formation && with_feedback) {
if (cj_active_hydro && cj->hydro.count > 0) {
scheduler_activate_recv(s, cj->mpi.recv, task_subtype_sf_counts);
scheduler_activate_recv(s, cj->mpi.recv, task_subtype_tend_spart);
}
if (ci_active_hydro && ci->hydro.count > 0) {
scheduler_activate_send(s, ci->mpi.send, task_subtype_sf_counts,
cj_nodeID);
scheduler_activate_send(s, ci->mpi.send, task_subtype_tend_spart,
cj_nodeID);
}
}
}
#endif
}
......@@ -830,12 +871,16 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Star ghost tasks ? */
else if (t_type == task_type_stars_ghost) {
if (cell_is_active_stars(t->ci, e)) scheduler_activate(s, t);
if (cell_is_active_stars(t->ci, e) ||
(with_star_formation && cell_is_active_hydro(t->ci, e)))
scheduler_activate(s, t);
}
/* Feedback implicit tasks? */
else if (t_type == task_type_stars_in || t_type == task_type_stars_out)