Simulation Example: Dissolved Oxygen


Lecture 07

September 18, 2024

Review of Last Class

Last Class

  • Model-based simulation as a way to understand system dynamics and response.
  • Box models: mass-balance in some region of the domain
  • Can generalize single box models by:
    • Adding more complexity;
    • combining multiple boxes.

Why Simulate?

  1. System involves complex, nonlinear dynamics that may not be analytically tractable.
  2. Setting up and running a real-world experiment is not possible.
  3. State depends on prior states or states of nearby locations, so need to iterate over multiple spatial or temporal steps.
  4. Need to understand range of system performance across rarely-seen conditions.

Questions

Poll Everywhere QR Code

Text: VSRIKRISH to 22333

URL: https://pollev.com/vsrikrish

See Results

Dissolved Oxygen Overview

Fate & Transport Modeling

How do nutrients and other quantities move through environmental mediums?

What can make fate & transport modeling more complex?

  • Multiple points of inflow;
  • More complex growth/decay dynamics.
  • Stochasticity/randomness.

Dissolved Oxygen

Dissolved oxygen (DO) is the free, non-compound oxygen present in water or other liquids.

Freshwater can only hold small amounts, and this capacity is regulated by temperature.

Dissolved Oxygen by temperature

Source: fondriest.com

Temperature Impact on DO

Dissolved Oxygen and Temperature Plot

Source: usgs.gov

Dissolved Oxygen and Life

Dissolved oxygen is an important nutrient for aquatic life.

Hypoxia occurs when DO levels are \(< 2\) mg/L.

Minimum DO requirements for freshwater fish

Source: fondriest.com

Factors Influencing DO

  • Temperature, Pressure, Depth
  • Salinity
  • Mixing
  • Plant and Microbial Life
  • Organic Matter

Impact of Paris On Seine DO, 1874

Dissolved Oxygen Downstream of Paris, 1874

Source: Dmitrieva, T., et al. (2018). https://doi.org/10.1007/s12685-018-0216-7

DO Regulatory Standards

Objective: Keep DO above the regulatory standard.

In NY (via Westlaw):

  • DO levels may not fall below 3 mg/L
  • DO may not be below 4.8 mg/L for an extended period

Modeling Dissolved Oxygen

Oxygen Balance in Rivers and Streams

Processes influencing oxygen balance in moving freshwater

Selecting a Metric for DO Fluxes

Typically use oxygen demand (OD):

  • measure of the concentration of oxidizable materials in a water sample
  • metric for organic waste contamination
  • reflects how oxygen will be depleted in a given segment

But there are several different processes affecting total OD!

Biochemical Oxygen Demand (BOD)

Oxygen used by microbes during aerobic decomposition of organic materials: \[\text{Organic Matter} + \text{O}_2 \rightarrow \text{CO}_2 + \text{H}_2\text{O} + \text{NO}_3 + \text{SO}_2 + \text{Residuals}\]

Broadly speaking, we care about two types of BOD: Carbonaceous BOD and Nitrogenous BOD.

Carbonaceous BOD (CBOD)

Oxygen consumed during microbial decomposition of carbon compounds, e.g.: \[\text{C}_a\text{H}_b\text{O}_c + d\text{O}_2 \rightarrow e\text{H}_2\text{O} + f\text{CO}_2\]

Nitrogenous BOD (NBOD)

Oxygen consumed during microbial decomposition of nitrogen compounds: \[2\text{NH}_2^+ + 4\text{O}_2 \rightarrow 2\text{H}_2\text{O} + 4\text{H}^+ + 2\text{NO}_3^-\]

BOD and Time

Moreover, BOD is differentiated based on time frame, e.g.:

  • BOD5: oxygen demand over 5 days
  • BOD20: oxygen demand over 20 days

DO Modeling Needs

Need a model that will predict DO as a function of CBOD, NBOD.

Use a fate and transport modeling approach: how are relevant quantities moved downstream?

Note: Can’t assume homogeneous processes.

Modeling DO

So what do we do?

Start by assuming steady-state waste in each section (or box…).

Processes influencing oxygen balance in moving freshwater

Modeling DO

We’ll track the mass balance in terms of rates (not absolute mass).

What happens to an element of water as it moves downstream?

Processes influencing oxygen balance in moving freshwater

Steady-State Waste, DO Mass Balance

Let \(U\) be the river velocity (km/d), \(x\) the distance downstream from a waste release site in km, and \(C(x)\) the DO concentration at \(x\) in mg/L.

\[\begin{align} U \frac{dC}{dx} &= \text{Change in DO} \\[0.5em] &= \text{Reaeration} + \text{Photosynthesis} - \text{Respiration} \\[0.5em] & \qquad - \text{Benthal Uptake} - \text{CBOD} - \text{NBOD} \end{align}\]

BOD Oxygen Uptake

Assume deoxygenation from waste decomposition is first-order (rate \(k\)):

\[\begin{aligned} \frac{dM}{dt} &= -kM \\ \Rightarrow M &= M_0 \exp(-kt) \end{aligned}\]

But our equations are formulated in terms of distance:

\[M = M_0 \exp(-kx/U)\]

BOD Oxygen Uptake

For biochemical organics, if \(k_c\) is the deoxygenation rate (d\(^{-1}\));

\[B(x) = B_0 \exp(-k_c x / U);\]

For nitrification, if \(k_n\) is the deoxygenation rate (d\(^{-1}\)):

\[N(x) = N_0 \exp(-k_n x / U).\]

Steady-State Waste, DO Mass Balance

So the corresponding oxygen uptake rates are \[k_c B(x) = k_c B_0 \exp(-k_c x / U)\] and

\[k_n N(x) = k_n N_0 \exp(-k_n x / U).\]

Steady-State Waste, DO Mass Balance

Other processes:

  • Reaeration, assume a simple linear model based on difference from saturation level \(C_s\): \(k_a (C_s - C)\)

  • Assume measured, constant values for photosynthesis (\(P_s\)), respiration (\(R\)), benthal uptake (\(S_B\))

Steady-State Waste, DO Mass Balance

Putting it all together:

\[ \begin{aligned} U \frac{dC}{dx} &= k_a (C_s - C) + P - R - S_B \\ &\quad - k_cB_0\exp\left(\frac{-k_cx}{U}\right) - k_n N_0\exp\left(\frac{-k_nx}{U}\right) \end{aligned} \]

Note: Usually models ignore \(P\), \(R\), and \(S_B\).

Why do you think that might be?

Steady-State Solution (Streeter-Phelps)

\[\begin{align} C(x) &= C_s(1 - \alpha_1) + C_0 \alpha_1 - B_0 \alpha_2 - N_0 \alpha_3 + \left(\frac{P-R-S_B}{k_a}\right) (1-\alpha_1), \\[1em] \alpha_1 &= \exp\left(-\frac{k_a x}{U}\right) \\[0.25em] \alpha_2 &= \left(\frac{k_c}{k_a-k_c}\right)\left[\exp\left(\frac{-k_c x}{U}\right) - \exp\left(\frac{-k_ax}{U}\right)\right] \\[0.25em] \alpha_3 &= \left(\frac{k_n}{k_a-k_n}\right)\left[\exp\left(\frac{-k_n x}{U}\right) - \exp\left(\frac{-k_ax}{U}\right)\right] \end{align}\]

Simulation Example

Single-Discharge Example

Consider a single waste release along a river:

Single-Discharge DO Setup

Single-Discharge Example

Parameter River Waste General
Volume (m3/d) 100,000 10,000
DO (mg/L) 6.4 4.2
CBOD (mg/L) 5 49
NBOD (mg/L) 5 27
\(C_s\) (mg/L) 7
\(k_a\), \(k_c\), \(k_n\) 0.6, 0.4, 0.25

Single-Discharge Example: Initial Condition

How do we find the initial state (\(x=0\))?

Need to compute the mixed concentrations of DO, CBOD, and NBOD (\(Q\) is the flow volume):

\[C_0 = C_\text{mixed} = \frac{C_\text{river} \times Q_\text{river} + C_\text{waste} \times Q_\text{waste}}{Q_\text{river} + Q_\text{waste}}\]

Single-Discharge Example: Initial Condition

So the initial values:

\[C_0 = 6.2 \ \text{mg/L}\]

\[B_0 = 9 \ \text{mg/L}\]

\[N_0 = 7 \ \text{mg/L}\]

Simulation Outputs (“Sag Curve”)

Code
function do_simulate(x, C0, B0, N0, ka, kn, kc, Cs, U)
    B = B0 * exp(-kc * x / U)
    N = N0 * exp(-kn * x / U)
    α1 = exp(-ka * x / U)
    α2 = (kc/(ka-kc)) * (exp.(-kc * x / U) - exp(-ka * x / U))
    α3 = (kn/(ka-kn)) * (exp(-kn * x / U) - exp(-ka * x / U))
    C = Cs * (1 - α1) + (C0 * α1) - (B0 * α2) - (N0 * α3)
    return (C, B, N)
end  

# set river properties
ka = 0.6
kc = 0.4
kn = 0.25

C0 = 6.2
B0 = 9
N0 = 7

Cs = 7
U = 5

x = 0:40

# evaluate model over all x's
# this uses broadcasting
do_out = (y -> do_simulate(y, C0, B0, N0, ka, kc, kn, Cs, U)).(x)
# unpack outputs into individual arrays for C, B, and N
# this uses comprehensions to pull out the relevant components 
#of the tuples that our function outputs
C = [d[1] for d in do_out]
B = [d[2] for d in do_out]
N = [d[3] for d in do_out]

# plot outputs
p1 = plot(; ylabel="DO/OD (mg/l)", xlabel="Distance (km)", left_margin=8mm, top_margin=10mm, guidefontsize=18, legendfontsize=16, tickfontsize=16, legend=:outerright, bottom_margin=10mm)
plot!(p1, x, C, color=:black, linewidth=4, label="DO")
plot!(p1, x, B, color=:green, label="CBOD", linestyle=:dash, linewidth=3)
plot!(p1, x, N, color=:blue, label="NBOD", linestyle=:dash, linewidth=3)
# plot Cs, which is a constant value 
plot!(p1, x, Cs * ones(length(x)), color=:purple, label=L"C_s", linestyle=:dot, linewidth=2)

hline!([3], color=:red, linewidth=2, label="Regulatory Standard")
plot!(size=(1200, 450))
xaxis!((0, 40))
Figure 1: Sag curve for dissolved oxygen

Multiple Discharges

What happens if we have multiple discharge sites?

Schematic for Multiple Discharge Example

Simulating Multiple Discharges

Think of this as a multi-box system.

  1. Flow from waste release 1 to waste release 2.
  2. Flow from waste release 2 on.

Schematic for Multiple Discharge Example

How do we compute the initial conditions at release 2?

Who is Responsible for Non-Compliance?

Figure 2: Multi-Release Dissolved Oxygen Example

Key Points

Key Points

  • Dissolved oxygen (DO) is essential for water quality and aquatic life.
  • Commonly regulated to keep DO above a minimum threshold.
  • DO impacted by a number of factors, notably organic waste decomposition and nitrification.
  • “Sag Curve”: DO reduced near a discharge until waste decomposition reduces OD and re-aeration can occur.

Upcoming Schedule

Next Classes

Next Week: Uncertainty and Monte Carlo

Assessments

Exercises: Due Monday before class.