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 RRS6to18 and RRSwISC6to18 meshes #576

Merged
merged 19 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions compass/ocean/suites/rrs6to18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ocean/global_ocean/RRS6to18/mesh
ocean/global_ocean/RRS6to18/PHC/init
ocean/global_ocean/RRS6to18/PHC/performance_test
ocean/global_ocean/RRS6to18/PHC/dynamic_adjustment
ocean/global_ocean/RRS6to18/PHC/files_for_e3sm
5 changes: 5 additions & 0 deletions compass/ocean/suites/rrswisc6to18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ocean/global_ocean/RRSwISC6to18/mesh
ocean/global_ocean/RRSwISC6to18/PHC/init
ocean/global_ocean/RRSwISC6to18/PHC/performance_test
ocean/global_ocean/RRSwISC6to18/PHC/dynamic_adjustment
ocean/global_ocean/RRSwISC6to18/PHC/files_for_e3sm
7 changes: 7 additions & 0 deletions compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from compass.ocean.tests.global_ocean.mesh.qu.dynamic_adjustment import (
QUDynamicAdjustment,
)
from compass.ocean.tests.global_ocean.mesh.rrs6to18.dynamic_adjustment import (
RRS6to18DynamicAdjustment,
)
from compass.ocean.tests.global_ocean.mesh.so12to60.dynamic_adjustment import (
SO12to60DynamicAdjustment,
)
Expand Down Expand Up @@ -74,6 +77,10 @@ def __init__(self, mpas_core):
self._add_tests(mesh_names=['WC14', 'WCwISC14'],
DynamicAdjustment=WC14DynamicAdjustment)

# RRS6to18: with and without cavities
self._add_tests(mesh_names=['RRS6to18', 'RRSwISC6to18'],
DynamicAdjustment=RRS6to18DynamicAdjustment)

# Kuroshio meshes without ice-shelf cavities
self._add_tests(mesh_names=['Kuroshio12to60', 'Kuroshio8to60'],
DynamicAdjustment=KuroshioDynamicAdjustment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ def run(self):
symlink('graph.info', f'mpas-o.graph.info.{creation_date}')

ncells = sum(1 for _ in open('graph.info'))
cores = get_core_list(ncells=ncells)
max_cells_per_core = config.getint('files_for_e3sm',
'max_cells_per_core')
min_cells_per_core = config.getint('files_for_e3sm',
'min_cells_per_core')
cores = get_core_list(ncells=ncells,
max_cells_per_core=max_cells_per_core,
min_cells_per_core=min_cells_per_core)

logger.info(f'Creating graph files between {np.amin(cores)} and '
f'{np.amax(cores)}')
for ncores in cores:
if ncores > ncells:
raise ValueError('Can\t have more tasks than cells in a '
'partition file.')
out_filename = f'mpas-o.graph.info.{creation_date}.part.{ncores}'
if os.path.exists(out_filename):
continue
if ncores == 1:
args = ['touch', f'mpas-o.graph.info.{creation_date}.part.1']
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ def run(self):
write_netcdf(ds, 'mesh.nc')
mesh_filename = 'mesh.nc'

cores = get_core_list(ncells=ncells)
max_cells_per_core = config.getint('files_for_e3sm',
'max_cells_per_core')
min_cells_per_core = config.getint('files_for_e3sm',
'min_cells_per_core')
cores = get_core_list(ncells=ncells,
max_cells_per_core=max_cells_per_core,
min_cells_per_core=min_cells_per_core)
logger.info(f'Creating graph files between {np.amin(cores)} and '
f'{np.amax(cores)}')

Expand Down Expand Up @@ -116,6 +122,13 @@ def run(self):
if ncores > ncells:
raise ValueError('Can\t have more tasks than cells in a '
'partition file.')
if ncores <= 0:
raise ValueError(f'Can\t make a partition for {ncores} tasks.')
out_filename = \
f'mpas-seaice.graph.info.{creation_date}.part.{ncores}'
if os.path.exists(out_filename):
continue

if ncores > 1:
args.append(f'{ncores}')

Expand Down
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 @@ -112,6 +112,10 @@ temperature_max = 33.0
# for E3SM
[files_for_e3sm]

# The minimum and maximum cells per core for creating graph partitions
max_cells_per_core = 30000
min_cells_per_core = 2

## the following relate to the comparison grids in MPAS-Analysis to generate
## mapping files for. The default values are also the defaults in
## MPAS-Analysis. Coarser or finer resolution may be desirable for some MPAS
Expand Down
3 changes: 3 additions & 0 deletions compass/ocean/tests/global_ocean/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
IcosMeshFromConfigStep,
QUMeshFromConfigStep,
)
from compass.ocean.tests.global_ocean.mesh.rrs6to18 import RRS6to18BaseMesh
from compass.ocean.tests.global_ocean.mesh.so12to60 import SO12to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.wc14 import WC14BaseMesh
from compass.ocean.tests.global_ocean.metadata import (
Expand Down Expand Up @@ -91,6 +92,8 @@ def __init__(self, test_group, mesh_name, high_res_topography):
base_mesh_step = EC30to60BaseMesh(self, name=name, subdir=subdir)
elif mesh_name in ['ARRM10to60', 'ARRMwISC10to60']:
base_mesh_step = ARRM10to60BaseMesh(self, name=name, subdir=subdir)
elif mesh_name in ['RRS6to18', 'RRSwISC6to18']:
base_mesh_step = RRS6to18BaseMesh(self, name=name, subdir=subdir)
elif mesh_name in ['SO12to60', 'SOwISC12to60']:
base_mesh_step = SO12to60BaseMesh(self, name=name, subdir=subdir)
elif mesh_name.startswith('Kuroshio'):
Expand Down
40 changes: 40 additions & 0 deletions compass/ocean/tests/global_ocean/mesh/rrs6to18/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import mpas_tools.mesh.creation.mesh_definition_tools as mdt
import numpy as np

from compass.mesh import QuasiUniformSphericalMeshStep


class RRS6to18BaseMesh(QuasiUniformSphericalMeshStep):
"""
A step for creating RRS6to18 and RRSwISC6to18 meshes
"""

def build_cell_width_lat_lon(self):
"""
Create cell width array for this mesh on a regular latitude-longitude
grid

Returns
-------
cellWidth : numpy.array
m x n array of cell width in km

lon : numpy.array
longitude in degrees (length n and between -180 and 180)

lat : numpy.array
longitude in degrees (length m and between -90 and 90)
"""

dlon = 10.
dlat = 0.1
nlon = int(360. / dlon) + 1
nlat = int(180. / dlat) + 1
lon = np.linspace(-180., 180., nlon)
lat = np.linspace(-90., 90., nlat)

cellWidthVsLat = mdt.RRS_CellWidthVsLat(lat, cellWidthEq=18.,
cellWidthPole=6.)
cellWidth = np.outer(cellWidthVsLat, np.ones([1, lon.size]))

return cellWidth, lon, lat
Loading
Loading