solve_pH_from_AT: Solver for the total alkalinity-pH equations

Description Usage Arguments Details Value Author(s) References Examples

Description

Determines [H+] from Total alkalinity and dissolved total elements in sea water. Universal and robust algorithm from Munhoven (2013) with Newton- Raphson iterations

Usage

1
2
3
solve_pH_from_AT(p_alktot, p_dicvar, p_bortot, p_po4tot, p_siltot, 
                 p_nh4tot, p_h2stot, p_so4tot, p_flutot, p_pHscale, p_dicsel,
                 p_askVal=FALSE, p_dissoc, p_temp=18, p_sal=35, p_pres=0, p_hini)

Arguments

p_alktot

Total alkalinity (mol/kg)

p_dicvar

Value of a carbonate system related variable : DIC, [CO2*], [HCO3-] or [CO3–] (mol/kg)

See below parameter p_dicsel

p_bortot

Total boron concentration (mol/kg)

p_po4tot

Total phosphate concentration (mol/kg)

p_siltot

Total silicate concentration (mol/kg)

p_nh4tot

Total ammonia concentration (mol/kg)

p_h2stot

Total sulfide concentration (mol/kg)

p_so4tot

Total sulphate concentration (mol/kg)

p_flutot

Total fluor concentration (mol/kg)

p_pHscale

Chosen pH scale: "T" for the total scale, "F" for the free scale and "SWS" for using the seawater scale

p_dicsel

Carbonate variable selector (default = DIC). See parameter p_dicvar above. Values are:

"DIC" : p_dicvar = DIC (Dissolved Inorganic Carbon)

"CO2" : p_dicvar = [CO2*]

"HCO3" : p_dicvar = [HCO3-]

"CO3" : p_dicvar = [CO3–]

p_askVal

Optional boolean - set to TRUE if you want this function to return error on alkalinity, along with [H+] concentration value. Default is FALSE

p_dissoc

Named list of all dissociation constants. The list is optional but, if given, it should contain all members listed below excepted K2_Sil, which is itself optional. Member names are :

K1_DIC : First dissociation constant of carbonic acid (mol/kg) on chosen scale

K2_DIC : Second dissociation constant of carbonic acid (mol/kg) on chosen scale

K_BT : Dissociation constant of boric acid (mol/kg) on chosen scale

K1_PO4 : First dissociation constant of phosphoric acid (mol/kg) on chosen scale

K2_PO4 : Second dissociation constant of phosphoric acid (mol/kg) on chosen scale

K3_PO4 : third dissociation constant of phosphoric acid (mol/kg) on chosen scale

K_Sil : First dissociation constant of sillicic acid (mol/kg) on chosen scale

K2_Sil : Second dissociation constant of sillicic acid (mol/kg) on chosen scale. It is optional. If K2_Sil is absent from the list, then SiO2(OH)2 ion is not considered in the alkalinity equation. Only SiO(OH)3 ion is.

K_NH4 : Dissociation constant of ammonium (mol/kg) on chosen scale

K_H2S : Dissociation constant of hydrogen sulfide (mol/kg) on chosen scale

K_HSO4 : Dissociation constant of hydrogen sulfate (mol/kg) on free scale

K_HF : Dissociation constant of hydrogen fluoride (mol/kg) on free scale

K_H2O : Dissociation constant of water (mol/kg) on chosen scale

Note that all dissociation constants shall be expressed in chosen pH scale except K_HF and K_HSO4 which shall be in free scale.

If the list is not given, these constants, excepted K2_Sil, will be calculated.

p_temp

Temperature in degree Celsius, to compute dissociation constants when p_dissoc is not given

p_sal

Salinity, in pratical salinty unit (psu), to compute dissociation constants when p_dissoc is not given

p_pres

Pressure, in bars, to compute dissociation constants when p_dissoc is not given

p_hini

Optional initial value of [H+] concentration

If p_dicsel = "CO3", a vector of two initial values are expected since there may be two solutions for pH. Else, one initial value is expected

Details

Formulations used when calculating dissociation constants:

This function does not support vectors as arguments, only scalar values.

Value

If p_dicsel is "CO3", there may be one or two solutions for [H+], else there is only one. In case there are two solutions, both are returned.

Author(s)

Guy Munhoven and Jean-Marie Epitalon

References

Munhoven G. Munhoven G. (2013) Mathematics of the total alkalinity-pH equation - pathway to robust and universal solution algorithms: the SolveSAPHE package v1.0.1. Geoscientif. Model Dev., 1367-1388

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Compute [H+] from Alkalinity total and DIC, on total pH scale
p_dissoc <- list()
p_dissoc$K1_DIC <- 1.421828e-06
p_dissoc$K2_DIC <- 1.081555e-09
p_dissoc$K_BT   <- 2.526573e-09
p_dissoc$K1_PO4 <- 0.02408434
p_dissoc$K2_PO4 <- 1.076024e-06
p_dissoc$K3_PO4 <- 1.600484e-09
p_dissoc$K_Sil  <- 4.071935e-10
p_dissoc$K_NH4  <- 5.380823e-10
p_dissoc$K_H2S  <- 3.087264e-07
p_dissoc$K_HSO4 <- 0.1003021    # on free scale
p_dissoc$K_HF   <- 0.00176441   # on free scale
p_dissoc$K_H2O  <- 5.97496e-14
solve_pH_from_AT(p_alktot=2.5e-3, p_dicvar=2e-3, p_bortot=0.0004157, p_po4tot=0, p_siltot=0, 
                 p_nh4tot=0, p_h2stot=0, p_so4tot=0.0282, p_flutot=6.832e-05, p_pHscale="T",
                 p_dicsel="DIC", p_dissoc=p_dissoc)

## Giving inital [H+] value and asking for final error on alkalinity, on seawater pH scale
result <- solve_pH_from_AT(p_alktot=0.00234, p_dicvar=0.001936461, p_bortot=0.0004157, p_po4tot=0,
                p_siltot=0, p_nh4tot=0, p_h2stot=0, p_so4tot=0.0282, p_flutot=6.832e-05, 
                p_pHscale="SWS",p_dicsel="DIC", p_dissoc=p_dissoc, p_askVal=TRUE, p_hini=1.e-8)
H <- result$zh
error <- result$val

## Compute [H+] from Alkalinity total and CO3, on total free scale
H <- solve_pH_from_AT(p_alktot=0.00240, p_dicvar=2.775481e-04, p_bortot=0.0004157, p_po4tot=0,
                p_siltot=0, p_nh4tot=0, p_h2stot=0, p_so4tot=0.0282, p_flutot=6.832e-05, 
                p_pHscale="F", p_dicsel="CO3", FALSE, p_dissoc=p_dissoc)
H1 <- H[1]
if (H[2] != 1) print ( c("Second solution : ", H[2]))

SolveSAPHE documentation built on May 2, 2021, 1:05 a.m.