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

Move the feedback properties carried by the star to a separate file.

parent 0a639f39
No related branches found
No related tags found
1 merge request!787Eagle stellar evolution matthieu
......@@ -7,14 +7,6 @@
__attribute__((always_inline)) INLINE static void feedback_init_spart(
struct spart* sp) {
#ifdef DEBUG_INTERACTIONS_STARS
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS_STARS; ++i)
sp->ids_ngbs_density[i] = -1;
sp->num_ngb_density = 0;
#endif
sp->rho_gas = 0.f;
sp->density_weighted_frac_normalisation_inv = 0.f;
sp->ngb_mass = 0.f;
}
......
struct feedback_struct_data {
struct {
/* Mass of ejecta */
float mass;
/* Total metal mass released */
float total_metal_mass;
/* Total mass released by element */
float metal_mass[chemistry_element_count];
/*! Total mass released due to SNIa */
float mass_from_SNIa;
/*! Total metal mass released due to SNIa */
float metal_mass_from_SNIa;
/*! Total iron mass released due to SNIa */
float Fe_mass_from_SNIa;
/*! Total mass released due to SNII */
float mass_from_SNII;
/*! Total metal mass released due to SNII */
float metal_mass_from_SNII;
/*! Total mass released due to AGB */
float mass_from_AGB;
/*! Total metal mass released due to AGB */
float metal_mass_from_AGB;
/* Number of type Ia SNe per unit mass */
float num_SNIa;
/* Number of type II SNe per unit mass */
float num_SNII;
/* Number of SNe in timestep */
float num_SNe;
/* Energy change due to thermal and kinetic energy of ejecta */
float d_energy;
/* Probability for heating neighbouring gas particles */
float heating_probability;
} to_distribute;
/* Normalisation factor for density weight fraction for feedback (equivalent
* to metalweight_norm in EAGLE, see eagle_enrich.c:811) */
float density_weighted_frac_normalisation_inv;
/* total mass (unweighted) of neighbouring gas particles */
float ngb_mass;
}
......@@ -40,6 +40,14 @@ __attribute__((always_inline)) INLINE static float stars_compute_timestep(
__attribute__((always_inline)) INLINE static void stars_init_spart(
struct spart* sp) {
#ifdef DEBUG_INTERACTIONS_STARS
for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS_STARS; ++i)
sp->ids_ngbs_density[i] = -1;
sp->num_ngb_density = 0;
#endif
sp->rho_gas = 0.f;
sp->density.wcount = 0.f;
sp->density.wcount_dh = 0.f;
}
......
......@@ -59,6 +59,12 @@ runner_iact_nonsym_stars_density(
si->density.wcount += wi;
si->density.wcount_dh -= (hydro_dimension * wi + ui * wi_dx);
/* Get the gas mass. */
const float mj = hydro_get_mass(pj);
/* Compute contribution to the density */
si->rho_gas += mj * wi;
#ifdef DEBUG_INTERACTIONS_STARS
/* Update ngb counters */
if (si->num_ngb_density < MAX_NUM_OF_NEIGHBOURS_STARS)
......
......@@ -38,7 +38,7 @@ struct spart {
long long id;
/*! Pointer to corresponding gravity part. */
struct gpart *gpart;
struct gpart* gpart;
/*! Particle position. */
double x[3];
......@@ -84,61 +84,6 @@ struct spart {
} feedback;
struct {
/* Mass of ejecta */
float mass;
/* Total metal mass released */
float total_metal_mass;
/* Total mass released by element */
float metal_mass[chemistry_element_count];
/*! Total mass released due to SNIa */
float mass_from_SNIa;
/*! Total metal mass released due to SNIa */
float metal_mass_from_SNIa;
/*! Total iron mass released due to SNIa */
float Fe_mass_from_SNIa;
/*! Total mass released due to SNII */
float mass_from_SNII;
/*! Total metal mass released due to SNII */
float metal_mass_from_SNII;
/*! Total mass released due to AGB */
float mass_from_AGB;
/*! Total metal mass released due to AGB */
float metal_mass_from_AGB;
/* Number of type Ia SNe per unit mass */
float num_SNIa;
/* Number of type II SNe per unit mass */
float num_SNII;
/* Number of SNe in timestep */
float num_SNe;
/* Energy change due to thermal and kinetic energy of ejecta */
float d_energy;
/* Probability for heating neighbouring gas particles */
float heating_probability;
} to_distribute;
/* Normalisation factor for density weight fraction for feedback (equivalent
* to metalweight_norm in EAGLE, see eagle_enrich.c:811) */
float density_weighted_frac_normalisation_inv;
/* total mass (unweighted) of neighbouring gas particles */
float ngb_mass;
/*! Union for the birth time and birth scale factor */
union {
......@@ -169,6 +114,7 @@ struct spart {
#endif
#ifdef DEBUG_INTERACTIONS_STARS
/*! Number of interactions in the density SELF and PAIR */
int num_ngb_density;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment