Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
fe01ea44
Commit
fe01ea44
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Add comment to clarify the short- and long-range accelerations
parent
04d32684
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1014
Gravity brute force checks, extra options
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gravity.c
+17
-8
17 additions, 8 deletions
src/gravity.c
with
17 additions
and
8 deletions
src/gravity.c
+
17
−
8
View file @
fe01ea44
...
...
@@ -70,7 +70,7 @@ float ewald_fac;
*
* @param boxSize The side-length (L) of the volume.
*/
void
gravity_exact_force_ewald_init
(
double
boxSize
)
{
void
gravity_exact_force_ewald_init
(
const
double
boxSize
)
{
#ifdef SWIFT_GRAVITY_FORCE_CHECKS
...
...
@@ -325,8 +325,9 @@ void gravity_exact_force_ewald_init(double boxSize) {
* @param corr_f (return) The Ewald correction for the force.
* @param corr_p (return) The Ewald correction for the potential.
*/
void
gravity_exact_force_ewald_evaluate
(
double
rx
,
double
ry
,
double
rz
,
double
corr_f
[
3
],
double
*
corr_p
)
{
void
gravity_exact_force_ewald_evaluate
(
const
double
rx
,
const
double
ry
,
const
double
rz
,
double
corr_f
[
3
],
double
*
corr_p
)
{
#ifdef SWIFT_GRAVITY_FORCE_CHECKS
...
...
@@ -556,7 +557,15 @@ void gravity_exact_force_compute_mapper(void *map_data, int nr_gparts,
a_grav
[
2
]
+=
f
*
dz
;
pot
+=
phi
;
/* Apply Ewald correction for periodic BC */
/* Apply Ewald correction for periodic BC
*
* We also want to check what the tree and mesh do so we want to mimic
* that:
* - a_grav_short is the total acceleration multiplied by the
* short-range correction.
* - a_grav_long is the total acceleration (including Ewald correction)
* minus the short-range acceleration.
*/
if
(
periodic
&&
r
>
1e-5
*
hi
)
{
/* Compute trunctation for long and short range forces */
...
...
@@ -589,10 +598,10 @@ void gravity_exact_force_compute_mapper(void *map_data, int nr_gparts,
}
/* Store the exact answer */
for
(
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
gpi
->
a_grav_exact
[
ii
]
=
a_grav
[
ii
]
*
const_G
;
gpi
->
a_grav_exact_short
[
ii
]
=
a_grav_short
[
ii
]
*
const_G
;
gpi
->
a_grav_exact_long
[
ii
]
=
a_grav_long
[
ii
]
*
const_G
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
gpi
->
a_grav_exact
[
k
]
=
a_grav
[
k
]
*
const_G
;
gpi
->
a_grav_exact_short
[
k
]
=
a_grav_short
[
k
]
*
const_G
;
gpi
->
a_grav_exact_long
[
k
]
=
a_grav_long
[
k
]
*
const_G
;
}
gpi
->
potential_exact
=
pot
*
const_G
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment