diff --git a/NEWS.md b/NEWS.md index 0ff62a92fa..acb65f8178 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,10 @@ ClimaCoupler.jl Release Notes ### ClimaCoupler features +#### Use TripolarGrid with OceananigansSimulation PR[#1409](https://github.com/CliMA/ClimaCoupler.jl/pull/1409) + +Switch from using the Oceananigans.jl `LatitudeLongitudeGrid` to `TripolarGrid`. + #### Remove bucket `get_new_cache` PR[#1437](https://github.com/CliMA/ClimaCoupler.jl/pull/1437) As of ClimaLand v0.16.2, total energy and and water are always stored in the bucket cache. diff --git a/experiments/ClimaEarth/components/ocean/oceananigans.jl b/experiments/ClimaEarth/components/ocean/oceananigans.jl index 2d895e35e5..1338c6707e 100644 --- a/experiments/ClimaEarth/components/ocean/oceananigans.jl +++ b/experiments/ClimaEarth/components/ocean/oceananigans.jl @@ -49,29 +49,16 @@ function OceananigansSimulation(area_fraction, start_date, stop_date; output_dir download_dataset(en4_temperature) download_dataset(en4_salinity) - # Set up ocean grid (1 degree) - resolution_points = (360, 160, 32) - Nz = last(resolution_points) + # Set up tripolar ocean grid (1 degree) + Nx = 360 + Ny = 180 + Nz = 40 depth = 4000 # meters z = OC.ExponentialCoordinate(Nz, -depth, 0; scale = 0.85 * depth) - # Regular LatLong because we know how to do interpolation there - - # TODO: When moving to TripolarGrid, note that we need to be careful about - # ensuring the coordinate systems align (ie, rotate vectors on the OC grid) - - underlying_grid = OC.LatitudeLongitudeGrid( - arch; - size = resolution_points, - longitude = (-180, 180), - latitude = (-80, 80), # NOTE: Don't goo to high up when using LatLongGrid, or the cells will be too small - z, - halo = (7, 7, 7), - ) - + underlying_grid = OC.TripolarGrid(arch; size = (Nx, Ny, Nz), halo = (7, 7, 4), z) bottom_height = CO.regrid_bathymetry(underlying_grid; minimum_depth = 30, interpolation_passes = 20, major_basins = 1) - grid = OC.ImmersedBoundaryGrid(underlying_grid, OC.GridFittedBottom(bottom_height); active_cells_map = true) use_restoring = start_date + Dates.Month(1) < stop_date @@ -95,17 +82,19 @@ function OceananigansSimulation(area_fraction, start_date, stop_date; output_dir # Set initial condition to EN4 state estimate at start_date OC.set!(ocean.model, T = en4_temperature[1], S = en4_salinity[1]) + # Construct a remapper from the exchange grid to `Center, Center` fields long_cc = OC.λnodes(grid, OC.Center(), OC.Center(), OC.Center()) lat_cc = OC.φnodes(grid, OC.Center(), OC.Center(), OC.Center()) - # TODO: Go from 0 to Nx+1, Ny+1 (for halos) (for LatLongGrid) - # Construct a remapper from the exchange grid to `Center, Center` fields long_cc = reshape(long_cc, length(long_cc), 1) lat_cc = reshape(lat_cc, 1, length(lat_cc)) target_points_cc = @. CC.Geometry.LatLongPoint(lat_cc, long_cc) - # TODO: We can remove the `nothing` after CC > 0.14.33 - remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc, nothing) + if pkgversion(CC) >= v"0.14.34" + remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc) + else + remapper_cc = CC.Remapping.Remapper(axes(area_fraction), target_points_cc, nothing) + end # Construct two 2D Center/Center fields to use as scratch space while remapping scratch_cc1 = OC.Field{OC.Center, OC.Center, Nothing}(grid)