SUBJECT

About this Macro

General Information 

pH Scales

fCO2, pCO2

KSO4

Freshwater Option

GEOSECS Option 

Peng Option 

Pressure Effects

Calcium Carbonate Solubility 

(Omega Values) 

Alkalinity

Revelle Factor

Constants

Macro Version History

The code for this Macro was taken directly from Ernie Lewis' "CO2SYS.BAS" Basic 

information).

What it DoesÉ

 From two known CO2 parameters (TA, TCO2, pH, pCO2 or fCO2), the program wi

Revelle Factor, Carbonate species concentrationsÉ(referred to as "Auxiliary Data" in 

and P conditions (IN and OUT)

What it Doesn't doÉ

 Unlike CO2Sys.BAS, this macro does not calculate the sensitivity of the output o

HOW TO RUN THE CO2Sys MACRO.

 In Sheet "INFO":

 -- You can select which section of the program you want information on by select

information will be listed in this text box.

 In Sheet "INPUT":

 The program gives you a number of options. When selected, the option is highligh

 -- Select the set of CO2 constants you want to use for the calculations.

 -- Select the KHSO4.

 -- Select the pH scale of your data.

 -- Select the Total Boron formulation you want.

 In Sheet "Data":

 -- If copying from another Excel file, it is suggested to only paste the VALUES 

 -- Input your data in the appropriate columns for Salinity, Temperature (oC) and 

 -- Input the CO2 parameters in their respective columns. If more than two are 

different sets of parameters in different rows.

 -- Set the output conditions at which you want your results (optional).

 -- Click the red "Start" Button located on the top left part of the "Data" sheet.

 -- Calculations will stop when an entire row of data (columns "A" to "L") is empty

 -- You can either clear your data (columns "A" to "L") or clear the results (colum

of the column "M" in this sheet.

 After the program starts:

 -- You will be asked if you entered your data properlyÉthis gives you a chance to 

 -- You will be asked if you want to calculate the "Auxiliary Data". This correspon

column in both the "Input Conditions" and the "Output Conditions" sections. Choosing 

 -- Results at the "Input Conditions" are posted in columns "Q" to "AK" and are la

"AM" to "BB" and are labeled "out".

 -- If Pressure, Total P or Total Si are missing, equal to -999, or -9, their value is 

whole corresponding row is colored in red and column "BC" (labeled "SubFlag" ) will m
Any problem or comment related to the code of this macro can be addressed to:

 Denis Pierrot

 CIMAS

 University of Miami

 4600 Rickenbacker Causeway

 Miami, FL 33149

 dpierrot@rsmas.miami.edu or denis.pierrot@noaa.gov

nie Lewis' "CO2SYS.BAS" Basic Program. (See the "INFO" sheet in the macro for contact 

 pCO2 or fCO2), the program will calculate the other 3,as well as other quantities such as Omega, 

eferred to as "Auxiliary Data" in the macro).The quantities can be calculated at 2 different sets of T 

e the sensitivity of the output on the input(referred to as "Partials" in the original program).

ou want information on by selecting the appropriate option from the "Subject" column on the left. The 

n selected, the option is highlighted in yellow.

se for the calculations.

sted to only paste the VALUES in the cells.

r Salinity, Temperature (oC) and Pressure (dbars). Total Si and Total P (in umol/kg SW) are optional.

 columns. If more than two are entered, the FIRST TWO from the left will be used. You may use 

our results (optional).

p left part of the "Data" sheet.

ta (columns "A" to "L") is empty.

o "L") or clear the results (columns "L" to the end) by clicking on the appropriate button located on top 

perlyÉthis gives you a chance to cancel your action.

"Auxiliary Data". This corresponds to Omega, Revelle FactorÉetcÉany column right of the pCO2 

ut Conditions" sections. Choosing "No" will save time.

n columns "Q" to "AK" and are labeled "in". Those at the "Output Conditions" are posted in columns 

qual to -999, or -9, their value is set to zero and the calculation performed anyway. In this case, the 

 "BC" (labeled "SubFlag" ) will mention which input parameter was set to zero.
macro can be addressed to:

Set of Constants

 K1, K2 from Roy, et al., 1993 

 K1, K2 from Goyet and Poisson, 1989 

 K1, K2 from Hansson, 1973 refit by Dickson and Millero, 1987 

 K1, K2 from Mehrbach et al., 1973 refit by Dickson and Millero, 1987 

 K1, K2 from Hansson and Mehrbach refit by Dickson and Millero, 1987 

 GEOSECS constants (NBS scale); K1, K2 from Mehrbach et al., 1973 

 Constants from Peng et al. (NBS scale); K1, K2 from Mehrbach et al. 

 Salinity = 0 (freshwater); K1, K2 from Millero, 1979 

 K1, K2 from Cai and Wang, 1998

 K1, K2 from Lueker et al., 2000

 K1, K2 from Mojica Prieto et al., 2002

 K1, K2 from Millero et al., 2002

 K1, K2 from Millero et al., 2006

 K1, K2 from Millero, 2010
KHSO 4 pH Scale [B] T Value

Dickson Total scale (mol/kg-SW) Uppstrom, 1974

Khoo et al Seawater scale (mol/kg-SW) Lee et al., 2010

Free scale (mol/kg-SW) 

NBS scale (mol/kg-H2O) 
Salinity t(o

C) P (dbars) Total P 

(mol/kgSW)

Total Si 

(mol/kgSW) t(oC)

33.351 20 10 0.54 1.5 20

33.351 20 10 0.54 1.5 20

33.351 20 10 0.54 1.5 20

START START START START START START START START START 

INPUT CONDITIONS OUTPUT CONDITIONS




P (dbars) TA 

(mol/kgSW)

TCO2 

(mol/kgSW)

pH (Chosen 

Scale)

fCO2 

(atm)

pCO2 

(atm)

10 2232.36 353.63

10 2232.36 784.87

10 2232.36 783.71

1.16

START START START START START START START START

OUTPUT CONDITIONS DATA (leave empty if no data)




RESULTS (Input Conditions)

Clear 

DATA 

<----

Salinity t(oC) in P (dbars) in

33.351 20 10

33.351 20 10

33.351 20 10

DO NOT MODIFY...THE PROGRAM 

WILL DO IT!

pH Scale:

CO2 

Constants:

SCALES and CONSTANTS

Clear 

Results 

--->

Total Boron 

Source:

Uppstrom, 1974 

KSO4 

Source:

 K1, K2 from Mehrbach 

et al., 1973 refit by 

Dickson and Millero, Dickson 

Seawater scale (mol/kgSW) 




Total P 

(mol/kgS

W)

Total Si 

(mol/kgSW

)

TA in 

(mol/kgSW

)

TCO2 in 

(mol/kgSW

)

pH in

fCO2 in 

(atm)

pCO2 in 

(atm)

0.54 1.50 2232.4 1969.9 8.0744 352.4 353.6

0.54 1.50 2232.4 2104.6 7.7752 782.2 784.9

0.54 1.50 2232.4 2104.4 7.7758 781.1 783.7

#####




HCO3 in 

(mol/kgSW)

CO3 in 

(mol/kgSW

)

CO2 in 

(mol/kgSW

)

B Alk in 

(mol/kgS

W)

OH in 

(mol/kgSW

)

P Alk in 

(mol/kgSW

)

1771.8 186.572358 11.523709 82.3 4.499735 0.607202

1974.6 104.409865 25.576488 46.1 2.259487 0.569624

1974.3 104.532399 25.538689 46.1 2.262485 0.569683




RESULTS (Output Conditions)

Si Alk in 

(mol/kgSW

) 

Revelle in Ca in Ar in

xCO2 in (dry 

at 1 atm) 

(ppm)

t(oC) out P (dbars) 

out

0.1 10.250 4.51 2.92 361.8 20.000 10.0

0.0 14.310 2.52 1.64 803.1 20.000 10.0

0.0 14.302 2.53 1.64 801.9 20.000 10.0




Output Conditions)

pH out

fCO2 out 

(atm)

pCO2 out 

(atm)

HCO3 out 

(mol/kgSW

)

CO3 out 

(mol/kgSW)

CO2 out 

(mol/kgSW)

B Alk out 

(mol/kgSW

)

8.074 352.4 353.6 1771.8 186.6 11.5 82.3

7.775 782.2 784.9 1974.6 104.4 25.6 46.1

7.776 781.1 783.7 1974.3 104.5 25.5 46.1




OH out 

(mol/kgSW)

P Alk out 

(mol/kgSW

)

Si Alk out 

(mol/kgS

W) 

Revelle 

out

Ca out Ar out

4.5 0.6 0.1 10.250 4.51 2.92

2.3 0.6 0.0 14.310 2.52 1.64

2.3 0.6 0.0 14.302 2.53 1.64




xCO2 out (dry 

at 1 atm) (ppm)

SubFlag

361.8

803.1

801.9