Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
63484e4e
Commit
63484e4e
authored
Nov 29, 2018
by
Matthieu Schaller
Browse files
Make sure the direct neighbours of cells are always in the gravity proxies.
parent
111bdad3
Changes
1
Hide whitespace changes
Inline
Sidebyside
src/engine.c
View file @
63484e4e
...
...
@@ 3610,36 +3610,53 @@ void engine_makeproxies(struct engine *e) {
/* In the gravity case, check distances using the MAC. */
if
(
with_gravity
)
{
/* We don't have multipoles yet (or there CoMs) so we will have
to cook up something based on cell locations only. We hence
need an upper limit on the distance that the CoMs in those
cells could have. We then can decide whether we are too close
for an M2L 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 */
const
double
min_dist_centres2
=
cell_min_dist2_same_size
(
&
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
* but not too far such that M2L can be used? */
if
(
periodic
)
{
if
((
min_dist_CoM2
<
max_mesh_dist2
)
&&
(
!
gravity_M2L_accept
(
r_max
,
r_max
,
theta_crit2
,
min_dist_CoM2
)))
proxy_type
=
(
int
)
proxy_cell_type_gravity
;
/* First just add the direct neighbours. Then look for
some further out if the opening angle demands it */
/* This is superugly but checks for direct neighbours */
/* with periodic BC */
if
(((
abs
(
i

iii
)
<=
1

abs
(
i

iii

cdim
[
0
])
<=
1

abs
(
i

iii
+
cdim
[
0
])
<=
1
)
&&
(
abs
(
j

jjj
)
<=
1

abs
(
j

jjj

cdim
[
1
])
<=
1

abs
(
j

jjj
+
cdim
[
1
])
<=
1
)
&&
(
abs
(
k

kkk
)
<=
1

abs
(
k

kkk

cdim
[
2
])
<=
1

abs
(
k

kkk
+
cdim
[
2
])
<=
1
)))
{
proxy_type
=
(
int
)
proxy_cell_type_gravity
;
}
else
{
if
(
!
gravity_M2L_accept
(
r_max
,
r_max
,
theta_crit2
,
min_dist_CoM2
))
proxy_type
=
(
int
)
proxy_cell_type_gravity
;
/* We don't have multipoles yet (or there CoMs) so we will
have to cook up something based on cell locations only. We
hence need an upper limit on the distance that the CoMs in
those cells could have. We then can decide whether we are
too close for an M2L 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 */
const
double
min_dist_centres2
=
cell_min_dist2_same_size
(
&
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
* but not too far such that M2L can be used? */
if
(
periodic
)
{
if
((
min_dist_CoM2
<
max_mesh_dist2
)
&&
(
!
gravity_M2L_accept
(
r_max
,
r_max
,
theta_crit2
,
min_dist_CoM2
)))
proxy_type
=
(
int
)
proxy_cell_type_gravity
;
}
else
{
if
(
!
gravity_M2L_accept
(
r_max
,
r_max
,
theta_crit2
,
min_dist_CoM2
))
proxy_type
=
(
int
)
proxy_cell_type_gravity
;
}
}
}
...
...
Matthieu Schaller
@matthieu
mentioned in issue
#494 (closed)
·
Nov 30, 2018
mentioned in issue
#494 (closed)
mentioned in issue #494
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment