diff --git a/doc/RTD/source/SubgridModels/EAGLE/index.rst b/doc/RTD/source/SubgridModels/EAGLE/index.rst index 55ce89ac3d1b50374a807b49b74b892ffa283de1..d9eb19eb7fd41b016443d2cef1edbdbbf8d314b7 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/index.rst +++ b/doc/RTD/source/SubgridModels/EAGLE/index.rst @@ -647,9 +647,10 @@ Supernova feedback: Dalla Vecchia+2012 & Schaye+2015 filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 8.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 1 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Maximal fraction of energy applied in a SNII feedback event. @@ -681,7 +682,8 @@ different from the value (:math:`0.67`) reported in table 3 of `Schaye of :math:`h^{-2} = 0.6777^{-2} = 2.1773` is missing in the paper. The Magnesium yields from SNII have also been doubled since the -original EAGLE simulations were run. +original EAGLE simulations were run and the minimal mass for SNII stars has +been raised to 8 solar masses (from 6). diff --git a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml index 585cbf370dd35179d7b02dd69dde9a7c86861e5e..7aef01d27632c53eb68f8b0c637d3748675dbb0c 100644 --- a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml @@ -143,9 +143,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 8.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 1 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: dummy # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml index 0471399282687b14b52c070c22ac6411d8733ceb..b74c34e95af372498e8dd91f5fe8270b87c2e8c7 100644 --- a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml @@ -144,9 +144,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 8.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 1 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: dummy # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml index 0fc196eb0fa292697a1baf33642e6bfcc193dab8..cc18e2d110b53276e9913c0ff20d12597721b05a 100644 --- a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml @@ -144,9 +144,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 8.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 1 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: dummy # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml index f761050b9b25a0ccba31e382a3d0a5ed972f1c7f..4610d7ccf5763047af165599923b7c5e53421429 100644 --- a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml @@ -140,9 +140,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml index 789b56a996252356e3424b1176bd66d65f814d24..2ff6014fc886ef2a91a87f7530eb4ccc534fa83f 100644 --- a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml @@ -148,9 +148,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml index 0a2d602de8a1f54ce7b21e35851ad5cc511cd73f..6871e2389b6de68b6190abdee3652f36427990e2 100644 --- a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml @@ -139,9 +139,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml index af030fac2626d7ec328257bf890057fc11ff177d..cd451bbfb98099442d5438262c5afe2e6133f3d5 100644 --- a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml @@ -149,9 +149,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml b/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml index e043a578376f6cb8baaaf7e79e8919aa3e4af8a8..94a1b5a8fb29a46971bf1f025b545e47e2faf9f4 100644 --- a/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml +++ b/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml @@ -124,9 +124,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 1.0 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml b/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml index 421d454414af5c8b1ba50bb79ccfb4f0f4a70673..b6188cd20deb7f26dca4625981e8f1cd26d557af 100644 --- a/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml +++ b/examples/SubgridTests/CosmologicalStellarEvolution/stellar_evolution.yml @@ -94,9 +94,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml index fb20c2faf7f7045fb441d8eac92016656decf8f7..52b212de9e72e58a95f7f72a4796cc673a9dd4b5 100644 --- a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml +++ b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml @@ -88,9 +88,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 0 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Minimal fraction of energy applied in a SNII feedback event. diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 99c8600c83963220c5f8ff2663bf06dd0a9044d9..e9eab9c0c7e5922dfa5f9e4c8ea9c3bde5f1f458 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -393,9 +393,10 @@ EAGLEFeedback: filename: ./yieldtables/ # Path to the directory containing the EAGLE yield tables. IMF_min_mass_Msun: 0.1 # Minimal stellar mass considered for the Chabrier IMF in solar masses. IMF_max_mass_Msun: 100.0 # Maximal stellar mass considered for the Chabrier IMF in solar masses. - SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII feedback (not SNII enrichment!) in solar masses. - SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event. + SNII_min_mass_Msun: 6.0 # Minimal mass considered for SNII stars in solar masses. + SNII_max_mass_Msun: 100.0 # Maximal mass considered for SNII stars in solar masses. + SNII_sampled_delay: 1 # Sample the SNII lifetimes to do feedback. + SNII_wind_delay_Gyr: 0.03 # Time in Gyr between a star's birth and the SNII thermal feedback event when not sampling. SNII_delta_T_K: 3.16228e7 # Change in temperature to apply to the gas particle in a SNII thermal feedback event in Kelvin. SNII_energy_erg: 1.0e51 # Energy of one SNII explosion in ergs. SNII_energy_fraction_min: 0.3 # Maximal fraction of energy applied in a SNII feedback event. diff --git a/src/feedback/EAGLE/feedback.c b/src/feedback/EAGLE/feedback.c index 08e3c4375f735f8992ad014357c6b910314220b8..59612ca2f494f346548e4ec2543cd87e6d9c3941 100644 --- a/src/feedback/EAGLE/feedback.c +++ b/src/feedback/EAGLE/feedback.c @@ -44,7 +44,7 @@ double eagle_feedback_temperature_change(const struct spart* sp, /** * @brief Computes the number of supernovae of type II exploding for a given - * star particle. + * star particle assuming that all the SNII stars go off at once. * * @param sp The #spart. * @param props The properties of the stellar model. @@ -52,11 +52,113 @@ double eagle_feedback_temperature_change(const struct spart* sp, double eagle_feedback_number_of_SNII(const struct spart* sp, const struct feedback_props* props) { - /* Note: For a Chabrier 2003 IMF and SNII going off between 6 and 100 - * M_sun, the first term is 0.017362 M_sun^-1 */ + /* Note: For a Chabrier 2003 IMF and SNII going off + * - between 6 and 100 M_sun, the first term is 0.017362 M_sun^-1 (EAGLE) + * - between 8 and 100 M_sun, the first term is 0.011801 M_sun^-1 (EAGLE-XL) + */ return props->num_SNII_per_msun * sp->mass_init * props->mass_to_solar_mass; } +/** + * @brief Computes the number of supernovae of type II exploding for a given + * star particle between two mass limits + * + * @param sp The #spart. + * @param props The properties of the stellar model. + * @param min_dying_mass_Msun Minimal star mass dying this step (in solar + * masses). + * @param max_dying_mass_Msun Maximal star mass dying this step (in solar + * masses). + */ +double eagle_feedback_number_of_sampled_SNII(const struct spart* sp, + const struct feedback_props* props, + const double min_dying_mass_Msun, + const double max_dying_mass_Msun) { + + /* The max dying star mass is below the SNII mass window + * --> No SNII */ + if (max_dying_mass_Msun < props->SNII_min_mass_msun) return 0.; + + /* The min dying star mass is above the SNII mass window + * --> No SNII */ + if (min_dying_mass_Msun > props->SNII_max_mass_msun) return 0.; + + /* Ok, we have some overlap with the SNII mass window. */ + + double log10_min_mass_Msun = -10.; + double log10_max_mass_Msun = -10.; + + /* The min dying star mass dies inside the SNII mass window */ + if (min_dying_mass_Msun <= props->SNII_max_mass_msun && + min_dying_mass_Msun > props->SNII_min_mass_msun) { + + /* Now, check the max dying star mass */ + + /* The max dying star mass is also inside the SNII mass window */ + if (max_dying_mass_Msun <= props->SNII_max_mass_msun) { + log10_min_mass_Msun = log10(min_dying_mass_Msun); + log10_max_mass_Msun = log10(max_dying_mass_Msun); + } + + /* The max dying star is above the SNII mass window */ + else { + log10_min_mass_Msun = log10(min_dying_mass_Msun); + log10_max_mass_Msun = props->log10_SNII_max_mass_msun; + } + + } + + /* The min dying star mass dies below the SNII mass window */ + else if (min_dying_mass_Msun <= props->SNII_min_mass_msun) { + + /* Now, check the max dying star mass */ + + /* The max dying star mass is inside the SNII mass window */ + if (max_dying_mass_Msun > props->SNII_min_mass_msun && + max_dying_mass_Msun <= props->SNII_max_mass_msun) { + log10_min_mass_Msun = props->log10_SNII_min_mass_msun; + log10_max_mass_Msun = log10(max_dying_mass_Msun); + } + + /* The max dying star is above the SNII mass window */ + else if (max_dying_mass_Msun > props->SNII_max_mass_msun) { + log10_min_mass_Msun = props->log10_SNII_min_mass_msun; + log10_max_mass_Msun = props->log10_SNII_max_mass_msun; + } + + /* The max dying star mass is also below the SNII mass window */ + else { + + /* We already excluded this at the star of the function */ +#ifdef SWIFT_DEBUG_CHECKS + error("Error in the logic"); +#endif + } + } + + /* The min dying star mass dies above the SNII mass window */ + else { + + /* We already excluded this at the star of the function */ +#ifdef SWIFT_DEBUG_CHECKS + error("Error in the logic"); +#endif + } + +#ifdef SWIFT_DEBUG_CHECKS + if (log10_min_mass_Msun == -10. || log10_max_mass_Msun == -10.) + error("Something went wrong in the calculation of the number of SNII."); +#endif + + /* Calculate how many supernovae have exploded in this timestep + * by integrating the IMF between the bounds we chose */ + const double num_SNII_per_msun = + integrate_imf(log10_min_mass_Msun, log10_max_mass_Msun, + eagle_imf_integration_no_weight, NULL, props); + + return num_SNII_per_msun * sp->mass_init * props->mass_to_solar_mass; +} + /** * @brief Computes the number of supernovae of type Ia exploding for a given * star particle between time t0 and t1 @@ -161,22 +263,32 @@ double eagle_feedback_energy_fraction(const struct spart* sp, * @param dt Length of time-step in internal units. * @param ngb_gas_mass Total un-weighted mass in the star's kernel. * @param feedback_props The properties of the feedback model. + * @param min_dying_mass_Msun Minimal star mass dying this step (in solar + * masses). + * @param max_dying_mass_Msun Maximal star mass dying this step (in solar + * masses). */ INLINE static void compute_SNII_feedback( struct spart* sp, const double star_age, const double dt, - const float ngb_gas_mass, const struct feedback_props* feedback_props) { + const float ngb_gas_mass, const struct feedback_props* feedback_props, + const double min_dying_mass_Msun, const double max_dying_mass_Msun) { - /* Time after birth considered for SNII feedback (internal units) */ + /* Are we sampling the delay function or using a fixed delay? */ + const int SNII_sampled_delay = feedback_props->SNII_sampled_delay; + + /* Time after birth considered for SNII feedback (internal units) + * when using a fixed delay */ const double SNII_wind_delay = feedback_props->SNII_wind_delay; /* Are we doing feedback this step? * Note that since the ages are calculated using an interpolation table we * must allow some tolerance here*/ - if (star_age <= SNII_wind_delay && - (star_age + 1.0001 * dt) > SNII_wind_delay) { + if ((SNII_sampled_delay) || (star_age <= SNII_wind_delay && + (star_age + 1.001 * dt) > SNII_wind_delay)) { - /* Make sure a star does not do feedback twice! */ - if (sp->f_E != -1.f) { + /* Make sure a star does not do feedback twice + * when using a fixed delay! */ + if (!SNII_sampled_delay && sp->f_E != -1.f) { #ifdef SWIFT_DEBUG_CHECKS message("Star has already done feedback! sp->id=%lld age=%e d=%e", sp->id, star_age, dt); @@ -187,10 +299,21 @@ INLINE static void compute_SNII_feedback( /* Properties of the model (all in internal units) */ const double delta_T = eagle_feedback_temperature_change(sp, feedback_props); - const double N_SNe = eagle_feedback_number_of_SNII(sp, feedback_props); const double E_SNe = feedback_props->E_SNII; const double f_E = eagle_feedback_energy_fraction(sp, feedback_props); + /* Number of SNe at this time-step */ + double N_SNe; + if (SNII_sampled_delay) { + N_SNe = eagle_feedback_number_of_sampled_SNII( + sp, feedback_props, min_dying_mass_Msun, max_dying_mass_Msun); + } else { + N_SNe = eagle_feedback_number_of_SNII(sp, feedback_props); + } + + /* Abort if there are no SNe exploding this step */ + if (N_SNe == 0.) return; + /* Conversion factor from T to internal energy */ const double conv_factor = feedback_props->temp_to_u_factor; @@ -720,7 +843,7 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, #endif /* Convert dt and stellar age from internal units to Gyr. */ - const double Gyr_in_cgs = 1e9 * 365. * 24. * 3600.; + const double Gyr_in_cgs = 1e9 * 365.25 * 24. * 3600.; const double time_to_cgs = units_cgs_conversion_factor(us, UNIT_CONV_TIME); const double conversion_factor = time_to_cgs / Gyr_in_cgs; const double dt_Gyr = dt * conversion_factor; @@ -772,11 +895,6 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, error("Negative weight!"); #endif - /* Compute properties of the stochastic SNII feedback model. */ - if (feedback_props->with_SNII_feedback) { - compute_SNII_feedback(sp, age, dt, ngb_gas_mass, feedback_props); - } - /* Calculate mass of stars that has died from the star's birth up to the * beginning and end of timestep */ const double max_dying_mass_Msun = @@ -784,13 +902,19 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, const double min_dying_mass_Msun = dying_mass_msun(star_age_Gyr + dt_Gyr, Z, feedback_props); -#ifdef SWIFT_DEBUG_CHECK +#ifdef SWIFT_DEBUG_CHECKS /* Sanity check. Worth investigating if necessary as functions for evaluating * mass of stars dying might be strictly decreasing. */ if (min_dying_mass_Msun > max_dying_mass_Msun) error("min dying mass is greater than max dying mass"); #endif + /* Compute properties of the stochastic SNII feedback model. */ + if (feedback_props->with_SNII_feedback) { + compute_SNII_feedback(sp, age, dt, ngb_gas_mass, feedback_props, + min_dying_mass_Msun, max_dying_mass_Msun); + } + /* Integration interval is zero - this can happen if minimum and maximum * dying masses are above imf_max_mass_Msun. Return without doing any * enrichment. */ @@ -896,11 +1020,18 @@ void feedback_props_init(struct feedback_props* fp, /* Properties of the SNII energy feedback model ------------------------- */ - /* Set the delay time before SNII occur */ - const double Gyr_in_cgs = 1.0e9 * 365. * 24. * 3600.; - fp->SNII_wind_delay = - parser_get_param_double(params, "EAGLEFeedback:SNII_wind_delay_Gyr") * - Gyr_in_cgs / units_cgs_conversion_factor(us, UNIT_CONV_TIME); + /* Are we sampling the SNII lifetimes for feedback or using a fixed delay? */ + fp->SNII_sampled_delay = + parser_get_param_int(params, "EAGLEFeedback:SNII_sampled_delay"); + + if (!fp->SNII_sampled_delay) { + + /* Set the delay time before SNII occur */ + const double Gyr_in_cgs = 1.0e9 * 365.25 * 24. * 3600.; + fp->SNII_wind_delay = + parser_get_param_double(params, "EAGLEFeedback:SNII_wind_delay_Gyr") * + Gyr_in_cgs / units_cgs_conversion_factor(us, UNIT_CONV_TIME); + } /* Read the temperature change to use in stochastic heating */ fp->SNe_deltaT_desired = @@ -925,6 +1056,8 @@ void feedback_props_init(struct feedback_props* fp, error("Can't have the max SNII mass smaller than the min SNII mass!"); } + fp->SNII_min_mass_msun = SNII_min_mass_msun; + fp->SNII_max_mass_msun = SNII_max_mass_msun; fp->log10_SNII_min_mass_msun = log10(SNII_min_mass_msun); fp->log10_SNII_max_mass_msun = log10(SNII_max_mass_msun); diff --git a/src/feedback/EAGLE/feedback_properties.h b/src/feedback/EAGLE/feedback_properties.h index 0f1848c90f8cb93fae7e9d818c23eae72c929cee..a0107ccdd7f499e750beba34bce6e195312a8d5e 100644 --- a/src/feedback/EAGLE/feedback_properties.h +++ b/src/feedback/EAGLE/feedback_properties.h @@ -212,6 +212,12 @@ struct feedback_props { /* ------------ SNe feedback properties ------------ */ + /*! Minimal stellar mass considered for SNII feedback (in solar masses) */ + double SNII_min_mass_msun; + + /*! Maximal stellar mass considered for SNII feedback (in solar masses) */ + double SNII_max_mass_msun; + /*! Log 10 of the minimal stellar mass considered for SNII feedback (in solar * masses) */ double log10_SNII_min_mass_msun; @@ -223,7 +229,10 @@ struct feedback_props { /*! Number of type II supernovae per solar mass */ float num_SNII_per_msun; - /*! Wind delay time for SNII */ + /*! Are we sampling the SNII life-times or using a fixed delay? */ + int SNII_sampled_delay; + + /*! Wind delay time for SNII when using a fixed delay */ double SNII_wind_delay; /*! Temperature increase induced by SNe feedback */