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

Only call engine_rebuild() and not engine_init_particles() in main_fof. We...

Only call engine_rebuild() and not engine_init_particles() in main_fof. We don't need the full thing.
parent 5f41901e
......@@ -1112,8 +1112,7 @@ int main(int argc, char *argv[]) {
#endif
/* Initialise the particles */
engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values,
1);
engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values);
/* Write the state of the system before starting time integration. */
#ifdef WITH_LOGGER
......
......@@ -374,7 +374,6 @@ int main(int argc, char *argv[]) {
#endif
/* Common variables for restart and IC sections. */
int clean_smoothing_length_values = 0;
int flag_entropy_ICs = 0;
/* Initialize unit system and constants */
......@@ -396,7 +395,7 @@ int main(int argc, char *argv[]) {
parser_get_param_int(params, "InitialConditions:periodic");
const int replicate =
parser_get_opt_param_int(params, "InitialConditions:replicate", 1);
clean_smoothing_length_values = parser_get_opt_param_int(
const int clean_smoothing_length_values = parser_get_opt_param_int(
params, "InitialConditions:cleanup_smoothing_lengths", 0);
const int cleanup_h = parser_get_opt_param_int(
params, "InitialConditions:cleanup_h_factors", 0);
......@@ -590,8 +589,8 @@ int main(int argc, char *argv[]) {
e.tic_step = getticks();
#endif
/* Initialise the particles */
engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values, 0);
/* Initialise the tree and communication tasks */
engine_rebuild(&e, /*repartitionned=*/0, clean_smoothing_length_values);
#ifdef SWIFT_DEBUG_TASKS
e.toc_step = getticks();
......
......@@ -3441,11 +3441,11 @@ void engine_first_init_particles(struct engine *e) {
* @param flag_entropy_ICs Did the 'Internal Energy' of the particles actually
* contain entropy ?
* @param clean_h_values Are we cleaning up the values of h before building
* @param compute_init_accel Are we computing the initial acceleration of
*particles?
* @param start_acutal_run Are we computing the initial acceleration of
* particles (i.e. are we preparing for an actual run)?
*/
void engine_init_particles(struct engine *e, int flag_entropy_ICs,
int clean_h_values, int compute_init_accel) {
int clean_h_values) {
struct space *s = e->s;
......@@ -3516,9 +3516,6 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
}
}
/* Exit if only computing the FOF. */
if (!compute_init_accel) return;
#ifdef SWIFT_DEBUG_CHECKS
/* Check that we have the correct total mass in the top-level multipoles */
long long num_gpart_mpole = 0;
......
......@@ -514,7 +514,7 @@ void engine_dump_index(struct engine *e);
void engine_launch(struct engine *e);
void engine_prepare(struct engine *e);
void engine_init_particles(struct engine *e, int flag_entropy_ICs,
int clean_h_values, int compute_init_accel);
int clean_h_values);
void engine_step(struct engine *e);
void engine_split(struct engine *e, struct partition *initial_partition);
void engine_exchange_strays(struct engine *e, const size_t offset_parts,
......
......@@ -196,14 +196,20 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles,
inter-particle sepration? */
if (props->l_x_absolute != -1.) {
props->l_x2 = props->l_x_absolute * props->l_x_absolute;
message("Linking length is set to %e [internal units].",
props->l_x_absolute);
if (s->e->nodeID == 0) {
message("Linking length is set to %e [internal units].",
props->l_x_absolute);
}
} else {
props->l_x2 = l_x * l_x;
message(
"Linking length is set to %e [internal units] (%f of mean "
"inter-DM-particle separation).",
l_x, props->l_x_ratio);
if (s->e->nodeID == 0) {
message(
"Linking length is set to %e [internal units] (%f of mean "
"inter-DM-particle separation).",
l_x, props->l_x_ratio);
}
}
#ifdef WITH_MPI
......
......@@ -4017,8 +4017,8 @@ void space_first_init_parts_mapper(void *restrict map_data, int count,
const struct gravity_props *grav_props = s->e->gravity_properties;
const int with_gravity = e->policy & engine_policy_self_gravity;
// const struct chemistry_global_data *chemistry = e->chemistry;
// const struct star_formation *star_formation = e->star_formation;
const struct chemistry_global_data *chemistry = e->chemistry;
const struct star_formation *star_formation = e->star_formation;
const struct cooling_function_data *cool_func = e->cooling_func;
/* Check that the smoothing lengths are non-zero */
......@@ -4067,15 +4067,14 @@ void space_first_init_parts_mapper(void *restrict map_data, int count,
#endif
/* Also initialise the chemistry */
// chemistry_first_init_part(phys_const, us, cosmo, chemistry, &p[k],
// &xp[k]);
chemistry_first_init_part(phys_const, us, cosmo, chemistry, &p[k], &xp[k]);
/* Also initialise the star formation */
// star_formation_first_init_part(phys_const, us, cosmo, star_formation,
// &p[k], &xp[k]);
star_formation_first_init_part(phys_const, us, cosmo, star_formation, &p[k],
&xp[k]);
/* And the cooling */
// cooling_first_init_part(phys_const, us, cosmo, cool_func, &p[k], &xp[k]);
cooling_first_init_part(phys_const, us, cosmo, cool_func, &p[k], &xp[k]);
/* And the tracers */
tracers_first_init_xpart(&p[k], &xp[k], us, phys_const, cosmo, hydro_props,
......@@ -4176,7 +4175,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
const struct space *restrict s = (struct space *)extra_data;
const struct engine *e = s->e;
// const struct chemistry_global_data *chemistry = e->chemistry;
const struct chemistry_global_data *chemistry = e->chemistry;
#ifdef SWIFT_DEBUG_CHECKS
const ptrdiff_t delta = sp - s->sparts;
......@@ -4187,7 +4186,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
const int with_feedback = (e->policy & engine_policy_feedback);
const struct cosmology *cosmo = e->cosmology;
// const struct stars_props *stars_properties = e->stars_properties;
const struct stars_props *stars_properties = e->stars_properties;
const float a_factor_vel = cosmo->a;
/* Convert velocities to internal units */
......@@ -4223,10 +4222,10 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
/* Initialise the rest */
for (int k = 0; k < count; k++) {
// stars_first_init_spart(&sp[k], stars_properties);
stars_first_init_spart(&sp[k], stars_properties);
/* Also initialise the chemistry */
// chemistry_first_init_spart(chemistry, &sp[k]);
/* Also initialise the chemistry */
chemistry_first_init_spart(chemistry, &sp[k]);
#ifdef SWIFT_DEBUG_CHECKS
if (sp[k].gpart && sp[k].gpart->id_or_neg_offset != -(k + delta))
......
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