Skip to contents

ok_load() is the entry point for the okBATHTUB pipeline. It accepts tributary hydraulic and nutrient loading data, validates inputs, resolves the coefficient set, and returns an okBATHTUB object ready to pass into ok_hydraulics().

All concentration inputs are volume-flow-weighted means representing the period of analysis (typically an annual or seasonal average). If multiple tributaries contribute to the reservoir, either aggregate them manually before calling ok_load(), or use ok_load_multi() to supply tributary data as a data frame.

Usage

ok_load(
  inflow_m3yr,
  tp_inflow_ugl,
  tn_inflow_ugl = NULL,
  tss_inflow_mgl = NULL,
  segment_label = "main",
  coefficients = "walker",
  ecoregion = NULL
)

Arguments

inflow_m3yr

Numeric. Total annual tributary inflow volume (m^3/yr). Must be positive.

tp_inflow_ugl

Numeric. Flow-weighted mean total phosphorus concentration of tributary inflow (ug/L). Must be non-negative.

tn_inflow_ugl

Numeric. Flow-weighted mean total nitrogen concentration of tributary inflow (ug/L). Optional. Default NULL.

tss_inflow_mgl

Numeric. Flow-weighted mean total suspended solids concentration (mg/L). Optional. Default NULL.

segment_label

Character. Optional label for this reservoir segment (e.g. "riverine", "lacustrine"). Default "main".

coefficients

One of "walker" (default, Walker BATHTUB Model 1), "vollenweider" (Vollenweider 1976 / Larsen-Mercier 1976), "oklahoma" (Walker Model 1 retention plus Oklahoma-specific Chl-a / Secchi regressions), or a named list of custom coefficients.

ecoregion

Character. EPA Level III ecoregion name (e.g. "Cross Timbers"). Used only when coefficients = "oklahoma"; silently ignored otherwise (with a message if the combination is suspicious). Default NULL.

Value

An okBATHTUB object at pipeline step "load".

Examples

# Minimum required inputs (TP only)
result <- ok_load(inflow_m3yr = 45e6, tp_inflow_ugl = 120)
print(result)
#> -- okBATHTUB Result --
#>   Pipeline step : load
#>   Segment       : main
#>   Coefficients  : walker
#> 
#>   inflow_m3yr    : 4.5e+07
#>   tp_inflow_ugl  : 120
#>   tp_load_kgyr   : 5400

# Full inputs with TN and TSS
result <- ok_load(
  inflow_m3yr    = 45e6,
  tp_inflow_ugl  = 120,
  tn_inflow_ugl  = 1800,
  tss_inflow_mgl = 35,
  segment_label  = "lacustrine"
)

# Oklahoma ecoregion-specific coefficients
result <- ok_load(
  inflow_m3yr   = 45e6,
  tp_inflow_ugl = 120,
  coefficients  = "oklahoma",
  ecoregion     = "Cross Timbers"
)