Commit 9037c0a0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also compute the feedback strength when a star's smoothing length is limited by its softening.

parent 21836158
......@@ -282,7 +282,52 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
((sp->h <= stars_h_min) && (f > 0.f))) {
stars_reset_feedback(sp);
feedback_reset_feedback(sp, feedback_props);
/* Only do feedback if stars have a reasonable birth time */
if (feedback_do_feedback(sp)) {
const integertime_t ti_step = get_integer_timestep(sp->time_bin);
const integertime_t ti_begin =
get_integer_time_begin(e->ti_current - 1, sp->time_bin);
/* Get particle time-step */
double dt;
if (with_cosmology) {
dt = cosmology_get_delta_time(e->cosmology, ti_begin,
ti_begin + ti_step);
} else {
dt = get_timestep(sp->time_bin, e->time_base);
}
/* Calculate age of the star at current time */
double star_age_end_of_step;
if (with_cosmology) {
star_age_end_of_step =
cosmology_get_delta_time_from_scale_factors(
cosmo, (double)sp->birth_scale_factor, cosmo->a);
} else {
star_age_end_of_step = (float)e->time - sp->birth_time;
}
/* Has this star been around for a while ? */
if (star_age_end_of_step > 0.) {
/* Age of the star at the start of the step */
const double star_age_beg_of_step =
max(star_age_end_of_step - dt, 0.);
/* Compute the stellar evolution */
feedback_evolve_spart(sp, feedback_props, cosmo, us,
star_age_beg_of_step, dt);
} else {
/* Reset the feedback fields of the star particle */
feedback_reset_feedback(sp, feedback_props);
}
} else {
feedback_reset_feedback(sp, feedback_props);
}
/* Ok, we are done with this particle */
continue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment