Skip to content

Commit

Permalink
Merge pull request #655 from xylar/increase-haney-number
Browse files Browse the repository at this point in the history
Increase the max Haney number to 20
  • Loading branch information
xylar authored Jul 26, 2023
2 parents 47051e0 + e7ae472 commit 93f7546
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions compass/ocean/suites/wcwisc14.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ocean/global_ocean/WCwISC14/mesh
ocean/global_ocean/WCwISC14/WOA23/init
ocean/global_ocean/WCwISC14/WOA23/performance_test
ocean/global_ocean/WCwISC14/WOA23/data_ice_shelf_melt
ocean/global_ocean/WCwISC14/WOA23/dynamic_adjustment
ocean/global_ocean/WCwISC14/WOA23/files_for_e3sm
4 changes: 4 additions & 0 deletions compass/ocean/tests/global_ocean/global_ocean.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ dt_per_km = 30
btr_dt_per_km = 1.5

## config options related to the initial_state step

# Maximum allowed Haney number for configurations with ice-shelf cavities
rx1_max = 20

# number of cores to use
init_ntasks = 36
# minimum of cores, below which the step fails
Expand Down
10 changes: 10 additions & 0 deletions compass/ocean/tests/global_ocean/init/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def setup(self):
Get resources at setup from config options
"""
self._get_resources()
rx1_max = self.config.getfloat('global_ocean', 'rx1_max')
self.add_namelist_options({'config_rx1_max': f'{rx1_max}'},
mode='init')

def constrain_resources(self, available_resources):
"""
Expand All @@ -147,6 +150,13 @@ def constrain_resources(self, available_resources):
self._get_resources()
super().constrain_resources(available_resources)

def runtime_setup(self):
"""
Update the Haney number at runtime based on the config option.
"""
rx1_max = self.config.getfloat('global_ocean', 'rx1_max')
self.update_namelist_at_runtime({'config_rx1_max': f'{rx1_max}'})

def run(self):
"""
Run this step of the testcase
Expand Down
1 change: 0 additions & 1 deletion compass/ocean/tests/global_ocean/init/namelist.wisc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
config_land_ice_flux_mode = 'standalone'
config_init_vertical_grid_type = 'haney-number'
config_rx1_max = 5.0
config_global_ocean_depress_by_land_ice = .true.
config_global_ocean_land_ice_topo_file = 'topography.nc'
config_global_ocean_land_ice_topo_nlat_dimname = 'lat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def __init__(self, test_group, mesh, init, time_integrator):
The time integrator to use for the forward run
"""
if time_integrator != 'split_explicit':
raise ValueError('{} dynamic adjustment not defined for {}'.format(
mesh.mesh_name, time_integrator))
raise ValueError(f'{mesh.mesh_name} dynamic adjustment not '
f'defined for {time_integrator}')

restart_times = ['0001-01-11_00:00:00', '0001-01-31_00:00:00',
'0001-02-10_00:00:00']
restart_filenames = [
'restarts/rst.{}.nc'.format(restart_time.replace(':', '.'))
f'restarts/rst.{restart_time.replace(":", ".")}.nc'
for restart_time in restart_times]

super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_output_file(filename='../{}'.format(restart_filenames[0]))
step.add_output_file(filename=f'../{restart_filenames[0]}')
self.add_step(step)

# second step
Expand All @@ -90,7 +90,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
'config_dt': "'00:15:00'",
'config_btr_dt': "'00:00:10'",
'config_do_restart': '.true.',
'config_start_time': "'{}'".format(restart_times[0])}
'config_start_time': f"'{restart_times[0]}'"}
namelist_options.update(shared_options)
step.add_namelist_options(namelist_options)

Expand All @@ -100,8 +100,8 @@ def __init__(self, test_group, mesh, init, time_integrator):
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_input_file(filename='../{}'.format(restart_filenames[0]))
step.add_output_file(filename='../{}'.format(restart_filenames[1]))
step.add_input_file(filename=f'../{restart_filenames[0]}')
step.add_output_file(filename=f'../{restart_filenames[1]}')
self.add_step(step)

# final step
Expand All @@ -115,7 +115,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
'config_dt': "'00:30:00'",
'config_btr_dt': "'00:00:10'",
'config_do_restart': '.true.',
'config_start_time': "'{}'".format(restart_times[1])}
'config_start_time': f"'{restart_times[1]}'"}
namelist_options.update(shared_options)
step.add_namelist_options(namelist_options)

Expand All @@ -125,8 +125,8 @@ def __init__(self, test_group, mesh, init, time_integrator):
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_input_file(filename='../{}'.format(restart_filenames[1]))
step.add_output_file(filename='../{}'.format(restart_filenames[2]))
step.add_input_file(filename=f'../{restart_filenames[1]}')
step.add_output_file(filename=f'../{restart_filenames[2]}')
step.add_output_file(filename='output.nc')
self.add_step(step)

Expand Down
3 changes: 3 additions & 0 deletions compass/ocean/tests/global_ocean/mesh/ec30to60/ec30to60.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ transition_levels = 28
# options for global ocean testcases
[global_ocean]

# Maximum allowed Haney number for configurations with ice-shelf cavities
rx1_max = 15

# the approximate number of cells in the mesh
approx_cell_count = 240000

Expand Down

0 comments on commit 93f7546

Please sign in to comment.