Skip to content

Exchange sediment and particle DIC with every carbonate replicate - #458

Open
ali-ramadhan wants to merge 2 commits into
ali/replicate-namesfrom
ali/fix-dic-couplings
Open

ali-ramadhan wants to merge 2 commits into
ali/replicate-namesfrom
ali/fix-dic-couplings

Conversation

@ali-ramadhan

Copy link
Copy Markdown
Collaborator

Closes #451.

The carbon-tracking SimpleMultiG sediment and the SugarKelp particles exchange carbon with a tracer named DIC. A replicated or labelled carbonate system has no DIC: it has DIC1 and DIC2, or DIC_control, ….

So the couplings now ask the biogeochemistry which tracers to exchange with:

tracer_replicates(bgc, :DIC)
# (:DIC,)          for CarbonateSystem()
# (:DIC1, :DIC2)   for CarbonateSystem(2)
# (:DIC_a, :DIC_b) for CarbonateSystem((:a, :b))

The carbon-tracking `SimpleMultiG` sediment and the `SugarKelp` particles exchange carbon with a
tracer named `DIC`, which a replicated or labelled carbonate system doesn't have (it has `DIC1`,
`DIC2` or `DIC_control`, ...), so these couplings failed with
`FieldError: type NamedTuple has no field DIC`.

The couplings now ask the biogeochemistry which tracers to exchange with, `tracer_replicates(bgc, name)`,
which is just `name` unless the biogeochemistry replicates it, and a carbonate system returns the `DIC`
of every replicate. The flux depends only on the sediment or the particles, so every replicate gets
the same flux and evolves exactly as the single system does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ali-ramadhan
ali-ramadhan requested a review from jagoosw October 27, 2026 04:30
`test_PISCES.jl` imports PISCES's `NitrateAmmonia` into `Main`, so in the full test suite the new
sediment test built its nutrients from PISCES's type and failed with a `MethodError`. `LOBSTER`
builds its own nutrients.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ali-ramadhan
ali-ramadhan added this pull request to stack #460 October 27, 2026 13:28

@jagoosw jagoosw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@ali-ramadhan

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @jagoosw! If it's okay with you I was hoping to wait until #456 and #459 have been approved before merging all three as a stacked PR.

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.

Sediment and particle couplings to :DIC don't work with replicated or relabelled carbonate tracers

2 participants