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
6a6ad24a
Commit
6a6ad24a
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
More consistent naming r_lr --> r_s throughout
parent
8120990d
No related branches found
No related tags found
2 merge requests
!566
Periodic gravity calculation
,
!565
Mesh force task
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gravity/Default/gravity_iact.h
+12
-10
12 additions, 10 deletions
src/gravity/Default/gravity_iact.h
src/gravity_properties.c
+2
-2
2 additions, 2 deletions
src/gravity_properties.c
src/kernel_long_gravity.h
+2
-2
2 additions, 2 deletions
src/kernel_long_gravity.h
with
16 additions
and
14 deletions
src/gravity/Default/gravity_iact.h
+
12
−
10
View file @
6a6ad24a
...
@@ -84,13 +84,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_full(
...
@@ -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_inv Inverse of the softening length.
* @param h_inv3 Cube of the inverse of the softening length.
* @param h_inv3 Cube of the inverse of the softening length.
* @param mass Mass of the point-mass.
* @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 f_ij (return) The force intensity.
* @param pot_ij (return) The potential.
* @param pot_ij (return) The potential.
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_grav_pp_truncated
(
__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
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 */
/* Get the inverse distance */
const
float
r_inv
=
1
.
f
/
sqrtf
(
r2
+
FLT_MIN
);
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(
...
@@ -117,7 +117,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp_truncated(
}
}
/* Get long-range correction */
/* 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
;
float
corr_f_lr
,
corr_pot_lr
;
kernel_long_grav_force_eval
(
u_lr
,
&
corr_f_lr
);
kernel_long_grav_force_eval
(
u_lr
,
&
corr_f_lr
);
kernel_long_grav_pot_eval
(
u_lr
,
&
corr_pot_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(
...
@@ -153,12 +153,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
* and its CoM as the "particle" property */
* and its CoM as the "particle" property */
#if SELF_GRAVITY_MULTIPOLE_ORDER < 3
#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
,
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_x
=
f_ij
*
r_x
;
*
f_y
=
f_ij
*
r_y
;
*
f_y
=
f_ij
*
r_y
;
*
f_z
=
f_ij
*
r_z
;
*
f_z
=
f_ij
*
r_z
;
*
pot
=
pot_ij
;
#else
#else
...
@@ -217,7 +218,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
...
@@ -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 r2 Square of the distance vector to the multipole.
* @param h The softening length.
* @param h The softening length.
* @param h_inv Inverse of 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 m The multipole.
* @param f_x (return) The x-component of the acceleration.
* @param f_x (return) The x-component of the acceleration.
* @param f_y (return) The y-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(
...
@@ -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
(
__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
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
)
{
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.
/* 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(
...
@@ -234,12 +235,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated(
* and its CoM as the "particle" property */
* and its CoM as the "particle" property */
#if SELF_GRAVITY_MULTIPOLE_ORDER < 3
#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
,
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_x
=
f_ij
*
r_x
;
*
f_y
=
f_ij
*
r_y
;
*
f_y
=
f_ij
*
r_y
;
*
f_z
=
f_ij
*
r_z
;
*
f_z
=
f_ij
*
r_z
;
*
pot
=
pot_ij
;
#else
#else
...
@@ -249,7 +251,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated(
...
@@ -249,7 +251,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated(
/* Compute the derivatives of the potential */
/* Compute the derivatives of the potential */
struct
potential_derivatives_M2P
d
;
struct
potential_derivatives_M2P
d
;
compute_potential_derivatives_M2P
(
r_x
,
r_y
,
r_z
,
r2
,
r_inv
,
h
,
h_inv
,
1
,
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) */
/* 1st order terms (monopole) */
*
f_x
=
m
->
M_000
*
d
.
D_100
;
*
f_x
=
m
->
M_000
*
d
.
D_100
;
...
...
This diff is collapsed.
Click to expand it.
src/gravity_properties.c
+
2
−
2
View file @
6a6ad24a
...
@@ -134,7 +134,7 @@ void gravity_props_print(const struct gravity_props *p) {
...
@@ -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 truncation cut-off ratio: r_cut_min=%f"
,
p
->
r_cut_min
);
message
(
"Self-gravity mesh truncation function: %s"
,
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
);
message
(
"Self-gravity tree update frequency: f=%f"
,
p
->
rebuild_frequency
);
}
}
...
@@ -166,7 +166,7 @@ void gravity_props_print_snapshot(hid_t h_grpgrav,
...
@@ -166,7 +166,7 @@ void gravity_props_print_snapshot(hid_t h_grpgrav,
io_write_attribute_f
(
h_grpgrav
,
"Tree update frequency"
,
io_write_attribute_f
(
h_grpgrav
,
"Tree update frequency"
,
p
->
rebuild_frequency
);
p
->
rebuild_frequency
);
io_write_attribute_s
(
h_grpgrav
,
"Mesh truncation function"
,
io_write_attribute_s
(
h_grpgrav
,
"Mesh truncation function"
,
r
kernel_gravity_
softening
_name
);
kernel_
long_
gravity_
truncation
_name
);
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
src/kernel_long_gravity.h
+
2
−
2
View file @
6a6ad24a
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
#define GADGET2_LONG_RANGE_CORRECTION
#define GADGET2_LONG_RANGE_CORRECTION
#ifdef 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
#else
#define kernel_gravity_
softening
_name "Exp-based Sigmoid"
#define kernel_
long_
gravity_
truncation
_name "Exp-based Sigmoid"
#endif
#endif
/**
/**
...
...
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