Skip to content

Commit 477a5f7

Browse files
authored
Allow repeat:true from a user defined restart (#580)
A minor refinement to the implementation of user-defined restarts, so that if `repeat:true` is set, it will start all the runs from the user-defined restart. Previously it was assumed to always start from an initial condition, which is not available/supported for all models (e.g. access-esm1.5 and 1.6) .
1 parent ed5f3c2 commit 477a5f7

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

docs/source/config.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ Experiment Tracking
514514
Miscellaneous
515515
=============
516516

517+
.. _restart:
517518
``restart``
518519
Specify the full path to a restart directory from which to start the run.
519520
This is known as a "warm start". This option has no effect if there is an
@@ -576,8 +577,10 @@ Miscellaneous
576577
command-line flag.
577578

578579
``repeat``
579-
Ignore any restart files and repeat the initial run upon resubmission. This
580-
is generally only used for testing purposes, such as bit reproducibility.
580+
Remove any archived restart files and repeat the initial run upon resubmission.
581+
The repeated runs start from the same :ref:`user-defined restart <restart>` or
582+
initial condition. This is generally only used for testing purposes, such as bit
583+
reproducibility.
581584

582585
.. _configuring-modules:
583586
``modules``

payu/models/access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def setup(self):
112112
caltype = cpl_group['caltype']
113113

114114
# Get timing information for the new run.
115-
if model.prior_restart_path and not self.expt.repeat_run:
115+
if model.prior_restart_path:
116116
# Read the start date from the restart date namelist.
117117
start_date_fpath = os.path.join(
118118
model.prior_restart_path,
@@ -202,7 +202,7 @@ def setup(self):
202202
f90nml.write(cpl_nml, nml_work_path + '~')
203203
shutil.move(nml_work_path + '~', nml_work_path)
204204

205-
if model.prior_restart_path and not self.expt.repeat_run:
205+
if model.prior_restart_path:
206206
# Set up and check the cice restart files.
207207
model.overwrite_restart_ptr(run_start_date,
208208
previous_runtime,

payu/models/access_esm1p6.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def setup(self):
121121
caltype = cpl_group['caltype']
122122

123123
# Get timing information for the new run.
124-
if model.prior_restart_path and not self.expt.repeat_run:
124+
if model.prior_restart_path:
125125
# Read the start date from the restart date namelist.
126126
start_date_fpath = os.path.join(
127127
model.prior_restart_path,
@@ -211,7 +211,7 @@ def setup(self):
211211
f90nml.write(cpl_nml, nml_work_path + '~')
212212
shutil.move(nml_work_path + '~', nml_work_path)
213213

214-
if model.prior_restart_path and not self.expt.repeat_run:
214+
if model.prior_restart_path:
215215
# Set up and check the cice restart files.
216216
model.overwrite_restart_ptr(run_start_date,
217217
previous_runtime,

payu/models/cesm_cmeps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def setup(self):
148148
# Copy configuration files from control path to work path
149149
self.setup_configuration_files()
150150

151-
if self.prior_restart_path and not self.expt.repeat_run:
151+
if self.prior_restart_path:
152152
start_type = 'continue'
153153

154154
# Overwrite restart pointer symlinks with copies

payu/models/mitgcm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def setup(self):
7575
# Generic model setup
7676
super(Mitgcm, self).setup()
7777

78-
if self.prior_restart_path and not self.expt.repeat_run:
78+
if self.prior_restart_path:
7979
# Determine total number of timesteps since initialisation
8080
core_restarts = [f for f in os.listdir(self.prior_restart_path)
8181
if f.startswith('pickup.')]
@@ -128,8 +128,7 @@ def setup(self):
128128
# Assume n_timesteps and dt set correctly
129129
pass
130130

131-
if t_start is None or (self.prior_restart_path
132-
and not self.expt.repeat_run):
131+
if t_start is None or self.prior_restart_path:
133132
# Look for a restart file from a previous run
134133
if os.path.exists(restart_calendar_path):
135134
with open(restart_calendar_path, 'r') as restart_file:

payu/models/mom6.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def init_config(self):
114114

115115
input_nml = f90nml.read(input_fpath)
116116

117-
if ((self.expt.counter == 0 or self.expt.repeat_run) and
118-
self.prior_restart_path is None):
117+
if (self.prior_restart_path is None):
119118
input_type = 'n'
120119
else:
121120
input_type = 'r'

payu/models/um.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def setup(self):
133133

134134

135135
# Stage the UM restart file.
136-
if self.prior_restart_path and not self.expt.repeat_run:
136+
if self.prior_restart_path :
137137
f_src = os.path.join(self.prior_restart_path, self.restart)
138138
f_dst = os.path.join(self.work_input_path, self.restart)
139139

@@ -170,8 +170,7 @@ def setup(self):
170170
self.restart_calendar_file)
171171

172172
# Modify namelists for a continuation run.
173-
if self.prior_restart_path and not self.expt.repeat_run \
174-
and os.path.exists(restart_calendar_path):
173+
if self.prior_restart_path and os.path.exists(restart_calendar_path):
175174

176175
run_start_date = self.read_calendar_file(restart_calendar_path)
177176

0 commit comments

Comments
 (0)