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
a9e78804
Commit
a9e78804
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Correctly gather the next time-step
parent
af97a961
No related branches found
No related tags found
1 merge request
!301
New time line
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner.c
+43
-21
43 additions, 21 deletions
src/runner.c
with
43 additions
and
21 deletions
src/runner.c
+
43
−
21
View file @
a9e78804
...
@@ -972,6 +972,16 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
...
@@ -972,6 +972,16 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
ti_end_min
=
min
(
ti_end
+
ti_new_step
,
ti_end_min
);
ti_end_min
=
min
(
ti_end
+
ti_new_step
,
ti_end_min
);
ti_end_max
=
max
(
ti_end
+
ti_new_step
,
ti_end_max
);
ti_end_max
=
max
(
ti_end
+
ti_new_step
,
ti_end_max
);
}
}
else
{
/* part is inactive */
const
integertime_t
ti_end
=
get_integer_time_end
(
ti_current
,
p
->
time_bin
);
/* What is the next sync-point ? */
ti_end_min
=
min
(
ti_end
,
ti_end_min
);
ti_end_max
=
max
(
ti_end
,
ti_end_max
);
}
}
}
/* Loop over the g-particles in this cell. */
/* Loop over the g-particles in this cell. */
...
@@ -980,34 +990,46 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
...
@@ -980,34 +990,46 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the part. */
/* Get a handle on the part. */
struct
gpart
*
restrict
gp
=
&
gparts
[
k
];
struct
gpart
*
restrict
gp
=
&
gparts
[
k
];
/* If the g-particle has no counterpart
and needs to be kicked
*/
/* If the g-particle has no counterpart */
if
(
gp
->
id_or_neg_offset
>
0
&&
gpart_is_active
(
gp
,
e
)
)
{
if
(
gp
->
id_or_neg_offset
>
0
)
{
/*
First, finish the force loop
*/
/*
need to be kicked ?
*/
gravity_end_force
(
gp
,
const_G
);
if
(
gpart_is_active
(
gp
,
e
))
{
const
integertime_t
ti_step
=
get_integer_timestep
(
gp
->
time_bin
);
/* First, finish the force loop */
const
integertime_t
ti_begin
=
gravity_end_force
(
gp
,
const_G
);
get_integer_time_begin
(
ti_current
,
gp
->
time_bin
);
const
integertime_t
ti_end
=
get_integer_time_end
(
ti_current
,
gp
->
time_bin
);
/* Finish the time-step with a second half-kick */
const
integertime_t
ti_step
=
get_integer_timestep
(
gp
->
time_bin
);
kick_gpart
(
gp
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
,
ti_current
,
const
integertime_t
ti_begin
=
timeBase
);
get_integer_time_begin
(
ti_current
,
gp
->
time_bin
);
const
integertime_t
ti_end
=
get_integer_time_end
(
ti_current
,
gp
->
time_bin
);
/* Get new time-step */
/* Finish the time-step with a second half-kick */
const
integertime_t
ti_new_step
=
get_gpart_timestep
(
gp
,
e
);
kick_gpart
(
gp
,
ti_begin
+
ti_step
/
2
,
ti_begin
+
ti_step
,
ti_current
,
timeBase
);
/*
Update particle
*/
/*
Get new time-step
*/
gp
->
time_bin
=
get_time_bin
(
ti_new_step
);
const
integertime_t
ti_new_step
=
get_gpart_timestep
(
gp
,
e
);
/* Number of u
pdate
d g-
particle
s
*/
/* U
pdate
particle */
g_updated
++
;
gp
->
time_bin
=
get_time_bin
(
ti_new_step
)
;
/* What is the next sync-point ? */
/* Number of updated g-particles */
ti_end_min
=
min
(
ti_end
+
ti_new_step
,
ti_end_min
);
g_updated
++
;
ti_end_max
=
max
(
ti_end
+
ti_new_step
,
ti_end_max
);
/* What is the next sync-point ? */
ti_end_min
=
min
(
ti_end
+
ti_new_step
,
ti_end_min
);
ti_end_max
=
max
(
ti_end
+
ti_new_step
,
ti_end_max
);
}
else
{
/* gpart is inactive */
const
integertime_t
ti_end
=
get_integer_time_end
(
ti_current
,
gp
->
time_bin
);
/* What is the next sync-point ? */
ti_end_min
=
min
(
ti_end
,
ti_end_min
);
ti_end_max
=
max
(
ti_end
,
ti_end_max
);
}
}
}
}
}
}
}
...
...
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