Skip to content
Snippets Groups Projects
Commit 8752a893 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'cold_gas_in_snapshots' into 'master'

Cold gas in snapshots

See merge request swift/swiftsim!1327
parents 3ed8e584 4d58dbf7
Branches
Tags
1 merge request!1327Cold gas in snapshots
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -177,12 +177,11 @@ Reference_frame_for_properties=2 #use the minimum potential as reference frame a
#Extra fields
################################
# Also compute the H abundance as well as the HI, HII and H_2 fractions
Gas_internal_property_names=ElementMassFractions,SpeciesFractions,SpeciesFractions,SpeciesFractions,
Gas_internal_property_index_in_file=0,0,1,2,
Gas_internal_property_input_output_unit_conversion_factors=1.0,1.0,1.0,1.0
Gas_internal_property_calculation_type =averagemassweighted,averagemassweighted,averagemassweighted,averagemassweighted,
Gas_internal_property_output_units=unitless,unitless,unitless,unitless,
# Also compute the HI and H_2 masses in apertures
Gas_internal_property_names=AtomicHydrogenMasses,MolecularHydrogenMasses,
Gas_internal_property_input_output_unit_conversion_factors=1.0e10,1.0e10,
Gas_internal_property_calculation_type=aperture_total,aperture_total,
Gas_internal_property_output_units=solar_mass,solar_mass,
# Collect the BH subgrid masses and compute the max, min, average and total mass in apertures
BH_internal_property_names=SubgridMasses,SubgridMasses,SubgridMasses,SubgridMasses,
......
......@@ -114,6 +114,34 @@ INLINE static void convert_part_sub_species_frac(const struct engine* e,
ret[2] /= sum;
}
INLINE static void convert_part_HI_mass(const struct engine* e,
const struct part* p,
const struct xpart* xp, float* ret) {
const float X_H =
chemistry_get_metal_mass_fraction_for_cooling(p)[chemistry_element_H];
const float HI_frac = cooling_get_particle_subgrid_HI_fraction(
e->internal_units, e->physical_constants, e->cosmology,
e->hydro_properties, e->entropy_floor, e->cooling_func, p, xp);
*ret = hydro_get_mass(p) * X_H * HI_frac;
}
INLINE static void convert_part_H2_mass(const struct engine* e,
const struct part* p,
const struct xpart* xp, float* ret) {
const float X_H =
chemistry_get_metal_mass_fraction_for_cooling(p)[chemistry_element_H];
const float H2_frac = cooling_get_particle_subgrid_H2_fraction(
e->internal_units, e->physical_constants, e->cosmology,
e->hydro_properties, e->entropy_floor, e->cooling_func, p, xp);
*ret = hydro_get_mass(p) * X_H * H2_frac * 2.f;
}
/**
* @brief Specifies which particle fields to write to a dataset
*
......@@ -160,7 +188,23 @@ __attribute__((always_inline)) INLINE static int cooling_write_particles(
"above deltaT of the entropy floor, the normal hydro quantities are "
"used.");
return 4;
list[4] = io_make_output_field_convert_part(
"AtomicHydrogenMasses", FLOAT, 1, UNIT_CONV_MASS, 0.f, parts, xparts,
convert_part_HI_mass,
"Atomic hydrogen masses containted in the particles. This quantity is "
"obtained from the cooling tables and, if the particle is on the entropy "
"floor, by extrapolating to the equilibrium curve assuming constant "
"pressure.");
list[5] = io_make_output_field_convert_part(
"MolecularHydrogenMasses", FLOAT, 1, UNIT_CONV_MASS, 0.f, parts, xparts,
convert_part_H2_mass,
"Molecular hydrogen masses containted in the particles. This quantity is "
"obtained from the cooling tables and, if the particle is on the entropy "
"floor, by extrapolating to the equilibrium curve assuming constant "
"pressure.");
return 6;
}
#endif /* SWIFT_COOLING_COLIBRE_IO_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment