From 20f2aa1f94c4c67b52224a7f9eec1500680dce97 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Mon, 8 Apr 2019 16:54:39 +0200 Subject: [PATCH] Make sure we correctly collect the time-step sizes in the case where we only have external gravity and no self-gravity. --- src/engine.c | 8 +++++--- src/runner.c | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine.c b/src/engine.c index 406bd3df51..d32cea6acc 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2567,6 +2567,8 @@ void engine_collect_end_of_step_mapper(void *map_data, int num_elements, const struct engine *e = data->e; const int with_hydro = (e->policy & engine_policy_hydro); const int with_self_grav = (e->policy & engine_policy_self_gravity); + const int with_ext_grav = (e->policy & engine_policy_external_gravity); + const int with_grav = (with_self_grav || with_ext_grav); const int with_stars = (e->policy & engine_policy_stars); struct space *s = e->s; int *local_cells = (int *)map_data; @@ -2590,7 +2592,7 @@ void engine_collect_end_of_step_mapper(void *map_data, int num_elements, if (with_hydro) { engine_collect_end_of_step_recurse_hydro(c, e); } - if (with_self_grav) { + if (with_grav) { engine_collect_end_of_step_recurse_grav(c, e); } if (with_stars) { @@ -3667,7 +3669,6 @@ void engine_unskip(struct engine *e) { const int with_hydro = e->policy & engine_policy_hydro; const int with_self_grav = e->policy & engine_policy_self_gravity; const int with_ext_grav = e->policy & engine_policy_external_gravity; - const int with_grav = (with_self_grav || with_ext_grav); const int with_stars = e->policy & engine_policy_stars; const int with_feedback = e->policy & engine_policy_feedback; @@ -3685,7 +3686,8 @@ void engine_unskip(struct engine *e) { struct cell *c = &s->cells_top[local_cells[k]]; if ((with_hydro && cell_is_active_hydro(c, e)) || - (with_grav && cell_is_active_gravity(c, e)) || + (with_self_grav && cell_is_active_gravity(c, e)) || + (with_ext_grav && c->nodeID == nodeID && cell_is_active_gravity(c, e)) || (with_feedback && cell_is_active_stars(c, e)) || (with_stars && c->nodeID == nodeID && cell_is_active_stars(c, e))) { diff --git a/src/runner.c b/src/runner.c index a3c87d90d9..979bdae384 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1903,6 +1903,7 @@ void runner_do_unskip_mapper(void *map_data, int num_elements, void *extra_data) { struct engine *e = (struct engine *)extra_data; + const int nodeID = e->nodeID; struct space *s = e->s; int *local_cells = (int *)map_data; @@ -1915,7 +1916,7 @@ void runner_do_unskip_mapper(void *map_data, int num_elements, /* All gravity tasks */ if ((e->policy & engine_policy_self_gravity) || - (e->policy & engine_policy_external_gravity)) + ((e->policy & engine_policy_external_gravity) && c->nodeID == nodeID)) runner_do_unskip_gravity(c, e); /* Stars tasks */ -- GitLab