diff --git a/src/cell.h b/src/cell.h index 070ed0aed6e68239d67371e52a8b250f97f57180..52853c3eaec13415d76d531533fe4240b31baee4 100644 --- a/src/cell.h +++ b/src/cell.h @@ -606,6 +606,13 @@ struct cell { /*! The drift task for bparts */ struct task *drift; + /*! Implicit tasks marking the entry of the BH physics block of tasks + */ + struct task *black_holes_in; + + /*! Implicit tasks marking the exit of the BH physics block of tasks */ + struct task *black_holes_out; + /*! The star ghost task itself */ struct task *ghost; diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index ca69599b8e64460484e174aca9fc786dd45d8349..920b7f430d9150790722d773d523c9ad92cc0fc6 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -729,6 +729,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c) { const int with_feedback = (e->policy & engine_policy_feedback); const int with_cooling = (e->policy & engine_policy_cooling); const int with_star_formation = (e->policy & engine_policy_star_formation); + const int with_black_holes = (e->policy & engine_policy_black_holes); /* Are we in a super-cell ? */ if (c->hydro.super == c) { @@ -775,6 +776,13 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c) { scheduler_addunlock(s, c->stars.drift, c->super->kick2); } + /* Black holes */ + if (with_black_holes) { + c->black_holes.drift = scheduler_addtask( + s, task_type_drift_bpart, task_subtype_none, 0, 0, c, NULL); + scheduler_addunlock(s, c->black_holes.drift, c->super->kick2); + } + /* Subgrid tasks: cooling */ if (with_cooling) { @@ -810,6 +818,25 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c) { c->stars.stars_in); } } + + /* Subgrid tasks: black hole feedback */ + if (with_black_holes) { + + c->black_holes.black_holes_in = + scheduler_addtask(s, task_type_bh_in, task_subtype_none, 0, + /* implicit = */ 1, c, NULL); + + c->black_holes.black_holes_out = + scheduler_addtask(s, task_type_bh_out, task_subtype_none, 0, + /* implicit = */ 1, c, NULL); + + c->black_holes.ghost = scheduler_addtask( + s, task_type_bh_ghost, task_subtype_none, 0, 0, c, NULL); + + scheduler_addunlock(s, c->super->kick2, c->black_holes.black_holes_in); + scheduler_addunlock(s, c->black_holes.black_holes_out, + c->super->timestep); + } } } else { /* We are above the super-cell so need to go deeper */ diff --git a/src/task.c b/src/task.c index c0a168277a0fcb532d07dade5eb3126af850d972..8bad4550af0c6043552bc4015df770b56ad8ad67 100644 --- a/src/task.c +++ b/src/task.c @@ -89,6 +89,8 @@ const char *taskID_names[task_type_count] = {"none", "stars_ghost", "stars_ghost_out", "stars_sort", + "bh_in", + "bh_out", "bh_ghost"}; /* Sub-task type names. */ diff --git a/src/task.h b/src/task.h index 3e1e3778240866389714620f02fe5e3742d70ef6..b78e64ee43c40eb62ab7cde97665a62bdc0c21ff 100644 --- a/src/task.h +++ b/src/task.h @@ -84,6 +84,8 @@ enum task_types { task_type_stars_ghost, task_type_stars_ghost_out, /* Implicit */ task_type_stars_sort, + task_type_bh_in, /* Implicit */ + task_type_bh_out, /* Implicit */ task_type_bh_ghost, task_type_count } __attribute__((packed));