From f0126fe936b3c8d0a226e7ee8328ac7c93fdbad6 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Tue, 18 Apr 2017 17:44:40 +0100 Subject: [PATCH] Do not run the gravity exact calculation checks if we are not running with self gravity --- src/engine.c | 12 ++++++++---- src/runner.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/engine.c b/src/engine.c index a04f75c27d..019f1fefed 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3143,7 +3143,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) { #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Run the brute-force gravity calculation for some gparts */ - gravity_exact_force_compute(e->s, e); + if (e->policy & engine_policy_self_gravity) + gravity_exact_force_compute(e->s, e); #endif /* Run the 0th time-step */ @@ -3151,7 +3152,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) { #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Check the accuracy of the gravity calculation */ - gravity_exact_force_check(e->s, e, 1e-1); + if (e->policy & engine_policy_self_gravity) + gravity_exact_force_check(e->s, e, 1e-1); #endif /* Recover the (integer) end of the next time-step */ @@ -3242,7 +3244,8 @@ void engine_step(struct engine *e) { #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Run the brute-force gravity calculation for some gparts */ - gravity_exact_force_compute(e->s, e); + if (e->policy & engine_policy_self_gravity) + gravity_exact_force_compute(e->s, e); #endif /* Do we need to drift the top-level multipoles ? */ @@ -3255,7 +3258,8 @@ void engine_step(struct engine *e) { #ifdef SWIFT_GRAVITY_FORCE_CHECKS /* Check the accuracy of the gravity calculation */ - gravity_exact_force_check(e->s, e, 1e-1); + if (e->policy & engine_policy_self_gravity) + gravity_exact_force_check(e->s, e, 1e-1); #endif /* Let's trigger a rebuild every-so-often for good measure */ // MATTHIEU diff --git a/src/runner.c b/src/runner.c index 4e85082359..29d715a329 100644 --- a/src/runner.c +++ b/src/runner.c @@ -466,7 +466,7 @@ void runner_do_init_grav(struct runner *r, struct cell *c, int timer) { /* Drift the multipole */ cell_drift_multipole(c, e); - + /* Reset the gravity acceleration tensors */ gravity_field_tensors_init(&c->multipole->pot); -- GitLab