Skip to content
Open
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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 11 additions & 22 deletions experiments/ClimaEarth/components/ocean/oceananigans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue for this, so we can track it there instead of in this TODO


# 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)
Expand Down
Loading