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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
25dbafe2
Commit
25dbafe2
authored
Feb 17, 2018
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added cosmological factors for the drifting of multipoles.
parent
5eb11ec9
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!509
Cosmological time integration
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cell.c
+23
-11
23 additions, 11 deletions
src/cell.c
with
23 additions
and
11 deletions
src/cell.c
+
23
−
11
View file @
25dbafe2
...
@@ -2482,7 +2482,7 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
...
@@ -2482,7 +2482,7 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
}
else
if
(
!
c
->
split
&&
force
&&
ti_current
>
ti_old_gpart
)
{
}
else
if
(
!
c
->
split
&&
force
&&
ti_current
>
ti_old_gpart
)
{
/* Drift from the last time the cell was drifted to the current time */
/* Drift from the last time the cell was drifted to the current time */
float
dt_drift
;
double
dt_drift
;
if
(
e
->
policy
&
engine_policy_cosmology
)
if
(
e
->
policy
&
engine_policy_cosmology
)
dt_drift
=
dt_drift
=
cosmology_get_drift_factor
(
e
->
cosmology
,
ti_old_gpart
,
ti_current
);
cosmology_get_drift_factor
(
e
->
cosmology
,
ti_old_gpart
,
ti_current
);
...
@@ -2547,19 +2547,25 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
...
@@ -2547,19 +2547,25 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
*/
*/
void
cell_drift_all_multipoles
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
void
cell_drift_all_multipoles
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
const
double
timeBase
=
e
->
timeBase
;
const
integertime_t
ti_old_multipole
=
c
->
ti_old_multipole
;
const
integertime_t
ti_old_multipole
=
c
->
ti_old_multipole
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
integertime_t
ti_current
=
e
->
ti_current
;
/* Drift from the last time the cell was drifted to the current time */
#ifdef SWIFT_DEBUG_CHECKS
const
double
dt
=
(
ti_current
-
ti_old_multipole
)
*
timeBase
;
/* Check that we are actually going to move forward. */
/* Check that we are actually going to move forward. */
if
(
ti_current
<
ti_old_multipole
)
error
(
"Attempt to drift to the past"
);
if
(
ti_current
<
ti_old_multipole
)
error
(
"Attempt to drift to the past"
);
#endif
/* Drift from the last time the cell was drifted to the current time */
double
dt_drift
;
if
(
e
->
policy
&
engine_policy_cosmology
)
dt_drift
=
cosmology_get_drift_factor
(
e
->
cosmology
,
ti_old_multipole
,
ti_current
);
else
dt_drift
=
(
ti_current
-
ti_old_multipole
)
*
e
->
time_base
;
/* Drift the multipole */
/* Drift the multipole */
if
(
ti_current
>
ti_old_multipole
)
if
(
ti_current
>
ti_old_multipole
)
gravity_drift
(
c
->
multipole
,
dt
,
c
->
dx_max_gpart
);
gravity_drift
(
c
->
multipole
,
dt
_drift
,
c
->
dx_max_gpart
);
/* Are we not in a leaf ? */
/* Are we not in a leaf ? */
if
(
c
->
split
)
{
if
(
c
->
split
)
{
...
@@ -2584,18 +2590,24 @@ void cell_drift_all_multipoles(struct cell *c, const struct engine *e) {
...
@@ -2584,18 +2590,24 @@ void cell_drift_all_multipoles(struct cell *c, const struct engine *e) {
*/
*/
void
cell_drift_multipole
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
void
cell_drift_multipole
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
const
double
timeBase
=
e
->
timeBase
;
const
integertime_t
ti_old_multipole
=
c
->
ti_old_multipole
;
const
integertime_t
ti_old_multipole
=
c
->
ti_old_multipole
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
integertime_t
ti_current
=
e
->
ti_current
;
/* Drift from the last time the cell was drifted to the current time */
#ifdef SWIFT_DEBUG_CHECKS
const
double
dt
=
(
ti_current
-
ti_old_multipole
)
*
timeBase
;
/* Check that we are actually going to move forward. */
/* Check that we are actually going to move forward. */
if
(
ti_current
<
ti_old_multipole
)
error
(
"Attempt to drift to the past"
);
if
(
ti_current
<
ti_old_multipole
)
error
(
"Attempt to drift to the past"
);
#endif
/* Drift from the last time the cell was drifted to the current time */
double
dt_drift
;
if
(
e
->
policy
&
engine_policy_cosmology
)
dt_drift
=
cosmology_get_drift_factor
(
e
->
cosmology
,
ti_old_multipole
,
ti_current
);
else
dt_drift
=
(
ti_current
-
ti_old_multipole
)
*
e
->
time_base
;
if
(
ti_current
>
ti_old_multipole
)
if
(
ti_current
>
ti_old_multipole
)
gravity_drift
(
c
->
multipole
,
dt
,
c
->
dx_max_gpart
);
gravity_drift
(
c
->
multipole
,
dt
_drift
,
c
->
dx_max_gpart
);
/* Update the time of the last drift */
/* Update the time of the last drift */
c
->
ti_old_multipole
=
ti_current
;
c
->
ti_old_multipole
=
ti_current
;
...
...
...
...
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
sign in
to comment