diff --git a/examples/main.c b/examples/main.c index 25eaf92a39f5aa357879d014d4a9d1db320a4d18..bf7b43f0477b79c5ce0e5a225f00b61a6f90e47f 100644 --- a/examples/main.c +++ b/examples/main.c @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) { error("Call to MPI_Comm_set_errhandler failed with error %i.", res); if (myrank == 0) printf("[0000] [00000.0] main: MPI is up and running with %i node(s).\n\n", - nr_nodes); + nr_nodes); if (nr_nodes == 1) { message("WARNING: you are running with one MPI rank."); message("WARNING: you should use the non-MPI version of this program."); diff --git a/src/engine.c b/src/engine.c index 827778100fcdea0a89afb210677bf26fc9acd8b8..e82930d9d5f15e9361b082a20c2f93b14545a2c6 100644 --- a/src/engine.c +++ b/src/engine.c @@ -891,13 +891,14 @@ void engine_repartition_trigger(struct engine *e) { /* Do nothing if there have not been enough steps since the last * repartition, don't want to repeat this too often or immediately after * a repartition step. */ - if (e->step - e->last_repartition > 2) { + if (e->step - e->last_repartition >= 2) { /* Old style if trigger is >1 or this is the second step (want an early * repartition following the initial repartition). */ if (e->reparttype->trigger > 1 || e->step == 2) { if (e->reparttype->trigger > 1) { - if (e->step % (int)e->reparttype->trigger == 2) e->forcerepart = 1; + if ((e->step % (int)e->reparttype->trigger) == 0) + e->forcerepart = 1; } else { e->forcerepart = 1; } @@ -4064,7 +4065,7 @@ void engine_init(struct engine *e, struct space *s, e->parameter_file = params; #ifdef WITH_MPI e->cputime_last_step = 0; - e->last_repartition = -1; + e->last_repartition = 0; #endif engine_rank = nodeID; diff --git a/src/partition.c b/src/partition.c index e0d7b289aad151bbc943766c6a2c747157e590eb..f30e5d0ad3c9ce8750a39891b2527729d9ad3b5d 100644 --- a/src/partition.c +++ b/src/partition.c @@ -1070,6 +1070,10 @@ void partition_init(struct partition *partition, parser_get_opt_param_float(params, "DomainDecomposition:trigger", 0.05f); if (repartition->trigger <= 0) error("Invalid DomainDecomposition:trigger, must be greater than zero"); + if (repartition->trigger < 2 && repartition->trigger >= 1) + error( + "Invalid DomainDecomposition:trigger, must be 2 or greater or less" + " than 1"); /* Fraction of particles that should be updated before a repartition * based on CPU time is considered. */