Skip to content

Comments

Mass-conservative interpolation and per-reach retention#137

Merged
taddyb merged 9 commits intoDeepGroundwater:masterfrom
taddyb:mass_balance
Feb 22, 2026
Merged

Mass-conservative interpolation and per-reach retention#137
taddyb merged 9 commits intoDeepGroundwater:masterfrom
taddyb:mass_balance

Conversation

@taddyb
Copy link
Collaborator

@taddyb taddyb commented Feb 21, 2026

Summary

  • Mass-conservative interpolation: Replaced nearest-neighbor daily→hourly q_prime interpolation with linear interpolation + per-day rescaling that exactly preserves daily mass balance. Hourly values now ramp smoothly between daily values, giving Manning's n, retention, and leakance different conditions each hour instead of 24 identical copies.
  • Per-reach retention (linear reservoir): Added a post-MC-solve retention mechanism where each reach can capture a fraction alpha of routed discharge into storage and release accumulated storage at rate (1-alpha). Alpha is learned by the KAN (initialized near zero via off_parameters bias = -2.0). Controlled by use_retention config flag.
  • KAN off_parameters: New initialization mode that sets output bias to -2.0 (sigmoid ≈ 0.12), so parameters default to near-zero without binary gating. Unlike gate_parameters, these remain continuous.

Test plan

  • 265-line test suite for mass_conservative_rescale covering daily mean preservation, volume conservation, within-day variability, edge cases, and full roundtrip (daily → hourly → downsample → daily)
  • Integration test updated with use_retention=True and off_parameters=["alpha"]
  • Verify retention storage logging in training output
  • Run benchmark on HPC to confirm mass balance improvement

🤖 Generated with Claude Code

@taddyb taddyb merged commit 63bdabc into DeepGroundwater:master Feb 22, 2026
4 checks passed
@taddyb taddyb deleted the mass_balance branch February 22, 2026 02:09
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