Commit f3793a0e authored by Matthieu Schaller's avatar Matthieu Schaller

Merge branch 'seed_bh_density' into 'master'

Store BH birth density and metallicity

See merge request !1135
parents 30474e59 45716e12
......@@ -821,8 +821,9 @@ INLINE static void black_holes_create_from_gas(
* in the FOF code. We update them here.
* (i.e. position, velocity, mass, time-step have been set) */
/* Birth time */
/* Birth time and density */
bp->formation_scale_factor = cosmo->a;
bp->formation_gas_density = hydro_get_physical_density(p, cosmo);
/* Initial seed mass */
bp->subgrid_mass = props->subgrid_seed_mass;
......
......@@ -139,7 +139,7 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
int with_cosmology) {
/* Say how much we want to write */
*num_fields = 29;
*num_fields = 30;
/* List what we want to write */
list[0] = io_make_output_field_convert_bpart(
......@@ -328,6 +328,13 @@ INLINE static void black_holes_write_particles(const struct bpart* bparts,
sound_speed_subgrid_gas,
"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
list += *num_fields;
......
......@@ -74,6 +74,9 @@ struct bpart {
float formation_scale_factor;
};
/*! Physical density of the converted part (internal units) */
float formation_gas_density;
/*! Subgrid mass of the black hole */
float subgrid_mass;
......
......@@ -348,6 +348,9 @@ __attribute__((always_inline)) INLINE static void chemistry_bpart_from_part(
p_data->metal_mass_fraction_from_AGB * gas_mass;
bp_data->iron_mass_from_SNIa =
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,
"Masses of the BH particles in iron that have been "
"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
......
......@@ -120,6 +120,12 @@ struct chemistry_bpart_data {
/*! Iron mass coming 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 */
Markdown is supported
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