diff --git a/src/cell.c b/src/cell.c index 86a0bee9ee65499f7aa4fadd471e8f7a87ac0162..d2b102a974ff92d0548fe072b70c44ce417343cf 100644 --- a/src/cell.c +++ b/src/cell.c @@ -64,6 +64,7 @@ #include "scheduler.h" #include "space.h" #include "space_getsid.h" +#include "star_formation.h" #include "stars.h" #include "timers.h" #include "tools.h" @@ -4207,6 +4208,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { if (part_is_active(p, e)) { hydro_init_part(p, &e->s->hs); chemistry_init_part(p, e->chemistry); + star_formation_init_part(p, e->star_formation); tracers_after_init(p, xp, e->internal_units, e->physical_constants, with_cosmology, e->cosmology, e->hydro_properties, e->cooling_func, e->time); diff --git a/src/runner.c b/src/runner.c index 38c450316d4133ad2937b1fec8f8cf368ef3daa8..6eff7f3a33794ddc36edda53b9d959d39f405009 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1926,6 +1926,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { const struct cosmology *cosmo = e->cosmology; const struct chemistry_global_data *chemistry = e->chemistry; const struct star_formation *star_formation = e->star_formation; + + const int with_cosmology = (e->policy & engine_policy_cosmology); + const float hydro_h_max = e->hydro_properties->h_max; const float hydro_h_min = e->hydro_properties->h_min; const float eps = e->hydro_properties->h_tolerance; @@ -2071,7 +2074,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { /* Calculate the time-step for passing to hydro_prepare_force, used * for the evolution of alpha factors (i.e. those involved in the * artificial viscosity and thermal conduction terms) */ - const int with_cosmology = (e->policy & engine_policy_cosmology); const double time_base = e->time_base; const integertime_t ti_current = e->ti_current; double dt_alpha; @@ -2168,6 +2170,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { hydro_init_part(p, hs); chemistry_init_part(p, chemistry); star_formation_init_part(p, star_formation); + tracers_after_init(p, xp, e->internal_units, e->physical_constants, + with_cosmology, e->cosmology, + e->hydro_properties, e->cooling_func, e->time); /* Off we go ! */ continue; @@ -2222,7 +2227,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { /* Calculate the time-step for passing to hydro_prepare_force, used for * the evolution of alpha factors (i.e. those involved in the artificial * viscosity and thermal conduction terms) */ - const int with_cosmology = (e->policy & engine_policy_cosmology); const double time_base = e->time_base; const integertime_t ti_current = e->ti_current; double dt_alpha; diff --git a/src/space.c b/src/space.c index 1c5023c3b79aab472b40756072c01870eb50dcd4..92e9f98a57e202842f0ad3619244f8a41965b329 100644 --- a/src/space.c +++ b/src/space.c @@ -4333,8 +4333,21 @@ void space_init_parts_mapper(void *restrict map_data, int count, void *restrict extra_data) { struct part *restrict parts = (struct part *)map_data; - const struct hydro_space *restrict hs = (struct hydro_space *)extra_data; - for (int k = 0; k < count; k++) hydro_init_part(&parts[k], hs); + const struct engine *restrict e = (struct engine *)extra_data; + const struct hydro_space *restrict hs = &e->s->hs; + const int with_cosmology = (e->policy & engine_policy_cosmology); + + size_t ind = parts - e->s->parts; + struct xpart *restrict xparts = e->s->xparts + ind; + + for (int k = 0; k < count; k++) { + hydro_init_part(&parts[k], hs); + chemistry_init_part(&parts[k], e->chemistry); + star_formation_init_part(&parts[k], e->star_formation); + tracers_after_init(&parts[k], &xparts[k], e->internal_units, + e->physical_constants, with_cosmology, e->cosmology, + e->hydro_properties, e->cooling_func, e->time); + } } /** @@ -4349,7 +4362,7 @@ void space_init_parts(struct space *s, int verbose) { if (s->nr_parts > 0) threadpool_map(&s->e->threadpool, space_init_parts_mapper, s->parts, - s->nr_parts, sizeof(struct part), 0, &s->hs); + s->nr_parts, sizeof(struct part), 0, &s->e); if (verbose) message("took %.3f %s.", clocks_from_ticks(getticks() - tic), clocks_getunit());