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

Added cosmological conversion factor for the time-step size.

parent 96516056
No related branches found
No related tags found
1 merge request!509Cosmological time integration
......@@ -167,6 +167,9 @@ void cosmology_update(struct cosmology *c, integertime_t ti_current) {
/* Expansion rate */
c->a_dot = c->H * c->a;
/* Time-step conversion factor */
c->time_step_factor = c->H;
/* Time */
c->time = cosmology_get_time_since_big_bang(c, a);
c->lookback_time = c->universe_age_at_present_day - c->time;
......@@ -464,6 +467,8 @@ void cosmology_init_no_cosmo(struct cosmology *c) {
c->a_factor_hydro_accel = 1.;
c->a_factor_grav_accel = 1.;
c->time_step_factor = 1.;
c->a_dot = 0.;
c->time = 0.;
c->universe_age_at_present_day = 0.;
......
......@@ -62,6 +62,9 @@ struct cosmology {
/*! Hubble constant at the current redshift (in internal units) */
double H;
/*! Conversion factor from internal time-step size to cosmological step */
double time_step_factor;
/*! Expansion rate at the current redshift (in internal units) */
double a_dot;
......
......@@ -84,8 +84,8 @@ __attribute__((always_inline)) INLINE static integertime_t get_gpart_timestep(
/* Take the minimum of all */
float new_dt = min(new_dt_self, new_dt_ext);
/* Apply cosmology correction (H==1 if non-cosmological) */
new_dt *= e->cosmology->H;
/* Apply cosmology correction */
new_dt *= e->cosmology->time_step_factor;
/* Limit timestep within the allowed range */
new_dt = min(new_dt, e->dt_max);
......@@ -149,7 +149,7 @@ __attribute__((always_inline)) INLINE static integertime_t get_part_timestep(
new_dt = min(new_dt, dt_h_change);
/* Apply cosmology correction (H==1 if non-cosmological) */
new_dt *= e->cosmology->H;
new_dt *= e->cosmology->time_step_factor;
/* Limit timestep within the allowed range */
new_dt = min(new_dt, e->dt_max);
......@@ -192,7 +192,7 @@ __attribute__((always_inline)) INLINE static integertime_t get_spart_timestep(
float new_dt = min3(new_dt_star, new_dt_self, new_dt_ext);
/* Apply cosmology correction (H==1 if non-cosmological) */
new_dt *= e->cosmology->H;
new_dt *= e->cosmology->time_step_factor;
/* Limit timestep within the allowed range */
new_dt = min(new_dt, e->dt_max);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment