diff --git a/src/engine.c b/src/engine.c index 272d5c0c9ff07b98befed3c68810d4c909e78c57..c2f47df0a6ee0685011a126b157f5c93af1cbcc2 100644 --- a/src/engine.c +++ b/src/engine.c @@ -285,7 +285,6 @@ void engine_redistribute(struct engine *e) { #endif } - /** * @brief Repartition the cells amongst the nodes. * @@ -1393,7 +1392,7 @@ void engine_init_particles(struct engine *e) { struct space *s = e->s; - if(e->nodeID == 0) message("Initialising particles"); + if (e->nodeID == 0) message("Initialising particles"); /* Make sure all particles are ready to go */ /* i.e. clean-up any stupid state in the ICs */ @@ -1831,7 +1830,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, int home = numa_node_of_cpu(sched_getcpu()), half = nr_cores / 2; bool done = false, swap_hyperthreads = hyperthreads_present(); if (swap_hyperthreads && nodeID == 0) - message("prefer physical cores to hyperthreads"); + message("prefer physical cores to hyperthreads"); while (!done) { done = true; @@ -1928,15 +1927,13 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, engine_print_policy(e); /* Print information about the hydro scheme */ - if (e->nodeID == 0) - message("Hydrodynamic scheme: %s", SPH_IMPLEMENTATION); + if (e->nodeID == 0) message("Hydrodynamic scheme: %s", SPH_IMPLEMENTATION); /* Deal with timestep */ e->timeBase = (timeEnd - timeBegin) / max_nr_timesteps; e->ti_current = 0; - if (e->nodeID == 0) - message("Absolute minimal timestep size: %e", e->timeBase); + /* Fixed time-step case */ if ((e->policy & engine_policy_fixdt) == engine_policy_fixdt) { e->dt_min = e->dt_max; @@ -1947,11 +1944,32 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, e->dt_min = e->dt_max = dti_timeline * e->timeBase; if (e->nodeID == 0) message("Timestep set to %e", e->dt_max); + } else { + + if (e->nodeID == 0) { + message("Absolute minimal timestep size: %e", e->timeBase); + + float dt_min = timeEnd - timeBegin; + while (dt_min > e->dt_min) dt_min /= 2.f; + + message("Minimal timestep size (on time-line): %e", dt_min); + + float dt_max = timeEnd - timeBegin; + while (dt_max > e->dt_max) dt_max /= 2.f; + + message("Minimal timestep size (on time-line): %e", dt_max); + } } if (e->dt_min < e->timeBase && e->nodeID == 0) - error("Minimal timestep smaller than the absolue possible minimum dt=%e", - e->timeBase); + error( + "Minimal time-step size smaller than the absolue possible minimum " + "dt=%e", + e->timeBase); + + if (e->dt_max > (e->timeEnd - e->timeBegin) && e->nodeID == 0) + error("Maximal time-step size larger than the simulation run time t=%e", + e->timeEnd - e->timeBegin); /* Construct types for MPI communications */ #ifdef WITH_MPI diff --git a/src/runner.c b/src/runner.c index 1cd52e1dd89f08172c3a3b679f15a096a0007b1b..c64dc6c3e056723bb3865d78b7ce85f4d24e2263 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1,3 +1,4 @@ + /******************************************************************************* * This file is part of SWIFT. * Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)