diff --git a/src/feedback/EAGLE/feedback.c b/src/feedback/EAGLE/feedback.c index 10500f5c12222178a070f5b4af4aa3e0c354982a..8b97bb510a540df9093bcf7a3863c71e4f9300fe 100644 --- a/src/feedback/EAGLE/feedback.c +++ b/src/feedback/EAGLE/feedback.c @@ -125,13 +125,14 @@ double eagle_feedback_energy_fraction(const struct spart* sp, * step. * * @param sp The star particle. - * @param feedback_props The properties of the feedback model. * @param star_age Age of star at the beginning of the step in internal units. * @param dt Length of time-step in internal units. + * @param ngb_gas_mass Total un-weighted mass in the star's kernel. + * @param feedback_props The properties of the feedback model. */ inline static void compute_SNe_feedback( struct spart* sp, const double star_age, const double dt, - const struct feedback_props* feedback_props) { + const float ngb_gas_mass, const struct feedback_props* feedback_props) { /* Time after birth considered for SNII feedback (internal units) */ const float SNII_wind_delay = feedback_props->SNII_wind_delay; @@ -150,8 +151,7 @@ inline static void compute_SNe_feedback( const double conv_factor = feedback_props->temp_to_u_factor; /* Calculate the default heating probability */ - double prob = f_E * E_SNe * N_SNe / - (conv_factor * delta_T * sp->feedback_data.ngb_mass); + double prob = f_E * E_SNe * N_SNe / (conv_factor * delta_T * ngb_gas_mass); /* Calculate the change in internal energy of the gas particles that get * heated */ @@ -167,7 +167,7 @@ inline static void compute_SNe_feedback( desired deltaT to ensure we inject all the available energy. */ prob = 1.; - delta_u = f_E * E_SNe * N_SNe / sp->feedback_data.ngb_mass; + delta_u = f_E * E_SNe * N_SNe / ngb_gas_mass; } /* Store all of this in the star for delivery onto the gas */ @@ -315,8 +315,6 @@ inline static void evolve_SNIa(const float log10_min_mass, const float num_SNIa = eagle_feedback_number_of_SNIa( sp, star_age_Gyr, star_age_Gyr + dt_Gyr, props); - sp->feedback_data.to_distribute.num_SNIa = num_SNIa; - /* compute mass of each metal */ for (int i = 0; i < chemistry_element_count; i++) { sp->feedback_data.to_distribute.metal_mass[i] += @@ -384,11 +382,6 @@ inline static void evolve_SNII(float log10_min_mass, float log10_max_mass, determine_imf_bins(log10_min_mass, log10_max_mass, &low_imf_mass_bin_index, &high_imf_mass_bin_index, props); - /* Integrate IMF to determine number of SNII */ - sp->feedback_data.to_distribute.num_SNII = - integrate_imf(log10_min_mass, log10_max_mass, - eagle_imf_integration_no_weight, stellar_yields, props); - /* determine which metallicity bin and offset this star belongs to */ int iz_low = 0, iz_high = 0, low_index_3d, high_index_3d, low_index_2d, high_index_2d; @@ -653,6 +646,34 @@ inline static void evolve_AGB(const float log10_min_mass, float log10_max_mass, } } +inline static void feedback_init_to_distribute(struct spart* sp) { + + /* Zero the amount of mass that is distributed */ + sp->feedback_data.to_distribute.mass = 0.f; + + /* Zero the metal enrichment quantities */ + for (int i = 0; i < chemistry_element_count; i++) { + sp->feedback_data.to_distribute.metal_mass[i] = 0.f; + } + sp->feedback_data.to_distribute.total_metal_mass = 0.f; + sp->feedback_data.to_distribute.mass_from_AGB = 0.f; + sp->feedback_data.to_distribute.metal_mass_from_AGB = 0.f; + sp->feedback_data.to_distribute.mass_from_SNII = 0.f; + sp->feedback_data.to_distribute.metal_mass_from_SNII = 0.f; + sp->feedback_data.to_distribute.mass_from_SNIa = 0.f; + sp->feedback_data.to_distribute.metal_mass_from_SNIa = 0.f; + sp->feedback_data.to_distribute.Fe_mass_from_SNIa = 0.f; + + /* Zero the energy to inject */ + sp->feedback_data.to_distribute.d_energy = 0.f; + + /* Zero the SNII feedback probability */ + sp->feedback_data.to_distribute.SNII_heating_probability = 0.f; + + /* Zero the SNII feedback energy */ + sp->feedback_data.to_distribute.SNII_delta_u = 0.f; +} + /** * @brief calculates stellar mass in spart that died over the timestep, calls * functions to calculate feedback due to SNIa, SNII and AGB @@ -682,8 +703,23 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, /* Get the metallicity */ const float Z = sp->chemistry_data.metal_mass_fraction_total; + /* Properties collected in the stellar density loop. */ + const float ngb_gas_mass = sp->feedback_data.to_collect.ngb_mass; + const float enrichment_weight_inv = + sp->feedback_data.to_collect.enrichment_weight_inv; + + /* Now we start filling the data structure for information to apply to the + * particles. Do _NOT_ read from the to_collect substructure any more. */ + + /* Zero all the output fields */ + feedback_init_to_distribute(sp); + + /* Update the weights used for distribution */ + const float enrichment_weight = 1.f / enrichment_weight_inv; + sp->feedback_data.to_distribute.enrichment_weight = enrichment_weight; + /* Compute properties of the stochastic SNe feedback model. */ - compute_SNe_feedback(sp, age, dt, feedback_props); + compute_SNe_feedback(sp, age, dt, ngb_gas_mass, feedback_props); /* Calculate mass of stars that has died from the star's birth up to the * beginning and end of timestep */ diff --git a/src/feedback/EAGLE/feedback.h b/src/feedback/EAGLE/feedback.h index 18012ff47edbc0c845185173a91d6260d8e6999b..5b8955b92612e9730dd220ff8085449c88a88554 100644 --- a/src/feedback/EAGLE/feedback.h +++ b/src/feedback/EAGLE/feedback.h @@ -41,8 +41,8 @@ void compute_stellar_evolution(const struct feedback_props* feedback_props, __attribute__((always_inline)) INLINE static void feedback_init_spart( struct spart* sp) { - sp->feedback_data.density_weighted_frac_normalisation_inv = 0.f; - sp->feedback_data.ngb_mass = 0.f; + sp->feedback_data.to_collect.enrichment_weight_inv = 0.f; + sp->feedback_data.to_collect.ngb_mass = 0.f; } /** @@ -70,37 +70,7 @@ __attribute__((always_inline)) INLINE static void feedback_first_init_spart( * @param feedback_props The properties of the feedback model. */ __attribute__((always_inline)) INLINE static void feedback_prepare_spart( - struct spart* sp, const struct feedback_props* feedback_props) { - - /* Zero the amount of mass that is distributed */ - sp->feedback_data.to_distribute.mass = 0.f; - - /* Zero the number of SN */ - sp->feedback_data.to_distribute.num_SNIa = 0.f; - sp->feedback_data.to_distribute.num_SNII = 0.f; - sp->feedback_data.to_distribute.num_SNe = 0.f; - - /* Zero the enrichment quantities */ - for (int i = 0; i < chemistry_element_count; i++) - sp->feedback_data.to_distribute.metal_mass[i] = 0.f; - sp->feedback_data.to_distribute.total_metal_mass = 0.f; - sp->feedback_data.to_distribute.mass_from_AGB = 0.f; - sp->feedback_data.to_distribute.metal_mass_from_AGB = 0.f; - sp->feedback_data.to_distribute.mass_from_SNII = 0.f; - sp->feedback_data.to_distribute.metal_mass_from_SNII = 0.f; - sp->feedback_data.to_distribute.mass_from_SNIa = 0.f; - sp->feedback_data.to_distribute.metal_mass_from_SNIa = 0.f; - sp->feedback_data.to_distribute.Fe_mass_from_SNIa = 0.f; - - /* Zero the energy to inject */ - sp->feedback_data.to_distribute.d_energy = 0.f; - - /* Zero the SNII feedback probability */ - sp->feedback_data.to_distribute.SNII_heating_probability = 0.f; - - /* Zero the SNII feedback energy */ - sp->feedback_data.to_distribute.SNII_delta_u = 0.f; -} + struct spart* sp, const struct feedback_props* feedback_props) {} /** * @brief Evolve the stellar properties of a #spart. diff --git a/src/feedback/EAGLE/feedback_iact.h b/src/feedback/EAGLE/feedback_iact.h index 93937677317c28b7e298e3ace45b5e03bd341e93..63cecf017126484535572cac5192729af12b349e 100644 --- a/src/feedback/EAGLE/feedback_iact.h +++ b/src/feedback/EAGLE/feedback_iact.h @@ -55,7 +55,7 @@ runner_iact_nonsym_feedback_density(const float r2, const float *dx, kernel_eval(ui, &wi); /* Add mass of pj to neighbour mass of si */ - si->feedback_data.ngb_mass += mj; + si->feedback_data.to_collect.ngb_mass += mj; /* Add contribution of pj to normalisation of density weighted fraction * which determines how much mass to distribute to neighbouring @@ -63,7 +63,7 @@ runner_iact_nonsym_feedback_density(const float r2, const float *dx, const float rho = hydro_get_comoving_density(pj); if (rho != 0.f) - si->feedback_data.density_weighted_frac_normalisation_inv += wi / rho; + si->feedback_data.to_collect.enrichment_weight_inv += wi / rho; } /** @@ -100,20 +100,20 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, float wi; kernel_eval(ui, &wi); + /* Gas particle density */ + const float rho_j = hydro_get_comoving_density(pj); + /* Compute weighting for distributing feedback quantities */ - float density_weighted_frac; - const float rho = hydro_get_comoving_density(pj); - if (rho * si->feedback_data.density_weighted_frac_normalisation_inv != 0) { - density_weighted_frac = - wi / (rho * si->feedback_data.density_weighted_frac_normalisation_inv); + float Omega_frac; + if (rho_j != 0.f) { + Omega_frac = si->feedback_data.to_distribute.enrichment_weight * wi / rho_j; } else { - density_weighted_frac = 0.f; + Omega_frac = 0.f; } /* Update particle mass */ const double current_mass = hydro_get_mass(pj); - const double delta_mass = - si->feedback_data.to_distribute.mass * density_weighted_frac; + const double delta_mass = si->feedback_data.to_distribute.mass * Omega_frac; const double new_mass = current_mass + delta_mass; hydro_set_mass(pj, new_mass); @@ -122,7 +122,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, const double current_metal_mass_total = pj->chemistry_data.metal_mass_fraction_total * current_mass; const double delta_metal_mass_total = - si->feedback_data.to_distribute.total_metal_mass * density_weighted_frac; + si->feedback_data.to_distribute.total_metal_mass * Omega_frac; const double new_metal_mass_total = current_metal_mass_total + delta_metal_mass_total; @@ -134,8 +134,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, const double current_metal_mass = pj->chemistry_data.metal_mass_fraction[elem] * current_mass; const double delta_metal_mass = - si->feedback_data.to_distribute.metal_mass[elem] * - density_weighted_frac; + si->feedback_data.to_distribute.metal_mass[elem] * Omega_frac; const double new_metal_mass = current_metal_mass + delta_metal_mass; pj->chemistry_data.metal_mass_fraction[elem] = new_metal_mass / new_mass; @@ -147,7 +146,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* const float new_iron_from_SNIa_mass = */ /* current_iron_from_SNIa_mass + */ /* si->feedback_data.to_distribute.Fe_mass_from_SNIa * - * density_weighted_frac; */ + * Omega_frac; */ /* pj->chemistry_data.iron_mass_fraction_from_SNIa = */ /* new_iron_from_SNIa_mass / new_mass; */ @@ -156,7 +155,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* pj->chemistry_data.mass_from_SNIa * current_mass; */ /* const float new_mass_from_SNIa = */ /* current_mass_from_SNIa + */ - /* si->feedback_data.to_distribute.mass_from_SNIa * density_weighted_frac; + /* si->feedback_data.to_distribute.mass_from_SNIa * Omega_frac; */ /* pj->chemistry_data.mass_from_SNIa = new_mass_from_SNIa / new_mass; */ @@ -166,7 +165,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* const float new_metal_mass_fraction_from_SNIa = */ /* current_metal_mass_fraction_from_SNIa + */ /* si->feedback_data.to_distribute.metal_mass_from_SNIa * */ - /* density_weighted_frac; */ + /* Omega_frac; */ /* pj->chemistry_data.metal_mass_fraction_from_SNIa = */ /* new_metal_mass_fraction_from_SNIa / new_mass; */ @@ -175,7 +174,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* pj->chemistry_data.mass_from_SNII * current_mass; */ /* const float new_mass_from_SNII = */ /* current_mass_from_SNII + */ - /* si->feedback_data.to_distribute.mass_from_SNII * density_weighted_frac; + /* si->feedback_data.to_distribute.mass_from_SNII * Omega_frac; */ /* pj->chemistry_data.mass_from_SNII = new_mass_from_SNII / new_mass; */ @@ -185,7 +184,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* const float new_metal_mass_fraction_from_SNII = */ /* current_metal_mass_fraction_from_SNII + */ /* si->feedback_data.to_distribute.metal_mass_from_SNII * */ - /* density_weighted_frac; */ + /* Omega_frac; */ /* pj->chemistry_data.metal_mass_fraction_from_SNII = */ /* new_metal_mass_fraction_from_SNII / new_mass; */ @@ -194,7 +193,7 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* pj->chemistry_data.mass_from_AGB * current_mass; */ /* const float new_mass_from_AGB = */ /* current_mass_from_AGB + */ - /* si->feedback_data.to_distribute.mass_from_AGB * density_weighted_frac; + /* si->feedback_data.to_distribute.mass_from_AGB * Omega_frac; */ /* pj->chemistry_data.mass_from_AGB = new_mass_from_AGB / new_mass; */ @@ -204,25 +203,25 @@ runner_iact_nonsym_feedback_apply(const float r2, const float *dx, /* const float new_metal_mass_fraction_from_AGB = */ /* current_metal_mass_fraction_from_AGB + */ /* si->feedback_data.to_distribute.metal_mass_from_AGB * */ - /* density_weighted_frac; */ + /* Omega_frac; */ /* pj->chemistry_data.metal_mass_fraction_from_AGB = */ /* new_metal_mass_fraction_from_AGB / new_mass; */ /* /\* Update momentum *\/ */ /* for (int i = 0; i < 3; i++) { */ - /* pj->v[i] += si->feedback_data.to_distribute.mass * density_weighted_frac + /* pj->v[i] += si->feedback_data.to_distribute.mass * Omega_frac * * */ /* (si->v[i] - pj->v[i]); */ /* } */ /* Energy feedback */ // d_energy += si->feedback_data.to_distribute.d_energy * - // density_weighted_frac; + // Omega_frac; /* if (feedback_props->continuous_heating) { */ /* // We're doing ONLY continuous heating */ /* d_energy += si->feedback_data.to_distribute.num_SNIa * */ - /* feedback_props->total_energy_SNe * density_weighted_frac * */ + /* feedback_props->total_energy_SNe * Omega_frac * */ /* si->mass_init; */ /* } else { */ diff --git a/src/feedback/EAGLE/feedback_struct.h b/src/feedback/EAGLE/feedback_struct.h index cd9c923224bef3c2ea75b86992759502e56c068b..f5950772a6f61671fef205693edb43852c820741 100644 --- a/src/feedback/EAGLE/feedback_struct.h +++ b/src/feedback/EAGLE/feedback_struct.h @@ -19,66 +19,69 @@ #ifndef SWIFT_FEEDBACK_STRUCT_EAGLE_H #define SWIFT_FEEDBACK_STRUCT_EAGLE_H +/** + * @brief Feedback fields carried by each star particles + */ struct feedback_spart_data { - struct { + union { - /* Mass of ejecta */ - float mass; + struct { - /* Total metal mass released */ - float total_metal_mass; + /*! Inverse of normalisation factor used for the enrichment */ + float enrichment_weight_inv; - /* Total mass released by element */ - float metal_mass[chemistry_element_count]; + /*! Total mass (unweighted) of neighbouring gas particles */ + float ngb_mass; - /*! Total mass released due to SNIa */ - float mass_from_SNIa; + } to_collect; - /*! Total metal mass released due to SNIa */ - float metal_mass_from_SNIa; + struct { - /*! Total iron mass released due to SNIa */ - float Fe_mass_from_SNIa; + /*! Normalisation factor used for the enrichment */ + float enrichment_weight; - /*! Total mass released due to SNII */ - float mass_from_SNII; + /*! Mass released */ + float mass; - /*! Total metal mass released due to SNII */ - float metal_mass_from_SNII; + /*! Total metal mass released */ + float total_metal_mass; - /*! Total mass released due to AGB */ - float mass_from_AGB; + /*! Total mass released by each element */ + float metal_mass[chemistry_element_count]; - /*! Total metal mass released due to AGB */ - float metal_mass_from_AGB; + /*! Total mass released due to SNIa */ + float mass_from_SNIa; - /* Number of type Ia SNe per unit mass */ - float num_SNIa; + /*! Total metal mass released due to SNIa */ + float metal_mass_from_SNIa; - /* Number of type II SNe per unit mass */ - float num_SNII; + /*! Total iron mass released due to SNIa */ + float Fe_mass_from_SNIa; - /* Number of SNe in timestep */ - float num_SNe; + /*! Total mass released due to SNII */ + float mass_from_SNII; - /* Energy change due to thermal and kinetic energy of ejecta */ - float d_energy; + /*! Total metal mass released due to SNII */ + float metal_mass_from_SNII; - /*! Probability to heating neighbouring gas particle for SNII feedback */ - float SNII_heating_probability; + /*! Total mass released due to AGB */ + float mass_from_AGB; - /*! Change in energy from SNII feedback energy injection */ - float SNII_delta_u; + /*! Total metal mass released due to AGB */ + float metal_mass_from_AGB; - } to_distribute; + /*! Energy change due to thermal and kinetic energy of ejecta */ + float d_energy; - /* 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; + /*! Probability to heating neighbouring gas particle for SNII feedback */ + float SNII_heating_probability; - /* total mass (unweighted) of neighbouring gas particles */ - float ngb_mass; + /*! Change in energy from SNII feedback energy injection */ + float SNII_delta_u; + + } to_distribute; + }; }; #endif /* SWIFT_FEEDBACK_STRUCT_EAGLE_H */ diff --git a/src/stars/EAGLE/stars.h b/src/stars/EAGLE/stars.h index 8d0a75da9af72c2c8e627a20c96a59dfa5d4404d..9577ea65e9f6c2c015505c7bdd193ccad9de03d8 100644 --- a/src/stars/EAGLE/stars.h +++ b/src/stars/EAGLE/stars.h @@ -46,8 +46,6 @@ __attribute__((always_inline)) INLINE static void stars_init_spart( sp->num_ngb_density = 0; #endif - sp->rho_gas = 0.f; - sp->density.wcount = 0.f; sp->density.wcount_dh = 0.f; } @@ -78,18 +76,7 @@ __attribute__((always_inline)) INLINE static void stars_first_init_spart( * @param dt_drift The drift time-step for positions. */ __attribute__((always_inline)) INLINE static void stars_predict_extra( - struct spart* restrict sp, float dt_drift) { - - // MATTHIEU - /* const float h_inv = 1.f / sp->h; */ - - /* /\* Predict smoothing length *\/ */ - /* const float w1 = sp->feedback.h_dt * h_inv * dt_drift; */ - /* if (fabsf(w1) < 0.2f) */ - /* sp->h *= approx_expf(w1); /\* 4th order expansion of exp(w) *\/ */ - /* else */ - /* sp->h *= expf(w1); */ -} + struct spart* restrict sp, float dt_drift) {} /** * @brief Sets the values to be predicted in the drifts to their values at a @@ -108,10 +95,7 @@ __attribute__((always_inline)) INLINE static void stars_reset_predicted_values( * @param sp The particle to act upon */ __attribute__((always_inline)) INLINE static void stars_end_feedback( - struct spart* sp) { - - sp->feedback.h_dt *= sp->h * hydro_dimension_inv; -} + struct spart* sp) {} /** * @brief Kick the additional variables @@ -138,7 +122,6 @@ __attribute__((always_inline)) INLINE static void stars_end_density( const float h_inv_dim_plus_one = h_inv_dim * h_inv; /* 1/h^(d+1) */ /* Finish the calculation by inserting the missing h-factors */ - sp->rho_gas *= h_inv_dim; sp->density.wcount *= h_inv_dim; sp->density.wcount_dh *= h_inv_dim_plus_one; } @@ -156,7 +139,6 @@ __attribute__((always_inline)) INLINE static void stars_spart_has_no_neighbours( /* Re-set problematic values */ sp->density.wcount = 0.f; sp->density.wcount_dh = 0.f; - sp->rho_gas = 0.f; } /** @@ -186,9 +168,6 @@ __attribute__((always_inline)) INLINE static void stars_reset_acceleration( __attribute__((always_inline)) INLINE static void stars_reset_feedback( struct spart* restrict p) { - /* Reset time derivative */ - p->feedback.h_dt = 0.f; - #ifdef DEBUG_INTERACTIONS_STARS for (int i = 0; i < MAX_NUM_OF_NEIGHBOURS_STARS; ++i) p->ids_ngbs_force[i] = -1; diff --git a/src/stars/EAGLE/stars_iact.h b/src/stars/EAGLE/stars_iact.h index 7958eaec563778221dc8f7a69252890f42dd9a6d..b384598f8c6958bec82afdf22fbac98551fe550c 100644 --- a/src/stars/EAGLE/stars_iact.h +++ b/src/stars/EAGLE/stars_iact.h @@ -54,12 +54,6 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj, 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) diff --git a/src/stars/EAGLE/stars_io.h b/src/stars/EAGLE/stars_io.h index 9f5b263e2f1af597d1422749eb3ff0e248ad797f..df4810f12e8d6ec3997037eeb87d157418fb91a0 100644 --- a/src/stars/EAGLE/stars_io.h +++ b/src/stars/EAGLE/stars_io.h @@ -64,7 +64,7 @@ INLINE static void stars_write_particles(const struct spart *sparts, int *num_fields) { /* Say how much we want to write */ - *num_fields = 9; + *num_fields = 8; /* List what we want to write */ list[0] = io_make_output_field("Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, @@ -83,8 +83,6 @@ INLINE static void stars_write_particles(const struct spart *sparts, sparts, mass_init); list[7] = io_make_output_field("BirthTime", FLOAT, 1, UNIT_CONV_TIME, sparts, birth_time); - list[8] = io_make_output_field("GasDensity", FLOAT, 1, UNIT_CONV_DENSITY, - sparts, rho_gas); } /** diff --git a/src/stars/EAGLE/stars_part.h b/src/stars/EAGLE/stars_part.h index 81fa313f11a3f1bdc172412eee65039dd0070feb..fce47de63c2b76d907cc8da905d91b6999d9e41f 100644 --- a/src/stars/EAGLE/stars_part.h +++ b/src/stars/EAGLE/stars_part.h @@ -62,12 +62,6 @@ struct spart { /*! Particle smoothing length. */ float h; - /*! Density of the gas surrounding the star. */ - float rho_gas; - - /*! Particle time bin */ - timebin_t time_bin; - struct { /* Number of neighbours. */ @@ -78,13 +72,6 @@ struct spart { } density; - struct { - - /* Change in smoothing length over time. */ - float h_dt; - - } feedback; - /*! Union for the birth time and birth scale factor */ union { @@ -107,6 +94,9 @@ struct spart { /*! Chemistry structure */ struct chemistry_part_data chemistry_data; + /*! Particle time bin */ + timebin_t time_bin; + #ifdef SWIFT_DEBUG_CHECKS /* Time of the last drift */ diff --git a/src/timestep.h b/src/timestep.h index 40750c07f1309289303375dcaa890ea5c3f556d0..c2b1a10fcb3b0426e7c34625d65c1fd5353d25e9 100644 --- a/src/timestep.h +++ b/src/timestep.h @@ -201,14 +201,8 @@ __attribute__((always_inline)) INLINE static integertime_t get_spart_timestep( new_dt_self = gravity_compute_timestep_self( sp->gpart, a_hydro, e->gravity_properties, e->cosmology); - /* Limit change in smoothing length */ - const float dt_h_change = (sp->feedback.h_dt != 0.0f) - ? fabsf(e->stars_properties->log_max_h_change * - sp->h / sp->feedback.h_dt) - : FLT_MAX; - /* Take the minimum of all */ - float new_dt = min4(new_dt_stars, new_dt_self, new_dt_ext, dt_h_change); + float new_dt = min3(new_dt_stars, new_dt_self, new_dt_ext); /* Apply the maximal displacement constraint (FLT_MAX if non-cosmological)*/ new_dt = min(new_dt, e->dt_max_RMS_displacement);