@@ -55,33 +55,20 @@ function OceananigansSimulation(
5555 download_dataset (en4_temperature)
5656 download_dataset (en4_salinity)
5757
58- # Set up ocean grid (1 degree)
59- resolution_points = (360 , 160 , 32 )
60- Nz = last (resolution_points)
58+ # Set up tripolar ocean grid (1 degree)
59+ Nx = 360
60+ Ny = 180
61+ Nz = 40
6162 depth = 4000 # meters
6263 z = OC. ExponentialDiscretization (Nz, - depth, 0 ; scale = 0.85 * depth)
6364
64- # Regular LatLong because we know how to do interpolation there
65-
66- # TODO : When moving to TripolarGrid, note that we need to be careful about
67- # ensuring the coordinate systems align (ie, rotate vectors on the OC grid)
68-
69- underlying_grid = OC. LatitudeLongitudeGrid (
70- arch;
71- size = resolution_points,
72- longitude = (- 180 , 180 ),
73- latitude = (- 80 , 80 ), # NOTE: Don't goo to high up when using LatLongGrid, or the cells will be too small
74- z,
75- halo = (7 , 7 , 7 ),
76- )
77-
65+ underlying_grid = OC. TripolarGrid (arch; size = (Nx, Ny, Nz), halo = (7 , 7 , 4 ), z)
7866 bottom_height = CO. regrid_bathymetry (
7967 underlying_grid;
8068 minimum_depth = 30 ,
8169 interpolation_passes = 20 ,
8270 major_basins = 1 ,
8371 )
84-
8572 grid = OC. ImmersedBoundaryGrid (
8673 underlying_grid,
8774 OC. GridFittedBottom (bottom_height);
@@ -113,17 +100,19 @@ function OceananigansSimulation(
113100 # Set initial condition to EN4 state estimate at start_date
114101 OC. set! (ocean. model, T = en4_temperature[1 ], S = en4_salinity[1 ])
115102
103+ # Construct a remapper from the exchange grid to `Center, Center` fields
116104 long_cc = OC. λnodes (grid, OC. Center (), OC. Center (), OC. Center ())
117105 lat_cc = OC. φnodes (grid, OC. Center (), OC. Center (), OC. Center ())
118106
119- # TODO : Go from 0 to Nx+1, Ny+1 (for halos) (for LatLongGrid)
107+ # Create a 2D matrix containing each lat/long combination as a LatLongPoint
108+ # Note this must be done on CPU since the CC.Remapper module is not GPU-compatible
109+ target_points_cc = Array (CC. Geometry. LatLongPoint .(lat_cc, long_cc))
120110
121- # Construct a remapper from the exchange grid to `Center, Center` fields
122- long_cc = reshape (long_cc, length (long_cc), 1 )
123- lat_cc = reshape (lat_cc, 1 , length (lat_cc))
124- target_points_cc = @. CC. Geometry. LatLongPoint (lat_cc, long_cc)
125- # TODO : We can remove the `nothing` after CC > 0.14.33
126- remapper_cc = CC. Remapping. Remapper (axes (area_fraction), target_points_cc, nothing )
111+ if pkgversion (CC) >= v " 0.14.34"
112+ remapper_cc = CC. Remapping. Remapper (axes (area_fraction), target_points_cc)
113+ else
114+ remapper_cc = CC. Remapping. Remapper (axes (area_fraction), target_points_cc, nothing )
115+ end
127116
128117 # Construct two 2D Center/Center fields to use as scratch space while remapping
129118 scratch_cc1 = OC. Field {OC.Center, OC.Center, Nothing} (grid)
0 commit comments