Commit 903f845a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Naming convention improvements in the EAGLE cooling section of the YAML file. Code formatting.

parent 8266849a
...@@ -98,32 +98,30 @@ In the snapshots, we output for each gas and star particle: ...@@ -98,32 +98,30 @@ In the snapshots, we output for each gas and star particle:
| | | smoothed over SPH neighbours | | | | | | smoothed over SPH neighbours | | |
+----------------------------------+-------------------------------------+-----------+-----------------------------+ +----------------------------------+-------------------------------------+-----------+-----------------------------+
The stars will lose mass over their lifetime (up to ~45%). The The stars will lose mass over their lifetime (up to ~45%). The fractions will
fractions will remain unchanged but if one is interested in computing remain unchanged but if one is interested in computing an absolute metal mass
an absolute metal mass (say) for a star, the ``InitialMass`` (see (say) for a star, the ``InitialMass`` (see below) of the star must be used.
below) of the star must be used.
The chemistry model only requires a small number of parameters to be specified
The chemistry model only requires a small number of parameters to be in the `EAGLEChemistry` section of the YAML file. These are the initial values
specified in the `EAGLEChemistry` section of the YAML file. These are of the metallicity and element mass fractions. These are then applied at the
the initial values of the metallicity and element mass start of a simulation to *all* the *gas* particles. All 9 traced elements have
fractions. These are then applied at the start of a simulation to to be specified An example section, for primordial abundances (typical for a
*all* the *gas* particles. All 9 elements have to be specified An cosmological run), is:
example section, for primordial abundances (typical for a cosmological
run), is:
.. code:: YAML .. code:: YAML
EAGLEChemistry: EAGLEChemistry:
Metallicity: 0. # Mass fraction in all metals init_abundance_metal: 0. # Mass fraction in *all* metals
InitAbundance_Hydrogen: 0.755 # Mass fraction in Hydrogen init_abundance_Hydrogen: 0.755 # Mass fraction in Hydrogen
InitAbundance_Helium: 0.245 # Mass fraction in Helium init_abundance_Helium: 0.245 # Mass fraction in Helium
InitAbundance_Carbon: 0. # Mass fraction in Carbon init_abundance_Carbon: 0. # Mass fraction in Carbon
InitAbundance_Nitrogen: 0. # Mass fraction in Nitrogen init_abundance_Nitrogen: 0. # Mass fraction in Nitrogen
InitAbundance_Oxygen: 0. # Mass fraction in Oxygen init_abundance_Oxygen: 0. # Mass fraction in Oxygen
InitAbundance_Neon: 0. # Mass fraction in Neon init_abundance_Neon: 0. # Mass fraction in Neon
InitAbundance_Magnesium: 0. # Mass fraction in Magnesium init_abundance_Magnesium: 0. # Mass fraction in Magnesium
InitAbundance_Silicon: 0. # Mass fraction in Silicon init_abundance_Silicon: 0. # Mass fraction in Silicon
InitAbundance_Iron: 0. # Mass fraction in Iron init_abundance_Iron: 0. # Mass fraction in Iron
Whilst one would use the following values for solar abundances Whilst one would use the following values for solar abundances
(typical for an idealised low-redshift run): (typical for an idealised low-redshift run):
...@@ -131,16 +129,16 @@ Whilst one would use the following values for solar abundances ...@@ -131,16 +129,16 @@ Whilst one would use the following values for solar abundances
.. code:: YAML .. code:: YAML
EAGLEChemistry: EAGLEChemistry:
Metallicity: 0.014 # Mass fraction in all metals init_abundance_metal: 0.014 # Mass fraction in *all* metals
InitAbundance_Hydrogen: 0.70649785 # Mass fraction in Hydrogen init_abundance_Hydrogen: 0.70649785 # Mass fraction in Hydrogen
InitAbundance_Helium: 0.28055534 # Mass fraction in Helium init_abundance_Helium: 0.28055534 # Mass fraction in Helium
InitAbundance_Carbon: 2.0665436e-3 # Mass fraction in Carbon init_abundance_Carbon: 2.0665436e-3 # Mass fraction in Carbon
InitAbundance_Nitrogen: 8.3562563e-4 # Mass fraction in Nitrogen init_abundance_Nitrogen: 8.3562563e-4 # Mass fraction in Nitrogen
InitAbundance_Oxygen: 5.4926244e-3 # Mass fraction in Oxygen init_abundance_Oxygen: 5.4926244e-3 # Mass fraction in Oxygen
InitAbundance_Neon: 1.4144605e-3 # Mass fraction in Neon init_abundance_Neon: 1.4144605e-3 # Mass fraction in Neon
InitAbundance_Magnesium: 5.907064e-4 # Mass fraction in Magnesium init_abundance_Magnesium: 5.907064e-4 # Mass fraction in Magnesium
InitAbundance_Silicon: 6.825874e-4 # Mass fraction in Silicon init_abundance_Silicon: 6.825874e-4 # Mass fraction in Silicon
InitAbundance_Iron: 1.1032152e-3 # Mass fraction in Iron init_abundance_Iron: 1.1032152e-3 # Mass fraction in Iron
......
...@@ -59,17 +59,17 @@ EAGLECooling: ...@@ -59,17 +59,17 @@ EAGLECooling:
He_reion_z_sigma: 0.5 He_reion_z_sigma: 0.5
He_reion_eV_p_H: 2.0 He_reion_eV_p_H: 2.0
EAGLEChemistry: EAGLEChemistry: # Solar abundances
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
GearChemistry: GearChemistry:
InitialMetallicity: 0.01295 InitialMetallicity: 0.01295
...@@ -16,16 +16,16 @@ Cosmology: ...@@ -16,16 +16,16 @@ Cosmology:
Omega_b: 0.0455 # Baryon density parameter Omega_b: 0.0455 # Baryon density parameter
EAGLEChemistry: EAGLEChemistry:
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
......
...@@ -57,17 +57,17 @@ InitialConditions: ...@@ -57,17 +57,17 @@ InitialConditions:
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget 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 cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget
EAGLEChemistry: # Solar abundances EAGLEChemistry: # Solar abundances
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
......
...@@ -66,18 +66,18 @@ InitialConditions: ...@@ -66,18 +66,18 @@ InitialConditions:
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget 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 cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget
EAGLEChemistry: # Solar abundances EAGLEChemistry: # Solar abundances
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
H_reion_z: 11.5 H_reion_z: 11.5
......
...@@ -59,18 +59,18 @@ InitialConditions: ...@@ -59,18 +59,18 @@ InitialConditions:
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget 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 cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget
EAGLEChemistry: # Solar abundances EAGLEChemistry: # Solar abundances
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
H_reion_z: 11.5 H_reion_z: 11.5
......
...@@ -70,17 +70,17 @@ InitialConditions: ...@@ -70,17 +70,17 @@ InitialConditions:
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget 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 cleanup_velocity_factors: 1 # Remove the sqrt(a) factor in the velocities inherited from Gadget
EAGLEChemistry: # Solar abundances EAGLEChemistry: # Solar abundances
InitMetallicity: 0.014 init_abundance_metal: 0.014
InitAbundance_Hydrogen: 0.70649785 init_abundance_Hydrogen: 0.70649785
InitAbundance_Helium: 0.28055534 init_abundance_Helium: 0.28055534
InitAbundance_Carbon: 2.0665436e-3 init_abundance_Carbon: 2.0665436e-3
InitAbundance_Nitrogen: 8.3562563e-4 init_abundance_Nitrogen: 8.3562563e-4
InitAbundance_Oxygen: 5.4926244e-3 init_abundance_Oxygen: 5.4926244e-3
InitAbundance_Neon: 1.4144605e-3 init_abundance_Neon: 1.4144605e-3
InitAbundance_Magnesium: 5.907064e-4 init_abundance_Magnesium: 5.907064e-4
InitAbundance_Silicon: 6.825874e-4 init_abundance_Silicon: 6.825874e-4
InitAbundance_Iron: 1.1032152e-3 init_abundance_Iron: 1.1032152e-3
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
......
...@@ -59,17 +59,18 @@ InitialConditions: ...@@ -59,17 +59,18 @@ InitialConditions:
generate_gas_in_ics: 1 # Generate gas particles from the DM-only ICs 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. cleanup_smoothing_lengths: 1 # Since we generate gas, make use of the (expensive) cleaning-up procedure.
# Impose primoridal metallicity
EAGLEChemistry: EAGLEChemistry:
InitMetallicity: 0.0 init_abundance_metal: 0.0
InitAbundance_Hydrogen: 0.752 init_abundance_Hydrogen: 0.752
InitAbundance_Helium: 0.248 init_abundance_Helium: 0.248
InitAbundance_Carbon: 0.0 init_abundance_Carbon: 0.0
InitAbundance_Nitrogen: 0.0 init_abundance_Nitrogen: 0.0
InitAbundance_Oxygen: 0.0 init_abundance_Oxygen: 0.0
InitAbundance_Neon: 0.0 init_abundance_Neon: 0.0
InitAbundance_Magnesium: 0.0 init_abundance_Magnesium: 0.0
InitAbundance_Silicon: 0.0 init_abundance_Silicon: 0.0
InitAbundance_Iron: 0.0 init_abundance_Iron: 0.0
EAGLECooling: EAGLECooling:
dir_name: ./coolingtables/ dir_name: ./coolingtables/
......
...@@ -72,13 +72,13 @@ EAGLECooling: ...@@ -72,13 +72,13 @@ EAGLECooling:
# Impose primoridal metallicity # Impose primoridal metallicity
EAGLEChemistry: EAGLEChemistry:
InitMetallicity: 0.0 init_abundance_metal: 0.0
InitAbundance_Hydrogen: 0.755 init_abundance_Hydrogen: 0.752
InitAbundance_Helium: 0.245 init_abundance_Helium: 0.248
InitAbundance_Carbon: 0. init_abundance_Carbon: 0.0
InitAbundance_Nitrogen: 0. init_abundance_Nitrogen: 0.0
InitAbundance_Oxygen: 0. init_abundance_Oxygen: 0.0
InitAbundance_Neon: 0. init_abundance_Neon: 0.0
InitAbundance_Magnesium: 0. init_abundance_Magnesium: 0.0
InitAbundance_Silicon: 0. init_abundance_Silicon: 0.0
InitAbundance_Iron: 0. init_abundance_Iron: 0.0
...@@ -276,16 +276,16 @@ GrackleCooling: ...@@ -276,16 +276,16 @@ GrackleCooling:
# EAGLE model # EAGLE model
EAGLEChemistry: EAGLEChemistry:
InitMetallicity: 0. # Inital fraction of particle mass in *all* metals init_abundance_metal: 0. # Inital fraction of particle mass in *all* metals
InitAbundance_Hydrogen: 0.752 # Inital fraction of particle mass in Hydrogen init_abundance_Hydrogen: 0.752 # Inital fraction of particle mass in Hydrogen
InitAbundance_Helium: 0.248 # Inital fraction of particle mass in Helium init_abundance_Helium: 0.248 # Inital fraction of particle mass in Helium
InitAbundance_Carbon: 0.000 # Inital fraction of particle mass in Carbon init_abundance_Carbon: 0.000 # Inital fraction of particle mass in Carbon
InitAbundance_Nitrogen: 0.000 # Inital fraction of particle mass in Nitrogen init_abundance_Nitrogen: 0.000 # Inital fraction of particle mass in Nitrogen
InitAbundance_Oxygen: 0.000 # Inital fraction of particle mass in Oxygen init_abundance_Oxygen: 0.000 # Inital fraction of particle mass in Oxygen
InitAbundance_Neon: 0.000 # Inital fraction of particle mass in Neon init_abundance_Neon: 0.000 # Inital fraction of particle mass in Neon
InitAbundance_Magnesium: 0.000 # Inital fraction of particle mass in Magnesium init_abundance_Magnesium: 0.000 # Inital fraction of particle mass in Magnesium
InitAbundance_Silicon: 0.000 # Inital fraction of particle mass in Silicon init_abundance_Silicon: 0.000 # Inital fraction of particle mass in Silicon
InitAbundance_Iron: 0.000 # Inital fraction of particle mass in Iron init_abundance_Iron: 0.000 # Inital fraction of particle mass in Iron
# Structure finding options (requires velociraptor) # Structure finding options (requires velociraptor)
StructureFinding: StructureFinding:
......
...@@ -154,6 +154,7 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( ...@@ -154,6 +154,7 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
if (data->initial_metal_mass_fraction_total != -1) { if (data->initial_metal_mass_fraction_total != -1) {
p->chemistry_data.metal_mass_fraction_total = p->chemistry_data.metal_mass_fraction_total =
data->initial_metal_mass_fraction_total; data->initial_metal_mass_fraction_total;
for (int elem = 0; elem < chemistry_element_count; ++elem) for (int elem = 0; elem < chemistry_element_count; ++elem)
p->chemistry_data.metal_mass_fraction[elem] = p->chemistry_data.metal_mass_fraction[elem] =
data->initial_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, ...@@ -176,13 +177,13 @@ static INLINE void chemistry_init_backend(struct swift_params* parameter_file,
/* Read the total metallicity */ /* Read the total metallicity */
data->initial_metal_mass_fraction_total = parser_get_opt_param_float( 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) { if (data->initial_metal_mass_fraction_total != -1) {
/* Read the individual mass fractions */ /* Read the individual mass fractions */
for (int elem = 0; elem < chemistry_element_count; ++elem) { for (int elem = 0; elem < chemistry_element_count; ++elem) {
char buffer[50]; char buffer[50];
sprintf(buffer, "EAGLEChemistry:InitAbundance_%s", sprintf(buffer, "EAGLEChemistry:init_abundance_%s",
chemistry_get_element_name((enum chemistry_element)elem)); chemistry_get_element_name((enum chemistry_element)elem));
data->initial_metal_mass_fraction[elem] = data->initial_metal_mass_fraction[elem] =
......
...@@ -740,8 +740,8 @@ void cooling_init_backend(struct swift_params *parameter_file, ...@@ -740,8 +740,8 @@ void cooling_init_backend(struct swift_params *parameter_file,
/* read some parameters */ /* read some parameters */
parser_get_param_string(parameter_file, "EAGLECooling:dir_name", parser_get_param_string(parameter_file, "EAGLECooling:dir_name",
cooling->cooling_table_path); cooling->cooling_table_path);
cooling->H_reion_z = parser_get_param_float( cooling->H_reion_z =
parameter_file, "EAGLECooling:H_reion_z"); parser_get_param_float(parameter_file, "EAGLECooling:H_reion_z");
cooling->He_reion_z_centre = cooling->He_reion_z_centre =
parser_get_param_float(parameter_file, "EAGLECooling:He_reion_z_centre"); parser_get_param_float(parameter_file, "EAGLECooling:He_reion_z_centre");
cooling->He_reion_z_sigma = cooling->He_reion_z_sigma =
...@@ -754,7 +754,7 @@ void cooling_init_backend(struct swift_params *parameter_file, ...@@ -754,7 +754,7 @@ void cooling_init_backend(struct swift_params *parameter_file,
parameter_file, "EAGLECooling:Ca_over_Si_in_solar", 1.f); parameter_file, "EAGLECooling:Ca_over_Si_in_solar", 1.f);
cooling->S_over_Si_ratio_in_solar = parser_get_opt_param_float( cooling->S_over_Si_ratio_in_solar = parser_get_opt_param_float(
parameter_file, "EAGLECooling:S_over_Si_in_solar", 1.f); parameter_file, "EAGLECooling:S_over_Si_in_solar", 1.f);
/* convert to cgs */ /* convert to cgs */
cooling->He_reion_heat_cgs *= cooling->He_reion_heat_cgs *=
phys_const->const_electron_volt * phys_const->const_electron_volt *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment