Skip to content
Snippets Groups Projects
Commit 45716e12 authored by Stuart McAlpine's avatar Stuart McAlpine Committed by Matthieu Schaller
Browse files

Store BH birth density and metallicity

parent 30474e59
Branches
Tags
No related merge requests found
...@@ -821,8 +821,9 @@ INLINE static void black_holes_create_from_gas( ...@@ -821,8 +821,9 @@ INLINE static void black_holes_create_from_gas(
* in the FOF code. We update them here. * in the FOF code. We update them here.
* (i.e. position, velocity, mass, time-step have been set) */ * (i.e. position, velocity, mass, time-step have been set) */
/* Birth time */ /* Birth time and density */
bp->formation_scale_factor = cosmo->a; bp->formation_scale_factor = cosmo->a;
bp->formation_gas_density = hydro_get_physical_density(p, cosmo);
/* Initial seed mass */ /* Initial seed mass */
bp->subgrid_mass = props->subgrid_seed_mass; bp->subgrid_mass = props->subgrid_seed_mass;
......
...@@ -139,7 +139,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -139,7 +139,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
int with_cosmology) { int with_cosmology) {
/* Say how much we want to write */ /* Say how much we want to write */
*num_fields = 29; *num_fields = 30;
/* List what we want to write */ /* List what we want to write */
list[0] = io_make_output_field_convert_bpart( list[0] = io_make_output_field_convert_bpart(
...@@ -328,6 +328,13 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts, ...@@ -328,6 +328,13 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
sound_speed_subgrid_gas, sound_speed_subgrid_gas,
"Physical subgrid sound-speeds used in the subgrid-Bondi model."); "Physical subgrid sound-speeds used in the subgrid-Bondi model.");
list[29] = io_make_output_field(
"BirthGasDensities", FLOAT, 1, UNIT_CONV_DENSITY, 0.f, bparts,
formation_gas_density,
"Physical densities of the converted part at the time of birth. "
"We store the physical density at the birth redshift, no conversion is "
"needed.");
#ifdef DEBUG_INTERACTIONS_BLACK_HOLES #ifdef DEBUG_INTERACTIONS_BLACK_HOLES
list += *num_fields; list += *num_fields;
......
...@@ -74,6 +74,9 @@ struct bpart { ...@@ -74,6 +74,9 @@ struct bpart {
float formation_scale_factor; float formation_scale_factor;
}; };
/*! Physical density of the converted part (internal units) */
float formation_gas_density;
/*! Subgrid mass of the black hole */ /*! Subgrid mass of the black hole */
float subgrid_mass; float subgrid_mass;
......
...@@ -348,6 +348,9 @@ __attribute__((always_inline)) INLINE static void chemistry_bpart_from_part( ...@@ -348,6 +348,9 @@ __attribute__((always_inline)) INLINE static void chemistry_bpart_from_part(
p_data->metal_mass_fraction_from_AGB * gas_mass; p_data->metal_mass_fraction_from_AGB * gas_mass;
bp_data->iron_mass_from_SNIa = bp_data->iron_mass_from_SNIa =
p_data->iron_mass_fraction_from_SNIa * gas_mass; p_data->iron_mass_fraction_from_SNIa * gas_mass;
bp_data->formation_metallicity = p_data->metal_mass_fraction_total;
bp_data->smoothed_formation_metallicity =
p_data->smoothed_metal_mass_fraction_total;
} }
/** /**
......
...@@ -271,7 +271,19 @@ INLINE static int chemistry_write_bparticles(const struct bpart* bparts, ...@@ -271,7 +271,19 @@ INLINE static int chemistry_write_bparticles(const struct bpart* bparts,
"Masses of the BH particles in iron that have been " "Masses of the BH particles in iron that have been "
"produced by SNIa stars"); "produced by SNIa stars");
return 9; list[9] =
io_make_output_field("BirthMetallicities", FLOAT, 1, UNIT_CONV_NO_UNITS,
0.f, bparts, chemistry_data.formation_metallicity,
"Metallicities (metal mass fractions) of the gas "
"particles the black holes formed from");
list[10] = io_make_output_field(
"SmoothedBirthMetallicities", FLOAT, 1, UNIT_CONV_NO_UNITS, 0.f, bparts,
chemistry_data.smoothed_formation_metallicity,
"Smoothed metallicities (metal mass fractions) of the gas particles the "
"black holes formed from");
return 11;
} }
#ifdef HAVE_HDF5 #ifdef HAVE_HDF5
......
...@@ -120,6 +120,12 @@ struct chemistry_bpart_data { ...@@ -120,6 +120,12 @@ struct chemistry_bpart_data {
/*! Iron mass coming from SNIa */ /*! Iron mass coming from SNIa */
float iron_mass_from_SNIa; float iron_mass_from_SNIa;
/*! Metallicity of converted part. */
float formation_metallicity;
/*! Smoothed metallicity of converted part. */
float smoothed_formation_metallicity;
}; };
#endif /* SWIFT_CHEMISTRY_STRUCT_EAGLE_H */ #endif /* SWIFT_CHEMISTRY_STRUCT_EAGLE_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment