Skip to content

SIP310 Implement H2O mass-balance checking - #343

Open
ANAMASGARD wants to merge 1 commit into
PecanProject:masterfrom
ANAMASGARD:310-h2o-balance-check
Open

ANAMASGARD wants to merge 1 commit into
PecanProject:masterfrom
ANAMASGARD:310-h2o-balance-check

Conversation

@ANAMASGARD

@ANAMASGARD ANAMASGARD commented May 27, 2026 •

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 pool — ctx.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

Copilot AI review requested due to automatic review settings May 27, 2026 13:00
@dlebauer dlebauer changed the title Implement H2O mass-balance checking SIP310 Implement H2O mass-balance checking May 29, 2026
@Alomir

Alomir commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

testBalance overall still fails due to a pre-existing carbon balance delta (deltaC ≈ 610 g C/m²), unrelated to this PR. Water checks pass.

@ANAMASGARD Can you say more about this? I don't see the failure.

@ANAMASGARD

ANAMASGARD commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@Alomir sorry for the confusion, and also sorry my previous reply missed your actual question entirely (I answered the wrong thing).

You're right that you don't see the failure - because it wasn't a real pre-existing issue. That note was based on a testBalance failure I saw only in my local environment before syncing with master. After merging master, it disappeared completely and all tests pass cleanly in CI. I can't reproduce it anymore either.

It was likely a stale local build artifact rather than an actual code issue. I've removed that checkbox from the PR description to avoid further confusion.

Track soilWater + snow, compare pool change against external water fluxes,
log warnings on failure, and expose bcdeltaC/bcdeltaN/bcdeltaW in sipnet.out.
Extends testBalance and smoke baselines. Closes PecanProject#310.
@ANAMASGARD
ANAMASGARD force-pushed the 310-h2o-balance-check branch from 0c45e84 to 3ed9827 Compare August 19, 2026 07:08

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.

Implement H2O balance checking

2 participants