diff --git a/compass/ocean/tests/hurricane/configure.py b/compass/ocean/tests/hurricane/configure.py index c7708e937f..4f0db8eff9 100644 --- a/compass/ocean/tests/hurricane/configure.py +++ b/compass/ocean/tests/hurricane/configure.py @@ -13,13 +13,11 @@ def configure_hurricane(test_case, mesh): mesh : compass.ocean.tests.global_ocean.mesh.Mesh The test case that produces the mesh for this run - - init : compass.ocean.tests.global_ocean.init.Init, optional - The test case that produces the initial condition for this run """ config = test_case.config - mesh_step = mesh.mesh_step - config.add_from_package(mesh_step.package, mesh_step.mesh_config_filename, + + config.add_from_package('compass.mesh', 'mesh.cfg') + config.add_from_package(mesh.package, mesh.mesh_config_filename, exception=True) get_author_and_email_from_git(config) diff --git a/compass/ocean/tests/hurricane/forward/forward.py b/compass/ocean/tests/hurricane/forward/forward.py index 1710f622e4..3cee4bd3ce 100644 --- a/compass/ocean/tests/hurricane/forward/forward.py +++ b/compass/ocean/tests/hurricane/forward/forward.py @@ -45,7 +45,7 @@ def __init__(self, test_case, mesh, init, name='forward', subdir=None): self.add_streams_file( 'compass.ocean.tests.hurricane.forward', 'streams.ocean') - mesh_package = mesh.mesh_step.package + mesh_package = mesh.package self.add_namelist_file(mesh_package, 'namelist.ocean') initial_state_target = \ diff --git a/compass/ocean/tests/hurricane/mesh/__init__.py b/compass/ocean/tests/hurricane/mesh/__init__.py index 790acf680a..e7b889e06d 100644 --- a/compass/ocean/tests/hurricane/mesh/__init__.py +++ b/compass/ocean/tests/hurricane/mesh/__init__.py @@ -1,6 +1,7 @@ from compass.testcase import TestCase from compass.ocean.tests.hurricane.mesh.dequ120at30cr10rr2 \ - import DEQU120at30cr10rr2Mesh + import DEQU120at30cr10rr2BaseMesh +from compass.ocean.tests.hurricane.configure import configure_hurricane class Mesh(TestCase): @@ -28,26 +29,30 @@ def __init__(self, test_group, mesh_name): name = 'mesh' subdir = '{}/{}'.format(mesh_name, name) super().__init__(test_group=test_group, name=name, subdir=subdir) + if mesh_name == 'DEQU120at30cr10rr2': - self.mesh_step = DEQU120at30cr10rr2Mesh( + self.mesh_step = DEQU120at30cr10rr2BaseMesh( self, mesh_name, preserve_floodplain=False) + mesh_lower = 'dequ120at30cr10rr2' elif mesh_name == 'DEQU120at30cr10rr2WD': - self.mesh_step = DEQU120at30cr10rr2Mesh( + self.mesh_step = DEQU120at30cr10rr2BaseMesh( self, mesh_name, preserve_floodplain=True) + mesh_lower = 'dequ120at30cr10rr2' else: raise ValueError(f'Unexpected mesh name {mesh_name}') + self.package = f'compass.ocean.tests.hurricane.mesh.{mesh_lower}' + self.mesh_config_filename = f'{mesh_lower}.cfg' + self.add_step(self.mesh_step) def configure(self): """ Modify the configuration options for this test case """ - self.config.add_from_package(self.mesh_step.package, - self.mesh_step.mesh_config_filename, - exception=True) + configure_hurricane(test_case=self, mesh=self) def run(self): """ diff --git a/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/__init__.py b/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/__init__.py index 573f6d6a21..212ed88ed8 100644 --- a/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/__init__.py +++ b/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/__init__.py @@ -1,41 +1,12 @@ import mpas_tools.ocean.coastal_tools as ct -from compass.ocean.tests.global_ocean.mesh.mesh import MeshStep +from compass.ocean.mesh.floodplain_mesh import FloodplainMeshStep -class DEQU120at30cr10rr2Mesh(MeshStep): +class DEQU120at30cr10rr2BaseMesh(FloodplainMeshStep): """ A step for creating DEQU120at30cr10rr2 meshes """ - def __init__(self, test_case, mesh_name, preserve_floodplain): - """ - Create a new step - - Parameters - ---------- - test_case : compass.TestCase - The test case this step belongs to - - mesh_name : str - The name of the mesh - - preserve_floodplain : bool - Whether the mesh includes land cells - """ - - with_ice_shelf_cavities = False - - super().__init__(test_case, mesh_name, with_ice_shelf_cavities, - package=self.__module__, - mesh_config_filename='dequ120at30cr10rr2.cfg', - do_inject_bathymetry=True, - preserve_floodplain=preserve_floodplain) - - self.add_input_file( - filename='earth_relief_15s.nc', - target='SRTM15_plus_earth_relief_15s.nc', - database='bathymetry_database') - def build_cell_width_lat_lon(self): """ Create cell width array for this mesh on a regular latitude-longitude diff --git a/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/dequ120at30cr10rr2.cfg b/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/dequ120at30cr10rr2.cfg index fb91bfb12d..6972b95141 100644 --- a/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/dequ120at30cr10rr2.cfg +++ b/compass/ocean/tests/hurricane/mesh/dequ120at30cr10rr2/dequ120at30cr10rr2.cfg @@ -1,19 +1,25 @@ -# options for global ocean testcases -[global_ocean] +# options for spherical meshes +[spherical_mesh] -## config options related to the mesh step +## config options related to the step for culling land from the mesh # number of cores to use -mesh_cores = 1 +cull_mesh_cores = 18 # minimum of cores, below which the step fails -mesh_min_cores = 1 +cull_mesh_min_cores = 1 +# maximum memory usage allowed (in MB) +cull_mesh_max_memory = 1000 + +# Elevation threshold to use for including land cells +floodplain_elevation = 10.0 + + +# options for global ocean testcases +[global_ocean] # The following options are detected from .gitconfig if not explicitly entered author = autodetect email = autodetect -# Elevation threshold to use for including land cells -floodplain_elevation = 10.0 - # options for hurricane testcases [hurricane] @@ -22,11 +28,11 @@ floodplain_elevation = 10.0 # number of cores to use init_cores = 36 # minimum of cores, below which the step fails -init_min_cores = 8 +init_min_cores = 8 # maximum memory usage allowed (in MB) init_max_memory = 1000 # number of threads -init_threads = 1 +init_threads = 1 ## config options related to the forward steps # number of cores to use