A convenience wrapper around ok_segment() for reservoirs with more
than two segments. Accepts a list of segment morphometry specifications and
runs them sequentially, passing each segment's outflow into the next.
Usage
ok_segment_chain(
inflow_m3yr,
tp_inflow_ugl,
tn_inflow_ugl = NULL,
segments,
coefficients = "walker",
ecoregion = NULL
)Arguments
- inflow_m3yr
Numeric. Total annual inflow (m\(^3\)/yr).
- tp_inflow_ugl
Numeric. Inflow TP (ug/L).
- tn_inflow_ugl
Numeric. Inflow TN (ug/L). Optional.
- segments
A list of named lists, one per segment, each containing:
labelCharacter. Segment name.
surface_area_haNumeric. Surface area (ha).
mean_depth_mNumeric. Mean depth (m).
outflow_m3yrNumeric. Outflow volume (m\(^3\)/yr). Optional; defaults to inflow.
- coefficients
Coefficient set applied to all segments. Default
"walker".- ecoregion
EPA Level III ecoregion. Applied to all segments.
Value
A named list of okBATHTUB objects at step "tsi",
one per segment, in downstream order. Names match the label
field of each segment specification.
Examples
segments <- list(
list(label = "riverine", surface_area_ha = 280, mean_depth_m = 3.1),
list(label = "transitional", surface_area_ha = 410, mean_depth_m = 4.5),
list(label = "lacustrine", surface_area_ha = 610, mean_depth_m = 5.8)
)
results <- ok_segment_chain(
inflow_m3yr = 45e6,
tp_inflow_ugl = 150,
tn_inflow_ugl = 2200,
segments = segments
)
# View trophic state of each segment
lapply(results, function(r) r$data$trophic_state)
#> $riverine
#> [1] "Eutrophic"
#>
#> $transitional
#> [1] "Eutrophic"
#>
#> $lacustrine
#> [1] "Mesotrophic"
#>