Skip to content
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

Enable seperate ice_history.nml & cice_in.nml settings #483

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Changes from 4 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
15 changes: 13 additions & 2 deletions payu/models/cice.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, expt, name, config):

self.ice_nml_fname = 'cice_in.nml'

self.history_nml_fname = 'ice_history.nml' # only used by payu
aidanheerdegen marked this conversation as resolved.
Show resolved Hide resolved

self.set_timestep = self.set_local_timestep

self.copy_inputs = False
Expand Down Expand Up @@ -156,6 +158,14 @@ def get_access_ptr_restart_dir(self):
def setup(self):
super(Cice, self).setup()

# If there is a seperate ice_history.nml,
# update the cice namelist with its contents
history_nml_fpath = os.path.join(self.control_path,
self.history_nml_fname)
if os.path.isfile(history_nml_fpath):
history_nml = f90nml.read(history_nml_fpath)
self.ice_in.patch(history_nml)

setup_nml = self.ice_in['setup_nml']
init_date = datetime.date(year=setup_nml['year_init'], month=1, day=1)

Expand Down Expand Up @@ -244,8 +254,9 @@ def setup(self):
assert(total_runtime % setup_nml['dt'] == 0)
setup_nml['istep0'] = int(total_runtime / setup_nml['dt'])

# Force creation of a dump (restart) file at end of run
setup_nml['dump_last'] = True
if self.model_type != 'cice': # model_type==cice5
# Force creation of a dump (restart) file at end of run
setup_nml['dump_last'] = True
aidanheerdegen marked this conversation as resolved.
Show resolved Hide resolved

nml_path = os.path.join(self.work_path, self.ice_nml_fname)
self.ice_in.write(nml_path, force=True)
Expand Down
Loading