Skip to content
Snippets Groups Projects

Backported the new interface to the chemistry from the COLIBRE fork.

Merged Matthieu Schaller requested to merge colibre_backport into master
6 files
+ 169
63
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -170,9 +170,10 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
p->chemistry_data.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] =
data->initial_metal_mass_fraction[elem];
}
}
chemistry_init_part(p, data);
}
@@ -241,4 +242,106 @@ static INLINE void chemistry_print_backend(
chemistry_element_count);
}
/**
* @brief Updates the metal mass fractions after diffusion at the end of the
* force loop.
*
* @param p The particle to act upon.
* @param cosmo The current cosmological model.
*/
__attribute__((always_inline)) INLINE static void chemistry_end_force(
struct part* restrict p, const struct cosmology* cosmo) {}
/**
* @brief Computes the chemistry-related time-step constraint.
*
* @param phys_const The physical constants in internal units.
* @param cosmo The current cosmological model.
* @param us The internal system of units.
* @param hydro_props The properties of the hydro scheme.
* @param p Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float chemistry_timestep(
const struct phys_const* restrict phys_const,
const struct cosmology* restrict cosmo,
const struct unit_system* restrict us,
const struct hydro_props* hydro_props,
const struct chemistry_global_data* cd, const struct part* restrict p) {
return FLT_MAX;
}
/**
* @brief Returns the total metallicity (metal mass fraction) of the
* star particle to be used in feedback/enrichment related routines.
*
* EAGLE uses smooth abundances for everything.
*
* @param sp Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float
chemistry_get_total_metal_mass_fraction_for_feedback(
const struct spart* restrict sp) {
return sp->chemistry_data.smoothed_metal_mass_fraction_total;
}
/**
* @brief Returns the total metallicity (metal mass fraction) of the
* gas particle to be used in cooling related routines.
*
* EAGLE uses smooth abundances for everything.
*
* @param p Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float
chemistry_get_total_metal_mass_fraction_for_cooling(
const struct part* restrict p) {
return p->chemistry_data.smoothed_metal_mass_fraction_total;
}
/**
* @brief Returns the abundance array (metal mass fractions) of the
* gas particle to be used in cooling related routines.
*
* EAGLE uses smooth abundances for everything.
*
* @param p Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float const*
chemistry_get_metal_mass_fraction_for_cooling(const struct part* restrict p) {
return p->chemistry_data.smoothed_metal_mass_fraction;
}
/**
* @brief Returns the total metallicity (metal mass fraction) of the
* gas particle to be used in star formation related routines.
*
* EAGLE uses smooth abundances for everything.
*
* @param p Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float
chemistry_get_total_metal_mass_fraction_for_star_formation(
const struct part* restrict p) {
return p->chemistry_data.smoothed_metal_mass_fraction_total;
}
/**
* @brief Returns the abundance array (metal mass fractions) of the
* gas particle to be used in star formation related routines.
*
* EAGLE uses smooth abundances for everything.
*
* @param p Pointer to the particle data.
*/
__attribute__((always_inline)) INLINE static float const*
chemistry_get_metal_mass_fraction_for_star_formation(
const struct part* restrict p) {
return p->chemistry_data.smoothed_metal_mass_fraction;
}
#endif /* SWIFT_CHEMISTRY_EAGLE_H */
Loading