Carbonate Calculator Version 1.0
Carbonate Calculator Version 1.0
Data required:-
(a) pH of sample when collected,
(b) temperature in celcius of the sample when collected,
(c) salinity in parts per thousand,
and either,
(d) total alkalinity determined by titration in natural waters"
Version (d) works out the total inorganic carbon (TIC) from the
total alkalinity (mol m-3) at a given salinity (o/oo) and
temperature (in celcius). The algorithms are from Ostrom B., 1975. An
algorithm for the Computation of Primary Production. Botanica Marina 17:
20 - 22. Borate alkalinity is subtracted to give Carbonate Alkalinity.
Version (e) can be used to calculate the carbonate system in
artificial media with a known addition of inorganic carbon to TIC-free media.
The amount of borate in the medium is then not relevant as it is not used in
the calculations. The program is not suitable for media of high ionic stength
with an ionic composition greatly different to seawater.
The formulae are from Vollenweider, R.A. (1974) 'Primary production
in aquatic environments', IBP Handbook No 12, Blackwell Scientific Publ. Pp
54 - 59 and Golterman, H.L., Clymo, R.S. & Ohnstad, M.A.M. (1978) 'Methods for
Physical & Chemical Analysis of Fresh Waters', IBP Handbook No 8, Blackwell
Scientific Publ., pp 58 - 64 & 186 - 194. Remember that carbonate ion is
counted twice in carbonate alkalinity values.
The methods described by Strickland, J.D.H. & Parsons, T.R. (1968) 'A
Practical Handbook of Seawater Analysis' Bull. Fish. Res. Bd Can. 167 only
apply to seawater and a limited range of salinities.
Limitations of program:
* will not work for salinities greater than about 38 o/oo
* not reliable for temperatures greater than 40 oC but can be used
for frigid seawater down to -4 oC.
The atmospheric CO2 value is based on an excponential fit to
average CO2 at Mona Loa to 2009.
pK (borate)
8.66763529
Kborate
2.14963E-09
Borate Alkalinity (mM or mol m-3)
0.10521717
±95% conf.
0.00089823
18.5364594
2.30348436
1.31E-127
biophysics:
CLEAR
REM 960419
REM must use long adress mode
CALL TEXTFONT (3):REM this sets the type to GENEVA
CLS:
carbonate:
CLS:
DEFDBL A-zzz
PRINT "CARBONATE SYSTEMS"
PRINT
PRINT "Data required:-"
PRINT" (a) pH of sample when collected,
PRINT " (b) temperature in celcius of the sample when collected,
PRINT" (c) salinity or chlorinity in parts per thousand,
PRINT " and either,"
PRINT " (d) total alkalinity determined by titration in natural waters"
PRINT " or (e) total inorganic carbon added to CO2-free water."
PRINT "Do you want to read the documentation ?"
GOSUB replies:
IF Q$ = "Y" THEN GOSUB carbonatedocumentation:
CLS:PRINT "CARBONATE SYSTEMS"
REM The formulae for the dissociation constants are from Ostrom 1974 & 1977
DEC = 1E+07
REM calculation of CO2, HCO3 and CO3 of water at various pH and salinity
GOSUB pK1pK2:
carbonate1:
PRINT "Enter pH =";
GOSUB carbsign:
pH=X
IF pH>14 THEN carbonate1:
H = 10^(-pH)
OH=10^(pH-14)
TIC=0
ps=260
BUTTON 1,1, "Total Alkalinity",(10,ps)-(150,ps+20),1
BUTTON 2,1, "Known Addition of Total Inorganic Carbon",(160,ps)-(450,ps+20),1
WHILE DIALOG(0) <>1:WEND
buttonpushed = DIALOG(1)
BUTTON CLOSE 0
IF buttonpushed = 1 THEN TIC=0
IF buttonpushed = 2 THEN TIC=1
IF TIC=0 THEN PRINT "Enter Total Alkalinity (in mol m-3) = ";:GOSUB carbsign:TA=X
IF TIC=1 THEN PRINT "Enter Total Inorganic Carbon Added to System (in mol m-3) = ";:G
carbonate2:
CLS:
REM calculate bunsen coefficient (Ko) for CO2 for pure or saltwater
lnKo = -58.0931 + 90.5069*(100/TABS) + 22.294*LOG (TABS/100) + S*(.027766 -.0258
Ko = EXP(lnKo)
REM salinity correction SalCF
salCF = (Ko-Cl*EXP(58.68995-11.768*LOG(TABS)))/Ko
REM ratio of molecular weight to volume for CO2 is 1.97681
REM one mole of CO2 at STP occupies 22. 2631. Bunsen coefficient.
bunsen = Ko*22.2631
REM calculate borate alkalinity in mM
balk = 0
balk = Kborate*2.2*Cl*10^(-2)/(H+Kborate)
IF TIC=0 THEN CA=TA-OH+H-balk
IF TIC=0 THEN C=CA*(1+salCF*H/(K1*AH2O) + K2/H)/(1 + 2*K2/H)
CO2 = H*H*C/(H*H + H*K1 + K1*K2)
HCO3 = H*K1*C/(H*H + H*K1 + K1*K2)
CO3 = K1*K2*C/(H*H + H*K1 + K1*K2)
CA=HCO3+2*CO3
C=INT(DEC*C + .5)/DEC
CO2 = INT(DEC*CO2 + .5)/DEC
HCO3 = INT(DEC*HCO3 + .5)/DEC
CO3 = INT(DEC*CO3 + .5)/DEC
CLS
PRINT "Carbonate System"
PRINT "pH = ";CSNG(pH);TAB(25)"Temperature = ";CSNG(t);" celcius"
PRINT "Salinity = ";CSNG(S);"o/oo";TAB(25) "Chlorinity = ";CSNG(Cl);"o/oo"
IF TIC = 0 THEN PRINT "Borate alkalinity = ";CSNG(balk)
PRINT TAB(0) "pK1 = ";CSNG(INT(1000*pK1+.5)/1000);TAB(25) "pK2 = ";CSNG(INT(100
PRINT TAB(0) "K1 = ";CSNG(K1);TAB(25) "K2 = ";CSNG(K2)
titration = INT(100*-.5*LOG(K1*C/1000)/LOG(10))/100
PRINT "Approximate end-point of titration = ";titration
PRINT "Carbonate Alkalinity = ";CSNG(CA);" mol m-3"
PRINT TAB (15) "Total Inorganic Carbon Species (mol m-3)"
PRINT TAB(5) "pH";TAB(15) "[CO2]";TAB(25) "[HCO3-]";TAB(35) "[CO3(2-)]";TAB(45)"[T
PRINT TAB(5) CSNG(pH);TAB(15) CSNG(CO2);TAB(25) CSNG(HCO3);TAB(35) CSNG(CO3)
PRINT"Saturation with 1 Atmosphere CO2 =";
PRINT CSNG(INT(1000*DEC*Ko + .5)/DEC);" mol m-3"
PRINT "This water sample, if in equilibrium with the air, would contain"
PRINT CSNG(INT(1000000!*DEC*CSNG(Ko)*.00037 +.5)/DEC);" mmol m-3 CO2 at curren
PRINT
ps=250
BUTTON 1,1, "Round off Results",(10,ps)-(140,ps+20),1
BUTTON 2,1, "Another Run on Same Salinity & Temperature",(150,ps)-(450,ps+20),1
BUTTON 3,1, "New Salinity & Temperature",(10,ps+30)-(210,ps+50),1
BUTTON 4,1, "Biophysics Menu",(220,ps+30)-(350,ps+50),1
BUTTON 5,1, "Quit",(360,ps+30)-(450,ps+50),1
WHILE DIALOG(0) <>1:WEND
buttonpushed = DIALOG(1)
BUTTON CLOSE 0
IF buttonpushed = 1 THEN GOSUB roundoff:GOTO carbonate2:
IF buttonpushed = 2 THEN CLS:PRINT "Same Salinity & Temperature":GOTO carbonate1:
IF buttonpushed = 3 THEN carbonate:
IF buttonpushed = 4 THEN biophysics:
CLOSE:SYSTEM
carbsign: INPUT X
IF X<0 THEN PRINT "Are you sure it is less than zero !":GOSUB replies: IF Q$ = "N" TH
RETURN
pK1pK2:
PRINT "Enter temperature in degrees C";
GOSUB sign:
t=X
BUTTON 1,1, "Salinity",(0,40)-(140,60),1
BUTTON 2,1,"Chlorinity",(150,40)-(300,60),1
BUTTON 3,1,"Quit",(310,40)-(450,60),1
WHILE DIALOG(0) <> 1:WEND
buttonpushed = DIALOG(1):BUTTON CLOSE(0)
IF buttonpushed=1 THEN GOSUB carbonatesalinity:
IF buttonpushed=2 THEN GOSUB carbonatechlorinity:
IF buttonpushed=3 THEN CLOSE:SYSTEM
TABS = t + 273.16
pK1 = (17052/TABS + 215.21*LOG(TABS)/LOG(10) - .12675*TABS-545.56) -(.145-.00
K1 = 10^(-pK1)
pK2 = -(-2902.39/TABS + 6.498-.02379*TABS) - .51*Cl^(1/3)
K2 = 10^(-pK2)
PRINT TAB(5) "S = ";CSNG(S);"o/oo";TAB(35) "Cl = ";CSNG(Cl);"o/oo"
PRINT TAB(5) "pK1 = ";CSNG(INT(1000*pK1+.5)/1000);TAB(35) "K1 = ";CSNG(K1)
PRINT TAB(5) "pK2 = ";CSNG(INT(1000*pK2+.5)/1000); TAB(35) "K2 = ";CSNG(K2)
REM pKborate calculation
pKborate = 9.22 - .123*Cl^(1/3)-.0086*Cl + .17-9.333330000000001D-03*t
Kborate = 10^(-pKborate)
PRINT TAB(5) "pK(borate) = ";CSNG(pKborate);TAB(35) "K (borate) = ";CSNG(Kborate
REM calculate H2O activity
AH2O = 1-.000969*Cl
PRINT "Activity of Water = ";CSNG(AH2O)
RETURN
carbonatesalinity:
PRINT "Enter salinity in parts per thousand (seawater = 34.3) ";
INPUT S
IF S<0 OR S>38 THEN PRINT "Salinity must be 0 =< S =< 38":GOSUB carbonatesalinit
Cl = S/1.80655
RETURN
carbonatechlorinity:
PRINT "Enter chlorinity in parts per thousand (seawater = 19)";
INPUT Cl
IF Cl<0 OR S>21 THEN PRINT "Salinity must be 0 =< Cl =< 21":GOSUB carbonatechlor
S = Cl*1.80655
RETURN
carbonatesign: INPUT X
IF X<0 THEN PRINT "Are you sure it is less than zero !":GOSUB replies: IF Q$ = "N" TH
RETURN
carbonatezeropositive:INPUT X
IF X>=0 THEN RETURN
PRINT "Questionable entry! Normally zero or a positive number !":PRINT "Is this correct
GOSUB replies:
IF buttonpushed=2 THEN GOTO carbonatezeropositive:
RETURN
carbonatedocumentation:
CLS
PRINT" This program works out the total inorganic carbon (TIC) from the "
PRINT "carbonate alkalinity at a given salinity (in parts per thousand) and"
PRINT "temperature (in celcius). The algorithms are from Ostrom B., 1975. An"
PRINT "algorithm for the Computation of Primary Production. Botanica Marina 17:"
PRINT " 20 - 22. Borate alkalinity has been taken into account."
PRINT" The formulae are from Vollenweider, R.A. (1974) 'Primary production"
PRINT "in aquatic environments', IBP Handbook No 12, Blackwell Scientific Publ. pp"
PRINT "54 - 59 and Golterman, H.L., Clymo, R.S. & Ohnstad, M.A.M. (1978) 'Methods for"
PRINT "Physical & Chemical Analysis of Fresh Waters', IBP Handbook No 8, Blackwell"
PRINT "Scientific Publ., pp 58 - 64 & 186 - 194. Remember that carbonate ion is"
PRINT "counted twice in carbonate alkalinity values."
PRINT " The methods described by Strickland, J.D.H. & Parsons, T.R. (1968) 'A"
PRINT "Practical Handbook of Seawater Analysis' Bull. Fish. Res. Bd Can. 167 only"
PRINT"apply to seawater and a limited range of salinities."
PRINT
ps=260
BUTTON 1,1, "Return to Program",(10,ps)-(450,ps+20),1
WHILE DIALOG(0) <>1:WEND
buttonpushed = DIALOG(1)
BUTTON CLOSE 0
IF buttonpushed=1 THEN CLS
RETURN
en collected,
in natural waters"
ree water."
n",(160,ps)-(450,ps+20),1
SNG(t);" celcius"
y = ";CSNG(Cl);"o/oo"
]";TAB(35) "[CO3(2-)]";TAB(45)"[TIC]"
) CSNG(HCO3);TAB(35) CSNG(CO3);TAB(45) CSNG(C)
, would contain"
.5)/DEC);" mmol m-3 CO2 at current air CO2 levels (370 ppm,2002)"
ature",(150,ps)-(450,ps+20),1
)-(210,ps+50),1
1*Cl^(1/3)
= ";CSNG(Cl);"o/oo"
000);TAB(35) "K1 = ";CSNG(K1)
000); TAB(35) "K2 = ";CSNG(K2)
333330000000001D-03*t
er = 34.3) ";
ater = 19)";
) 'Primary production"
ackwell Scientific Publ. pp"
ad, M.A.M. (1978) 'Methods for"
P Handbook No 8, Blackwell"
er that carbonate ion is"
Version (d) works out the total inorganic carbon (TIC) from the
total alkalinity (mol m-3) at a given salinity (o/oo) and
temperature (in celcius).
This version uses the pK1 and pK2 values from Millero FJ (1979) The
thermodynamics of the carbonate system in seawater. Geochimica et
Cosmochimica Acta 43: 1651 - 1661. (Here the most modern values are used)
Borate alkalinity is subtracted to give Carbonate Alkalinity.
Version (e) can be used to calculate the carbonate system in
artificial media with a known addition of inorganic carbon to TIC-free media.
The amount of borate in the medium is then not relevant as it is not used in
the calculations. The program is not suitable for media of high ionic stength
with an ionic composition greatly different to seawater.
The formulae are from Vollenweider, R.A. (1974) 'Primary production
in aquatic environments', IBP Handbook No 12, Blackwell Scientific Publ. Pp
54 - 59 and Golterman, H.L., Clymo, R.S. & Ohnstad, M.A.M. (1978) 'Methods for
Physical & Chemical Analysis of Fresh Waters', IBP Handbook No 8, Blackwell
Scientific Publ., pp 58 - 64 & 186 - 194. Remember that carbonate ion is
counted twice in carbonate alkalinity values.
The methods described by Strickland, J.D.H. & Parsons, T.R. (1968) 'A
Practical Handbook of Seawater Analysis' Bull. Fish. Res. Bd Can. 167 only
apply to seawater and a limited range of salinities.
Limitations of program:
* will not work for salinities greater than about 38 o/oo
* not reliable for temperatures greater than 40 oC but can be used
for frigid seawater down to -4 oC.
The atmospheric CO2 value is based on an exponential + constant fi to
average CO2 at Mona Loa to 2009.
pK (borate)
8.61591587
Kborate
2.4215E-09
Borate Alkalinity (mM or mol m-3)
0.11584663
pK1pK2:
PRINT "Enter tempera
GOSUB sign:
t=X
BUTTON 1,1, "Salinity
BUTTON 2,1,"Chlorinit
BUTTON 3,1,"Quit",(3
WHILE DIALOG(0) <>
buttonpushed = DIALO
IF buttonpushed=1 TH
IF buttonpushed=2 TH
IF buttonpushed=3 TH
TABS = t + 273.16
pK1 = (17052/TABS +
K1 = 10^(-pK1)
pK2 = -(-2902.39/TAB
K2 = 10^(-pK2)
PRINT TAB(5) "S = ";
PRINT TAB(5) "pK1 =
PRINT TAB(5) "pK2 =
REM pKborate calculat
pKborate = 9.22 - .12
Kborate = 10^(-pKbo
PRINT TAB(5) "pK(bor
REM calculate H2O activi
AH2O = 1-.000969*C
PRINT "Activity of Wat
RETURN
carbonatesalinity:
PRINT "Enter salinity i
INPUT S
IF S<0 OR S>38 THEN
Cl = S/1.80655
RETURN
carbonatechlorinity:
PRINT "Enter chlorinit
INPUT Cl
IF Cl<0 OR S>21 THE
S = Cl*1.80655
RETURN
carbonatesign: INPUT X
IF X<0 THEN PRINT "A
RETURN
carbonatezeropositive:IN
IF X>=0 THEN RETUR
PRINT "Questionable e
GOSUB replies:
IF buttonpushed=2 TH
RETURN
carbonatedocumentation:
CLS
PRINT" This program wo
PRINT "carbonate alkalinity
PRINT "temperature (in celc
PRINT "algorithm for the Co
PRINT " 20 - 22. Borate alk
PRINT" The formulae are
PRINT "in aquatic environm
PRINT "54 - 59 and Golterm
PRINT "Physical & Chemical
PRINT "Scientific Publ., pp 5
PRINT "counted twice in car
PRINT " The methods des
PRINT "Practical Handbook
PRINT"apply to seawater an
PRINT
ps=260
BUTTON 1,1, "Return
WHILE DIALOG(0) <>
buttonpushed = DIALO
BUTTON CLOSE 0
IF buttonpushed=1 TH
RETURN
M must use long adress mode
ALL TEXTFONT (3):REM this sets the type to GENEVA
DEFDBL A-zzz
PRINT "CARBONATE SYSTEMS"
balk = Kborate*2.2*Cl*10^(-2)/(H+Kborate)
IF TIC=0 THEN CA=TA-OH+H-balk
IF TIC=0 THEN C=CA*(1+salCF*H/(K1*AH2O) + K2/H)/(1 + 2*K2/H)
CO2 = H*H*C/(H*H + H*K1 + K1*K2)
HCO3 = H*K1*C/(H*H + H*K1 + K1*K2)
CO3 = K1*K2*C/(H*H + H*K1 + K1*K2)
CA=HCO3+2*CO3
C=INT(DEC*C + .5)/DEC
CO2 = INT(DEC*CO2 + .5)/DEC
HCO3 = INT(DEC*HCO3 + .5)/DEC
CO3 = INT(DEC*CO3 + .5)/DEC
carbonatesign: INPUT X
IF X<0 THEN PRINT "Are you sure it is less than zero !":GOSUB replies: IF Q$ = "N" THEN GOTO carbonatesign:
RETURN
carbonatezeropositive:INPUT X
IF X>=0 THEN RETURN
PRINT "Questionable entry! Normally zero or a positive number !":PRINT "Is this correct?"
GOSUB replies:
IF buttonpushed=2 THEN GOTO carbonatezeropositive:
RETURN
rbonatedocumentation:
RINT" This program works out the total inorganic carbon (TIC) from the "
INT "carbonate alkalinity at a given salinity (in parts per thousand) and"
INT "temperature (in celcius). The algorithms are from Ostrom B., 1975. An"
INT "algorithm for the Computation of Primary Production. Botanica Marina 17:"
INT " 20 - 22. Borate alkalinity has been taken into account."
INT" The formulae are from Vollenweider, R.A. (1974) 'Primary production"
INT "in aquatic environments', IBP Handbook No 12, Blackwell Scientific Publ. pp"
INT "54 - 59 and Golterman, H.L., Clymo, R.S. & Ohnstad, M.A.M. (1978) 'Methods for"
INT "Physical & Chemical Analysis of Fresh Waters', IBP Handbook No 8, Blackwell"
INT "Scientific Publ., pp 58 - 64 & 186 - 194. Remember that carbonate ion is"
INT "counted twice in carbonate alkalinity values."
INT " The methods described by Strickland, J.D.H. & Parsons, T.R. (1968) 'A"
INT "Practical Handbook of Seawater Analysis' Bull. Fish. Res. Bd Can. 167 only"
INT"apply to seawater and a limited range of salinities."
ps=260
BUTTON 1,1, "Return to Program",(10,ps)-(450,ps+20),1
WHILE DIALOG(0) <>1:WEND
buttonpushed = DIALOG(1)
BUTTON CLOSE 0
IF buttonpushed=1 THEN CLS
RETURN
carbsign:C=X
TABS/100) + .0050578#*(TABS/100)^2)
2+.5)/1000)
(45) CSNG(C)
t)*Cl^(1/3)
OTO carbonatesign: