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

Add a function to set the cosmological factors to valid values when running a...

Add a function to set the cosmological factors to valid values when running a non-cosmological case.
parent d89e855d
Branches
Tags
1 merge request!509Cosmological time integration
...@@ -601,7 +601,10 @@ int main(int argc, char *argv[]) { ...@@ -601,7 +601,10 @@ int main(int argc, char *argv[]) {
/* Initialise the cosmology */ /* Initialise the cosmology */
struct cosmology cosmo; struct cosmology cosmo;
if (with_cosmology) cosmology_init(params, &us, &prog_const, &cosmo); if (with_cosmology)
cosmology_init(params, &us, &prog_const, &cosmo);
else
cosmology_init_no_cosmo(params, &us, &prog_const, &cosmo);
if (with_cosmology) cosmology_print(&cosmo); if (with_cosmology) cosmology_print(&cosmo);
/* Initialise the hydro properties */ /* Initialise the hydro properties */
......
...@@ -421,6 +421,51 @@ void cosmology_init(const struct swift_params *params, ...@@ -421,6 +421,51 @@ void cosmology_init(const struct swift_params *params,
cosmology_init_tables(c); cosmology_init_tables(c);
} }
/**
* @brief Initialise the #cosmology for non-cosmological time-integration
*
* Essentially sets all constants to 1.
*
* @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.
*/
void cosmology_init_no_cosmo(const struct swift_params *params,
const struct unit_system *us,
const struct phys_const *phys_const,
struct cosmology *c) {
c->Omega_m = 0.;
c->Omega_r = 0.;
c->Omega_k = 0.;
c->Omega_lambda = 0.;
c->Omega_b = 0.;
c->w_0 = 0.;
c->w_a = 0.;
c->h = 0.;
c->w = 0.;
c->a_begin = 1.;
c->a_end = 1.;
c->log_a_begin = 0.;
c->log_a_end = 0.;
c->H = 1.;
c->a = 1.;
c->a_inv = 1.;
c->a_dot = 0.;
c->time = 0.;
c->universe_age_at_present_day = 0.;
/* Initialise the interpolation tables */
c->drift_fac_interp_table = NULL;
c->grav_kick_fac_interp_table = NULL;
c->hydro_kick_fac_interp_table = NULL;
c->time_interp_table = NULL;
c->time_interp_table_offset = 0.;
}
/** /**
* @brief Computes the cosmology factor that enters the drift operator. * @brief Computes the cosmology factor that enters the drift operator.
* *
......
...@@ -146,6 +146,11 @@ void cosmology_init(const struct swift_params *params, ...@@ -146,6 +146,11 @@ void cosmology_init(const struct swift_params *params,
const struct unit_system *us, const struct unit_system *us,
const struct phys_const *phys_const, struct cosmology *c); const struct phys_const *phys_const, struct cosmology *c);
void cosmology_init_no_cosmo(const struct swift_params *params,
const struct unit_system *us,
const struct phys_const *phys_const,
struct cosmology *c);
void cosmology_print(const struct cosmology *c); void cosmology_print(const struct cosmology *c);
void cosmology_clean(struct cosmology *c); void cosmology_clean(struct cosmology *c);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment