Skip to content

fixed ponded head mass balance accounting error for when conceptual r… - #58

Merged
peterlafollette merged 1 commit into
NOAA-OWP:masterfrom
peterlafollette:PTL_fix_ponded_head_mass_bal_accounting
Jun 14, 2026
Merged

fixed ponded head mass balance accounting error for when conceptual r…#58
peterlafollette merged 1 commit into
NOAA-OWP:masterfrom
peterlafollette:PTL_fix_ponded_head_mass_bal_accounting

Conversation

@peterlafollette

@peterlafollette peterlafollette commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

…eservoir is enabled and ponded head is allowed to be greater than 0

When a nonlinear reservoir is enabled and ponded_depth_max is set to greater than 0, fixed mass balance accounting.

To reproduce old error:
Change configs/config_lasam_Bushland.txt such that:

mbal_tol=0.001
ponded_depth_max=2[cm]

you will get a mass balance error. In the new branch you will not.

There are no changes to the simulated wetting fronts or model outputs, this fix is purely a mass balance accounting error. (You can actually see this in the identical model summaries if you leave out the mbal_tol line in the config.) So both the old and new simulations should be the same except for the substep mass balance accounting.

In particular, what was going wrong:

When ponded_depth_max > 0, ponded water can be carried into the next substep as volon_timestep_cm. If preferential flow to the conceptual reservoir is active on that substep, the code partitions both precipitation and existing ponded water: a fraction is routed to the conceptual reservoir, and volon_timestep_cm is reduced to the fraction that remains on at the surface. So far so good.

The issue: the old local mass balance check used this already-reduced volon_timestep_cm as the initial ponded water storage term, meaning it missed the fraction that went to the reservoir. So it undercounted the water present at the start of the substep, while the conceptual reservoir storage/outflow terms still accounted for the fraction routed to the reservoir. As a result, the model could report a false substep mass balance error and abort.

Additions

Removals

Changes

Testing

Screenshots

Notes

Todos

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Windows
  • Linux
  • Browser

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

@ajkhattak ajkhattak 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.

looks good.

…eservoir is enabled and ponded head is allowed to be greater than 0
@peterlafollette
peterlafollette force-pushed the PTL_fix_ponded_head_mass_bal_accounting branch from bf448ca to 45c0cf2 Compare June 13, 2026 20:10
@peterlafollette
peterlafollette merged commit 50f9972 into NOAA-OWP:master Jun 14, 2026
4 checks passed
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.

2 participants