Skip to content
Snippets Groups Projects
Commit e4a7ead7 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Drift the particles to the current time before rebuilding when restarting a...

Drift the particles to the current time before rebuilding when restarting a run from a check-point file.
parent fcbd80c6
Branches
Tags
1 merge request!579Lean gravity option
...@@ -4722,6 +4722,10 @@ void engine_step(struct engine *e) { ...@@ -4722,6 +4722,10 @@ void engine_step(struct engine *e) {
fflush(e->file_timesteps); fflush(e->file_timesteps);
} }
/* We need some cells to exist but not the whole task stuff. */
if(e->restarting)
space_rebuild(e->s, e->verbose);
/* Move forward in time */ /* Move forward in time */
e->ti_old = e->ti_current; e->ti_old = e->ti_current;
e->ti_current = e->ti_end_min; e->ti_current = e->ti_end_min;
...@@ -4730,6 +4734,11 @@ void engine_step(struct engine *e) { ...@@ -4730,6 +4734,11 @@ void engine_step(struct engine *e) {
e->step += 1; e->step += 1;
e->step_props = engine_step_prop_none; e->step_props = engine_step_prop_none;
/* When restarting, move everyone to the current time. */
if(e->restarting)
engine_drift_all(e);
/* Get the physical value of the time and time-step size */
if (e->policy & engine_policy_cosmology) { if (e->policy & engine_policy_cosmology) {
e->time_old = e->time; e->time_old = e->time;
cosmology_update(e->cosmology, e->physical_constants, e->ti_current); cosmology_update(e->cosmology, e->physical_constants, e->ti_current);
...@@ -4982,9 +4991,6 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) { ...@@ -4982,9 +4991,6 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) {
if (e->restart_dump) { if (e->restart_dump) {
ticks tic = getticks(); ticks tic = getticks();
if(e->nodeID == 0)
message("Writing restart files");
/* Dump when the time has arrived, or we are told to. */ /* Dump when the time has arrived, or we are told to. */
int dump = ((tic > e->restart_next) || force); int dump = ((tic > e->restart_next) || force);
...@@ -4994,6 +5000,10 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) { ...@@ -4994,6 +5000,10 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) {
MPI_Bcast(&dump, 1, MPI_INT, 0, MPI_COMM_WORLD); MPI_Bcast(&dump, 1, MPI_INT, 0, MPI_COMM_WORLD);
#endif #endif
if (dump) { if (dump) {
if(e->nodeID == 0)
message("Writing restart files");
/* Clean out the previous saved files, if found. Do this now as we are /* Clean out the previous saved files, if found. Do this now as we are
* MPI synchronized. */ * MPI synchronized. */
restart_remove_previous(e->restart_file); restart_remove_previous(e->restart_file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment