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

Only call cosmology_update() after the cosmological tables have been allocated.

parent 01f622a8
No related branches found
No related tags found
1 merge request!509Cosmological time integration
...@@ -414,9 +414,6 @@ void cosmology_init(const struct swift_params *params, ...@@ -414,9 +414,6 @@ void cosmology_init(const struct swift_params *params,
c->H0 = H0_cgs * units_cgs_conversion_factor(us, UNIT_CONV_TIME); c->H0 = H0_cgs * units_cgs_conversion_factor(us, UNIT_CONV_TIME);
c->Hubble_time = 1. / c->H0; c->Hubble_time = 1. / c->H0;
/* Set remaining variables to alid values */
cosmology_update(c, 0);
/* Initialise the interpolation tables */ /* Initialise the interpolation tables */
c->drift_fac_interp_table = NULL; c->drift_fac_interp_table = NULL;
c->grav_kick_fac_interp_table = NULL; c->grav_kick_fac_interp_table = NULL;
...@@ -425,6 +422,9 @@ void cosmology_init(const struct swift_params *params, ...@@ -425,6 +422,9 @@ void cosmology_init(const struct swift_params *params,
c->time_interp_table_offset = 0.; c->time_interp_table_offset = 0.;
cosmology_init_tables(c); cosmology_init_tables(c);
/* Set remaining variables to alid values */
cosmology_update(c, 0);
/* Update the times */ /* Update the times */
c->time_begin = cosmology_get_time_since_big_bang(c, c->a_begin); c->time_begin = cosmology_get_time_since_big_bang(c, c->a_begin);
c->time_end = cosmology_get_time_since_big_bang(c, c->a_end); c->time_end = cosmology_get_time_since_big_bang(c, c->a_end);
...@@ -433,11 +433,8 @@ void cosmology_init(const struct swift_params *params, ...@@ -433,11 +433,8 @@ void cosmology_init(const struct swift_params *params,
/** /**
* @brief Initialise the #cosmology for non-cosmological time-integration * @brief Initialise the #cosmology for non-cosmological time-integration
* *
* Essentially sets all constants to 1. * Essentially sets all constants to 1 or 0.
* *
* @param params The parsed values.
* @param us The current internal system of units.
* @param phys_const The physical constants in the current system of units.
* @param c The #cosmology to initialise. * @param c The #cosmology to initialise.
*/ */
void cosmology_init_no_cosmo(struct cosmology *c) { void cosmology_init_no_cosmo(struct cosmology *c) {
......
...@@ -5946,7 +5946,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) { ...@@ -5946,7 +5946,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
chemistry_struct_restore(chemistry, stream); chemistry_struct_restore(chemistry, stream);
e->chemistry = chemistry; e->chemistry = chemistry;
struct sourceterms *sourceterms = (struct sourceterms *) malloc(sizeof(struct sourceterms)); struct sourceterms *sourceterms =
(struct sourceterms *)malloc(sizeof(struct sourceterms));
sourceterms_struct_restore(sourceterms, stream); sourceterms_struct_restore(sourceterms, stream);
e->sourceterms = sourceterms; e->sourceterms = sourceterms;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment