Skip to content

Adds RiverConcentration to make river fresh water input carry tracers - #728

Open
jagoosw wants to merge 4 commits into
mainfrom
jsw/river-concentration
Open

jagoosw wants to merge 4 commits into
mainfrom
jsw/river-concentration

Conversation

@jagoosw

@jagoosw jagoosw commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds RiverConcentration which can be passed to freshwater_tracer_content and it fills the freshwater flux into the tracer with concentration x volume flux.

jagoosw and others added 3 commits September 29, 2026 13:00
`freshwater_tracer_content = (; X = RiverConcentration(c))` makes tracer X
enter the ocean only with land (river) runoff, at concentration c: its content
flux is c * Jʳ, where Jʳ is the runoff volume flux (m/s, positive into the
ocean). Rain, snow, evaporation, icebergs and sea ice carry none of the
tracer but still dilute it.

- `hydrostatic_ocean_simulation` allocates one shared `river_freshwater_volume_flux`
  Field only when some tracer uses `RiverConcentration`, and materializes each
  entry into an internal `RiverTracerContent`.
- `net_fluxes(ocean)` exposes `river_freshwater_volume_flux` (the Field or `nothing`).
- `_assemble_net_ocean_fluxes!` writes the land runoff `Jˡⁿ / ρᵒᶜ` into it
  (zero on inactive nodes; no-op when `nothing`).
- Correct the `freshwater_tracer_content` docstring: it is a tracer flux
  Σᵢ cᵢ Jʷᵢ, not a concentration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checks that a `RiverConcentration(c)` tracer's content is c times the shared
runoff volume flux field (other tracers untouched), that with a prescribed land
the coupled model fills `river_freshwater_volume_flux` with the land runoff
divided by the ocean reference density (>= 0, nonzero, zero on land), and that
the field is `nothing` when no tracer uses `RiverConcentration`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Oceans/ocean_simulation.jl 90.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jagoosw
jagoosw marked this pull request as ready for review October 1, 2026 13:37

This branch has not been deployed

No deployments
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