Skip to content

Equilibrium constants from 5 to 90 °C ​

Before this page

Validation against published data, the constants of the database at 25 °C against their sources.

Cemdata18 (Lothenbach et al., 2019) tabulates its constants at 25 °C. At another temperature they follow from the standard properties of its species: the equation of state of Helgeson et al. (1981) for the aqueous species, the heat capacities of the solids, and the water's own equation of state. The PHREEQC database (Parkhurst and Appelo, 2013) gives many of the same reactions an analytical expression fitted to measured constants over a temperature range, with its sources in comments where it gives them. The two are independent descriptions of the same equilibria, and this page compares them from 5 to 90 °C, reaction by reaction (scripts/logk_temperature_check.jl, on the copy of phreeqc.dat of PHREEQC 3.7.3, which datapath obtains).

1. The comparison ​

For each reaction, its constant at 25 °C in both databases, and the difference of their temperature dependences at 50 °C and at its largest between 5 and 90 °C: each constant taken from its own value at 25 °C, the two differences compared, so that what the two databases already disagree on at 25 °C is not counted twice. Where phreeqc.dat gives a reaction two expressions (gypsum), the second is used, which its comment calls the better fit.

julia
using ChemistryLab, DynamicQuantities, Printf
include(joinpath(pkgdir(ChemistryLab), "scripts", "logk_temperature_check.jl"))

rows = lkt_compare()
println(rpad("reaction", 22), "  log K at 25 °C        difference of the temperature dependences")
println(rpad("", 22), "  PHREEQC  Cemdata18    at 50 °C   largest, 5-90 °C")
for r in rows
    @printf("%-22s %8.3f %9.3f    %+7.3f   %+6.3f at %2d °C\n", r.name, r.phreeqc25, r.cemdata25, r.at50, r.worst, r.worst_T)
end
reaction                log K at 25 °C        difference of the temperature dependences
                        PHREEQC  Cemdata18    at 50 °C   largest, 5-90 °C
water                   -13.995   -14.000     -0.008   -0.016 at 90 °C
bicarbonate              10.329    10.329     -0.006   -0.053 at 90 °C
carbon dioxide (aq)      16.681    16.681     -0.016   -0.082 at 90 °C
bisulfate                 1.988     1.988     +0.063   +0.139 at 90 °C
CO2(g)                   -1.468    -1.468     -0.001   +0.009 at  5 °C
calcite                  -8.480    -8.480     +0.045   +0.235 at 90 °C
aragonite                -8.336    -8.336     -0.013   -0.019 at 70 °C
dolomite                -17.084   -17.090     -0.042   +0.157 at 90 °C
gypsum                   -4.582    -4.581     -0.030   -0.107 at 90 °C
anhydrite                -4.278    -4.357     -0.009   -0.065 at 90 °C
quartz                   -3.980    -3.746     -0.050   -0.115 at 90 °C
amorphous silica         -2.712    -2.714     +0.020   +0.047 at 90 °C
Show the code of scripts/logk_temperature_check.jl, included above

The file scripts/logk_temperature_check.jl on GitHub, at the commit this page was built from:

julia
# =============================================================================
#  logk_temperature_check.jl — Cemdata18's equilibrium constants from 5 to 90 °C
#
#  The temperature dependence of twelve equilibrium constants as Cemdata18
#  computes them (the HKF equations of state of its aqueous species, the heat
#  capacities of its solids, water from its own equation of state), against the
#  analytical expressions of the PHREEQC database, fits to measured constants
#  whose sources the file names in its comments where it names them. The file is
#  PHREEQC's phreeqc.dat of release 3.7.3, which datapath obtains. The page
#  docs/src/tutorials/validation_logk_temperature.md runs it.
# =============================================================================

using ChemistryLab
using DynamicQuantities

const LKT_DB = Dict(symbol(s) => s for s in build_species(datapath("cemdata18-thermofun.json"); verbose = false))
const LKT_PHREEQC = datapath("phreeqc.dat")

# Each reaction: the line or the phase name that heads its record in
# phreeqc.dat, and the same reaction in Cemdata18 symbols, products positive.
# The aqueous silica of Cemdata18 is SiO2@, which PHREEQC writes H4SiO4: the
# same constant, water at unit activity.
const LKT_REACTIONS = [
    "water" => ("H2O = OH- + H+", Dict("OH-" => 1, "H+" => 1, "H2O@" => -1)),
    "bicarbonate" => ("CO3-2 + H+ = HCO3-", Dict("HCO3-" => 1, "CO3-2" => -1, "H+" => -1)),
    "carbon dioxide (aq)" => ("CO3-2 + 2 H+ = CO2 + H2O", Dict("CO2@" => 1, "H2O@" => 1, "CO3-2" => -1, "H+" => -2)),
    "bisulfate" => ("SO4-2 + H+ = HSO4-", Dict("HSO4-" => 1, "SO4-2" => -1, "H+" => -1)),
    "CO2(g)" => ("CO2(g)", Dict("CO2@" => 1, "CO2" => -1)),
    "calcite" => ("Calcite", Dict("Ca+2" => 1, "CO3-2" => 1, "Cal" => -1)),
    "aragonite" => ("Aragonite", Dict("Ca+2" => 1, "CO3-2" => 1, "Arg" => -1)),
    "dolomite" => ("Dolomite", Dict("Ca+2" => 1, "Mg+2" => 1, "CO3-2" => 2, "Ord-Dol" => -1)),
    "gypsum" => ("Gypsum", Dict("Ca+2" => 1, "SO4-2" => 1, "H2O@" => 2, "Gp" => -1)),
    "anhydrite" => ("Anhydrite", Dict("Ca+2" => 1, "SO4-2" => 1, "Anh" => -1)),
    "quartz" => ("Quartz", Dict("SiO2@" => 1, "Qtz" => -1)),
    "amorphous silica" => ("SiO2(a)", Dict("SiO2@" => 1, "Amor-Sl" => -1)),
]

"""
    lkt_analytic(header) -> Vector{Float64}

The six coefficients of the analytical expression of the record headed by
`header` in phreeqc.dat, `log K = A₁ + A₂T + A₃/T + A₄ log₁₀T + A₅/T² + A₆T²`,
T in kelvin, those the record does not give at zero. Where a record gives two
expressions (gypsum), the second, which its comment calls the better fit.
"""
function lkt_analytic(header)
    lines = readlines(LKT_PHREEQC)
    k = findfirst(l -> strip(first(split(l, '#'))) == header, lines)
    k === nothing && error("lkt_analytic: no record \"$header\" in phreeqc.dat")
    coefficients = nothing
    # A phase is headed by its name, its reaction on the next line.
    reaction_next = !occursin('=', header)
    for l in lines[(k + 1):end]
        s = strip(first(split(l, '#')))
        isempty(s) && continue
        if !startswith(s, "-")
            reaction_next && (reaction_next = false; continue)
            # The record ends where the next one starts: a line that is not an option.
            break
        end
        option, rest... = split(s)
        if lowercase(option) in ("-analytic", "-analytical", "-analytical_expression", "-a_e")
            a = zeros(6)
            for (i, x) in enumerate(rest)
                a[i] = parse(Float64, x)
            end
            coefficients = a
        end
    end
    coefficients === nothing && error("lkt_analytic: \"$header\" has no analytical expression")
    return coefficients
end

lkt_phreeqc(a, T) = a[1] + a[2] * T + a[3] / T + a[4] * log10(T) + a[5] / T^2 + a[6] * T^2

"""
    lkt_cemdata(ν, T) -> Float64

log₁₀ K of the reaction `ν` (symbol => coefficient, products positive) at `T`
kelvin and 1 bar, from the standard Gibbs energies of Cemdata18.
"""
function lkt_cemdata(ν, T)
    ΔG = sum(c * ustrip(us"J/mol", LKT_DB[s][:ΔₐG⁰](T = T * u"K", P = 1.0e5u"Pa"; unit = true)) for (s, c) in ν)
    return -ΔG / (R_GAS * T * log(10))
end

"""
    lkt_compare(; temperatures = 5:5:90) -> Vector{NamedTuple}

For each reaction: log K of both at 25 °C, and the difference of the two once
each is taken from its own value at 25 °C (what the temperature dependence
alone contributes), at 50 °C and at its largest over `temperatures`, °C.
"""
function lkt_compare(; temperatures = 5:5:90)
    return map(LKT_REACTIONS) do (name, (header, ν))
        a = lkt_analytic(header)
        p(T) = lkt_phreeqc(a, T + 273.15)
        c(T) = lkt_cemdata(ν, T + 273.15)
        shift(T) = (c(T) - c(25)) - (p(T) - p(25))
        worst = argmax(T -> abs(shift(T)), temperatures)
        (; name, phreeqc25 = p(25), cemdata25 = c(25), at50 = shift(50), worst_T = worst, worst = shift(worst))
    end
end

The constants of two reactions along the range, the most and the least soluble of the calcium sulfates and carbonates:

julia
println(" °C   calcite: PHREEQC Cemdata18    anhydrite: PHREEQC Cemdata18")
for T_C in (5, 25, 50, 75, 90)
    T = T_C + 273.15
    c = lkt_analytic("Calcite"); a = lkt_analytic("Anhydrite")
    @printf("%3d          %7.3f %9.3f               %7.3f %9.3f\n", T_C,
            lkt_phreeqc(c, T), lkt_cemdata(Dict("Ca+2" => 1, "CO3-2" => 1, "Cal" => -1), T),
            lkt_phreeqc(a, T), lkt_cemdata(Dict("Ca+2" => 1, "SO4-2" => 1, "Anh" => -1), T))
end
 °C   calcite: PHREEQC Cemdata18    anhydrite: PHREEQC Cemdata18
  5           -8.393    -8.398                -4.075    -4.185
 25           -8.480    -8.480                -4.278    -4.357
 50           -8.736    -8.691                -4.576    -4.665
 75           -9.122    -8.975                -4.908    -5.027
 90           -9.406    -9.170                -5.118    -5.263

2. What the comparison says ​

At 25 °C the two databases share their constants. Ten of the twelve agree within 0.01; anhydrite differs by 0.08 and quartz by 0.23, Cemdata18 making quartz the more soluble.

Up to 50 °C their temperature dependences agree within 0.07, the largest difference being that of the bisulfate ion, and by 0.05 at most for the minerals. Up to 90 °C they part by at most 0.24, for calcite, whose PHREEQC expression is a fit over 0 to 250 °C (its comment names Ellis (1959) and Plummer and Busenberg (1982)); aragonite, which PHREEQC gives another expression, agrees with Cemdata18 within 0.02 over the whole range. Gypsum and anhydrite stay within 0.11, the carbonate equilibria within 0.09, the water within 0.02. For a cement cured up to 50 °C, the equations of state of Cemdata18 carry its constants as the fits to measurements do, to a few hundredths of a log unit; at 90 °C the calcium carbonates and sulfates are known to a tenth or two, less well than at 25 °C.