Last active
August 9, 2016 11:38
-
-
Save TonyLadson/2e1dd2f106e2a665bc9b0008f91870fa to your computer and use it in GitHub Desktop.
Function to calculate 100% saturated dissolved oxygen in mg/L as a function of temperature in degrees Celcius
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to calculate 100% saturated dissolved oxygen 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 | |
DOsat100 = exp(-C1 + C2/Ta - C3/(Ta^2) + C4/(Ta^3) - C5/(Ta^4)) | |
return ( DOsat100) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment