Commit d352b4c2 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Call the stellar evolution in the star ghost.

parent 319853a7
......@@ -83,7 +83,7 @@ __attribute__((always_inline)) INLINE static void feedback_prepare_spart(
* @param cosmo The current cosmological model.
* @param stars_properties The #stars_props
*/
__attribute__((always_inline)) INLINE static void stars_evolve_spart(
__attribute__((always_inline)) INLINE static void feedback_evolve_spart(
struct spart* restrict sp, const struct feedback_props* feedback_props,
const struct cosmology* cosmo, const struct unit_system* us,
double star_age, double dt) {
......
......@@ -137,9 +137,10 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
struct spart *restrict sparts = c->stars.parts;
const struct engine *e = r->e;
// const struct unit_system *us = e->internal_units;
// const int with_cosmology = (e->policy & engine_policy_cosmology);
const struct unit_system *us = e->internal_units;
const int with_cosmology = (e->policy & engine_policy_cosmology);
const struct cosmology *cosmo = e->cosmology;
const struct feedback_props *feedback_props = e->feedback_props;
const float stars_h_max = e->hydro_properties->h_max;
const float stars_h_min = e->hydro_properties->h_min;
const float eps = e->stars_properties->h_tolerance;
......@@ -204,18 +205,18 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
/* Get a direct pointer on the part. */
struct spart *sp = &sparts[sid[i]];
/* get particle timestep */
/* double dt; */
/* if (with_cosmology) { */
/* 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); */
/* dt = cosmology_get_therm_kick_factor(e->cosmology, ti_begin, */
/* ti_begin + ti_step); */
/* } else { */
/* dt = get_timestep(sp->time_bin, e->time_base); */
/* } */
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);
}
#ifdef SWIFT_DEBUG_CHECKS
/* Is this part within the timestep? */
......@@ -371,28 +372,21 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
stars_reset_feedback(sp);
// MATTHIEU
/* Only do feedback if stars have a reasonable birth time */
/* if (sp->birth_time != -1) { */
/* /\* Calculate age of the star *\/ */
/* double star_age, current_time_begin = -1; */
/* if (with_cosmology) { */
/* star_age = cosmology_get_delta_time_from_scale_factors( */
/* cosmo, sp->birth_scale_factor, (float)cosmo->a); */
/* } else { */
/* current_time_begin = */
/* get_integer_time_begin(e->ti_current - 1, sp->time_bin) * */
/* e->time_base + */
/* e->time_begin; */
/* star_age = current_time_begin - sp->birth_time; */
/* } */
/* /\* Compute the stellar evolution *\/ */
/* //stars_evolve_spart(sp, e->stars_properties, cosmo, us, star_age,
* dt); */
/* } */
if (sp->birth_time != -1.) {
/* Calculate age of the star */
double star_age;
if (with_cosmology) {
star_age = cosmology_get_delta_time_from_scale_factors(
cosmo, sp->birth_scale_factor, (float)cosmo->a);
} else {
star_age = e->time - sp->birth_time;
}
/* Compute the stellar evolution */
feedback_evolve_spart(sp, feedback_props, cosmo, us, star_age, dt);
}
}
/* We now need to treat the particles whose smoothing length had not
......
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