Skip to content
Snippets Groups Projects
Commit ba69a218 authored by Matthieu Schaller's avatar Matthieu Schaller Committed by Matthieu Schaller
Browse files

Correct distance used for the long-range escape condition in runner_dopair_grav().

parent e2e484b9
No related branches found
No related tags found
2 merge requests!566Periodic gravity calculation,!565Mesh force task
...@@ -206,8 +206,11 @@ static INLINE void runner_dopair_grav_mm(struct runner *r, ...@@ -206,8 +206,11 @@ static INLINE void runner_dopair_grav_mm(struct runner *r,
cj->ti_old_multipole, cj->nodeID, ci->nodeID, e->ti_current); cj->ti_old_multipole, cj->nodeID, ci->nodeID, e->ti_current);
/* Let's interact at this level */ /* Let's interact at this level */
gravity_M2L(&ci->multipole->pot, multi_j, ci->multipole->CoM, if (0)
cj->multipole->CoM, props, periodic, dim, rlr_inv); gravity_M2L(&ci->multipole->pot, multi_j, ci->multipole->CoM,
cj->multipole->CoM, props, periodic, dim, rlr_inv);
runner_dopair_grav_pp(r, ci, cj, 0);
TIMER_TOC(timer_dopair_grav_mm); TIMER_TOC(timer_dopair_grav_mm);
} }
...@@ -1077,7 +1080,6 @@ static INLINE void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -1077,7 +1080,6 @@ static INLINE void runner_dopair_grav(struct runner *r, struct cell *ci,
const struct gravity_props *props = e->gravity_properties; const struct gravity_props *props = e->gravity_properties;
const double theta_crit2 = props->theta_crit2; const double theta_crit2 = props->theta_crit2;
const double max_distance = e->mesh->a_smooth * props->r_cut_max; const double max_distance = e->mesh->a_smooth * props->r_cut_max;
const double max_distance2 = max_distance * max_distance;
/* Anything to do here? */ /* Anything to do here? */
if (!((cell_is_active_gravity(ci, e) && ci->nodeID == nodeID) || if (!((cell_is_active_gravity(ci, e) && ci->nodeID == nodeID) ||
...@@ -1120,9 +1122,10 @@ static INLINE void runner_dopair_grav(struct runner *r, struct cell *ci, ...@@ -1120,9 +1122,10 @@ static INLINE void runner_dopair_grav(struct runner *r, struct cell *ci,
dz = nearest(dz, dim[2]); dz = nearest(dz, dim[2]);
} }
const double r2 = dx * dx + dy * dy + dz * dz; const double r2 = dx * dx + dy * dy + dz * dz;
const double r_lr_check = sqrt(r2) - (multi_i->r_max + multi_j->r_max);
/* Are we beyond the distance where the truncated forces are 0? */ /* Are we beyond the distance where the truncated forces are 0? */
if (periodic && r2 > max_distance2) { if (periodic && r_lr_check > max_distance) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Need to account for the interactions we missed */ /* Need to account for the interactions we missed */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment