diff --git a/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml b/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml index 9b8c3e34dad20eba560a7316f16364b76a088c05..b3d318d68b69d0940d7a37b17ae5331a711b140f 100644 --- a/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml +++ b/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml @@ -40,7 +40,8 @@ SPH: # Properties of the stars Stars: - birth_time: 0.00991 # Give the star in the ICs a decent birth time + overwrite_birth_time: 1 + birth_time: 0.00991 # Give the star in the ICs a decent birth time # Parameters related to the initial conditions InitialConditions: diff --git a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml index 230ce6c8b8a51603c1dab9a308845be3e984febb..63c7a4d2624793af26bdbaf628715243e2ab511d 100644 --- a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml +++ b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml @@ -34,7 +34,8 @@ SPH: # Properties of the stars Stars: - birth_time: 0. # Give the star in the ICs a decent birth time + overwrite_birth_time: 1 + birth_time: 0. # Give the star in the ICs a decent birth time # Parameters related to the initial conditions InitialConditions: diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index db7b8fddc4afac64d539d8e55952670ae937a57b..1d09719e011b93e01b39b02ecc3cd90590bd0a32 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -54,7 +54,8 @@ Stars: h_tolerance: 1e-4 # (Optional) Relative accuracy of the Netwon-Raphson scheme for the smoothing lengths. Defaults to the SPH value. max_ghost_iterations: 30 # (Optional) Maximal number of iterations allowed to converge towards the smoothing length. Defaults to the SPH value. max_volume_change: 1.4 # (Optional) Maximal allowed change of kernel volume over one time-step. Defaults to the SPH value. - birth_time: -1 # (Optional) Initial birth time of *all* the stars. If not -1, this value will overwrite all the values read from the ICs. + overwrite_birth_time: 0 # (Optional) Do we want to overwrite the birth time of the stars read from the ICs? (default: 0). + birth_time: -1 # (Optional) Initial birth times of *all* the stars to be used if we are overwriting them. (-1 means the stars remain inactive feedback-wise througout the run). # Parameters for the self-gravity scheme Gravity: diff --git a/src/stars/EAGLE/stars.h b/src/stars/EAGLE/stars.h index f102ddb22c0075d33b02c726d0447b64fa9d3df7..82ad2e25f474e6c66e6cf5e09f39188faa09b084 100644 --- a/src/stars/EAGLE/stars.h +++ b/src/stars/EAGLE/stars.h @@ -65,7 +65,7 @@ __attribute__((always_inline)) INLINE static void stars_first_init_spart( sp->time_bin = 0; sp->birth_density = 0.f; sp->f_E = -1.f; - if (stars_properties->spart_first_init_birth_time != -1.f) + if (stars_properties->overwrite_birth_time) sp->birth_time = stars_properties->spart_first_init_birth_time; stars_init_spart(sp); diff --git a/src/stars/EAGLE/stars_io.h b/src/stars/EAGLE/stars_io.h index b91b5cf94595a05acd280cfd4f51755f91cce04d..fc898c558772d2ef3ceb8eca81fd785c712d5ae8 100644 --- a/src/stars/EAGLE/stars_io.h +++ b/src/stars/EAGLE/stars_io.h @@ -217,8 +217,11 @@ INLINE static void stars_props_init(struct stars_props *sp, else sp->log_max_h_change = logf(powf(max_volume_change, hydro_dimension_inv)); - /* Read birth time to set all stars in ICs to (defaults to -1 to indicate star - * present in ICs) */ + /* Do we want to overwrite the stars' birth time? */ + sp->overwrite_birth_time = + parser_get_opt_param_int(params, "Stars:overwrite_birth_time", 0); + + /* Read birth time to set all stars in ICs */ sp->spart_first_init_birth_time = parser_get_opt_param_float(params, "Stars:birth_time", -1.f); } @@ -244,6 +247,10 @@ INLINE static void stars_props_print(const struct stars_props *sp) { message("Maximal iterations in ghost task set to %d", sp->max_smoothing_iterations); + + if (sp->overwrite_birth_time) + message("Stars' birth time read from the ICs will be overwritten to %f", + sp->spart_first_init_birth_time); } #if defined(HAVE_HDF5) diff --git a/src/stars/EAGLE/stars_part.h b/src/stars/EAGLE/stars_part.h index 4502b10edb7b646e9ba845e1ffffbb9255cdc01c..9114cb9107e1259698c365be82e5318d60d37ac7 100644 --- a/src/stars/EAGLE/stars_part.h +++ b/src/stars/EAGLE/stars_part.h @@ -144,7 +144,7 @@ struct stars_props { /*! Smoothing length tolerance */ float h_tolerance; - /*! Tolerance on neighbour number (for info only)*/ + /*! Tolerance on neighbour number (for info only) */ float delta_neighbours; /*! Maximal number of iterations to converge h */ @@ -153,7 +153,10 @@ struct stars_props { /*! Maximal change of h over one time-step */ float log_max_h_change; - /*! Value to set birth time of stars read from ICs if not set to -1 */ + /*! Are we overwriting the stars' birth time read from the ICs? */ + int overwrite_birth_time; + + /*! Value to set birth time of stars read from ICs */ float spart_first_init_birth_time; };