From eeb51cb50612ea8c4077c0e8f728f6a59f1b0c7c Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Wed, 28 Oct 2020 19:08:45 +0100
Subject: [PATCH] Also activate the drifts at the super-level for sub-tasks in
 marktasks

---
 src/engine_marktasks.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/engine_marktasks.c b/src/engine_marktasks.c
index 71453c625d..c72b03a404 100644
--- a/src/engine_marktasks.c
+++ b/src/engine_marktasks.c
@@ -113,6 +113,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
         if (ci_active_hydro) {
           scheduler_activate(s, t);
           cell_activate_subcell_hydro_tasks(ci, NULL, s, with_timestep_limiter);
+
+          if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
           if (with_timestep_limiter) cell_activate_limiter(ci, s);
         }
       }
@@ -163,6 +165,9 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
           scheduler_activate(s, t);
           cell_activate_subcell_stars_tasks(ci, NULL, s, with_star_formation,
                                             with_timestep_sync);
+
+          if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
+          if (ci->nodeID == engine_rank) cell_activate_drift_spart(ci, s);
         }
       }
 
@@ -374,6 +379,10 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
                  t_subtype == task_subtype_density) {
           cell_activate_subcell_hydro_tasks(t->ci, t->cj, s,
                                             with_timestep_limiter);
+
+          /* Activate the drifts if the cells are local. */
+          if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
+          if (cj->nodeID == engine_rank) cell_activate_drift_part(cj, s);
         }
       }
 
@@ -437,6 +446,16 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
                  t_subtype == task_subtype_stars_density) {
           cell_activate_subcell_stars_tasks(ci, cj, s, with_star_formation,
                                             with_timestep_sync);
+
+          /* Activate the drifts if the cells are local. */
+          if (ci_active_stars) {
+            if (ci->nodeID == engine_rank) cell_activate_drift_spart(ci, s);
+            if (cj->nodeID == engine_rank) cell_activate_drift_part(cj, s);
+          }
+          if (cj_active_stars) {
+            if (cj->nodeID == engine_rank) cell_activate_drift_spart(cj, s);
+            if (ci->nodeID == engine_rank) cell_activate_drift_part(ci, s);
+          }
         }
       }
 
-- 
GitLab