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
aaab643a
Commit
aaab643a
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Removed more debugging information
parent
177227c0
No related branches found
No related tags found
1 merge request
!314
Timestep order
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/const.h
+0
-2
0 additions, 2 deletions
src/const.h
src/drift.h
+2
-5
2 additions, 5 deletions
src/drift.h
src/kick.h
+2
-2
2 additions, 2 deletions
src/kick.h
src/potential/point_mass/potential.h
+26
-32
26 additions, 32 deletions
src/potential/point_mass/potential.h
with
30 additions
and
41 deletions
src/const.h
+
0
−
2
View file @
aaab643a
...
@@ -59,6 +59,4 @@
...
@@ -59,6 +59,4 @@
#define SOURCETERMS_NONE
#define SOURCETERMS_NONE
//#define SOURCETERMS_SN_FEEDBACK
//#define SOURCETERMS_SN_FEEDBACK
#define ICHECK 0
#endif
/* SWIFT_CONST_H */
#endif
/* SWIFT_CONST_H */
This diff is collapsed.
Click to expand it.
src/drift.h
+
2
−
5
View file @
aaab643a
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* @param ti_current Integer end of time-step
* @param ti_current Integer end of time-step
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
drift_gpart
(
__attribute__
((
always_inline
))
INLINE
static
void
drift_gpart
(
struct
gpart
*
restrict
gp
,
double
dt
,
double
timeBase
,
integertime_t
ti_old
,
struct
gpart
*
restrict
gp
,
float
dt
,
double
timeBase
,
integertime_t
ti_old
,
integertime_t
ti_current
)
{
integertime_t
ti_current
)
{
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
...
@@ -53,9 +53,6 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
...
@@ -53,9 +53,6 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
gp
->
ti_drift
=
ti_current
;
gp
->
ti_drift
=
ti_current
;
#endif
#endif
// message("dt= %e", dt);
// fprintf(files_timestep[gp->id_or_neg_offset], "drift: dt=%e\n", dt);
/* Drift... */
/* Drift... */
gp
->
x
[
0
]
+=
gp
->
v_full
[
0
]
*
dt
;
gp
->
x
[
0
]
+=
gp
->
v_full
[
0
]
*
dt
;
gp
->
x
[
1
]
+=
gp
->
v_full
[
1
]
*
dt
;
gp
->
x
[
1
]
+=
gp
->
v_full
[
1
]
*
dt
;
...
@@ -78,7 +75,7 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
...
@@ -78,7 +75,7 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
* @param ti_current Integer end of time-step
* @param ti_current Integer end of time-step
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
drift_part
(
__attribute__
((
always_inline
))
INLINE
static
void
drift_part
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
double
dt
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
double
timeBase
,
integertime_t
ti_old
,
integertime_t
ti_current
)
{
double
timeBase
,
integertime_t
ti_old
,
integertime_t
ti_current
)
{
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
...
...
This diff is collapsed.
Click to expand it.
src/kick.h
+
2
−
2
View file @
aaab643a
...
@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static void kick_gpart(
...
@@ -40,7 +40,7 @@ __attribute__((always_inline)) INLINE static void kick_gpart(
double
timeBase
)
{
double
timeBase
)
{
/* Time interval for this half-kick */
/* Time interval for this half-kick */
const
double
dt
=
(
ti_end
-
ti_start
)
*
timeBase
;
const
float
dt
=
(
ti_end
-
ti_start
)
*
timeBase
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
gp
->
ti_kick
!=
ti_start
)
if
(
gp
->
ti_kick
!=
ti_start
)
...
@@ -75,7 +75,7 @@ __attribute__((always_inline)) INLINE static void kick_part(
...
@@ -75,7 +75,7 @@ __attribute__((always_inline)) INLINE static void kick_part(
integertime_t
ti_end
,
double
timeBase
)
{
integertime_t
ti_end
,
double
timeBase
)
{
/* Time interval for this half-kick */
/* Time interval for this half-kick */
const
double
dt
=
(
ti_end
-
ti_start
)
*
timeBase
;
const
float
dt
=
(
ti_end
-
ti_start
)
*
timeBase
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
p
->
ti_kick
!=
ti_start
)
if
(
p
->
ti_kick
!=
ti_start
)
...
...
This diff is collapsed.
Click to expand it.
src/potential/point_mass/potential.h
+
26
−
32
View file @
aaab643a
...
@@ -64,33 +64,27 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
...
@@ -64,33 +64,27 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
gpart
*
restrict
g
)
{
const
struct
gpart
*
restrict
g
)
{
const
double
G_newton
=
phys_const
->
const_newton_G
;
const
float
G_newton
=
phys_const
->
const_newton_G
;
const
double
dx
=
g
->
x
[
0
]
-
potential
->
x
;
const
float
dx
=
g
->
x
[
0
]
-
potential
->
x
;
const
double
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
float
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
double
dz
=
g
->
x
[
2
]
-
potential
->
z
;
const
float
dz
=
g
->
x
[
2
]
-
potential
->
z
;
/* const float rinv = 1.f / sqrtf(dx * dx + dy * dy + dz * dz); */
const
float
rinv
=
1
.
f
/
sqrtf
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
/* const float rinv2 = rinv * rinv; */
const
float
rinv2
=
rinv
*
rinv
;
/* const float rinv3 = rinv2 * rinv; */
const
float
rinv3
=
rinv2
*
rinv
;
/* const float drdv = (g->x[0] - potential->x) * (g->v_full[0]) + */
const
float
drdv
=
(
g
->
x
[
0
]
-
potential
->
x
)
*
(
g
->
v_full
[
0
])
+
/* (g->x[1] - potential->y) * (g->v_full[1]) + */
(
g
->
x
[
1
]
-
potential
->
y
)
*
(
g
->
v_full
[
1
])
+
/* (g->x[2] - potential->z) * (g->v_full[2]); */
(
g
->
x
[
2
]
-
potential
->
z
)
*
(
g
->
v_full
[
2
]);
/* const float dota_x = G_newton * potential->mass * rinv3 * */
const
float
dota_x
=
G_newton
*
potential
->
mass
*
rinv3
*
/* (-g->v_full[0] + 3.f * rinv2 * drdv * dx); */
(
-
g
->
v_full
[
0
]
+
3
.
f
*
rinv2
*
drdv
*
dx
);
/* const float dota_y = G_newton * potential->mass * rinv3 * */
const
float
dota_y
=
G_newton
*
potential
->
mass
*
rinv3
*
/* (-g->v_full[1] + 3.f * rinv2 * drdv * dy); */
(
-
g
->
v_full
[
1
]
+
3
.
f
*
rinv2
*
drdv
*
dy
);
/* const float dota_z = G_newton * potential->mass * rinv3 * */
const
float
dota_z
=
G_newton
*
potential
->
mass
*
rinv3
*
/* (-g->v_full[2] + 3.f * rinv2 * drdv * dz); */
(
-
g
->
v_full
[
2
]
+
3
.
f
*
rinv2
*
drdv
*
dz
);
/* const float dota_2 = dota_x * dota_x + dota_y * dota_y + dota_z * dota_z;
const
float
dota_2
=
dota_x
*
dota_x
+
dota_y
*
dota_y
+
dota_z
*
dota_z
;
*/
const
float
a_2
=
g
->
a_grav
[
0
]
*
g
->
a_grav
[
0
]
+
g
->
a_grav
[
1
]
*
g
->
a_grav
[
1
]
+
/* const float a_2 = g->a_grav[0] * g->a_grav[0] + g->a_grav[1] * g->a_grav[1]
g
->
a_grav
[
2
]
*
g
->
a_grav
[
2
];
*/
/* + g->a_grav[2] * g->a_grav[2]; */
return
potential
->
timestep_mult
*
sqrtf
(
a_2
/
dota_2
);
/* return potential->timestep_mult * sqrtf(a_2 / dota_2); */
const
double
r
=
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
return
potential
->
timestep_mult
*
sqrt
(
r
*
r
*
r
/
(
G_newton
*
potential
->
mass
));
}
}
/**
/**
...
@@ -111,11 +105,11 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
...
@@ -111,11 +105,11 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
double
time
,
const
struct
external_potential
*
restrict
potential
,
double
time
,
const
struct
external_potential
*
restrict
potential
,
const
struct
phys_const
*
restrict
phys_const
,
struct
gpart
*
restrict
g
)
{
const
struct
phys_const
*
restrict
phys_const
,
struct
gpart
*
restrict
g
)
{
const
double
dx
=
g
->
x
[
0
]
-
potential
->
x
;
const
float
dx
=
g
->
x
[
0
]
-
potential
->
x
;
const
double
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
float
dy
=
g
->
x
[
1
]
-
potential
->
y
;
const
double
dz
=
g
->
x
[
2
]
-
potential
->
z
;
const
float
dz
=
g
->
x
[
2
]
-
potential
->
z
;
const
double
rinv
=
1
.
/
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
const
float
rinv
=
1
.
f
/
sqrt
f
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
const
double
rinv3
=
rinv
*
rinv
*
rinv
;
const
float
rinv3
=
rinv
*
rinv
*
rinv
;
g
->
a_grav
[
0
]
+=
-
potential
->
mass
*
dx
*
rinv3
;
g
->
a_grav
[
0
]
+=
-
potential
->
mass
*
dx
*
rinv3
;
g
->
a_grav
[
1
]
+=
-
potential
->
mass
*
dy
*
rinv3
;
g
->
a_grav
[
1
]
+=
-
potential
->
mass
*
dy
*
rinv3
;
...
...
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