fixed ponded head mass balance accounting error for when conceptual r… - #58
Merged
peterlafollette merged 1 commit intoJun 14, 2026
Conversation
21 tasks
…eservoir is enabled and ponded head is allowed to be greater than 0
peterlafollette
force-pushed
the
PTL_fix_ponded_head_mass_bal_accounting
branch
from
June 13, 2026 20:10
bf448ca to
45c0cf2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.001ponded_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 asvolon_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, andvolon_timestep_cmis 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_cmas 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
Testing checklist
Target Environment support
Accessibility
Other