Commit 3db6d305 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'nonperiodic_mpi' into 'master'

Nonperiodic mpi

See merge request !1130
parents cd0db0fe 0cd5009d
...@@ -3157,11 +3157,8 @@ void engine_makeproxies(struct engine *e) { ...@@ -3157,11 +3157,8 @@ void engine_makeproxies(struct engine *e) {
cell_width[2] * cell_width[2]; cell_width[2] * cell_width[2];
const double r_diag = 0.5 * sqrt(r_diag2); const double r_diag = 0.5 * sqrt(r_diag2);
/* Maximal distance from a shifted CoM to centre of cell */
const double delta_CoM = engine_max_proxy_centre_frac * r_diag;
/* Maximal distance from shifted CoM to any corner */ /* Maximal distance from shifted CoM to any corner */
const double r_max = r_diag + 2. * delta_CoM; const double r_max = 2 * r_diag;
/* Prepare the proxies and the proxy index. */ /* Prepare the proxies and the proxy index. */
if (e->proxy_ind == NULL) if (e->proxy_ind == NULL)
...@@ -3274,35 +3271,34 @@ void engine_makeproxies(struct engine *e) { ...@@ -3274,35 +3271,34 @@ void engine_makeproxies(struct engine *e) {
proxy_type |= (int)proxy_cell_type_gravity; proxy_type |= (int)proxy_cell_type_gravity;
} else { } else {
/* We don't have multipoles yet (or there CoMs) so we will /* We don't have multipoles yet (or their CoMs) so we will
have to cook up something based on cell locations only. We have to cook up something based on cell locations only. We
hence need an upper limit on the distance that the CoMs in hence need a lower limit on the distance that the CoMs in
those cells could have. We then can decide whether we are those cells could have and an upper limit on the distance
too close for an M2L interaction and hence require a proxy of the furthest particle in the multipole from its CoM.
as this pair of cells cannot rely on just an M2L We then can decide whether we are too close for an M2L
calculation. */ interaction and hence require a proxy as this pair of cells
cannot rely on just an M2L calculation. */
/* Minimal distance between any two points in the cells */ /* Minimal distance between any two points in the cells */
const double min_dist_centres2 = cell_min_dist2_same_size( const double min_dist_CoM2 = cell_min_dist2_same_size(
&cells[cid], &cells[cjd], periodic, dim); &cells[cid], &cells[cjd], periodic, dim);
/* Let's now assume the CoMs will shift a bit */
const double min_dist_CoM =
sqrt(min_dist_centres2) - 2. * delta_CoM;
const double min_dist_CoM2 = min_dist_CoM * min_dist_CoM;
/* Are we beyond the distance where the truncated forces are 0 /* Are we beyond the distance where the truncated forces are 0
* but not too far such that M2L can be used? */ * but not too far such that M2L can be used? */
if (periodic) { if (periodic) {
if ((min_dist_CoM2 < max_mesh_dist2) && if ((min_dist_CoM2 < max_mesh_dist2) &&
!(2. * r_max < theta_crit * min_dist_CoM2)) !(4. * r_max * r_max <
theta_crit * theta_crit * min_dist_CoM2))
proxy_type |= (int)proxy_cell_type_gravity; proxy_type |= (int)proxy_cell_type_gravity;
} else { } else {
if (!(2. * r_max < theta_crit * min_dist_CoM2)) if (!(4. * r_max * r_max <
theta_crit * theta_crit * min_dist_CoM2)) {
proxy_type |= (int)proxy_cell_type_gravity; proxy_type |= (int)proxy_cell_type_gravity;
}
} }
} }
} }
......
...@@ -107,7 +107,6 @@ enum engine_step_properties { ...@@ -107,7 +107,6 @@ enum engine_step_properties {
#define engine_maxproxies 64 #define engine_maxproxies 64
#define engine_tasksreweight 1 #define engine_tasksreweight 1
#define engine_parts_size_grow 1.05 #define engine_parts_size_grow 1.05
#define engine_max_proxy_centre_frac 0.5
#define engine_redistribute_alloc_margin 1.2 #define engine_redistribute_alloc_margin 1.2
#define engine_rebuild_link_alloc_margin 1.2 #define engine_rebuild_link_alloc_margin 1.2
#define engine_foreign_alloc_margin 1.05 #define engine_foreign_alloc_margin 1.05
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment