/******************************************************************************* * This file is part of SWIFT. * Copyright (c) 2018 Matthieu Schaller (schaller@strw.leidenuniv.nl) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * ******************************************************************************/ #ifndef SWIFT_FEEDBACK_STRUCT_COLIBRE_H #define SWIFT_FEEDBACK_STRUCT_COLIBRE_H /*! The total number of rays used in stellar feedback */ #define colibre_SNII_feedback_num_of_rays FEEDBACK_NR_RAYS_SNII #define colibre_SNIa_feedback_num_of_rays FEEDBACK_NR_RAYS_SNIa #include "chemistry_struct.h" #include "dust_struct.h" #include "rays_struct.h" /** * @brief Feedback fields carried by each hydro particles */ struct feedback_part_data { /* Id of the stellar particle that can kick this gas particle in this * time-step. */ long long SNII_stellar_id_kick_allowed; /* Maximal SNII kinetic energy per pair of two gas particles available in this * time-step. */ float SNII_max_E_kin_pair_avail; }; /** * @brief Extra feedback fields carried by each hydro particles */ struct feedback_xpart_data {}; /** * @brief Feedback fields carried by each star particles */ struct feedback_spart_data { union { /** * @brief Values collected from the gas neighbours. */ struct { /*! Inverse of normalisation factor used for the enrichment */ float enrichment_weight_inv; /*! Total mass (unweighted) of neighbouring gas particles (internal units) */ float ngb_mass; /*! SPH-weighted density of the neighbouring gas particles (internal * comoving units) */ float ngb_rho; /*! SPH-weighted internal energy per unit mass of the neighbouring gas * particles (internal comoving units) */ float ngb_u; /*! SPH-weighted metallicity of the neighbouring gas particles (internal * units) */ float ngb_Z; /*! Total (unweighted) number gas neighbours in the stellar kernel */ int ngb_N; } to_collect; /** * @brief Values to be distributed to the gas neighbours. * * WARNING: The first two elements must be the enrichment_weight and mass!! */ struct { /*! Normalisation factor used for the enrichment */ float enrichment_weight; /*! Mass released */ float mass; /*! Total metal mass released */ float total_metal_mass; /*! Total mass released by each element */ float metal_mass[chemistry_element_count]; /*! Total mass released by each grain species */ float dust_mass[dust_grain_species_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; /* Mass released by r processes */ float mass_from_NSM; float mass_from_collapsar; float mass_from_CEJSN; /*! 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; /*! Energy change due to thermal and kinetic energy of ejecta */ float energy; /*! Change in gas-particle internal energy from SNII feedback */ float SNII_delta_u; /*! Total kinetic energy to distribute in SNII feedback per time step */ float SNII_E_kinetic; /*! Change in gas-particle internal energy from SNIa feedback */ float SNIa_delta_u; /*! Age of star particle in Myr when SNII goes off */ float SNII_star_age_Myr; /*! Number of SNII energy injections in thermal form */ int SNII_num_of_thermal_energy_inj; /*! Number of SNII energy injections in kinetic form */ int SNII_num_of_kinetic_energy_inj; /*! Number of SNIa energy injections in thermal form */ int SNIa_num_of_thermal_energy_inj; /*! HII region timer in SU (time since BB for cosmo runs) */ float HIIregion_endtime; /*! ID of star particle responsible for HII region */ long long HIIregion_starid; /*! HII region probability */ float HIIregion_probability; /*! Energy floor of the HII region for injection */ float HII_u; /*! Probability to kick a particle in the early stellar feedback */ float momentum_probability; /*! Kick velocity in the early stellar feedback */ float momentum_delta_v; } to_distribute; }; /* Instantiate ray structs for SNII isotropic feedback */ struct ray_data SNII_rays_true[colibre_SNII_feedback_num_of_rays]; struct ray_data SNII_rays_mirr[colibre_SNII_feedback_num_of_rays]; /* Create extra ray structs for SNII isotropic kinetic feedback */ struct ray_data_extra SNII_rays_ext_true[colibre_SNII_feedback_num_of_rays]; struct ray_data_extra SNII_rays_ext_mirr[colibre_SNII_feedback_num_of_rays]; /* Energy in SNII kinetic feedback remained after some particle kicks * could not be executed */ float SNII_E_kinetic_residual; /* Number of energy injection events in SNII kinetic feedback remained * after some particle kicks could not be executed */ int SNII_num_of_kinetic_energy_inj_residual; /* Instantiate ray structs for SNIa isotropic feedback */ struct ray_data SNIa_rays[colibre_SNIa_feedback_num_of_rays]; /* Are we doing feedback in this step? */ char do_feedback; }; #endif /* SWIFT_FEEDBACK_STRUCT_COLIBRE_H */