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
36296f3a
Commit
36296f3a
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added infrastructure to check that particles follow the Kick-Drift-Kick scheme correctly
parent
7fb5b96d
No related branches found
No related tags found
1 merge request
!301
New time line
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/drift.h
+10
-0
10 additions, 0 deletions
src/drift.h
src/hydro/Gadget2/hydro_part.h
+10
-0
10 additions, 0 deletions
src/hydro/Gadget2/hydro_part.h
src/kick.h
+11
-1
11 additions, 1 deletion
src/kick.h
src/runner.c
+2
-4
2 additions, 4 deletions
src/runner.c
src/space.c
+5
-0
5 additions, 0 deletions
src/space.c
with
38 additions
and
5 deletions
src/drift.h
+
10
−
0
View file @
36296f3a
...
...
@@ -66,6 +66,16 @@ __attribute__((always_inline)) INLINE static void drift_part(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
double
timeBase
,
integertime_t
ti_old
,
integertime_t
ti_current
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
p
->
ti_drift
!=
ti_old
)
error
(
"Particle has not been drifted to the current time p->ti_drift=%lld, "
"c->ti_old=%lld, ti_current=%lld"
,
p
->
ti_drift
,
ti_old
,
ti_current
);
p
->
ti_drift
=
ti_current
;
#endif
/* Drift... */
p
->
x
[
0
]
+=
xp
->
v_full
[
0
]
*
dt
;
p
->
x
[
1
]
+=
xp
->
v_full
[
1
]
*
dt
;
...
...
This diff is collapsed.
Click to expand it.
src/hydro/Gadget2/hydro_part.h
+
10
−
0
View file @
36296f3a
...
...
@@ -130,6 +130,16 @@ struct part {
/* Time-step length */
timebin_t
time_bin
;
#ifdef SWIFT_DEBUG_CHECKS
/* Time of the last drift */
integertime_t
ti_drift
;
/* Time of the last kick */
integertime_t
ti_kick
;
#endif
}
SWIFT_STRUCT_ALIGN
;
#endif
/* SWIFT_GADGET2_HYDRO_PART_H */
This diff is collapsed.
Click to expand it.
src/kick.h
+
11
−
1
View file @
36296f3a
...
...
@@ -64,11 +64,21 @@ __attribute__((always_inline)) INLINE static void kick_gpart(
*/
__attribute__
((
always_inline
))
INLINE
static
void
kick_part
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
integertime_t
ti_start
,
integertime_t
ti_end
,
integertime_t
ti_current
,
double
timeBase
)
{
integertime_t
ti_end
,
double
timeBase
)
{
/* Time interval for this half-kick */
const
float
dt
=
(
ti_end
-
ti_start
)
*
timeBase
;
#ifdef SWIFT_DEBUG_CHECKS
if
(
p
->
ti_kick
!=
ti_start
)
error
(
"Particle has not been kicked to the current time p->ti_kick=%lld, "
"ti_start=%lld, ti_end=%lld"
,
p
->
ti_kick
,
ti_start
,
ti_end
);
p
->
ti_kick
=
ti_end
;
#endif
/* Get the acceleration */
float
a_tot
[
3
]
=
{
p
->
a_hydro
[
0
],
p
->
a_hydro
[
1
],
p
->
a_hydro
[
2
]};
if
(
p
->
gpart
!=
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/runner.c
+
2
−
4
View file @
36296f3a
...
...
@@ -867,8 +867,7 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) {
get_integer_time_begin
(
ti_current
,
p
->
time_bin
);
/* do the kick */
kick_part
(
p
,
xp
,
ti_begin
,
ti_begin
+
ti_step
/
2
,
ti_current
,
timeBase
);
kick_part
(
p
,
xp
,
ti_begin
,
ti_begin
+
ti_step
/
2
,
timeBase
);
}
}
...
...
@@ -944,8 +943,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
get_integer_time_begin
(
ti_current
,
p
->
time_bin
);
/* Finish the time-step with a second half-kick */
kick_part
(
p
,
xp
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
,
ti_current
,
timeBase
);
kick_part
(
p
,
xp
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
,
timeBase
);
/* Prepare the values to be drifted */
hydro_reset_predicted_values
(
p
,
xp
);
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
5
−
0
View file @
36296f3a
...
...
@@ -1770,6 +1770,11 @@ void space_init_parts(struct space *s) {
#endif
hydro_first_init_part
(
&
p
[
i
],
&
xp
[
i
]);
#ifdef SWIFT_DEBUG_CHECKS
p
->
ti_drift
=
0
;
p
->
ti_kick
=
0
;
#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