Skip to content

Integrate ClimaSeaIce snow model#164

Open
simone-silvestri wants to merge 46 commits intomainfrom
ss/snow-model-integration
Open

Integrate ClimaSeaIce snow model#164
simone-silvestri wants to merge 46 commits intomainfrom
ss/snow-model-integration

Conversation

@simone-silvestri
Copy link
Copy Markdown
Member

@simone-silvestri simone-silvestri commented Apr 15, 2026

Summary

  • sea_ice_simulation: add with_snow, `snow_conductivity
  • Update imports for ClimaSeaIce snow-model branch (SlabThermodynamics, etc.)
  • default_ai_temperature dispatches on IceSnowConductiveFlux when snow present
  • New flux_balance_temperature dispatch using combined resistance R = hs/ks + hi/ki
  • Refactored into shared conductive_flux_balance_temperature (DRY)
  • Snowfall routing: interpolate JRA55 snow separately → Jˢⁿ field → sea ice top_fluxes.snowfall
  • Sea ice exchanger state: rename hhi, add hs

Requires ClimaSeaIce >= 0.4.8 (snow-model branch merged)

Test plan

  • Run OMIP with with_snow=true, verify snow accumulates
  • Verify conductive flux reduces with snow (insulation effect)
  • Check surface temperature solve converges with IceSnowConductiveFlux

- Bathymetry: minor fix in regrid_bathymetry
- DataWrangling: inpainting and restoring improvements
- Diagnostics: MLD minor update
- EarthSystemModels: simplify time stepping, minor earth_system_model cleanup
- InterfaceComputations: minor refactors in sea_ice_ocean fluxes and heat flux formulations

Note: Ocean simulation refactoring (flux_and_restoring, Oceans.jl, ocean_simulation.jl)
and Diagnostics (interface_fluxes) are handled in PR #155 and #158.
- Bathymetry: minor fix in regrid_bathymetry
- DataWrangling: inpainting and restoring improvements
- Diagnostics: interface flux diagnostics and MLD updates
- Oceans: refactor ocean simulation, extract flux_and_restoring
- EarthSystemModels: simplify time stepping, minor earth_system_model cleanup
- InterfaceComputations: minor refactors in sea_ice_ocean fluxes and heat flux formulations
New type SeaIceAlbedo implementing the CCSM3 albedo parameterization
(Briegleb et al. 2004):
- Broadband albedos: bare ice 0.54, snow-covered 0.83
- Temperature-dependent reduction near melting (implicit melt ponds)
- Thin-ice transition to ocean albedo below 0.5 m
- Snow cover blending (full snow albedo at hs > 0.02 m)
- Handles nothing snow_thickness gracefully

Also evaluates state-dependent albedo to scalar via stateindex at
the top of the atmosphere-sea ice flux kernel, fixing a potential
struct-in-arithmetic bug when the albedo is not a plain number.

Changes to atmosphere_sea_ice_fluxes.jl:
- Evaluate radiation properties (α, ϵ) via stateindex before iteration
- Pass local_interface_properties with scalar values to compute_interface_state
- Add hs (snow thickness) to local_interior_state
- Rename h → hi for ice thickness in interior state

References:
- Briegleb et al. (2004): NCAR Tech Note
- Briegleb & Light (2007): NCAR/TN-472+STR
simone-silvestri and others added 3 commits April 15, 2026 14:31
- Add Adapt.adapt_structure for InterfaceProperties so that
  SeaIceAlbedo Fields are properly adapted for GPU kernels
- Fix get_snow_thickness call to pass grid argument

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Snow support for OMIP simulations:

Sea ice model changes:
- sea_ice_simulation: add with_snow, snow_conductivity, snowfall kwargs
- Update imports for ClimaSeaIce ss/snow-model (SlabThermodynamics,
  sea_ice_slab_thermodynamics, snow_slab_thermodynamics)
- default_ai_temperature dispatches on IceSnowConductiveFlux when snow present
- Add snowfall to net_fluxes (top fluxes NamedTuple)
- Sea ice exchanger state: rename h → hi, add hs (snow thickness)

Surface temperature solve:
- New flux_balance_temperature dispatch for IceSnowConductiveFlux
  using combined resistance R = hs/ks + hi/ki
- Refactored into shared conductive_flux_balance_temperature (DRY)
- ConductiveFlux dispatch updated: Ψi.h → Ψi.hi

Snowfall routing:
- Atmosphere exchanger: add Jˢⁿ field (interpolated snow flux)
- Interpolation kernel: interpolate snow component separately
- Sea ice flux assembly: write Jˢⁿ into top_fluxes.snowfall
- ClimaSeaIce reads model.snowfall during thermodynamic step

Requires ClimaSeaIce >= 0.4.8 (snow-model branch merged).
ice_heat_capacity → heat_capacity, ice_density → density

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@simone-silvestri simone-silvestri force-pushed the ss/snow-model-integration branch from 0d8881e to 8e3cb6b Compare April 15, 2026 12:31
@simone-silvestri simone-silvestri changed the base branch from ss/sea-ice-albedo to main April 15, 2026 12:54
simone-silvestri and others added 2 commits April 15, 2026 14:59
Strip out changes that belong to other PRs or branches:
- FluxAndRestoring struct and plumbing (separate PR)
- Bottom drag rework (drag_bulk_velocity, Uᴮ)
- Barotropic potential toggle, clock kwarg, materialize_buoyancy_gradients
- TKE advection change, meridional heat transport deletion
- Bathymetry minimum depth, inpainting NaN fill, restoring extract_field_time_series
- Sea ice albedo (CCSM3 scheme) and Adapt for InterfaceProperties (PR #163)
- ocean_surface_salinity/temperature view change

Keep only snow model integration: snow thermodynamics, snowfall routing,
IceSnowConductiveFlux flux balance, hs in exchanger and interior state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Unit tests:
- sea_ice_simulation with/without snow (with_snow kwarg)
- PhaseTransitions API (heat_capacity/density kwargs)
- ComponentExchanger includes hs (ZeroField without snow, Field with snow)
- default_ai_temperature dispatches on ConductiveFlux vs IceSnowConductiveFlux
- net_fluxes includes snowfall
- Thermal resistance: R_snow > R_ice

Integration tests:
- Coupled model without snow (time_step succeeds)
- Coupled model with snow (time_step succeeds)
- Snowfall routing: Jsn in exchanger, snowfall in net fluxes
- Snow insulation: IceSnowConductiveFlux wired with correct conductivities

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
simone-silvestri and others added 2 commits April 15, 2026 15:22
Build two coupled models (bare ice vs ice+snow), time-step both,
verify the snowy surface temperature is warmer due to added thermal
resistance from the snow layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Already covered by test_ocean_sea_ice_model.jl.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Integrates ClimaSeaIce’s snow model into the coupled sea-ice workflow, including new snowfall routing and updated conductive-flux temperature solving when snow is present.

Changes:

  • Extended sea_ice_simulation to optionally enable snow thermodynamics and expose snowfall / snow properties.
  • Updated interface computations to use IceSnowConductiveFlux (and combined thermal resistance) when snow exists, and added hs/hi to the sea-ice exchanger state.
  • Routed snowfall as a distinct atmospheric field (Jˢⁿ) into sea-ice top fluxes and added a new test suite covering snow integration wiring.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/test_snow_model_integration.jl Adds unit + lightweight integration tests for snow wiring, exchanger state, and dispatch.
src/SeaIces/sea_ice_simulation.jl Adds snow-related kwargs, switches to new ClimaSeaIce thermodynamics constructors, updates default_ai_temperature, and includes snowfall in net_fluxes.
src/SeaIces/assemble_net_sea_ice_fluxes.jl Adds snowfall field to assembled sea-ice top fluxes from atmospheric Jˢⁿ.
src/SeaIces/SeaIces.jl Updates sea-ice ComponentExchanger state from hhi and adds hs.
src/EarthSystemModels/InterfaceComputations/interface_states.jl Refactors conductive flux-balance temperature solve and adds snow+ice resistance formulation.
src/EarthSystemModels/InterfaceComputations/atmosphere_sea_ice_fluxes.jl Updates to read hi/hs from exchanger state and pass them into interface state.
src/Atmospheres/prescribed_atmosphere_regridder.jl Adds Jˢⁿ to prescribed atmosphere exchanger state.
src/Atmospheres/interpolate_atmospheric_state.jl Interpolates snowfall separately into Jˢⁿ while preserving total precip in Jᶜ.
src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_heat_flux_formulations.jl Updates doc citations for default TEF parameters.
src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl Pure formatting/alignment changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SeaIces/assemble_net_sea_ice_fluxes.jl
Comment thread src/Atmospheres/interpolate_atmospheric_state.jl
Comment thread src/SeaIces/sea_ice_simulation.jl Outdated
Comment thread src/SeaIces/sea_ice_simulation.jl
simone-silvestri and others added 3 commits April 15, 2026 15:45
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When with_snow=false, sea_ice.model.snowfall is a ConstantField(0) which
cannot be written to. Always allocate a writable Field for the net snowfall
flux since the kernel writes into it unconditionally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread src/SeaIces/sea_ice_simulation.jl Outdated
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.

3 participants