Skip to content

Instantly share code, notes, and snippets.

@TonyLadson
Created August 14, 2016 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TonyLadson/0c7e24d110da3bf3df7d5bf62304a5df to your computer and use it in GitHub Desktop.
Save TonyLadson/0c7e24d110da3bf3df7d5bf62304a5df to your computer and use it in GitHub Desktop.
Function to calculate 100% saturated dissolved oxygen in water in mg/L as a function of temperature in degrees Celcius
# Function to calculate 100% saturated dissolved oxygen in water in mg/L as a function of temperature in degrees Celcius
Calc_DOsat100 = function(temp){
# temp = temperature in degrees C
# relationship between temperature and dissolved oxygen as defined by the APHA
# American Public Health Association (1992)
# Standard methods for the examination of water and wastewater. 18th ed. Washington DC.
# Required constants
C1 = 139.34411
C2 = 1.575701e+5
C3 = 6.642308e+7
C4 = 1.243800e+10
C5 = 8.621949e+11
Ta =temp + 273.15
exp(-C1 + C2/Ta - C3/(Ta^2) + C4/(Ta^3) - C5/(Ta^4))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment