Skip to content

SIP310 Implement H2O mass-balance checking#343

Open
ANAMASGARD wants to merge 2 commits into
PecanProject:masterfrom
ANAMASGARD:310-h2o-balance-check
Open

SIP310 Implement H2O mass-balance checking#343
ANAMASGARD wants to merge 2 commits into
PecanProject:masterfrom
ANAMASGARD:310-h2o-balance-check

Conversation

@ANAMASGARD
Copy link
Copy Markdown
Contributor

FIXES #310

Summary

Implements water mass-balance checking following the same framework as PR #248 (carbon/nitrogen):

  • Tracks soilWater + snow each timestep (pre-update → post-update → post-clamp)
  • Compares pool change against external water fluxes (rain, snowfall, irrigation, transpiration, evaporation, sublimation, drainage, fast flow)
  • Logs a warning when deltaWater exceeds tolerance (EPS)
  • Adds bcdeltaC, bcdeltaN, and bcdeltaW columns to sipnet.out
  • Extends testBalance with checkWater() and updates smoke baselines

Design notes

  • No leaf-water poolctx.leafWater only caps immedEvap; excess interception goes to soil via netRain
  • snowMelt excluded — internal transfer (snow → soil), not external I/O
  • eventEvap on both sides — gross irrigation enters the system (input) and the evaporated portion leaves immediately (output); net soil addition is eventSoilWater

Test plan

  • make testbuild — builds successfully
  • Water balance closes: bcdeltaW = 0.00000 in smoke output; zero "Water balance check failed" warnings
  • checkWater() passes in all testBalance subtests
  • make smoke — passes after baseline update
  • testBalance overall still fails due to a pre-existing carbon balance delta (deltaC ≈ 610 g C/m²), unrelated to this PR. Water checks pass.

Mirror the PR PecanProject#248 balance framework for H2O: track soilWater and snow,
compare timestep change against external water fluxes, and log warnings
when conservation fails. Expose bcdeltaC, bcdeltaN, and bcdeltaW in
sipnet.out; extend testBalance and smoke baselines accordingly.
Closes PecanProject#310
Copilot AI review requested due to automatic review settings May 27, 2026 13:00
Regenerate sipnet.out and russell_1/events.out after make clean so CI
smoke tests agree with freshly built binaries. Removes stale reference
values and accidental events.out drift from the initial baseline update.
@dlebauer dlebauer changed the title Implement H2O mass-balance checking SIP310 Implement H2O mass-balance checking May 29, 2026
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.

Implement H2O balance checking

1 participant