Skip to content

Make radiation→ocean forcing hook live; rename radiative flux functions#372

Open
glwagner wants to merge 1 commit into
mainfrom
refactor-radiative-forcing-hook
Open

Make radiation→ocean forcing hook live; rename radiative flux functions#372
glwagner wants to merge 1 commit into
mainfrom
refactor-radiative-forcing-hook

Conversation

@glwagner

Copy link
Copy Markdown
Member

Summary

Two related cleanups around how radiation forces the ocean, prompted by tracing compute_radiative_forcing! and TwoColorRadiation.

1. compute_radiative_forcing! — from dead code to a live extension hook

Previously compute_radiative_forcing! was defined but never called, and its dispatch was backwards: the fallback was a no-op while the TwoColorRadiation method did host-side work that the in-kernel shortwave_radiative_forcing already does.

It's now the generic, overridable precompute hook for radiation models whose in-water absorption requires a vertical pass over ocean tracers (e.g. biogeochemical / chlorophyll-based schemes):

  • generic compute_radiative_forcing!(radiation, coupled_model) — the overridable entry point (fallback no-op),
  • compute_radiative_forcing!(::TwoColorRadiation, coupled_model) — explicit no-op (analytic absorption; its surface flux is set per-column in the flux kernel),
  • called from compute_radiation_ocean_fluxes! right before the kernel launch!.

Behavior today is unchanged (no-op for the only existing scheme and for nothing), but the extension point is now genuinely wired in. Also fixes notation Iˢʷℐˢʷ to match the script-I used in the kernel (ℐꜜˢʷ/ℐₜˢʷ/ℐꜛˡʷ).

2. Rename the radiative flux family: apply_air_*compute_radiation_*

The fluxes are sourced from the radiation component (coupled_model.radiation), not the atmosphere — these functions never touch coupled_model.atmosphere. The new names use the component-pair form parallel to the turbulent compute_atmosphere_ocean_fluxes!:

Old New
apply_air_sea_radiative_fluxes! compute_radiation_ocean_fluxes!
apply_air_sea_ice_radiative_fluxes! compute_radiation_sea_ice_fluxes!
apply_air_land_radiative_fluxes! compute_radiation_land_fluxes!

Files renamed (git mv, history preserved); all definitions, _-prefixed kernels, (::Any)/{<:Nothing} fallbacks, includes, and doc/comment references updated. grep confirms no stale apply_air_* tokens remain.

Left intentionally unchanged: air_sea_interface_radiation_state (describes the radiation state at the surface interface — distinct concept, separate scope).

Test plan

  • CI (no compile check run locally — no Julia REPL available; pure token rename + a no-op hook call, definition/call sites updated symmetrically)

🤖 Generated with Claude Code

…ions

Two related cleanups around how radiation drives the ocean:

1. Turn `compute_radiative_forcing!` from dead/backwards code into a live
   precompute hook. It is now the generic, overridable entry point for
   radiation models whose in-water absorption needs a vertical pass over
   ocean tracers (e.g. biogeochemical/chlorophyll-based schemes), and a
   no-op for analytic schemes like `TwoColorRadiation` (whose surface flux
   is set per-column in the flux kernel). The hook is called from
   `compute_radiation_ocean_fluxes!` before launching the kernel. Also fixes
   notation `Iˢʷ` → `ℐˢʷ` to match the script-I used elsewhere.

2. Rename the radiative flux family to reflect that the source is the
   `radiation` component, not the atmosphere, in the component-pair form
   parallel to `compute_atmosphere_ocean_fluxes!`:
     apply_air_sea_radiative_fluxes!      → compute_radiation_ocean_fluxes!
     apply_air_sea_ice_radiative_fluxes!  → compute_radiation_sea_ice_fluxes!
     apply_air_land_radiative_fluxes!     → compute_radiation_land_fluxes!
   Files renamed accordingly; all definitions, kernels, fallbacks, and
   doc/comment references updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant