Closed crpiceda closed 1 year ago
Thanks Constanza, this is a great idea. I'm going to spend some time of finalising a new version (currently labelled 2.4.0
, but could be 3.0.0
if we introduce any compatibility-breaking changes). Could you change the PR to merge into #70 instead? #71 has already been merged into #70, so I don't think it's a good idea to stack merges.
Superseded by #83
The idea of this implementation is to simplify the workflow to restart a simulation without having to starting at 0s. Before, if we wanted to the restart a model, we needed different folders for the different runs; otherwise, the outputs would be overwritten with each new run. This would mean having multiple output files spread over multiple folders, which might be cumbersome to post-process. The spirit of this new implementation is to have the flexibility to choose between starting a simulation at 0s (aka “scratch model”) and at any time-step from a previous simula-tion (aka “restart model”). When restarting a model, all the outputs are appended at the end of the files of the previous simulation instead of rewritten, which allows the user to have a unique folder with all the model runs.
Major changes introduced:
log
) that stores time-steps from all simulations. Convenient way to check if the restart function is working properly. All simulations time-steps are stored in one file, instead of having only different log files for each submission script.output_lastox
). This is going to be used as input (sigma
,V_0
andTheta_0
) for the initial conditions of the subsequent simulation.p.read_output
in the wrapper is also able to read the output of the last snapshot. Besides, the function can read output files from a folder other than the one of the script. These functionalities are convenient when setting the input file of the restart model and for postprocessing, respectively.FEAT_RESTART
: This flag indicates if the simulation is a scratch (FEAT_RESTART
=0) or a restart model (FEAT_RESTART
=1). The default value isFEAT_RESTART = 0
.RESTART_TIME
: the time of restart of the model. It is important to recall that this time-step of restart is the last snapshot of the previous simulation, which might or not be the actual last-time step, depending on the value ofset_dict[“NTOUT”]
(save output every N timesteps). The default value isRESTART_TIME= 0
. To quickly get this value, I introduced a function in the python wrapper calledrestart_time()
RESTART_SLIP
: the slip at the time of restarting of the model. To quickly get this value, I introduced a function in the python wrapper calledrestart_slip()
. The default value isRESTART_SLIP= 0
qdyn.in
also has a new line indicating if the model is restarting or not, and the time and slip values at which the model should restart. This information is latter used in theoutput
module in the source code.single_asperity_3D_restart.ipynb
) with an example on how to restart a model (using as initial model the single asperity 3D case). This notebook is found in the folder with the examples.