Skip to content

Commit 7b17877

Browse files
committed
use TripolarGrid with OceananigansSimulation
1 parent 873e3d2 commit 7b17877

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9+
#### Use TripolarGrid with OceananigansSimulation PR[#1409](https://github.com/CliMA/ClimaCoupler.jl/pull/1409)
10+
11+
Switch from using the Oceananigans.jl `LatitudeLongitudeGrid` to `TripolarGrid`.
12+
913
#### Remove bucket `get_new_cache` PR[#1437](https://github.com/CliMA/ClimaCoupler.jl/pull/1437)
1014

1115
As of ClimaLand v0.16.2, total energy and and water are always stored in the bucket cache.

experiments/ClimaEarth/components/ocean/oceananigans.jl

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,16 @@ function OceananigansSimulation(area_fraction, start_date, stop_date; output_dir
4949
download_dataset(en4_temperature)
5050
download_dataset(en4_salinity)
5151

52-
# Set up ocean grid (1 degree)
53-
resolution_points = (360, 160, 32)
54-
Nz = last(resolution_points)
52+
# Set up tripolar ocean grid (1 degree)
53+
Nx = 360
54+
Ny = 180
55+
Nz = 40
5556
depth = 4000 # meters
5657
z = OC.ExponentialCoordinate(Nz, -depth, 0; scale = 0.85 * depth)
5758

58-
# Regular LatLong because we know how to do interpolation there
59-
60-
# TODO: When moving to TripolarGrid, note that we need to be careful about
61-
# ensuring the coordinate systems align (ie, rotate vectors on the OC grid)
62-
63-
underlying_grid = OC.LatitudeLongitudeGrid(
64-
arch;
65-
size = resolution_points,
66-
longitude = (-180, 180),
67-
latitude = (-80, 80), # NOTE: Don't goo to high up when using LatLongGrid, or the cells will be too small
68-
z,
69-
halo = (7, 7, 7),
70-
)
71-
59+
underlying_grid = OC.TripolarGrid(arch; size = (Nx, Ny, Nz), halo = (7, 7, 4), z)
7260
bottom_height =
7361
CO.regrid_bathymetry(underlying_grid; minimum_depth = 30, interpolation_passes = 20, major_basins = 1)
74-
7562
grid = OC.ImmersedBoundaryGrid(underlying_grid, OC.GridFittedBottom(bottom_height); active_cells_map = true)
7663

7764
use_restoring = start_date + Dates.Month(1) < stop_date
@@ -95,17 +82,19 @@ function OceananigansSimulation(area_fraction, start_date, stop_date; output_dir
9582
# Set initial condition to EN4 state estimate at start_date
9683
OC.set!(ocean.model, T = en4_temperature[1], S = en4_salinity[1])
9784

85+
# Construct a remapper from the exchange grid to `Center, Center` fields
9886
long_cc = OC.λnodes(grid, OC.Center(), OC.Center(), OC.Center())
9987
lat_cc = OC.φnodes(grid, OC.Center(), OC.Center(), OC.Center())
10088

101-
# TODO: Go from 0 to Nx+1, Ny+1 (for halos) (for LatLongGrid)
102-
10389
# Construct a remapper from the exchange grid to `Center, Center` fields
10490
long_cc = reshape(long_cc, length(long_cc), 1)
10591
lat_cc = reshape(lat_cc, 1, length(lat_cc))
10692
target_points_cc = @. CC.Geometry.LatLongPoint(lat_cc, long_cc)
107-
# TODO: We can remove the `nothing` after CC > 0.14.33
108-
remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc, nothing)
93+
if pkgversion(CC) >= v"0.14.34"
94+
remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc)
95+
else
96+
remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc, nothing)
97+
end
10998

11099
# Construct two 2D Center/Center fields to use as scratch space while remapping
111100
scratch_cc1 = OC.Field{OC.Center, OC.Center, Nothing}(grid)

0 commit comments

Comments
 (0)