Skip to content

Improve Rainfall and Mass-Balance Precision - #49

Merged
lrntct merged 7 commits into
ItziModel:mainfrom
lrntct:test/rainfall-mass-balance-precision
Aug 13, 2026
Merged

Improve Rainfall and Mass-Balance Precision#49
lrntct merged 7 commits into
ItziModel:mainfrom
lrntct:test/rainfall-mass-balance-precision

Conversation

@lrntct

@lrntct lrntct commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Improves the numerical accuracy of rainfall, infiltration, and mass-balance reporting, with focused precision tests for float32 and float64 simulations.

Computational Changes

  • Raster volume reductions now use double-precision accumulation and cell-area calculations, reducing cancellation and rounding errors in mass totals.
  • Infiltration and user-defined losses are treated as candidate removal rates and capped together against the water available at the start of each hydrology event. The applied rates are reused by the surface solver, accumulators, output maps, and Green-Ampt state update.
  • Green-Ampt handling now supports the zero-cumulative-infiltration limit safely and commits only the infiltration that was actually applied.

Mass-Balance Output

MassBalanceData changes:

  • volume_error becomes created_volume: the nonnegative water volume introduced when a numerically negative calculated depth is clipped to zero.
  • percent_error becomes created_volume_ratio: the created volume divided by the signed domain-volume change.

MassBalanceData additions:

  • closure_residual: the signed difference between the observed domain-volume change and the sum of all reported signed volume terms.
  • relative_closure_error: the absolute closure residual normalized by the larger of the absolute volume change and total water throughput. It is a dimensionless relative error; a value of 0.001 corresponds to 0.1%.

These names distinguish numerical water creation from unexplained mass-balance closure.
The CSV mass-balance provider writes all real-valued fields, including ratios, as decimal values with up to 17 significant digits.
created_volume_ratio is reported as a dimensionless decimal ratio instead of percent in the CSV.

Arrays output

The array volume_error becomes created_volume.

Internal changes

ContinuityData changes:

  • volume_error becomes created_volume
  • continuity_error becomes created_volume_ration

@lrntct lrntct changed the title Test/rainfall mass balance precision rainfall/hydrology mass balance precision Jul 30, 2026
@lrntct lrntct added this to the Version 0.5.0 milestone Aug 12, 2026
@lrntct lrntct changed the title rainfall/hydrology mass balance precision Improve Rainfall and Mass-Balance Precision Aug 13, 2026
@lrntct
lrntct merged commit 7106488 into ItziModel:main Aug 13, 2026
9 checks passed
@lrntct
lrntct deleted the test/rainfall-mass-balance-precision branch August 13, 2026 18:04
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