Skip to content

Commit 9879cd8

Browse files
committed
Write daily restarts for ESM1px for restart repro
1 parent 8a065eb commit 9879cd8

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/model_config_tests/models/accessesm1p5.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
from typing import Any
55

6+
import f90nml
67
import yaml
78

89
from model_config_tests.models.model import SCHEMA_VERSION_1_0_0, Model
@@ -22,6 +23,9 @@ def __init__(self, experiment):
2223
self.output_filename = "access.out"
2324
self.output_file = self.output_0 / self.output_filename
2425

26+
self.ice_config = experiment.control_path / "ice" / "cice_in.nml"
27+
self.atmosphere_config = experiment.control_path / "atmosphere" / "namelists"
28+
2529
def set_model_runtime(
2630
self, years: int = 0, months: int = 0, seconds: int = DEFAULT_RUNTIME_SECONDS
2731
):
@@ -49,6 +53,19 @@ def set_model_runtime(
4953
with open(self.experiment.config_path, "w") as f:
5054
yaml.dump(doc, f)
5155

56+
# Write atmosphere restarts at daily frequency
57+
with open(self.atmosphere_config) as f:
58+
atmosphere_nml = f90nml.read(f)
59+
# 48 timesteps per day
60+
atmosphere_nml["NLSTCGEN"]["DUMPFREQim"] = [48, 0, 0, 0]
61+
atmosphere_nml.write(self.atmosphere_config, force=True)
62+
63+
# Write ice restarts at daily frequency
64+
with open(self.ice_config) as f:
65+
ice_nml = f90nml.read(f)
66+
ice_nml["setup_nml"]["dumpfreq"] = "d"
67+
ice_nml.write(self.ice_config, force=True)
68+
5269
def output_exists(self) -> bool:
5370
"""Check for existing output file"""
5471
return self.output_file.exists()

0 commit comments

Comments
 (0)