BEE 4750 Homework 3: Dissolved Oxygen and Monte Carlo

Published

October 2, 2024

Due Date

Thursday, 10/03/23, 9:00pm

If you are enrolled in the course, make sure that you use the GitHub Classroom link provided in Ed Discussion, or you may not be able to get help if you run into problems.

Otherwise, you can find the Github repository here.

Overview

Instructions

  • Problem 1 asks you to implement a model for dissolved oxygen in a river with multiple waste releases and use this to develop a strategy to ensure regulatory compliance.
  • Problem 2 asks you to use Monte Carlo simulation to assess how well your strategy from Problem 1 performs under uncertainty.
  • Problem 3 (5750 only) asks you to identify where a third discharge should be placed to maintain regulatory compliance.

Load Environment

The following code loads the environment and makes sure all needed packages are installed. This should be at the start of most Julia scripts.

import Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
using Random
using Plots
using LaTeXStrings
using Distributions
using CSV
using DataFrames

Problems (Total: 50/60 Points)

Problem 1 (30 points)

A river which flows at 6 km/d is receiving waste discharges from two sources which are 15 km apart. The oxygen reaeration rate is 0.55 day-1, and the decay rates of CBOD and NBOD are are 0.35 and 0.25 day-1, respectively. The river’s saturated dissolved oxygen concentration is 10m g/L.

If the characteristics of the river inflow and waste discharges are given in Table 1, write a Julia model to compute the dissolved oxygen concentration from the first wastewater discharge to an arbitrary distance d km downstream. Use your model to compute the minimum dissolved oxygen concentration up to 50 km downstream and how far downriver this maximum occurs.

Table 1: River inflow and waste stream characteristics for Problem 1.
Parameter River Inflow Waste Stream 1 Waste Stream 2
Inflow 100,000 m3/d 10,000 m3/d 15,000 m3/d
DO Concentration 7.5 mg/L 5 mg/L 5 mg/L
CBOD 5 mg/L 50 mg/L 45 mg/L
NBOD 5 mg/L 35 mg/L 35 mg/L

In this problem:

  • Plot the dissolved oxygen concentration from the first waste stream to 50 km downriver. What is the minimum value in mg/L?
  • What is the minimum level of treatment (% removal of organic waste) for waste stream 1 that will ensure that the dissolved oxygen concentration never drops below 4 mg/L, assuming that waste stream 2 remains untreated? How about if only waste stream 2 is treated?
  • Suppose you are responsible for designing a waste treatment plan for discharges into the river, with a regulatory mandate to keep the dissolved oxygen concentration above 4 mg/L. Discuss whether you’d opt to treat waste stream 2 alone or both waste streams equally. What other information might you need to make a conclusion, if any?

Problem 2 (20 points)

The simplest climate model involves capturing changes to the Earth’s energy budget (it is commonly called the energy balance model, or EBM). These changes are also called radiative forcings (RF), and can result from several causes, including greenhouse gas emissions, volcanic eruptions, and changes to the solar cycle. The EBM treats the Earth as a 0-dimensional sphere covered with water, which absorbs heat in response to radiative forcings. Chanwith global temperature changes resulting from imbalances in the average (over the entire surface area) heat flux.

The EBM equations are:

\[ \begin{aligned} \overbrace{\frac{dH}{dt}}^{\text{change in heat}} &= \overbrace{F}^{\substack{\text{radiative} \\ \text{forcing}}} - \overbrace{\lambda T}^{\substack{\text{change in} \\ \text{temperature}}} \\ \underbrace{C}_{\substack{\text{ocean heat} \\ \text{capacity}}} \frac{dT}{dt} &= F - \lambda T \\ c\underbrace{d}_{\substack{\text{ocean} \\ \text{mixing depth}}} \frac{dT}{dt} &= F - \lambda T, \end{aligned} \]

where \(c = 4.184\times 10^6 \mathrm{J/K/m}^2\) is the specific heat of water per area, \(d\) is the depth of the ocean mixed layer (we’ll assume \(d = 86 \mathrm{m}\)), and \(\lambda\) is the climate feedback factor and controls how much the Earth warms in response to increased radiative forcing (assume \(\lambda = 2.1^\circ \mathrm{C}/(\mathrm{W}/\mathrm{m}^2\))). The total radiative forcing \(F = F_\text{non-aerosol} + \alpha F_\text{aerosol}\), where \(\alpha\) is an uncertain scaling factor reflecting aerosol-cloud feedbacks (we’ll assume \(\alpha = 0.8\)).

The code below loads historical and projected radiative forcings (under the SSP5-8.5 future emissions scenario, which is the most extreme of the scenarios used to project climate change impacts) from data/ERF_ssp585_1750-2500.csv into a DataFrame object and calculates the non-aerosol and aerosol components of those forcings.

Look closely at and experiment with the code below: DataFrames are a common Julia datatype for tabular data, and you may work more with them later in the semester or beyond! They are broadly similar to DataFrames from pandas in Python.

# Dataset from https://zenodo.org/record/3973015
# The CSV is read into a DataFrame object, and we specify that it is comma delimited
forcings_all = CSV.read("data/ERF_ssp585_1750-2500.csv", DataFrame, delim=",")

# Separate out the individual components
# Get total aerosol forcings
forcing_aerosol_rad = forcings_all[!,"aerosol-radiation_interactions"]
forcing_aerosol_cloud = forcings_all[!,"aerosol-cloud_interactions"]
forcing_aerosol = forcing_aerosol_rad + forcing_aerosol_cloud
# Calculate non-aerosol forcings from the total.
forcing_total = forcings_all[!,"total"]
forcing_non_aerosol = forcing_total - forcing_aerosol

We can plot the aerosol and non-aerosol forcings below.

t = Int64.(forcings_all[!,"year"]) # Ensure that years are interpreted as integers
p_forcing = plot(; xlabel="Year", ylabel="Radiative Forcing (W/m²)")
plot!(p_forcing, t, forcing_aerosol, label="Aerosol Forcing", color=:blue, linewidth=2)
plot!(p_forcing, t, forcing_non_aerosol, label="Non-Aerosol Forcing", color=:red, linewidth=2)

In this problem:

  • Discretize the EBM to produce a simulation model of global mean temperatures \(T\) over time as a result of total radiative forcings \(F\).

  • Simulate global mean temperature anomalies (in \(^\circ C\) relative to 1750) from your model using the historical and SSP5-8.5 radiative forcing data. Use an annual time step for the simulation (in seconds: \(\Delta t = 31,558,152 \mathrm{s}\)). You can assume \(T(0) = 0^\circ C\). Plot the resulting temperature simulation.

  • The climate feedback factor \(\lambda\) is one of the key uncertainties in projecting future temperatures, even assuming a particular scenario of future radiative forcing. Suppose we use the following distribution for \(\lambda\), \[\lambda \sim \text{LogNormal}(\log(2.1), \log(2)/4).\]

    Use Monte Carlo simulation to estimate the expected temperature in 2100 assuming SSP5-RCP 8.5 radiative forcings (with 95% confidence intervals). How does this estimate compare to the value you got from your simulation using the expected value of \(\lambda=2.1^\circ \mathrm{C}/(\mathrm{W}/\mathrm{m}^2)\)? How did you decide your sample set was sufficient?

Problem 3 (10 points)

This problem is only required for students in BEE 5750.

A factory is planning a third wastewater discharge into the river downstream of the second plant. This discharge would consist of 5 m3/day of wastewater with a dissolved oxygen content of 4.5 mg/L and CBOD and NBOD levels of 50 and 45 mg/L, respectively.

In this problem:

  • Assume that the treatment plan you identified in Problem 1 is still in place for the existing discharges. If the third discharge will not be treated, under the original inflow conditions (7.5 mg/L DO), how far downstream from the second discharge does this third discharge need to be placed to keep the river concentration from dropping below 4 mg/L?

References

List any external references consulted, including classmates.