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

Corrected rounding error for the stellar age and SNII feedback.

parent a8038b01
No related branches found
No related tags found
1 merge request!805Communication tasks for on-the-fly star formation
...@@ -138,14 +138,18 @@ INLINE static void compute_SNII_feedback( ...@@ -138,14 +138,18 @@ INLINE static void compute_SNII_feedback(
const float ngb_gas_mass, const struct feedback_props* feedback_props) { const float ngb_gas_mass, const struct feedback_props* feedback_props) {
/* Time after birth considered for SNII feedback (internal units) */ /* Time after birth considered for SNII feedback (internal units) */
const float SNII_wind_delay = feedback_props->SNII_wind_delay; const double SNII_wind_delay = feedback_props->SNII_wind_delay;
/* Are we doing feedback this step? */ /* Are we doing feedback this step? */
if (star_age <= SNII_wind_delay && (star_age + dt) > SNII_wind_delay) { if (star_age <= SNII_wind_delay && (star_age + dt) > SNII_wind_delay) {
if (sp->f_E != -1.f) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (sp->f_E != -1.f) error("Star has already done feedback!"); message("Star has already done feedback! sp->id=%lld age=%e d=%e", sp->id,
star_age, dt);
#endif #endif
return;
}
/* Properties of the model (all in internal units) */ /* Properties of the model (all in internal units) */
const double delta_T = const double delta_T =
...@@ -685,8 +689,8 @@ INLINE static void evolve_AGB(const float log10_min_mass, float log10_max_mass, ...@@ -685,8 +689,8 @@ INLINE static void evolve_AGB(const float log10_min_mass, float log10_max_mass,
*/ */
void compute_stellar_evolution(const struct feedback_props* feedback_props, void compute_stellar_evolution(const struct feedback_props* feedback_props,
const struct cosmology* cosmo, struct spart* sp, const struct cosmology* cosmo, struct spart* sp,
const struct unit_system* us, const float age, const struct unit_system* us, const double age,
const float dt) { const double dt) {
TIMER_TIC; TIMER_TIC;
...@@ -843,9 +847,9 @@ void feedback_props_init(struct feedback_props* fp, ...@@ -843,9 +847,9 @@ void feedback_props_init(struct feedback_props* fp,
/* Properties of the SNII energy feedback model ------------------------- */ /* Properties of the SNII energy feedback model ------------------------- */
/* Set the delay time before SNII occur */ /* Set the delay time before SNII occur */
const float Gyr_in_cgs = 1e9 * 365 * 24 * 3600; const double Gyr_in_cgs = 1.0e9 * 365. * 24. * 3600.;
fp->SNII_wind_delay = fp->SNII_wind_delay =
parser_get_param_float(params, "EAGLEFeedback:SNII_wind_delay_Gyr") * parser_get_param_double(params, "EAGLEFeedback:SNII_wind_delay_Gyr") *
Gyr_in_cgs / units_cgs_conversion_factor(us, UNIT_CONV_TIME); Gyr_in_cgs / units_cgs_conversion_factor(us, UNIT_CONV_TIME);
/* Read the temperature change to use in stochastic heating */ /* Read the temperature change to use in stochastic heating */
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
void compute_stellar_evolution(const struct feedback_props* feedback_props, void compute_stellar_evolution(const struct feedback_props* feedback_props,
const struct cosmology* cosmo, struct spart* sp, const struct cosmology* cosmo, struct spart* sp,
const struct unit_system* us, const float age, const struct unit_system* us, const double age,
const float dt); const double dt);
/** /**
* @brief Should we do feedback for this star? * @brief Should we do feedback for this star?
......
...@@ -201,7 +201,7 @@ struct feedback_props { ...@@ -201,7 +201,7 @@ struct feedback_props {
float num_SNII_per_msun; float num_SNII_per_msun;
/*! Wind delay time for SNII */ /*! Wind delay time for SNII */
float SNII_wind_delay; double SNII_wind_delay;
/*! Temperature increase induced by SNe feedback */ /*! Temperature increase induced by SNe feedback */
float SNe_deltaT_desired; float SNe_deltaT_desired;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment