Skip to content

allow repeat_run from a restart defined in config.yaml #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions payu/models/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def setup(self):
caltype = cpl_group['caltype']

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

if model.prior_restart_path and not self.expt.repeat_run:
if model.prior_restart_path:
# Set up and check the cice restart files.
model.overwrite_restart_ptr(run_start_date,
previous_runtime,
Expand Down
4 changes: 2 additions & 2 deletions payu/models/access_esm1p6.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def setup(self):
caltype = cpl_group['caltype']

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

if model.prior_restart_path and not self.expt.repeat_run:
if model.prior_restart_path:
# Set up and check the cice restart files.
model.overwrite_restart_ptr(run_start_date,
previous_runtime,
Expand Down
2 changes: 1 addition & 1 deletion payu/models/cesm_cmeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def setup(self):
# Copy configuration files from control path to work path
self.setup_configuration_files()

if self.prior_restart_path and not self.expt.repeat_run:
if self.prior_restart_path:
start_type = 'continue'

# Overwrite restart pointer symlinks with copies
Expand Down
5 changes: 2 additions & 3 deletions payu/models/mitgcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def setup(self):
# Generic model setup
super(Mitgcm, self).setup()

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

if t_start is None or (self.prior_restart_path
and not self.expt.repeat_run):
if t_start is None or self.prior_restart_path:
# Look for a restart file from a previous run
if os.path.exists(restart_calendar_path):
with open(restart_calendar_path, 'r') as restart_file:
Expand Down
2 changes: 1 addition & 1 deletion payu/models/mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def init_config(self):

input_nml = f90nml.read(input_fpath)

if ((self.expt.counter == 0 or self.expt.repeat_run) and
if ((self.expt.counter == 0) and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the original line with or self.expt.repeat_run worked for situations where there isn't a restart: in config.yaml, but we still want to repeatedly start from initial conditions/a cold start? With repeat run, the experiment counter still increments for each subsequent run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it should just be :

if ( self.prior_restart_path is None ):
            input_type = 'n'

?

Is prior_restart_path used for both restart paths specified in config.yaml and those generated during payu runs ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it probably could just be if self.prior_restart_path is None.

Is prior_restart_path used for both restart paths specified in config.yaml and those generated during payu runs ?

Yup, that's correct. The base prior_restart_path is set as part of the Experiment class initialisation to either None, restart directory in config.yaml or an restart in the archive, and then passed to the various model drivers.

self.prior_restart_path is None):
input_type = 'n'
else:
Expand Down
5 changes: 2 additions & 3 deletions payu/models/um.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def setup(self):


# Stage the UM restart file.
if self.prior_restart_path and not self.expt.repeat_run:
if self.prior_restart_path :
f_src = os.path.join(self.prior_restart_path, self.restart)
f_dst = os.path.join(self.work_input_path, self.restart)

Expand Down Expand Up @@ -170,8 +170,7 @@ def setup(self):
self.restart_calendar_file)

# Modify namelists for a continuation run.
if self.prior_restart_path and not self.expt.repeat_run \
and os.path.exists(restart_calendar_path):
if self.prior_restart_path and os.path.exists(restart_calendar_path):

run_start_date = self.read_calendar_file(restart_calendar_path)

Expand Down
Loading