Skip to content
GitLab
Menu
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
6a6ad24a
Commit
6a6ad24a
authored
Jun 13, 2018
by
Matthieu Schaller
Browse files
More consistent naming r_lr --> r_s throughout
parent
8120990d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/gravity/Default/gravity_iact.h
View file @
6a6ad24a
...
...
@@ -84,13 +84,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_full(
* @param h_inv Inverse of the softening length.
* @param h_inv3 Cube of the inverse of the softening length.
* @param mass Mass of the point-mass.
* @param r
lr
_inv Inverse of the mesh smoothing scale.
* @param r
_s
_inv Inverse of the mesh smoothing scale.
* @param f_ij (return) The force intensity.
* @param pot_ij (return) The potential.
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_grav_pp_truncated
(
const
float
r2
,
const
float
h2
,
const
float
h_inv
,
const
float
h_inv3
,
const
float
mass
,
const
float
r
lr
_inv
,
float
*
f_ij
,
float
*
pot_ij
)
{
const
float
mass
,
const
float
r
_s
_inv
,
float
*
f_ij
,
float
*
pot_ij
)
{
/* Get the inverse distance */
const
float
r_inv
=
1
.
f
/
sqrtf
(
r2
+
FLT_MIN
);
...
...
@@ -117,7 +117,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_truncated(
}
/* Get long-range correction */
const
float
u_lr
=
r
*
r
lr
_inv
;
const
float
u_lr
=
r
*
r
_s
_inv
;
float
corr_f_lr
,
corr_pot_lr
;
kernel_long_grav_force_eval
(
u_lr
,
&
corr_f_lr
);
kernel_long_grav_pot_eval
(
u_lr
,
&
corr_pot_lr
);
...
...
@@ -153,12 +153,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
* and its CoM as the "particle" property */
#if SELF_GRAVITY_MULTIPOLE_ORDER < 3
float
f_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_full
(
r2
,
h
*
h
,
h_inv
,
h_inv
*
h_inv
*
h_inv
,
m
->
M_000
,
&
f_ij
,
pot
);
&
f_ij
,
&
pot
_ij
);
*
f_x
=
f_ij
*
r_x
;
*
f_y
=
f_ij
*
r_y
;
*
f_z
=
f_ij
*
r_z
;
*
pot
=
pot_ij
;
#else
...
...
@@ -217,7 +218,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
* @param r2 Square of the distance vector to the multipole.
* @param h The softening length.
* @param h_inv Inverse of the softening length.
* @param r
lr
_inv The inverse of the gravity mesh-smoothing scale.
* @param r
_s
_inv The inverse of the gravity mesh-smoothing scale.
* @param m The multipole.
* @param f_x (return) The x-component of the acceleration.
* @param f_y (return) The y-component of the acceleration.
...
...
@@ -226,7 +227,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_grav_pm_truncated
(
const
float
r_x
,
const
float
r_y
,
const
float
r_z
,
const
float
r2
,
const
float
h
,
const
float
h_inv
,
const
float
r
lr
_inv
,
const
float
h
,
const
float
h_inv
,
const
float
r
_s
_inv
,
const
struct
multipole
*
m
,
float
*
f_x
,
float
*
f_y
,
float
*
f_z
,
float
*
pot
)
{
/* In the case where the order is < 3, then there is only a monopole term left.
...
...
@@ -234,12 +235,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated(
* and its CoM as the "particle" property */
#if SELF_GRAVITY_MULTIPOLE_ORDER < 3
float
f_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_truncated
(
r2
,
h
*
h
,
h_inv
,
h_inv
*
h_inv
*
h_inv
,
m
->
M_000
,
r
lr
_inv
,
&
f_ij
,
pot
);
m
->
M_000
,
r
_s
_inv
,
&
f_ij
,
&
pot
_ij
);
*
f_x
=
f_ij
*
r_x
;
*
f_y
=
f_ij
*
r_y
;
*
f_z
=
f_ij
*
r_z
;
*
pot
=
pot_ij
;
#else
...
...
@@ -249,7 +251,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated(
/* Compute the derivatives of the potential */
struct
potential_derivatives_M2P
d
;
compute_potential_derivatives_M2P
(
r_x
,
r_y
,
r_z
,
r2
,
r_inv
,
h
,
h_inv
,
1
,
r
lr
_inv
,
&
d
);
r
_s
_inv
,
&
d
);
/* 1st order terms (monopole) */
*
f_x
=
m
->
M_000
*
d
.
D_100
;
...
...
src/gravity_properties.c
View file @
6a6ad24a
...
...
@@ -134,7 +134,7 @@ void gravity_props_print(const struct gravity_props *p) {
message
(
"Self-gravity truncation cut-off ratio: r_cut_min=%f"
,
p
->
r_cut_min
);
message
(
"Self-gravity mesh truncation function: %s"
,
kernel_gravity_
softening
_name
);
kernel_
long_
gravity_
truncation
_name
);
message
(
"Self-gravity tree update frequency: f=%f"
,
p
->
rebuild_frequency
);
}
...
...
@@ -166,7 +166,7 @@ void gravity_props_print_snapshot(hid_t h_grpgrav,
io_write_attribute_f
(
h_grpgrav
,
"Tree update frequency"
,
p
->
rebuild_frequency
);
io_write_attribute_s
(
h_grpgrav
,
"Mesh truncation function"
,
r
kernel_gravity_
softening
_name
);
kernel_
long_
gravity_
truncation
_name
);
}
#endif
...
...
src/kernel_long_gravity.h
View file @
6a6ad24a
...
...
@@ -34,9 +34,9 @@
#define GADGET2_LONG_RANGE_CORRECTION
#ifdef GADGET2_LONG_RANGE_CORRECTION
#define kernel_gravity_
softening
_name "Gadget-2 (error function)"
#define kernel_
long_
gravity_
truncation
_name "Gadget-2 (error function)"
#else
#define kernel_gravity_
softening
_name "Exp-based Sigmoid"
#define kernel_
long_
gravity_
truncation
_name "Exp-based Sigmoid"
#endif
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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