Commit 632f3418 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add a (temporary) optional parameter to the YAML file to impose a smoothing...

Add a (temporary) optional parameter to the YAML file to impose a smoothing length value to all stars.
parent a3ff381e
......@@ -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,
......
......@@ -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;
......
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