Oklahoma-BATHTUB

okBATHTUB

Empirical reservoir eutrophication modelling in R.

okBATHTUB implements steady-state water quality predictions for reservoirs using the Walker BATHTUB Model 1 (second-order available-phosphorus sedimentation) as the default retention model, with the simpler Vollenweider (1976) / Larsen-Mercier (1976) form available as an alternative. The package predicts in-lake total phosphorus, total nitrogen, chlorophyll-a, and Secchi depth from tributary nutrient and hydraulic loading inputs, and computes Carlson (1977) Trophic State Indices.

Optional Oklahoma-specific chlorophyll-a and Secchi regression coefficients are bundled, calibrated from publicly available state lake monitoring data, but the package is fully usable for reservoirs anywhere.

okBATHTUB is designed to complement watershed loading models such as SWAT and HAWQS in a two-model nutrient management workflow.

Installation

# install.packages("remotes")
remotes::install_github("0011235813/Oklahoma-BATHTUB", subdir = "okBATHTUB")

Documentation site: https://0011235813.github.io/Oklahoma-BATHTUB/

Quick start

library(okBATHTUB)

result <- ok_load(
    inflow_m3yr   = 45e6,      # tributary inflow
    tp_inflow_ugl = 120,       # flow-weighted mean TP
    tn_inflow_ugl = 1800       # flow-weighted mean TN
  ) |>
  ok_hydraulics(
    surface_area_ha = 890,     # normal pool surface area
    mean_depth_m    = 4.2      # mean depth at normal pool
  ) |>
  ok_retention() |>            # Walker BATHTUB Model 1
  ok_inlake()    |>            # Mass balance + Chl-a + Secchi
  ok_tsi()                     # Carlson Trophic State Index

summary(result)

Three retention model families

Set Retention Chl-a / Secchi
"walker" (default) Walker BATHTUB Model 1 Walker (1985) national
"vollenweider" Vollenweider/Larsen-Mercier (= BATHTUB Model 5) Walker (1985) national
"oklahoma" Walker BATHTUB Model 1 Oklahoma ecoregion-specific

The default is Walker Model 1 because it is the canonical default of the BATHTUB program and is calibrated to U.S. Army Corps of Engineers reservoir data, which matches the management context for most U.S. reservoirs. Vollenweider / Larsen-Mercier is provided for users who want a parsimonious single-parameter retention model when ortho-P / total-P partitioning is unknown.

Pipeline functions

Function Purpose
ok_load() Assemble tributary load inputs
ok_load_multi() Aggregate multiple tributaries automatically
ok_hydraulics() Add reservoir morphometry; compute residence time
ok_retention() TP / TN retention coefficients
ok_inlake() Mass balance, chlorophyll-a, Secchi depth
ok_tsi() Carlson Trophic State Indices
ok_segment() / Multi-segment reservoir modelling
ok_segment_chain()  
ok_scenario() / Load reduction scenario analysis
ok_scenario_sweep()  
ok_reservoir() / Look up Oklahoma reservoir morphometry
ok_reservoirs Bundled dataset (40 reservoirs, 7 ecoregions)
ok_lake_ecoregion() / Look up an Oklahoma lake’s EPA L3 ecoregion
ok_lake_ecoregions Bundled dataset (214 lakes, ecoregion + monitoring)
ok_plot_response() / Visualizations (require ggplot2)
ok_plot_scenario() /  
ok_plot_segments() /  
ok_plot_tsi()  

Vignettes

Caveats

Origin and independence

okBATHTUB was developed independently by Jordon Henderson on personal time and personal equipment. It is released under the MIT license as personal-capacity open-source research software. It is not a product of, sponsored by, or affiliated with any employer or government agency, and does not represent or imply endorsement by any agency. All data used to calibrate the bundled Oklahoma coefficients are publicly available state monitoring data.

References

License

MIT © 2026 Jordon Henderson.