Spherical grid with an idealized bathymetry
1. Import Modules
[1]:
%%capture
from mom6_forge.grid import Grid
from mom6_forge.topo import Topo
2. Create a horizontal MOM6 grid
Spherical grid (360 x 160 deg). Grid spacing (dx, dy) = 2 deg
[2]:
# Instantiate a MOM6 grid instance
grid = Grid(
nx = 180, # Number of grid points in x direction
ny = 80, # Number of grid points in y direction
lenx = 360.0, # grid length in x direction (degrees)
leny = 160.0, # grid length in y direction (degrees)
cyclic_x = True, # non-reentrant, rectangular domain
)
Plot grid properties:
[3]:
grid.tlat.plot();
[4]:
grid.tlon.plot();
3. Configure the bathymetry
[5]:
# Instantiate a Topo object associated with the horizontal grid object (grid).
topo = Topo(grid, min_depth=10.0)
Predefined idealized bathymetries:
Topo class provides three idealized bathymetry options, which are also provided by MOM6 as out-of-the-box idealized bathymetry options:
flat bottom: flat bottom set to MAXIMUM_DEPTH.
bowl: an analytically specified bowl-shaped basin ranging between MAXIMUM_DEPTH and MINIMUM_DEPTH.
spoon: a similar shape to ‘bowl’, but with an vertical wall at the southern face.
flat bottom bathymetry
[6]:
# Set the bathymetry to be a flat bottom with a depth of 2000m
topo.set_flat(D=2000.0)
[7]:
topo.depth.plot()
[7]:
<matplotlib.collections.QuadMesh at 0x1517d1159910>
spoon bathymetry
[8]:
topo.set_spoon(500.0, 50.0, expdecay=1e8)
[9]:
topo.depth.plot()
[9]:
<matplotlib.collections.QuadMesh at 0x1517d11a5410>
bowl bathymetry
[10]:
topo.set_bowl(100.0, 0.0, expdecay=1e8)
[11]:
topo.depth.plot()
[11]:
<matplotlib.collections.QuadMesh at 0x1517d461cb50>
[12]:
topo.tmask.plot()
[12]:
<matplotlib.collections.QuadMesh at 0x1517d4762fd0>
[13]:
topo._grid.tarea.plot()
[13]:
<matplotlib.collections.QuadMesh at 0x1517d126da50>
4. Save the grid and bathymetry files
[14]:
# MOM6 supergrid file:
grid.write_supergrid("./ocean_hgrid_1.nc")
# MOM6 topography file:
topo.write_topo("./ocean_topog_1.nc")
# CICE grid file:
topo.write_cice_grid("./cice_grid_1.nc")
# SCRIP grid file (for runoff remapping, if needed):
topo.write_scrip_grid("./scrip_grid_1.nc")
# ESMF mesh file:
topo.write_esmf_mesh("./ESMF_mesh_1.nc")
[ ]: