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

Add wave mesh generation for global_ocean mesh test cases #818

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fdac082
Start wave mesh test case
sbrus89 Apr 15, 2024
e4a5e87
Fix wave_mesh test case typos
sbrus89 Apr 15, 2024
08bde75
Update base_mesh step for waves
sbrus89 Apr 17, 2024
d3fe8d5
uost rebase
Apr 17, 2024
591e54d
UOST files step
Apr 17, 2024
012c86b
fix to __init__ in call to uost
Apr 17, 2024
cc54225
Add cull mesh step
sbrus89 Apr 17, 2024
115f539
Add rotate step
sbrus89 Apr 17, 2024
b062dd5
Minor changes to uost step
sbrus89 Apr 17, 2024
dadb9fb
Use initial_state.nc as ocean mesh
sbrus89 Apr 18, 2024
6f6c14e
scrip file creation
Apr 18, 2024
30bc773
Fix for scrip step
sbrus89 Apr 18, 2024
b72581e
initial remap step
Apr 18, 2024
08f9d12
Namelist updates
sbrus89 Apr 18, 2024
af10555
Add new lines at end of rotate and scrip nml files
sbrus89 Apr 19, 2024
b86b6f4
Update remap step
sbrus89 Apr 19, 2024
504d69a
Fix resolution specification in base_mesh step
sbrus89 Apr 19, 2024
6847615
Use GSHHS coastlines through cartopy
sbrus89 Apr 19, 2024
8a8c9f5
Use jinja templates for writing namelists
sbrus89 Apr 19, 2024
c325b88
Create ocean scrip file and fix remapping step
sbrus89 Jun 14, 2024
1fa223f
Add UOST rotation
sbrus89 Jul 15, 2024
849a837
Add units to config file
sbrus89 Jul 23, 2024
62a4aa5
Change coastline data set from level 6 to level 5
sbrus89 Sep 5, 2024
1550d55
Incorporate ocean base mesh into wave base mesh creation
sbrus89 Sep 6, 2024
66bb5c9
Clean up config file
sbrus89 Sep 6, 2024
acc78b6
Add standalone test for creating wave mesh from existing ocean mesh
sbrus89 Sep 6, 2024
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
21 changes: 16 additions & 5 deletions compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from compass.ocean.tests.global_ocean.performance_test import PerformanceTest
from compass.ocean.tests.global_ocean.restart_test import RestartTest
from compass.ocean.tests.global_ocean.threads_test import ThreadsTest
from compass.ocean.tests.global_ocean.wave_mesh import WaveMesh
from compass.testgroup import TestGroup


Expand Down Expand Up @@ -62,10 +63,15 @@ def __init__(self, mpas_core):
# A test case for making E3SM support files from an existing mesh
self.add_test_case(FilesForE3SM(test_group=self))

# Test cases for creating waves mesh
self.add_test_case(WaveMesh(test_group=self))
self._add_tests(mesh_names=['Icos'], include_wave_mesh=True)

def _add_tests(self, mesh_names, high_res_topography=True,
include_rk4=False,
include_regression=False, include_phc=False,
include_en4_1900=False):
include_en4_1900=False,
include_wave_mesh=False):
""" Add test cases for the given mesh(es) """

default_ic = 'WOA23'
Expand Down Expand Up @@ -116,10 +122,10 @@ def _add_tests(self, mesh_names, high_res_topography=True,
time_integrator=time_integrator)
self.add_test_case(dynamic_adjustment_test)

self.add_test_case(
FilesForE3SM(
test_group=self, mesh=mesh_test, init=init_test,
dynamic_adjustment=dynamic_adjustment_test))
e3sm_files_test = FilesForE3SM(
test_group=self, mesh=mesh_test, init=init_test,
dynamic_adjustment=dynamic_adjustment_test)
self.add_test_case(e3sm_files_test)

if include_rk4:
time_integrator = 'RK4'
Expand Down Expand Up @@ -167,3 +173,8 @@ def _add_tests(self, mesh_names, high_res_topography=True,
FilesForE3SM(
test_group=self, mesh=mesh_test, init=init_test,
dynamic_adjustment=dynamic_adjustment_test))

if include_wave_mesh:
self.add_test_case(
WaveMesh(test_group=self, ocean_mesh=mesh_test,
ocean_init=init_test))
99 changes: 99 additions & 0 deletions compass/ocean/tests/global_ocean/wave_mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# from compass.ocean.tests.global_ocean.metadata import (
# get_author_and_email_from_git,
# )
from compass.ocean.tests.global_ocean.wave_mesh.base_mesh import WavesBaseMesh
from compass.ocean.tests.global_ocean.wave_mesh.cull_mesh import WavesCullMesh
from compass.ocean.tests.global_ocean.wave_mesh.remap_files import (
WavesRemapFiles,
)
from compass.ocean.tests.global_ocean.wave_mesh.rotate_mesh import (
WavesRotateMesh,
)
from compass.ocean.tests.global_ocean.wave_mesh.scrip_file import (
WavesScripFile,
)
from compass.ocean.tests.global_ocean.wave_mesh.uost_files import (
WavesUostFiles,
)
from compass.testcase import TestCase

# from compass.validate import compare_variables


class WaveMesh(TestCase):
"""
A test case for creating a global MPAS-Ocean mesh

Attributes
----------
"""
def __init__(self, test_group, ocean_mesh=None, ocean_init=None):
"""
Create test case for creating a global MPAS-Ocean mesh

Parameters
----------
test_group : compass.ocean.tests.global_ocean.GlobalOcean
The global ocean test group that this test case belongs to

"""
name = 'wave_mesh'
if ocean_mesh is not None:
subdir = f'{ocean_mesh.mesh_name}/{name}'
else:
subdir = name

super().__init__(test_group=test_group, name=name, subdir=subdir)

self.package = 'compass.ocean.tests.global_ocean.wave_mesh'
self.mesh_config_filename = 'wave_mesh.cfg'

base_mesh_step = WavesBaseMesh(test_case=self,
ocean_base_mesh=ocean_mesh,
ocean_culled_mesh=ocean_init)
self.add_step(base_mesh_step)

cull_mesh_step = WavesCullMesh(test_case=self,
ocean_mesh=ocean_init,
wave_base_mesh=base_mesh_step)
self.add_step(cull_mesh_step)

scrip_file_step = WavesScripFile(test_case=self,
wave_culled_mesh=cull_mesh_step,
ocean_mesh=ocean_init)
self.add_step(scrip_file_step)

remap_file_step = WavesRemapFiles(test_case=self,
wave_scrip=scrip_file_step)
self.add_step(remap_file_step)

rotate_mesh_step = WavesRotateMesh(test_case=self,
wave_culled_mesh=cull_mesh_step)
self.add_step(rotate_mesh_step)

uost_file_step = WavesUostFiles(test_case=self,
wave_culled_mesh=cull_mesh_step,
wave_rotate_mesh=rotate_mesh_step)
self.add_step(uost_file_step)

def configure(self, config=None):
"""
Modify the configuration options for this test case

config : compass.config.CompassConfigParser, optional
Configuration options to update if not those for this test case
"""
if config is None:
config = self.config
config.add_from_package('compass.mesh', 'mesh.cfg', exception=True)

# get_author_and_email_from_git(config)

# def validate(self):
# """
# Test cases can override this method to perform validation of variables
# and timers
# """
# variables = ['xCell', 'yCell', 'zCell']
# compare_variables(test_case=self, variables=variables,
# filename1='cull_mesh/culled_mesh.nc')
Loading
Loading