diff --git a/src/space.c b/src/space.c index c368f2c220ad8176fcd600f3a44ab69e7d5f5ccc..ac6c08a3a586a42148db484d5cfb8e3ade5ff933 100644 --- a/src/space.c +++ b/src/space.c @@ -3512,6 +3512,8 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, const ptrdiff_t delta = sp - s->sparts; #endif + const float initial_h = s->initial_spart_h; + const int with_feedback = (e->policy & engine_policy_feedback); const struct cosmology *cosmo = e->cosmology; @@ -3524,6 +3526,11 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count, sp[k].v[1] *= a_factor_vel; sp[k].v[2] *= a_factor_vel; + /* Imposed smoothing length from parameter file */ + if (initial_h != -1.f) { + sp[k].h = initial_h; + } + #ifdef HYDRO_DIMENSION_2D sp[k].x[2] = 0.f; sp[k].v[2] = 0.f; @@ -3849,6 +3856,13 @@ void space_init(struct space *s, struct swift_params *params, for (size_t k = 0; k < Npart; k++) parts[k].h *= scaling; } + /* Read in imposed star smoothing length */ + s->initial_spart_h = parser_get_opt_param_float( + params, "InitialConditions:stars_smoothing_length", -1.f); + if (s->initial_spart_h != -1.f) { + message("Imposing a star smoothing length of %e", s->initial_spart_h); + } + /* Apply shift */ double shift[3] = {0.0, 0.0, 0.0}; parser_get_opt_param_double_array(params, "InitialConditions:shift", 3, diff --git a/src/space.h b/src/space.h index 564a1d099260483df4972022e7ec3e389fca90b1..fe47a2b8b995e5872e79e755b5b8075a409795b8 100644 --- a/src/space.h +++ b/src/space.h @@ -224,6 +224,9 @@ struct space { /*! Sum of the norm of the velocity of all the #spart */ float sum_spart_vel_norm; + /*! Initial value of the smoothing length read from the parameter file */ + float initial_spart_h; + /*! General-purpose lock for this space. */ swift_lock_type lock;