diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml b/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml index b55b42d9530bffbd825fd3c831b6abd0434c4bd3..24d31443f6320b09b3fb7a1d8146f5c142b3a4ba 100644 --- a/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml +++ b/examples/IsolatedGalaxy/IsolatedGalaxy_feedback/isolated_galaxy.yml @@ -1,14 +1,13 @@ # Define the system of units to use internally. InternalUnitSystem: UnitMass_in_cgs: 1.98848e43 # 10^10 M_sun in grams - UnitLength_in_cgs: 3.08567758E21 # 1 kpc - UnitVelocity_in_cgs: 1E5 # km/s - UnitCurrent_in_cgs: 1 # Amperes - UnitTemp_in_cgs: 1 # Kelvin + UnitLength_in_cgs: 3.08567758e21 # 1 kpc in cm + UnitVelocity_in_cgs: 1e5 # 1 km/s in cm/s + UnitCurrent_in_cgs: 1 # Amperes + UnitTemp_in_cgs: 1 # Kelvin # Parameters for the self-gravity scheme Gravity: - mesh_side_length: 32 # Number of cells along each axis for the periodic gravity mesh. eta: 0.025 # Constant dimensionless multiplier for time integration. theta: 0.7 # Opening angle (Multipole acceptance criterion). comoving_softening: 0.01 # Comoving softening length (in internal units). @@ -18,7 +17,7 @@ Gravity: TimeIntegration: time_begin: 0. # The starting time of the simulation (in internal units). time_end: 0.1 # The end time of the simulation (in internal units). - dt_min: 1e-9 # The minimal time-step size of the simulation (in internal units). + dt_min: 1e-14 # The minimal time-step size of the simulation (in internal units). dt_max: 1e-2 # The maximal time-step size of the simulation (in internal units). # Parameters governing the snapshots @@ -27,7 +26,6 @@ Snapshots: time_first: 0. # (Optional) Time of the first output if non-cosmological time-integration (in internal units) delta_time: 0.001 # Time difference between consecutive outputs (in internal units) - # Parameters governing the conserved quantities statistics Statistics: delta_time: 1e-2 # Time between statistics output @@ -110,18 +108,35 @@ EAGLEEntropyFloor: Cool_temperature_norm_K: 8000 # Temperature of the EAGLE Cool limiter entropy floor at the density threshold expressed in Kelvin. Cool_gamma_effective: 1. # Slope the of the EAGLE Cool limiter entropy floor +# EAGLE feedback model EAGLEFeedback: - filename: ./yieldtables/ - IMF_min_mass_Msun: 0.1 - IMF_max_mass_Msun: 100.0 - SNII_min_mass_Msun: 6.0 - SNII_max_mass_Msun: 100.0 - SNII_wind_delay_Gyr: 0.0003 - SNII_delta_T_K: 3.16228e7 - SNII_Energy_erg: 1.0e51 # Energy of one SNII explosion - SNII_Energy_fraction_min: 0.3 - SNII_Energy_fraction_max: 3.0 - SNII_Energy_fraction_Z_0: 0.0012663729 # Z_sun / 10 - SNII_Energy_fraction_n_0_H_p_cm3: 0.67 # cm^-3 - SNII_Energy_fraction_n_n: 0.8686 # 2/ln(10) - SNII_Energy_fraction_n_Z: 0.8686 # 2/ln(10) + use_SNe_feedback: 1 # Global switch for SNe thermal feedback. + use_AGB_enrichment: 1 # Global switch for enrichement from AGB stars. + use_SNII_enrichment: 1 # Global switch for enrichement from SNII stars. + use_SNIa_enrichment: 1 # Global switch for enrichement from SNIa stars. + 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_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: 3.0 # Maximal fraction of energy applied in a SNII feedback event. + SNII_Energy_fraction_max: 0.3 # Minimal fraction of energy applied in a SNII feedback event. + SNII_Energy_fraction_Z_0: 0.0012663729 # Pivot point for the metallicity dependance of the SNII energy fraction (metal mass fraction). + SNII_Energy_fraction_n_0_H_p_cm3: 0.67 # Pivot point for the birth density dependance of the SNII energy fraction in cm^-3. + SNII_Energy_fraction_n_Z: 0.8686 # Power-law for the metallicity dependance of the SNII energy fraction. + SNII_Energy_fraction_n_n: 0.8686 # Power-law for the birth density dependance of the SNII energy fraction. + SNIa_max_mass_Msun: 8.0 # Maximal mass considered for SNIa feedback and enrichment in solar masses. + SNIa_timescale_Gyr: 2.0 # Time-scale of the exponential decay of the SNIa rates in Gyr. + SNIa_efficiency_p_Msun: 0.002 # Normalisation of the SNIa rates in inverse solar masses. + SNII_yield_factor_Hydrogen: 1.0 # (Optional) Correction factor to apply to the Hydrogen yield from the SNII channel. + SNII_yield_factor_Helium: 1.0 # (Optional) Correction factor to apply to the Helium yield from the SNII channel. + SNII_yield_factor_Carbon: 0.5 # (Optional) Correction factor to apply to the Carbon yield from the SNII channel. + SNII_yield_factor_Nitrogen: 1.0 # (Optional) Correction factor to apply to the Nitrogen yield from the SNII channel. + SNII_yield_factor_Oxygen: 1.0 # (Optional) Correction factor to apply to the Oxygen yield from the SNII channel. + SNII_yield_factor_Neon: 1.0 # (Optional) Correction factor to apply to the Neon yield from the SNII channel. + SNII_yield_factor_Magnesium: 2.0 # (Optional) Correction factor to apply to the Magnesium yield from the SNII channel. + SNII_yield_factor_Silicon: 1.0 # (Optional) Correction factor to apply to the Silicon yield from the SNII channel. + SNII_yield_factor_Iron: 0.5 # (Optional) Correction factor to apply to the Iron yield from the SNII channel. diff --git a/examples/SubgridTests/StellarEvolution/run.sh b/examples/SubgridTests/StellarEvolution/run.sh index cf3c3bacb98413e51e21ea91e3885fb6d3738bc3..91032ced8970feecaf8f398ca0b65228e53fc312 100755 --- a/examples/SubgridTests/StellarEvolution/run.sh +++ b/examples/SubgridTests/StellarEvolution/run.sh @@ -26,22 +26,22 @@ then ./getSolutions.sh fi -../../swift --limiter --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.08 2>&1 | tee output.log +../../swift --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.08 2>&1 | tee output.log python plot_box_evolution.py -../../swift --limiter --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.04 2>&1 | tee output.log +../../swift --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.04 2>&1 | tee output.log python plot_box_evolution.py -../../swift --limiter --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.01 2>&1 | tee output.log +../../swift --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.01 2>&1 | tee output.log python plot_box_evolution.py -../../swift --limiter --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.001 2>&1 | tee output.log +../../swift --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.001 2>&1 | tee output.log python plot_box_evolution.py -../../swift --limiter --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.0001 2>&1 | tee output.log +../../swift --feedback --stars --hydro --external-gravity --threads=4 stellar_evolution.yml -P EAGLEChemistry:init_abundance_metal:0.0001 2>&1 | tee output.log python plot_box_evolution.py diff --git a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml index 431dce995ef8908bf171c03268a9ad06f6c9c3a1..559e415f706ebfbd0aa20db7b85dc79b61c48151 100644 --- a/examples/SubgridTests/StellarEvolution/stellar_evolution.yml +++ b/examples/SubgridTests/StellarEvolution/stellar_evolution.yml @@ -38,9 +38,11 @@ Statistics: SPH: resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. + minimal_temperature: 10. # Kelvin +# Properties of the stars Stars: - birth_time: 0. + birth_time: 0. # Give the star in the ICs a decent birth time # Parameters related to the initial conditions InitialConditions: @@ -61,7 +63,8 @@ EAGLEEntropyFloor: Cool_temperature_norm_K: 8000 # Temperature of the EAGLE Cool limiter entropy floor at the density threshold expressed in Kelvin. Cool_gamma_effective: 1. # Slope the of the EAGLE Cool limiter entropy floor -EAGLEChemistry: # Metallicites read in for the gas and star +# Metallicites read in for the gas and star +EAGLEChemistry: init_abundance_metal: 0.01 init_abundance_Hydrogen: 0.752 init_abundance_Helium: 0.248 @@ -73,13 +76,30 @@ EAGLEChemistry: # Metallicites read in for the gas and star init_abundance_Silicon: 0.0 init_abundance_Iron: 0.0 +# Properties of the EAGLE feedback and enrichment model. EAGLEFeedback: + use_SNe_feedback: 0 # No SNe feedback in this test. + use_AGB_enrichment: 1 + use_SNII_enrichment: 1 + use_SNIa_enrichment: 1 filename: ./yieldtables/ IMF_min_mass_Msun: 0.1 IMF_max_mass_Msun: 100.0 SNII_min_mass_Msun: 6.0 SNII_max_mass_Msun: 100.0 - SNII_yield_factor_Hydrogen: 1.0 + SNII_wind_delay_Gyr: 0.03 + SNII_delta_T_K: 3.16228e7 + SNII_Energy_erg: 1.0e51 + SNII_Energy_fraction_min: 3.0 + SNII_Energy_fraction_max: 0.3 + SNII_Energy_fraction_Z_0: 0.0012663729 + SNII_Energy_fraction_n_0_H_p_cm3: 0.67 + SNII_Energy_fraction_n_n: 0.8686 + SNII_Energy_fraction_n_Z: 0.8686 + SNIa_max_mass_Msun: 8.0 + SNIa_timescale_Gyr: 2.0 + SNIa_efficiency_p_Msun: 0.002 + SNII_yield_factor_Hydrogen: 1.0 # Correction to the yields following the EAGLE REF values SNII_yield_factor_Helium: 1.0 SNII_yield_factor_Carbon: 0.5 SNII_yield_factor_Nitrogen: 1.0 @@ -88,15 +108,3 @@ EAGLEFeedback: SNII_yield_factor_Magnesium: 2.0 SNII_yield_factor_Silicon: 1.0 SNII_yield_factor_Iron: 0.5 - SNII_wind_delay_Gyr: 0.03 - SNII_delta_T_K: 3.16228e7 - SNII_Energy_erg: 1.0e51 # Energy of one SNII explosion - SNII_Energy_fraction_min: 0. - SNII_Energy_fraction_max: 0. - SNII_Energy_fraction_Z_0: 0.0012663729 # Z_sun / 10 - SNII_Energy_fraction_n_0_H_p_cm3: 0.67 # cm^-3 - SNII_Energy_fraction_n_n: 0.8686 # 2/ln(10) - SNII_Energy_fraction_n_Z: 0.8686 # 2/ln(10) - SNIa_max_mass_Msun: 8.0 - SNIa_timescale_Gyr: 2.0 - SNIa_efficiency_p_Msun: 0.002 diff --git a/src/feedback/EAGLE/feedback.c b/src/feedback/EAGLE/feedback.c index 13c085fc9f3cfa2c6264d40247162f00e2a99cab..612fc8c798bf9c797a5e2b82694790c8f431ceb2 100644 --- a/src/feedback/EAGLE/feedback.c +++ b/src/feedback/EAGLE/feedback.c @@ -697,7 +697,9 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, sp->feedback_data.to_distribute.enrichment_weight = enrichment_weight; /* Compute properties of the stochastic SNe feedback model. */ - compute_SNe_feedback(sp, age, dt, ngb_gas_mass, feedback_props); + if (feedback_props->with_SNe_feedback) { + compute_SNe_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 */ @@ -724,12 +726,18 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, /* Compute elements, energy and momentum to distribute from the * three channels SNIa, SNII, AGB */ - evolve_SNIa(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, - feedback_props, sp, star_age_Gyr, dt_Gyr); - evolve_SNII(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, - stellar_yields, feedback_props, sp); - evolve_AGB(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, - stellar_yields, feedback_props, sp); + if (feedback_props->with_SNIa_enrichment) { + evolve_SNIa(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, + feedback_props, sp, star_age_Gyr, dt_Gyr); + } + if (feedback_props->with_SNII_enrichment) { + evolve_SNII(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, + stellar_yields, feedback_props, sp); + } + if (feedback_props->with_AGB_enrichment) { + evolve_AGB(log10_min_dying_mass_Msun, log10_max_dying_mass_Msun, + stellar_yields, feedback_props, sp); + } /* Compute the total mass to distribute (H + He metals) */ sp->feedback_data.to_distribute.mass = @@ -766,6 +774,20 @@ void feedback_props_init(struct feedback_props* fp, const struct hydro_props* hydro_props, const struct cosmology* cosmo) { + /* Main operation modes ------------------------------------------------- */ + + fp->with_SNe_feedback = + parser_get_param_int(params, "EAGLEFeedback:use_SNe_feedback"); + + fp->with_AGB_enrichment = + parser_get_param_int(params, "EAGLEFeedback:use_AGB_enrichment"); + + fp->with_SNII_enrichment = + parser_get_param_int(params, "EAGLEFeedback:use_SNII_enrichment"); + + fp->with_SNIa_enrichment = + parser_get_param_int(params, "EAGLEFeedback:use_SNIa_enrichment"); + /* Properties of the IMF model ------------------------------------------ */ /* Minimal and maximal mass considered */ diff --git a/src/feedback/EAGLE/feedback_properties.h b/src/feedback/EAGLE/feedback_properties.h index a18a0582bdd5a2389d54f9b5b40211e27d0ba32c..3ea28b82d9689695236b239b7c5a3f7c7ffa2e9c 100644 --- a/src/feedback/EAGLE/feedback_properties.h +++ b/src/feedback/EAGLE/feedback_properties.h @@ -73,9 +73,27 @@ struct lifetime_table { */ struct feedback_props { + /* ------------ Main operation modes ------------- */ + + /*! Are we doing SNe feedback? */ + int with_SNe_feedback; + + /*! Are we doing AGB enrichment? */ + int with_AGB_enrichment; + + /*! Are we doing SNII enrichment? */ + int with_SNII_enrichment; + + /*! Are we doing SNIa enrichment? */ + int with_SNIa_enrichment; + + /* ------------ Energy injection ----------------- */ + /* Kinetic energy of SN ejecta per unit mass (check name with Richard)*/ float ejecta_specific_thermal_energy; + /* ------------ Yield tables ----------------- */ + /* Yield tables for AGB and SNII */ struct yield_table yield_AGB; struct yield_table yield_SNII;