0% found this document useful (0 votes)
93 views27 pages

Carbonate Calculator Version 1.0

This document provides instructions for calculating carbonate systems in natural waters or artificial media. It describes: 1) The data required - pH, temperature, salinity, and either total alkalinity or total inorganic carbon added. 2) Two versions - version (d) calculates total inorganic carbon from alkalinity measurements, version (e) is for artificial media with known added carbon. 3) The program calculates carbonate species (CO2, HCO3-, CO32-) from input data and allows running additional calculations or changing parameters.

Uploaded by

gombossandor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views27 pages

Carbonate Calculator Version 1.0

This document provides instructions for calculating carbonate systems in natural waters or artificial media. It describes: 1) The data required - pH, temperature, salinity, and either total alkalinity or total inorganic carbon added. 2) Two versions - version (d) calculates total inorganic carbon from alkalinity measurements, version (e) is for artificial media with known added carbon. 3) The program calculates carbonate species (CO2, HCO3-, CO32-) from input data and allows running additional calculations or changing parameters.

Uploaded by

gombossandor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
You are on page 1/ 27

CARBONATE SYSTEMS

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"

or (e) total inorganic carbon added to CO2-free water."

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.

(Original Microsoft Basic Listing at column Z)


Program written by Raymond J. RITCHIE 05 May 2007
pH Temperature oC Salinity o/oo Current CO2 (ppm)
8.2 25 34 391
(seawater is 34.3)

Enter Total Alkalinity of Natural Waters (mol m-3)


2.3
Artificial Waters with Known Added Carbon (mol m-3)
2

Carbonate System in Natural Waters (mol m -3)


CO2 HCO3- CO32- Carbonate Alkalinity
0.0108 1.7272 0.2330 2.1931
CO2 in Equilibrium with Atm (mol m )
-3
TIC
0.01141 1.97100
Approximate titration end-point pH
4.35

Carbonate System in Artificial Media (mol m -3)


CO2 HCO3- CO32- Carbonate Alkalinity
0.0110 1.7526 0.2364 2.2254
CO2 in Equilibrium with Atm (mol m )
-3
TIC
0.0114 2.0000
Atmospheric CO2 calculator.
Chlorinity o/oo [H] [OH] pKw
Enter Date (CE)CO2 ppm 18.82040353 6.30957E-09 9.64048E-06 13.2159013
2011 394
T oK(absolute) pK1 pK2 (?) 0.51 Activity H2O
298.16 5.99650309 9.07006912 0.98176303
K1 K2
1.00808E-06 8.51003E-10

pK (borate)
8.66763529
Kborate
2.14963E-09
Borate Alkalinity (mM or mol m-3)
0.10521717

Calculate Solubility of CO2

lkalinity CO2 Bunsen Coefficient


0.02918131
Salinity correction factor
0.84901798
CO2 Solubility at STP (ml/l)
0.55157854

Corrected Carbonate Alkalinity (mol m-3)


lkalinity 2.1947732
Corrected TIC (mol m-3)
1.97099679

Atmospheric CO2 January 2011


Results Least Sqr Est ±SE
k(1) = 0.02175217 0.00044839
E(1) = 10.1843948 9.2532362
E2 = 279.92014 1.14987897

Pearsons r = 0.99910909 Probability =


CO2=E2+E1*exp(k*(date-1900))
pKw
0.55354128 13.9943147
cf for salinity
0.77841343
Salinity corrected pKw
13.2159013

±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."

om Ostrom 1974 & 1977

ious pH and salinity

n",(160,ps)-(450,ps+20),1

-3) = ";:GOSUB carbsign:TA=X


dded to System (in mol m-3) = ";:GOSUB carbsign:C=X

G (TABS/100) + S*(.027766 -.025888*(TABS/100) + .0050578#*(TABS/100)^2)


)/(1 + 2*K2/H)

SNG(t);" celcius"
y = ";CSNG(Cl);"o/oo"

0);TAB(25) "pK2 = ";CSNG(INT(1000*pK2+.5)/1000)

]";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

& Temperature":GOTO carbonate1:

o !":GOSUB replies: IF Q$ = "N" THEN GOTO carbsign:


- .12675*TABS-545.56) -(.145-.00025*t)*Cl^(1/3)

1*Cl^(1/3)

= ";CSNG(Cl);"o/oo"
000);TAB(35) "K1 = ";CSNG(K1)
000); TAB(35) "K2 = ";CSNG(K2)

333330000000001D-03*t

(35) "K (borate) = ";CSNG(Kborate)

er = 34.3) ";

< S =< 38":GOSUB carbonatesalinity:

ater = 19)";

< Cl =< 21":GOSUB carbonatechlorinity:

o !":GOSUB replies: IF Q$ = "N" THEN GOTO carbonatesign:

ive number !":PRINT "Is this correct?"


bon (TIC) from the "
r thousand) and"
Ostrom B., 1975. An"
on. Botanica Marina 17:"

) 'Primary production"
ackwell Scientific Publ. pp"
ad, M.A.M. (1978) 'Methods for"
P Handbook No 8, Blackwell"
er that carbonate ion is"

Parsons, T.R. (1968) 'A"


h. Res. Bd Can. 167 only"
CARBONATE SYSTEMS
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"

or (e) total inorganic carbon added to CO2-free water."

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.

(Original Microsoft Basic Listing at column Z)


Program written by Raymond J. RITCHIE 18 May 2007
pH Temperature oC Salinity o/oo Current CO2 (ppm) Atmospheric CO
8.2 25 34.3 392 Enter Date (CE)
(seawater is 34.3) 2011

Enter Total Alkalinity of Natural Waters (mol m-3)


2.4
Artificial Waters with Known Added Carbon (mol m-3)
2.101

Carbonate System in Natural Waters (mol m -3)


CO2 HCO3- CO32- Carbonate Alkalinity Calcite W
0.0117 1.8373 0.2225 2.2824 5.125
CO2 in Equilibrium with Atm (mol m )
-3
TIC Aragonite W
0.01142 2.07157 3.416
Approximate titration end-point pH
4.34

Carbonate System in Artificial Media (mol m -3)


CO2 HCO3- CO32- Carbonate Alkalinity Calcite W
0.0119 1.8634 0.2257 2.3148 5.198
CO2 in Equilibrium with Atm (mol m )
-3
TIC Aragonite W
0.0114 2.1010 3.465
ospheric CO2 calculator.
Chlorinity o/oo [H] [OH] pKw
CO2 ppm 18.98646592 6.30957E-09 9.68795E-06 13.2137682
394
T oK(absolute) pK1 pK2 Activity H2O
298.16 6.00500152 9.11677622 0.98160211
K1 K2
9.8855E-07 7.64229E-10

pK (borate)
8.61591587
Kborate
2.4215E-09
Borate Alkalinity (mM or mol m-3)
0.11584663

Calculate Solubility of CO2

CO2 Bunsen Coefficient


0.02914231
Salinity correction factor
0.84748194
CO2 Solubility at STP (ml/l)
0.54984474

Corrected Carbonate Alkalinity (mol m-3)


2.28414369
Corrected TIC (mol m-3)
2.07156588

Atmospheric CO2 January 2011


Results Least Sqr Est ±SE ±95% conf.
k(1) = 0.02175217 0.00044839 0.00089823
E(1) = 10.1843948 9.2532362 18.5364594
E2 = 279.92014 1.14987897 2.30348436

Pearsons r = 0.99910909 Probability = 1.31E-127


CO2=E2+E1*exp(k*(date-1900))
Millero pKw Millero pK1 Millero pK2 Millero pKB pH NBS scale biophysics:
13.9943147 6.35142544 10.3296272 9.23635702 pH at 25 oC CLEAR
cf for salinity cf for salinity cf for salinity cf for salinity 8.151 REM 960419
0.78054653 0.34642393 1.21285099 0.62044115 A REM must use long adress m
pKw' pK1' pK2' pKB' -0.0099725 CALL TEXTFONT (3):REM th
13.2137682 6.00500152 9.11677622 8.61591587 B CLS:
0.00011438 carbonate:
pH (NBS) CLS:
8.151 DEFDBL A-zzz
Millero pK CaCO3 PRINT "CARBONATE SYS
Calcite Aragonite PRINT
8.4331163 8.25700988 PRINT "Data required:-"
cf for salinity cf for salinity PRINT" (a) pH of samp
2.07419193 2.07419193 PRINT " (b) temperatu
pK(Cal)CaCO3pK(Ara)CaCO3' PRINT" (c) salinity or c
6.35892437 6.18281795 PRINT " and either,"
TA Calculation PRINT " (d) total alk
Ca OMEGA PRINT " or (e) total ino
5.12477004 3.41639416 PRINT "Do you want to r
Added C Calculation GOSUB replies:
Ca OMEGA IF Q$ = "Y" THEN GOSUB
5.19758602 3.46493644 CLS:PRINT "CARBONATE
REM The formulae for the
Atmospheric CO2 13 march 2009 DEC = 1E+07
Results Least Sqr Est ±SE ±95% conf. REM calculation of CO2,
k(1) = 0.0220052332 0.0004767596 0.0009558462 GOSUB pK1pK2:
E(1) = 9.8991803888 9.5533071366 19.15324421 carbonate1:
E2 = 280.35899762 1.160123614 2.3259098211 PRINT "Enter pH =";
GOSUB carbsign:
Pearsons r = 0.9990411019 Probability = 8.15E-122 pH=X
CO2=E2+E1*exp(k*(date-1900)) IF pH>14 THEN carbonat
H = 10^(-pH)
OH=10^(pH-14)
TIC=0
ps=260
BUTTON 1,1, "Total Alka
BUTTON 2,1, "Known Ad
WHILE DIALOG(0) <>1:W
buttonpushed = DIALOG
BUTTON CLOSE 0
IF buttonpushed = 1 THE
IF buttonpushed = 2 THE
IF TIC=0 THEN PRINT "E
IF TIC=1 THEN PRINT "E
carbonate2:
CLS:
REM calculate bunsen coeffi
lnKo = -58.0931 + 90.50
Ko = EXP(lnKo)
REM salinity correction S
salCF = (Ko-Cl*EXP(58.6
REM ratio of molecular weig
REM one mole of CO2 at ST
bunsen = Ko*22.2631
REM calculate borate alkalin
balk = 0
balk = Kborate*2.2*Cl*1
IF TIC=0 THEN CA=TA-O
IF TIC=0 THEN C=CA*(1
CO2 = H*H*C/(H*H + H
HCO3 = H*K1*C/(H*H +
CO3 = K1*K2*C/(H*H +
CA=HCO3+2*CO3
C=INT(DEC*C + .5)/DEC
CO2 = INT(DEC*CO2 + .
HCO3 = INT(DEC*HCO3
CO3 = INT(DEC*CO3 + .
CLS
PRINT "Carbonate System
PRINT "pH = ";CSNG(pH
PRINT "Salinity = ";CSNG
IF TIC = 0 THEN PRINT "
PRINT TAB(0) "pK1 = ";C
PRINT TAB(0) "K1 = ";CS
titration = INT(100*-.5*
PRINT "Approximate end
PRINT "Carbonate Alkalin
PRINT TAB (15) "Total In
PRINT TAB(5) "pH";TAB(
PRINT TAB(5) CSNG(pH)
PRINT"Saturation with 1
PRINT CSNG(INT(1000*D
PRINT "This water sampl
PRINT CSNG(INT(100000
PRINT
ps=250
BUTTON 1,1, "Round off
BUTTON 2,1, "Another R
BUTTON 3,1, "New Salini
BUTTON 4,1, "Biophysics
BUTTON 5,1, "Quit",(360
WHILE DIALOG(0) <>1:W
buttonpushed = DIALOG
BUTTON CLOSE 0
IF buttonpushed = 1 THE
IF buttonpushed = 2 THE
IF buttonpushed = 3 THE
IF buttonpushed = 4 THE
CLOSE:SYSTEM
carbsign: INPUT X
IF X<0 THEN PRINT "A
RETURN

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"

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:

PRINT "Enter pH =";


GOSUB carbsign:

IF pH>14 THEN carbonate1:


H = 10^(-pH)
OH=10^(pH-14)

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) = ";:GOSUB carbsign:C=X
M calculate bunsen coefficient (Ko) for CO2 for pure or saltwater
lnKo = -58.0931 + 90.5069*(100/TABS) + 22.294*LOG (TABS/100) + S*(.027766 -.025888*(TABS/100) + .0050578#*
Ko = EXP(lnKo)
REM salinity correction SalCF
salCF = (Ko-Cl*EXP(58.68995-11.768*LOG(TABS)))/Ko
M ratio of molecular weight to volume for CO2 is 1.97681
M one mole of CO2 at STP occupies 22. 2631. Bunsen coefficient.
bunsen = Ko*22.2631
M calculate borate alkalinity in mM

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

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(1000*pK2+.5)/1000)
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)"[TIC]"
PRINT TAB(5) CSNG(pH);TAB(15) CSNG(CO2);TAB(25) CSNG(HCO3);TAB(35) CSNG(CO3);TAB(45) CSNG(C)
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 current air CO2 levels (370 ppm,200

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
rbsign: INPUT X
IF X<0 THEN PRINT "Are you sure it is less than zero !":GOSUB replies: IF Q$ = "N" THEN GOTO carbsign:
RETURN

PRINT "Enter temperature in degrees C";


GOSUB sign:

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-.00025*t)*Cl^(1/3)
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 carbonatesalinity:
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 carbonatechlorinity:
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" 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)

CO2 levels (370 ppm,2002)"


OTO carbsign:

t)*Cl^(1/3)
OTO carbonatesign:

You might also like