Commit 7c052c00 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also check that the final time is larger than the initial time + correct a typo.

parent f4836978
...@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { ...@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) {
case 'd': case 'd':
if (sscanf(optarg, "%f", &dt_min) != 1) if (sscanf(optarg, "%f", &dt_min) != 1)
error("Error parsing minimal timestep."); error("Error parsing minimal timestep.");
if (myrank == 0) message("dt_min set to %e.", dt_max); if (myrank == 0) message("dt_min set to %e.", dt_min);
fflush(stdout); fflush(stdout);
break; break;
case 'e': case 'e':
...@@ -323,10 +323,6 @@ int main(int argc, char *argv[]) { ...@@ -323,10 +323,6 @@ int main(int argc, char *argv[]) {
aFactor(&us, UNIT_CONV_ENTROPY), hFactor(&us, UNIT_CONV_ENTROPY)); aFactor(&us, UNIT_CONV_ENTROPY), hFactor(&us, UNIT_CONV_ENTROPY));
} }
/* Check we have sensible time step bounds */
if (dt_min > dt_max)
error("Minimal time step size must be large than maximal time step size ");
/* Check whether an IC file has been provided */ /* Check whether an IC file has been provided */
if (strcmp(ICfileName, "") == 0) if (strcmp(ICfileName, "") == 0)
error("An IC file name must be provided via the option -f"); error("An IC file name must be provided via the option -f");
......
...@@ -1936,6 +1936,18 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, ...@@ -1936,6 +1936,18 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
/* Print information about the hydro scheme */ /* 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);
/* Check we have sensible time bounds */
if (timeBegin >= timeEnd)
error(
"Final simulation time (t_end = %e) must be larger than the start time "
"(t_beg = %e)",
timeEnd, timeBegin);
/* Check we have sensible time step bounds */
if (e->dt_min > e->dt_max)
error(
"Minimal time step size must be smaller than maximal time step size ");
/* Deal with timestep */ /* Deal with timestep */
e->timeBase = (timeEnd - timeBegin) / max_nr_timesteps; e->timeBase = (timeEnd - timeBegin) / max_nr_timesteps;
e->ti_current = 0; e->ti_current = 0;
......
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