solveresid_o3: Determine ozone decay

View source: R/solveresid_o3.R

solveresid_o3R Documentation

Determine ozone decay

Description

This function applies the ozone decay model to a water from U.S. EPA (2001) equation 5-128. For a single water, use solveresid_o3; to apply the model to a dataframe, use solveresid_o3_once. For most arguments, the ⁠_once⁠ helper "use_col" default looks for a column of the same name in the dataframe. The argument can be specified directly in the function instead or an unquoted column name can be provided.

Usage

solveresid_o3(water, dose, time)

solveresid_o3_once(
  df,
  input_water = "defined_water",
  output_column = "o3resid",
  dose = "use_col",
  time = "use_col"
)

Arguments

water

Source water object of class water created by define_water

dose

Applied ozone dose in mg/L

time

Ozone contact time in minutes

df

a data frame containing a water class column, which has already been computed using define_water_chain

input_water

name of the column of Water class data to be used as the input for this function. Default is "defined_water".

output_column

name of the output column storing doses in mg/L. Default is "dose_required".

Value

solveresid_o3 returns a numeric value for the residual ozone.

solveresid_o3_once returns a data frame containing the original data frame and columns for ozone dosed, time, and ozone residual.

Source

U.S. EPA (2001)

See reference list at: https://github.com/BrownandCaldwell-Public/tidywater/wiki/References

Examples

ozone_resid <- define_water(7, 20, 100, doc = 2, toc = 2.2, uv254 = .02, br = 50) %>%
  solveresid_o3(dose = 2, time = 10)

library(dplyr)
ozone_resid <- water_df %>%
  mutate(br = 50) %>%
  define_water_chain() %>%
  solveresid_o3_once(dose = 2, time = 10)

ozone_resid <- water_df %>%
  mutate(br = 50) %>%
  define_water_chain() %>%
  mutate(
    dose = seq(1, 12, 1),
    time = seq(2, 24, 2)
  ) %>%
  solveresid_o3_once()


tidywater documentation built on Aug. 8, 2025, 7:15 p.m.