Skip to content
Snippets Groups Projects
Commit 25dbafe2 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added cosmological factors for the drifting of multipoles.

parent 5eb11ec9
Branches
Tags
1 merge request!509Cosmological time integration
...@@ -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;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment