Skip to content

tripolar + conservative - updated in ext#1724

Open
juliasloan25 wants to merge 29 commits intomainfrom
js/tripolar-conservative-ext
Open

tripolar + conservative - updated in ext#1724
juliasloan25 wants to merge 29 commits intomainfrom
js/tripolar-conservative-ext

Conversation

@juliasloan25
Copy link
Copy Markdown
Member

@juliasloan25 juliasloan25 commented Feb 11, 2026

Purpose

Yet another version of #1679. I split that PR up into #1715 and this one since it was getting big.

To do

  • debug

Content

  • add ConservativeRegridding dependency
  • extend Interfacer.remap! for Oceananigans fields using CR.jl
  • remove interpolate! calls
  • add a function construct_remappers to make the remapper object and allocate scratch space
  • switch to TripolarGrid + JLD2 diagnostics

  • I have read and checked the items on the review checklist.

@juliasloan25 juliasloan25 force-pushed the js/tripolar-conservative-ext branch from 21fc7d6 to 520d18c Compare February 11, 2026 19:07
minimum_depth = 30,
interpolation_passes = 20,
minimum_depth = 20,
interpolation_passes = 2,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

change to 25 after debugging

To regrid from Oceananigans to ClimaCore, use `CR.regrid!(dest_vector, remapper_oc_to_cc, src_vector)`.
To regrid from ClimaCore to Oceananigans, use `CR.regrid!(dest_vector, transpose(remapper_oc_to_cc), src_vector)`.
"""
function construct_remappers(grid_oc, boundary_space)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

move to remapping.jl

@juliasloan25
Copy link
Copy Markdown
Member Author

We can't use Float32 as the simulation float type when we use ConservativeRegridding. Even if we set it correctly to Float32 for the ocean grid and boundary space, there's a mismatch in source/dest manifolds because of the way GO.Spherical is called. Here for Oceananigans and here for ClimaCore

We need the radius for the Oceananigans grid to agree with defaults.FloatType, or to otherwise use this FT to construct the Spherical object.

Error

julia> remapping = ClimaCouplerCMIPExt.construct_remappers(grid, boundary_space)
ERROR: Destination and source manifolds must be the same.  Got GeometryOpsCore.Spherical{Float32}(6.371f6) and GeometryOpsCore.Spherical{Float64}(6.371e6).
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] ConservativeRegridding.Regridder(dst::ClimaCore.Spaces.SpectralElementSpace2D{…}, src::Oceananigans.Grids.OrthogonalSphericalShellGrid{…}; kwargs::@Kwargs{…})
   @ ConservativeRegridding ~/.julia/packages/ConservativeRegridding/TJLZf/src/regridder/regridder.jl:116
 [3] construct_remappers(grid_oc::Oceananigans.ImmersedBoundaries.ImmersedBoundaryGrid{…}, boundary_space::ClimaCore.Spaces.SpectralElementSpace2D{…})
   @ ClimaCouplerCMIPExt ~/ClimaCoupler.jl/ext/ClimaCouplerCMIPExt/oceananigans.jl:225

julia> OC.defaults.FloatType
Float32

julia> CC.Spaces.undertype(boundary_space)
Float32

@simone-silvestri
Copy link
Copy Markdown
Contributor

We need the radius for the Oceananigans grid to agree with defaults.FloatType, or to otherwise use this FT to construct the Spherical object.

We can use 0.104.5 that should solve this issue

Comment thread ext/ClimaCouplerCMIPExt/oceananigans.jl Outdated
@@ -73,46 +49,35 @@ function OceananigansSimulation(
extra_kwargs...,
) where {FT}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

change substeps = 150 in the free surface constructor

@juliasloan25 juliasloan25 force-pushed the js/tripolar-conservative-ext branch from 80b3bb9 to 7f7f3e0 Compare March 4, 2026 23:29
Interfacer.remap!(target_field, source_field)

# Extend Interfacer.get_field to allow automatic remapping to the target space
function Interfacer.get_field!(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

move these to a file that's included later so we can keep the Simulation struct definitions in the corresponding files

@juliasloan25 juliasloan25 force-pushed the js/tripolar-conservative-ext branch from d173c98 to e2a731a Compare March 12, 2026 18:14
@simone-silvestri
Copy link
Copy Markdown
Contributor

we should try removing sea ice dynamics while debugging:

sea_ice_simulation(grid, ocean; dynamics=nothing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants