Skip to content

Commit

Permalink
Merge pull request #745 from xylar/update-redi-and-ab2
Browse files Browse the repository at this point in the history
Update namelist options for recent changes to Redi and Adams-Bashforth 2
  • Loading branch information
xylar authored Jan 9, 2024
2 parents 12114b1 + 46d5123 commit a2a9579
Show file tree
Hide file tree
Showing 33 changed files with 69 additions and 61 deletions.
2 changes: 1 addition & 1 deletion compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _add_tests(self, mesh_names, high_res_topography=True,
""" Add test cases for the given mesh(es) """

default_ic = 'WOA23'
default_time_int = 'split_explicit'
default_time_int = 'split_explicit_ab2'

for mesh_name in mesh_names:
mesh_test = Mesh(test_group=self, mesh_name=mesh_name,
Expand Down
2 changes: 1 addition & 1 deletion compass/ocean/tests/global_ocean/analysis_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from compass.ocean.tests.global_ocean.forward import (
ForwardStep,
ForwardTestCase,
)
from compass.validate import compare_variables
from compass.ocean.tests.global_ocean.forward import ForwardTestCase, \
ForwardStep


class DailyOutputTest(ForwardTestCase):
Expand All @@ -25,7 +27,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
8 changes: 5 additions & 3 deletions compass/ocean/tests/global_ocean/decomp_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from compass.ocean.tests.global_ocean.forward import (
ForwardStep,
ForwardTestCase,
)
from compass.validate import compare_variables
from compass.ocean.tests.global_ocean.forward import ForwardTestCase, \
ForwardStep


class DecompTest(ForwardTestCase):
Expand All @@ -24,7 +26,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
time_integrator=time_integrator,
name='dynamic_adjustment')

if time_integrator == 'split_explicit':
if time_integrator == 'split_explicit_ab2':
yaml_filename = 'dynamic_adjustment.yaml'
else:
yaml_filename = f'dynamic_adjustment_{time_integrator}.yaml'
Expand Down Expand Up @@ -145,7 +145,7 @@ def _add_step(self, step_name, options, get_dt_from_min_res,
required = ['run_duration', 'output_interval', 'restart_interval']
if not get_dt_from_min_res:
required.append('dt')
if time_integrator == 'split_explicit':
if time_integrator == 'split_explicit_ab2':
required.append('btr_dt')
for option in required:
if option not in options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, test_case, mesh, init):
The test case that produces the initial condition for this run
"""
super().__init__(test_case=test_case, mesh=mesh, init=init,
time_integrator='split_explicit',
time_integrator='split_explicit_ab2',
name='write_coeffs_reconstruct')

package = 'compass.ocean.tests.global_ocean.files_for_e3sm.' \
Expand Down
14 changes: 7 additions & 7 deletions compass/ocean/tests/global_ocean/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ForwardStep(Step):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
dynamic_ntasks : bool
Expand All @@ -51,7 +51,7 @@ def __init__(self, test_case, mesh, time_integrator, init=None,
mesh : compass.ocean.tests.global_ocean.mesh.Mesh
The test case that produces the mesh for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
init : compass.ocean.tests.global_ocean.init.Init, optional
Expand Down Expand Up @@ -173,7 +173,7 @@ def setup(self):

if self.get_dt_from_min_res:
dt, btr_dt = self._get_dts()
if self.time_integrator == 'split_explicit':
if self.time_integrator == 'split_explicit_ab2':
self.add_namelist_options({'config_dt': dt,
'config_btr_dt': btr_dt})
else:
Expand Down Expand Up @@ -201,7 +201,7 @@ def runtime_setup(self):
"""
if self.get_dt_from_min_res:
dt, btr_dt = self._get_dts()
if self.time_integrator == 'split_explicit':
if self.time_integrator == 'split_explicit_ab2':
self.update_namelist_at_runtime({'config_dt': dt,
'config_btr_dt': btr_dt})
else:
Expand Down Expand Up @@ -252,7 +252,7 @@ class ForwardTestCase(TestCase):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""

Expand All @@ -271,7 +271,7 @@ def __init__(self, test_group, mesh, init, time_integrator, name):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
name : str
Expand All @@ -295,7 +295,7 @@ def get_forward_subdir(init_subdir, time_integrator, name):
Get the subdirectory for a test case that is based on a forward run with
a time integrator
"""
if time_integrator == 'split_explicit':
if time_integrator == 'split_explicit_ab2':
# this is the default so we won't make a subdir for the time
# integrator
subdir = os.path.join(init_subdir, name)
Expand Down
2 changes: 1 addition & 1 deletion compass/ocean/tests/global_ocean/init/ssh_adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, test_case):
The test case this step belongs to
"""
super().__init__(test_case=test_case, mesh=test_case.mesh,
time_integrator='split_explicit',
time_integrator='split_explicit_ab2',
name='ssh_adjustment')

self.add_namelist_options({'config_AM_globalStats_enable': '.false.'})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:01:00'
config_btr_dt = '00:00:03'
config_run_duration = '0000_01:00:00'
Expand All @@ -7,4 +7,3 @@ config_mom_del2 = 10.0
config_mom_del4 = 1.5e10
config_hmix_scaleWithMesh = .true.
config_use_GM = .true.
config_Redi_min_layers_diag_terms = 15
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:05:00'
config_btr_dt = '00:00:10'
config_run_duration = '0000_00:15:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:10:00'
config_btr_dt = '00:00:10'
config_run_duration = '0000_01:00:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:05:00'
config_btr_dt = '00:00:10'
config_run_duration = '0000_01:00:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_run_duration = '0000_06:00:00'
config_hmix_use_ref_cell_width = .true.
config_write_output_on_startup = .false.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '02:00:00'
config_btr_dt = '00:06:00'
config_run_duration = '0000_06:00:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:01:00'
config_btr_dt = '00:00:03'
config_run_duration = '0000_01:30:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:01:00'
config_btr_dt = '00:00:02'
config_run_duration = '0000_01:00:00'
Expand Down
25 changes: 13 additions & 12 deletions compass/ocean/tests/global_ocean/mesh/wc14/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

import matplotlib.pyplot as plt
import mpas_tools.mesh.creation.mesh_definition_tools as mdt
from mpas_tools.mesh.creation.signed_distance import \
signed_distance_from_geojson, mask_from_geojson
import numpy as np
from geometric_features import read_feature_collection
from mpas_tools.cime.constants import constants
from mpas_tools.mesh.creation.signed_distance import (
mask_from_geojson,
signed_distance_from_geojson,
)
from mpas_tools.viz.colormaps import register_sci_viz_colormaps

from compass.mesh import QuasiUniformSphericalMeshStep
Expand All @@ -25,7 +26,7 @@ def setup(self):
inputs = ['coastline_CUSP.geojson',
'land_mask_Kamchatka.geojson',
'land_mask_Mexico.geojson',
'namelist.split_explicit',
'namelist.split_explicit_ab2',
'region_Arctic_Ocean.geojson',
'region_Bering_Sea.geojson',
'region_Bering_Sea_reduced.geojson',
Expand Down Expand Up @@ -58,8 +59,8 @@ def build_cell_width_lat_lon(self):
dlon = 0.1
dlat = dlon
earth_radius = constants['SHR_CONST_REARTH']
print('\nCreating cellWidth on a lat-lon grid of: {0:.2f} x {0:.2f} '
'degrees'.format(dlon, dlat))
print(f'\nCreating cellWidth on a lat-lon grid of: '
f'{dlon:.2f} x {dlat:.2f} degrees')
print('This can be set higher for faster test generation\n')
nlon = int(360. / dlon) + 1
nlat = int(180. / dlat) + 1
Expand Down Expand Up @@ -144,16 +145,16 @@ def build_cell_width_lat_lon(self):
earth_radius,
max_length=0.25)
maskSmoothEast = 0.5 * (
1 + np.tanh((transitionOffset - signedDistance) /
(transitionWidth / 2.)))
1 + np.tanh((transitionOffset - signedDistance) /
(transitionWidth / 2.)))

fc = read_feature_collection('region_Bering_Sea_reduced.geojson')
signedDistance = signed_distance_from_geojson(fc, lon, lat,
earth_radius,
max_length=0.25)
maskSmoothWest = 0.5 * (
1 + np.tanh((transitionOffset - signedDistance) /
(transitionWidth / 2.)))
1 + np.tanh((transitionOffset - signedDistance) /
(transitionWidth / 2.)))

fc = read_feature_collection('land_mask_Kamchatka.geojson')
maskWest = mask_from_geojson(fc, lon, lat)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_dt = '00:01:00'
config_btr_dt = '00:00:03'
config_run_duration = '0000_01:00:00'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from compass.ocean.tests.global_ocean.forward import (
ForwardStep,
ForwardTestCase,
)
from compass.validate import compare_variables
from compass.ocean.tests.global_ocean.forward import ForwardTestCase, \
ForwardStep


class MonthlyOutputTest(ForwardTestCase):
Expand All @@ -24,7 +26,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/global_ocean/namelist.forward
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config_ocean_run_mode = 'forward'
config_block_decomp_file_prefix = 'graph.info.part.'
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_use_mom_del2 = .true.
config_use_mom_del4 = .true.
config_use_cvmix_convection = .true.
Expand All @@ -13,7 +13,7 @@ config_implicit_constant_bottom_drag_coeff = 1.0e-3
config_use_bulk_wind_stress = .true.
config_use_bulk_thickness_flux = .true.
config_use_Redi = .true.
config_Redi_min_layers_diag_terms = 8
config_Redi_min_layers_diag_terms = 0
config_use_GM = .true.
config_AM_mixedLayerDepths_enable = .true.
config_AM_mixedLayerDepths_compute_interval = 'dt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/global_ocean/restart_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
time_integrator=time_integrator,
name='restart_test')
module = __name__

restart_time = {'split_explicit': '0001-01-01_04:00:00',
restart_time = {'split_explicit_ab2': '0001-01-01_04:00:00',
'RK4': '0001-01-01_00:10:00'}
restart_filename = '../restarts/rst.{}.nc'.format(
restart_time[time_integrator].replace(':', '.'))
Expand Down
8 changes: 5 additions & 3 deletions compass/ocean/tests/global_ocean/threads_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from compass.ocean.tests.global_ocean.forward import (
ForwardStep,
ForwardTestCase,
)
from compass.validate import compare_variables
from compass.ocean.tests.global_ocean.forward import ForwardTestCase, \
ForwardStep


class ThreadsTest(ForwardTestCase):
Expand All @@ -24,7 +26,7 @@ def __init__(self, test_group, mesh, init, time_integrator):
init : compass.ocean.tests.global_ocean.init.Init
The test case that produces the initial condition for this run
time_integrator : {'split_explicit', 'RK4'}
time_integrator : {'split_explicit_ab2', 'RK4'}
The time integrator to use for the forward run
"""
super().__init__(test_group=test_group, mesh=mesh, init=init,
Expand Down
2 changes: 1 addition & 1 deletion compass/ocean/tests/gotm/default/namelist.forward
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config_dt = '000:00:25'
config_btr_dt = '000:00:25'
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_run_duration = '0000_12:00:00'
config_zonal_ssh_grad = -1.0e-5
config_pressure_gradient_type = 'constant_forced'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config_btr_dt = '00:00:10'
config_run_duration = '0000-01-00_00:00:00'
config_write_output_on_startup = .false.
config_block_decomp_file_prefix = 'graph.info.part.'
config_time_integrator = 'split_explicit'
config_time_integrator = 'split_explicit_ab2'
config_use_mom_del2 = .true.
config_use_tracer_del2 = .true.
config_mom_del2 = 6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ goal_cells_per_core = 300
# few cores are available)
max_cells_per_core = 3000

# time integrator (RK4 or split_explicit)
# time integrator (RK4 or split_explicit_ab2)
time_integrator = RK4

# convergence threshold below which the test fails
Expand Down
Loading

0 comments on commit a2a9579

Please sign in to comment.