Restart a simulation when having submitted it with 'Chunk_lance'.
If the simulation was stopped (job was killed) or crashed it can often get re-submitted by executing again the command:
Chunk_lance
Restart a simulation from a previous restart file
Sometimes it happens that part of the restart files gets overwritten before a month is finished or that the restart files are corrupted or one would simply like to rerun of of a simulation. In that case one cannot just relaunch the month with Chunk_lance but has to get the original (uncorrupted) restart files back (from the month previous to the one one wants to rerun) and restart the simulation from there.
When the model job stops for whatever reason, there is an automatic check in Chunk_lance if the restart files are still the original ones or not. If they got already modified the following message will appear in the "chunk_job listing" (!!!) not in the model listing:
At least one of the restart files got already rewritten
Therefore the model could not get restarted automatically
You have to restart your simulation starting from the previous restart files
----- ABORT -----
If you see this message one cannot simply restart the simulation with Chunk_lance but as said, one need to restart it from the previous restart file - see below.
To restart a simulation one needs to :
1) Make sure the restart files of the previous month is under ~/MODEL_EXEC_RUN/$TRUE_HOST
2) Make sure the "Scripts-job", ${exp}_S, is in the config directory
3) Edit the file 'chunk_job.log'
As you hopefully know, each simulated month consists of two scripts:
- a very short Script-job : ${GEM_exp}_S
- followed by one of more Model-jobs : ${GEM_exp}_M
To know where the simulation is, Chunk_lance is using a log file called 'chunk_job.log'. The chunk_job itself will check this file to determine which job to execute next. Therefore, this log file should usually not be touched. However, to rerun part of a simulation one can alter the log file by hand. Just make sure there is never a blank line at the end of the log file 'chunk_job.log' since the chunk_job only checks the very last line of the log file!
'chunk_job.log' contains entries like the following:
1 simulation starting at Thu Aug 19 15:09:15 EDT 2021
1 scripts LUCAS_NAM-44_orgVeg_ISBA_197901_S finished at Thu Aug 19 15:09:36 EDT 2021
1 model LUCAS_NAM-44_orgVeg_ISBA_197901_M starting at Thu Aug 19 15:09:36 EDT 2021
1 model LUCAS_NAM-44_orgVeg_ISBA_197901_M finished at Thu Aug 19 16:04:22 EDT 2021
2 scripts LUCAS_NAM-44_orgVeg_ISBA_197902_S starting at Thu Aug 19 16:04:22 EDT 2021
2 scripts LUCAS_NAM-44_orgVeg_ISBA_197902_S finished at Thu Aug 19 16:04:26 EDT 2021
2 model LUCAS_NAM-44_orgVeg_ISBA_197902_M starting at Thu Aug 19 16:04:26 EDT 2021
2 model LUCAS_NAM-44_orgVeg_ISBA_197902_M finished at Thu Aug 19 16:52:18 EDT 2021
Each completed month has at least 4 entries:
..._S starting ...
..._S finished ...
..._M starting ...
..._M finished ...
To restart a month make sure the last line either contains:
... current_month_S starting ...
or
... previous_month_M finished ...
Restart from previous restart file
Continue simulation from a restart file:
- Copy restart file of previous month (if there is more than 1 part, copy all parts!) from the archive (${CLIMAT_archdir}/Restarts) back into the execution directory "~/MODEL_EXEC_RUN/$TRUE_HOST"
- Gunzip and unarchive (cmcarc -x -f ...) the restart file(s) in ~/MODEL_EXEC_RUN/$TRUE_HOST
The cmcarc-command will create a new directory, but the *.ca file will remain in the directory. You can remove it again. - Go into the config file directory
- Edit the log file 'chunk_job.log':
(First I suggest to make a backup copy of the log file.)
The remove all lines concerning the month you want to rerun and all following lines. - If you are running the entry in parallel, you will also have to remove all the ${exp}_entry_finished flags in your config file directory for all the months you want to rerun. Otherwise the entries for these months will not get rerun!
- Execute "Chunk_lance" again (without the '-start'!!!)