Email: jva5648@psu.edu
This R package, fwoxy, is a simple forward oxygen mass balance model that predicts the oxygen concentration of a well-mixed water column given the initial conditions and forcings. The primary use of this model is as a lab component for a marine biogeochemistry course to further understanding of biogeochemical and physical processes that influence ecosystem metabolism.
The development version of this package can be installed from Github:
install.packages('devtools')
library(devtools)
devtools::install_github('jmarriola/fwoxy')
There are six functions included in this package:
- fun_density.R - Calculates the density of seawater.
- fun_eqb_oxygen.R - Determines the oxygen equilibrium between the water column and air.
- fun_gas_transfer_velocity.R - Estimates the gas transfer velocity across the air-sea interface.
- fun_par_sin_model.R - Creates the PAR signal using a sin wave model.
- fun_schmidt_oxygen.R - Determines the Schmidt number, a unitless number used in calculating gas transfer velocity.
- fwoxy.R - The main function which sources the prior listed functions and runs the forward oxygen model.
Note: Functions 1 - 5 are sourced by the fwoxy.R function and do not need to be called separately. These functions should not be modified on their own.
Before identifying parameters for the model, load fwoxy for fwoxy.R to run:
library(fwoxy)
First, set the initial concentration of oxygen in the water column (oxy_ic). Next, set the parameters of the light efficiency (a_param) and ecosystem respiration (er_param). Equilibrium values for oxy_ic, a_param, and er_param are 250 (mmol/m3), 0.2 ((mmol/m3)/day)/(W/m2)), and 20 (mmol/m3/day), respectively.
# Set model parameters
oxy_ic <- 250 # (mmol/m^3), initial oxygen concentration
a_param <- 0.2 # ((mmol/m^3)/day)/(W/m^2), light efficiency
er_param <- 20 # (mmol/m^3/day), ecosystem respiration
Finally, set the forcings of the model. Currently, the model only accepts a constant value for each of the forcings. The forcings are depth of the well-mixed water column (ht_const), salinity (salt_const), water temperature (temp_const), and windspeed at 10 m height (wspd_const). Equilibrium values for ht_const, salt_const, temp_const, and wspd_const are 3 (m), 25 (ppt), 25 (deg C), and 3 (m/s), respectively.
# Constant Forcings
ht_const <- 3 # m, height of the water column
salt_const <- 25 # ppt, salinity
temp_const <- 25 # deg C, water temperature
wspd_const <- 3 # m/s, wind speed at 10 m
Although atmospheric pressure is used to calculate seawater density, in this forward model the atmospheric pressure is not defined by the user and is pre-set to 0 in the functions.
Recommendations for the ranges of the input parameters and forcings and their equilibrium values (listed below) are based on the minimum and 95th percentile values from data collected at the Cat Point Apalachicola Bay, Florida, NERR station from the year 2012.
Input | Min | Max | Equilibrium |
---|---|---|---|
oxy_ic | 100 | 300 | 250 |
a_param | 0.1 | 1.0 | 0.2 |
er_param | 0 | 80 | 20 |
ht_const | 0.5 | 5.0 | 3.0 |
salt_const | 5 | 35 | 25 |
temp_const | 15 | 30 | 25 |
wspd_const | 0 | 6 | 3 |
Once the inputs of the parameters and the forcings are set, you can now run the model. Before running the model select a unique name so that you can easily identify the results of this specific run. This object will store the results of the model outputs (here, example is used as the object). To include the argument values set for the constant parameters and forcings, you must call them in the function as shown here:
example <- fwoxy(oxy_ic = oxy_ic, a_param = a_param, er_param = er_param,
ht_in = ht_const, salt_in = salt_const, temp_in = temp_const,
wspd_in = wspd_const)
The forward model will output a data frame to the R environment that can be saved as a .csv file in the working directory using the following code:
write.csv(example, "example.csv", row.names = FALSE)
In addition to the data frame, the fwoxy function will create two plots in the Plots view in RStudio (see examples below). The top figure is the forward oxygen concentration time series versus time. This plot illustrates how the dissolved oxygen concentration (mmol/m3) in the water column will change due to the parameters and forcings of the model. The bottom figure is a plot of daily fluxes (mmol/m3/day) of the time rate of change of oxygen (dcdtd), the ecosystem respiration (erd), the gas exchange (gasexd), and the gross primary productivity (gppd) versus time. Neither of these plots will be automatically output to the working drive and will need to be saved by the user.