diff --git a/doc/RTD/source/SubgridModels/EAGLE/index.rst b/doc/RTD/source/SubgridModels/EAGLE/index.rst index a5687efb8ada5b27bb9f9db62376357490ed7983..6388f7d3d42859d8659d2bb13f9dfe5181927807 100644 --- a/doc/RTD/source/SubgridModels/EAGLE/index.rst +++ b/doc/RTD/source/SubgridModels/EAGLE/index.rst @@ -98,32 +98,30 @@ In the snapshots, we output for each gas and star particle: | | | smoothed over SPH neighbours | | | +----------------------------------+-------------------------------------+-----------+-----------------------------+ -The stars will lose mass over their lifetime (up to ~45%). The -fractions will remain unchanged but if one is interested in computing -an absolute metal mass (say) for a star, the ``InitialMass`` (see -below) of the star must be used. - -The chemistry model only requires a small number of parameters to be -specified in the `EAGLEChemistry` section of the YAML file. These are -the initial values of the metallicity and element mass -fractions. These are then applied at the start of a simulation to -*all* the *gas* particles. All 9 elements have to be specified An -example section, for primordial abundances (typical for a cosmological -run), is: +The stars will lose mass over their lifetime (up to ~45%). The fractions will +remain unchanged but if one is interested in computing an absolute metal mass +(say) for a star, the ``InitialMass`` (see below) of the star must be used. + +The chemistry model only requires a small number of parameters to be specified +in the `EAGLEChemistry` section of the YAML file. These are the initial values +of the metallicity and element mass fractions. These are then applied at the +start of a simulation to *all* the *gas* particles. All 9 traced elements have +to be specified An example section, for primordial abundances (typical for a +cosmological run), is: .. code:: YAML EAGLEChemistry: - Metallicity: 0. # Mass fraction in all metals - InitAbundance_Hydrogen: 0.755 # Mass fraction in Hydrogen - InitAbundance_Helium: 0.245 # Mass fraction in Helium - InitAbundance_Carbon: 0. # Mass fraction in Carbon - InitAbundance_Nitrogen: 0. # Mass fraction in Nitrogen - InitAbundance_Oxygen: 0. # Mass fraction in Oxygen - InitAbundance_Neon: 0. # Mass fraction in Neon - InitAbundance_Magnesium: 0. # Mass fraction in Magnesium - InitAbundance_Silicon: 0. # Mass fraction in Silicon - InitAbundance_Iron: 0. # Mass fraction in Iron + init_abundance_metal: 0. # Mass fraction in *all* metals + init_abundance_Hydrogen: 0.755 # Mass fraction in Hydrogen + init_abundance_Helium: 0.245 # Mass fraction in Helium + init_abundance_Carbon: 0. # Mass fraction in Carbon + init_abundance_Nitrogen: 0. # Mass fraction in Nitrogen + init_abundance_Oxygen: 0. # Mass fraction in Oxygen + init_abundance_Neon: 0. # Mass fraction in Neon + init_abundance_Magnesium: 0. # Mass fraction in Magnesium + init_abundance_Silicon: 0. # Mass fraction in Silicon + init_abundance_Iron: 0. # Mass fraction in Iron Whilst one would use the following values for solar abundances (typical for an idealised low-redshift run): @@ -131,16 +129,16 @@ Whilst one would use the following values for solar abundances .. code:: YAML EAGLEChemistry: - Metallicity: 0.014 # Mass fraction in all metals - InitAbundance_Hydrogen: 0.70649785 # Mass fraction in Hydrogen - InitAbundance_Helium: 0.28055534 # Mass fraction in Helium - InitAbundance_Carbon: 2.0665436e-3 # Mass fraction in Carbon - InitAbundance_Nitrogen: 8.3562563e-4 # Mass fraction in Nitrogen - InitAbundance_Oxygen: 5.4926244e-3 # Mass fraction in Oxygen - InitAbundance_Neon: 1.4144605e-3 # Mass fraction in Neon - InitAbundance_Magnesium: 5.907064e-4 # Mass fraction in Magnesium - InitAbundance_Silicon: 6.825874e-4 # Mass fraction in Silicon - InitAbundance_Iron: 1.1032152e-3 # Mass fraction in Iron + init_abundance_metal: 0.014 # Mass fraction in *all* metals + init_abundance_Hydrogen: 0.70649785 # Mass fraction in Hydrogen + init_abundance_Helium: 0.28055534 # Mass fraction in Helium + init_abundance_Carbon: 2.0665436e-3 # Mass fraction in Carbon + init_abundance_Nitrogen: 8.3562563e-4 # Mass fraction in Nitrogen + init_abundance_Oxygen: 5.4926244e-3 # Mass fraction in Oxygen + init_abundance_Neon: 1.4144605e-3 # Mass fraction in Neon + init_abundance_Magnesium: 5.907064e-4 # Mass fraction in Magnesium + init_abundance_Silicon: 6.825874e-4 # Mass fraction in Silicon + init_abundance_Iron: 1.1032152e-3 # Mass fraction in Iron diff --git a/examples/CoolingBox/coolingBox.yml b/examples/CoolingBox/coolingBox.yml index 785f699bf0f908f2f88109c04936b2285d1eb3c5..97b452e5ea376ab10bba155e0ff3e9acb8ed02bd 100644 --- a/examples/CoolingBox/coolingBox.yml +++ b/examples/CoolingBox/coolingBox.yml @@ -59,17 +59,17 @@ EAGLECooling: He_reion_z_sigma: 0.5 He_reion_eV_p_H: 2.0 -EAGLEChemistry: - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 +EAGLEChemistry: # Solar abundances + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 GearChemistry: InitialMetallicity: 0.01295 diff --git a/examples/CoolingRates/cooling_rates.yml b/examples/CoolingRates/cooling_rates.yml index 343c24d32012bb50730363752b2c4de9a8e59087..1d67ad0af79368c39c24879b101a540d0bccb3d1 100644 --- a/examples/CoolingRates/cooling_rates.yml +++ b/examples/CoolingRates/cooling_rates.yml @@ -16,16 +16,16 @@ Cosmology: Omega_b: 0.0455 # Baryon density parameter EAGLEChemistry: - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 EAGLECooling: dir_name: ./coolingtables/ diff --git a/examples/EAGLE_12/eagle_12.yml b/examples/EAGLE_12/eagle_12.yml index 062870a23bf39f94e8bc359e6342e989e0e9b680..367c5f769775d9293c0ec7b0bf670a2b22dcb328 100644 --- a/examples/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_12/eagle_12.yml @@ -57,17 +57,17 @@ InitialConditions: cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget -EAGLEChemistry: # Solar abundances - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 +EAGLEChemistry: # Solar abundances + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 EAGLECooling: dir_name: ./coolingtables/ diff --git a/examples/EAGLE_25/eagle_25.yml b/examples/EAGLE_25/eagle_25.yml index 0edc8bfa1d2b5e1a1b22ad268dc024db6c7f04d8..0aec970db486a164696b23fdc1e281fbe4853486 100644 --- a/examples/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_25/eagle_25.yml @@ -66,18 +66,18 @@ InitialConditions: cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget -EAGLEChemistry: # Solar abundances - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 - +EAGLEChemistry: # Solar abundances + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 + EAGLECooling: dir_name: ./coolingtables/ H_reion_z: 11.5 diff --git a/examples/EAGLE_50/eagle_50.yml b/examples/EAGLE_50/eagle_50.yml index 56b945a06a474f4dd25d352ea5bdf90aae922f8d..35f7c85993d6d52189eaa1da35821fc5fa103c56 100644 --- a/examples/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_50/eagle_50.yml @@ -59,18 +59,18 @@ InitialConditions: cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget -EAGLEChemistry: # Solar abundances - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 - +EAGLEChemistry: # Solar abundances + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 + EAGLECooling: dir_name: ./coolingtables/ H_reion_z: 11.5 diff --git a/examples/EAGLE_6/eagle_6.yml b/examples/EAGLE_6/eagle_6.yml index af533f5d8493a429898c35743cbbae354623333b..7c64c1cdedb6c8e9714471f4bad9611f548d05fa 100644 --- a/examples/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_6/eagle_6.yml @@ -70,17 +70,17 @@ InitialConditions: cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget -EAGLEChemistry: # Solar abundances - InitMetallicity: 0.014 - InitAbundance_Hydrogen: 0.70649785 - InitAbundance_Helium: 0.28055534 - InitAbundance_Carbon: 2.0665436e-3 - InitAbundance_Nitrogen: 8.3562563e-4 - InitAbundance_Oxygen: 5.4926244e-3 - InitAbundance_Neon: 1.4144605e-3 - InitAbundance_Magnesium: 5.907064e-4 - InitAbundance_Silicon: 6.825874e-4 - InitAbundance_Iron: 1.1032152e-3 +EAGLEChemistry: # Solar abundances + init_abundance_metal: 0.014 + init_abundance_Hydrogen: 0.70649785 + init_abundance_Helium: 0.28055534 + init_abundance_Carbon: 2.0665436e-3 + init_abundance_Nitrogen: 8.3562563e-4 + init_abundance_Oxygen: 5.4926244e-3 + init_abundance_Neon: 1.4144605e-3 + init_abundance_Magnesium: 5.907064e-4 + init_abundance_Silicon: 6.825874e-4 + init_abundance_Iron: 1.1032152e-3 EAGLECooling: dir_name: ./coolingtables/ diff --git a/examples/SantaBarbara/santa_barbara.yml b/examples/SantaBarbara/santa_barbara.yml index 08cb71d0cea04f28fa33c062e877033c6ce7fb95..eb20030e00c36646b4283012eab5ecae0e286680 100644 --- a/examples/SantaBarbara/santa_barbara.yml +++ b/examples/SantaBarbara/santa_barbara.yml @@ -59,17 +59,18 @@ InitialConditions: generate_gas_in_ics: 1 # Generate gas particles from the DM-only ICs cleanup_smoothing_lengths: 1 # Since we generate gas, make use of the (expensive) cleaning-up procedure. +# Impose primoridal metallicity EAGLEChemistry: - InitMetallicity: 0.0 - InitAbundance_Hydrogen: 0.752 - InitAbundance_Helium: 0.248 - InitAbundance_Carbon: 0.0 - InitAbundance_Nitrogen: 0.0 - InitAbundance_Oxygen: 0.0 - InitAbundance_Neon: 0.0 - InitAbundance_Magnesium: 0.0 - InitAbundance_Silicon: 0.0 - InitAbundance_Iron: 0.0 + init_abundance_metal: 0.0 + init_abundance_Hydrogen: 0.752 + init_abundance_Helium: 0.248 + init_abundance_Carbon: 0.0 + init_abundance_Nitrogen: 0.0 + init_abundance_Oxygen: 0.0 + init_abundance_Neon: 0.0 + init_abundance_Magnesium: 0.0 + init_abundance_Silicon: 0.0 + init_abundance_Iron: 0.0 EAGLECooling: dir_name: ./coolingtables/ diff --git a/examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml b/examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml index 47511f6b408f0c4b303ee02ec8ec7df19c42281d..2d2dec8408621e8a74cbb228e92916f2eacd38c5 100644 --- a/examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml +++ b/examples/SmallCosmoVolume_cooling/small_cosmo_volume.yml @@ -72,13 +72,13 @@ EAGLECooling: # Impose primoridal metallicity EAGLEChemistry: - InitMetallicity: 0.0 - InitAbundance_Hydrogen: 0.755 - InitAbundance_Helium: 0.245 - InitAbundance_Carbon: 0. - InitAbundance_Nitrogen: 0. - InitAbundance_Oxygen: 0. - InitAbundance_Neon: 0. - InitAbundance_Magnesium: 0. - InitAbundance_Silicon: 0. - InitAbundance_Iron: 0. + init_abundance_metal: 0.0 + init_abundance_Hydrogen: 0.752 + init_abundance_Helium: 0.248 + init_abundance_Carbon: 0.0 + init_abundance_Nitrogen: 0.0 + init_abundance_Oxygen: 0.0 + init_abundance_Neon: 0.0 + init_abundance_Magnesium: 0.0 + init_abundance_Silicon: 0.0 + init_abundance_Iron: 0.0 diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 2b20909b9df5a8f12ba87da74b5a16ed54cca4f4..9fdfc993c3f9ad125f4f588db159c6ef5c997c84 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -276,16 +276,16 @@ GrackleCooling: # EAGLE model EAGLEChemistry: - InitMetallicity: 0. # Inital fraction of particle mass in *all* metals - InitAbundance_Hydrogen: 0.752 # Inital fraction of particle mass in Hydrogen - InitAbundance_Helium: 0.248 # Inital fraction of particle mass in Helium - InitAbundance_Carbon: 0.000 # Inital fraction of particle mass in Carbon - InitAbundance_Nitrogen: 0.000 # Inital fraction of particle mass in Nitrogen - InitAbundance_Oxygen: 0.000 # Inital fraction of particle mass in Oxygen - InitAbundance_Neon: 0.000 # Inital fraction of particle mass in Neon - InitAbundance_Magnesium: 0.000 # Inital fraction of particle mass in Magnesium - InitAbundance_Silicon: 0.000 # Inital fraction of particle mass in Silicon - InitAbundance_Iron: 0.000 # Inital fraction of particle mass in Iron + init_abundance_metal: 0. # Inital fraction of particle mass in *all* metals + init_abundance_Hydrogen: 0.752 # Inital fraction of particle mass in Hydrogen + init_abundance_Helium: 0.248 # Inital fraction of particle mass in Helium + init_abundance_Carbon: 0.000 # Inital fraction of particle mass in Carbon + init_abundance_Nitrogen: 0.000 # Inital fraction of particle mass in Nitrogen + init_abundance_Oxygen: 0.000 # Inital fraction of particle mass in Oxygen + init_abundance_Neon: 0.000 # Inital fraction of particle mass in Neon + init_abundance_Magnesium: 0.000 # Inital fraction of particle mass in Magnesium + init_abundance_Silicon: 0.000 # Inital fraction of particle mass in Silicon + init_abundance_Iron: 0.000 # Inital fraction of particle mass in Iron # Structure finding options (requires velociraptor) StructureFinding: diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h index 9e9dc3b3232b326c5d6dc9487a75dce3b82dd401..b8a50f237ae12dcc9216f5552bd931be62102662 100644 --- a/src/chemistry/EAGLE/chemistry.h +++ b/src/chemistry/EAGLE/chemistry.h @@ -154,6 +154,7 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( if (data->initial_metal_mass_fraction_total != -1) { p->chemistry_data.metal_mass_fraction_total = data->initial_metal_mass_fraction_total; + for (int elem = 0; elem < chemistry_element_count; ++elem) p->chemistry_data.metal_mass_fraction[elem] = data->initial_metal_mass_fraction[elem]; @@ -176,13 +177,13 @@ static INLINE void chemistry_init_backend(struct swift_params* parameter_file, /* Read the total metallicity */ data->initial_metal_mass_fraction_total = parser_get_opt_param_float( - parameter_file, "EAGLEChemistry:InitMetallicity", -1); + parameter_file, "EAGLEChemistry:init_abundance_metal", -1); if (data->initial_metal_mass_fraction_total != -1) { /* Read the individual mass fractions */ for (int elem = 0; elem < chemistry_element_count; ++elem) { char buffer[50]; - sprintf(buffer, "EAGLEChemistry:InitAbundance_%s", + sprintf(buffer, "EAGLEChemistry:init_abundance_%s", chemistry_get_element_name((enum chemistry_element)elem)); data->initial_metal_mass_fraction[elem] = diff --git a/src/cooling/EAGLE/cooling.c b/src/cooling/EAGLE/cooling.c index bf3d2ace1680cd23e44994a9ebc331ffeb76563f..8345109a4e96e02e4870af578e9714e2d5003dad 100644 --- a/src/cooling/EAGLE/cooling.c +++ b/src/cooling/EAGLE/cooling.c @@ -740,8 +740,8 @@ void cooling_init_backend(struct swift_params *parameter_file, /* read some parameters */ parser_get_param_string(parameter_file, "EAGLECooling:dir_name", cooling->cooling_table_path); - cooling->H_reion_z = parser_get_param_float( - parameter_file, "EAGLECooling:H_reion_z"); + cooling->H_reion_z = + parser_get_param_float(parameter_file, "EAGLECooling:H_reion_z"); cooling->He_reion_z_centre = parser_get_param_float(parameter_file, "EAGLECooling:He_reion_z_centre"); cooling->He_reion_z_sigma = @@ -754,7 +754,7 @@ void cooling_init_backend(struct swift_params *parameter_file, parameter_file, "EAGLECooling:Ca_over_Si_in_solar", 1.f); cooling->S_over_Si_ratio_in_solar = parser_get_opt_param_float( parameter_file, "EAGLECooling:S_over_Si_in_solar", 1.f); - + /* convert to cgs */ cooling->He_reion_heat_cgs *= phys_const->const_electron_volt *