diff --git a/examples/MultiTypes/multiTypes.yml b/examples/MultiTypes/multiTypes.yml index 28d02fefa8168e35af696975a7c73a1bf767155e..f5a5dbc80844928cf3a7a064d80d1902d60ed88d 100644 --- a/examples/MultiTypes/multiTypes.yml +++ b/examples/MultiTypes/multiTypes.yml @@ -39,4 +39,5 @@ PointMass: position_x: 50. # location of external point mass in internal units position_y: 50. position_z: 50. - mass: 1e10 # mass of external point mass in internal units + mass: 1e11 # mass of external point mass in internal units + timestep_mult: 1e-2 diff --git a/examples/main.c b/examples/main.c index c2d3e3b8b926b72b0e24519da87e4139657b0bfb..615377b33f5614615afce0e32dfb97098c52064f 100644 --- a/examples/main.c +++ b/examples/main.c @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) { engine_init_particles(&e, flag_entropy_ICs); /* Write the state of the system before starting time integration. */ - engine_dump_snapshot(&e); + //engine_dump_snapshot(&e); /* Legend */ if (myrank == 0) @@ -605,7 +605,7 @@ int main(int argc, char *argv[]) { #endif /* Write final output. */ - engine_dump_snapshot(&e); + //engine_dump_snapshot(&e); #ifdef WITH_MPI if ((res = MPI_Finalize()) != MPI_SUCCESS) diff --git a/src/engine.c b/src/engine.c index 8c0501ae57d89fc244fe4433763550e1ad4e9c0a..89e33041d029aee31dad856ee92710843f2014f3 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2264,7 +2264,7 @@ void engine_prepare(struct engine *e) { /* Run through the tasks and mark as skip or not. */ int rebuild = (e->forcerebuild || engine_marktasks(e)); -/* Collect the values of rebuild from all nodes. */ + /* Collect the values of rebuild from all nodes. */ #ifdef WITH_MPI int buff = 0; if (MPI_Allreduce(&rebuild, &buff, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD) != @@ -2273,20 +2273,8 @@ void engine_prepare(struct engine *e) { rebuild = buff; #endif - /* Did this not go through? */ - if (rebuild) { - - /* First drift all particles to the current time */ - e->drift_all = 1; - threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top, - e->s->nr_cells, sizeof(struct cell), 1, e); - - /* Restore the default drifting policy */ - e->drift_all = (e->policy & engine_policy_drift_all); - - /* And now rebuild */ - engine_rebuild(e); - } + /* And rebuild if necessary. */ + if (rebuild) engine_rebuild(e); /* Re-rank the tasks every now and then. */ if (e->tasks_age % engine_tasksreweight == 1) { @@ -2705,10 +2693,15 @@ void engine_step(struct engine *e) { e->timeLastStatistics += e->deltaTimeStatistics; } - /* Drift only the necessary particles */ + /* Drift only the necessary particles, that all means all particles + * if we are about to repartition. */ + e->drift_all = (e->forcerepart != REPART_NONE) || e->drift_all; threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top, e->s->nr_cells, sizeof(struct cell), 1, e); + /* Restore the default drifting policy */ + e->drift_all = (e->policy & engine_policy_drift_all); + /* Re-distribute the particles amongst the nodes? */ if (e->forcerepart != REPART_NONE) engine_repartition(e);