Skip to content

Solubility ​

Methods ​

Coupled H2O–CO2 volatile solubility (dissolved-content) closures can be set with:

GeoParams.MaterialParameters.Solubility.Liu2005_Solubility Type
julia
Liu2005_Solubility(; coeffs=(b1..b6, c1..c4), Pref=1MPa, Tref=1K)

Coupled H2O–CO2 solubility for silicic (rhyolite) melt after Liu et al. (2005), as used by Degruyter & Huber (2014). It applies to rhyolite only and is useful to reproduce Degruyter & Huber-type models; for other melt compositions, for CO2 and for pressures above ~500 MPa use SunYao2026_Solubility. compute_dissolved returns the dissolved H2O and CO2 mass fractions of the melt as a function of pressure, temperature, and the CO2 mole fraction of the gas X_co2:

mH2O=(b1Pw1/2+b2Pw+b3Pw3/2)TrefT+b4Pw3/2+Pc(b5Pw1/2+b6Pw)mCO2=Pc(c1+c2Pw)TrefT+Pc(c3Pw1/2+c4Pw3/2)

with the dimensionless partial pressures Pw=P(1−Xco2)/Pref and Pc=PXco2/Pref. With Pref=1MPa, Tref=1K these equal the reference partial pressures in MPa and reproduce the Liu (2005) numbers; because they are ratios of like-dimensioned quantities, the closure is dimensionally homogeneous and nondimensionalizes cleanly. The fitted coeffs are dimensionless; isdimensional tracks the reference GeoUnits.

References

source
GeoParams.MaterialParameters.Solubility.Mafic_Solubility Type
julia
Mafic_Solubility(; coeffs=(b1..b10, c1..c4), T0=273.15K, Tref=1K, Pref=1MPa)

Coupled H2O–CO2 solubility for mafic (basalt) melt. Dissolved H2O follows the mafic polynomial of Scholz et al. (2023; MagmaChamberBoxModel, exsolve_mafic.m) in the dimensionless groups TC=(T−T0)/Tref (numerically °C) and Pm=P/Pref (numerically MPa); dissolved CO2 reuses the Liu (2005) rhyolite CO2 block. Nondimensionalizes like Liu2005_Solubility. The H2O polynomial has no floor at zero and goes negative outside its calibration (high X_co2, low P); the dissolved H2O output is floored at zero rather than returned as a negative mass fraction. At low pressure it does not tend to zero: with pure H2O gas it gives 2.74 wt% at P → 0 and 850 °C (1.52 wt% at 1100 °C), so the law is meaningful only at magma-chamber pressures, not near fragmentation.

References

source
GeoParams.MaterialParameters.Solubility.SunYao2026_Solubility Type
julia
SunYao2026_Solubility(; oxd_wt = (77.0, 0.1, 12.8, 0.8, 0.1, 0.6, 4.0, 4.6, 0.02), a = (a0..a9), b = (b0..b20))

Coupled H2O–CO2 solubility of Sun & Yao (2026), calibrated on 2090 experiments on melts from carbonatite to pure silica at 660–1924 °C and 1 bar–6 GPa. oxd_wt is the volatile-free melt composition in wt% of (SiO2, TiO2, Al2O3, FeOt, MgO, CaO, Na2O, K2O, P2O5), the oxide order of GiordanoMeltViscosity with P2O5 in place of H2O; the default is a high-silica rhyolite. It is converted once to the oxide mole fractions X, which are renormalized over these 9 oxides: MnO and Fe2O3 are not in the set, so fold Fe2O3 into FeOt.

Dissolved H2O (wt%) is the sum of molecular H2O and hydroxyl (eq. 7),

ln⁡SH2O,m=a0ln⁡PH2O+a1ln⁡T+a2P2T+(a3P+a4)XNa2OT,ln⁡SOH−=a5ln⁡PH2O+a6ln⁡T+(a7+a8XAl2O3+a9XNa2O)PT,

and dissolved CO2 (ppm) is the sum of molecular CO2 and carbonate (eq. 8),

ln⁡SCO2,m=b0ln⁡PCO2+b1ln⁡P+b2XAl2O3P+b3XMgO2+b4XK2O2,ln⁡SCO32−=b0ln⁡PCO2+b5ln⁡T+b6ln⁡P+Ω+F+QSH2O,

with Ω=(b7XSiO2+b8XCaO)P/T+(b9XCaO+b10XNa2O)P, F=b11XSiO2+b12XAl2O3+b13XFeOt+b14XMgO+b15XK2O+b16ln⁡[1−(XSiO2+XTiO2+XAl2O3+XP2O5)] and Q=b17XSiO2+b18XAl2O3+b19XNa2O+b20XK2O. T is in K, and the total pressure P and the partial pressures PH2O=P(1−Xco2), PCO2=PXco2 are in bar; the fit uses partial pressures in place of fugacities. The defaults of a and b are Table 1. compute_dissolved returns the totals as mass fractions; the species split is not returned. Pressure and temperature enter through the reference GeoUnits Pref = 1 bar and Tref = 1 K, so the law nondimensionalizes like Liu2005_Solubility.

Pure gases give exact zeros: no H2O at X_co2 = 1 and no CO2 at X_co2 = 0, with zero derivatives in P and T. The slopes in X_co2 are infinite at these endpoints (a0,a5,b0<1), so ∂dissolved_∂Xco2 is not finite there. The H2O data reach 2 GPa and the mixed-fluid data 1 GPa; only the pure-CO2 data reach 6 GPa. Above ~2 GPa the formula fails: the term a2P2/T makes the dissolved H2O exceed a mass fraction of 1 (rhyolite at 900 °C from ~2.5 GPa), and QSH2O does the same to the dissolved CO2 of H2O-bearing fluids (X_co2 = 0.5: rhyolite at 900 °C from ~2 GPa, basalt at 1200 °C below 2.5 GPa).

References

  • Sun, C., Yao, L. (2026), A unified H2O–CO2 solubility–speciation model for magmatic liquids: Constraints on magma storage architecture in continental rifts, EPSL 689, 120115, https://doi.org/10.1016/j.epsl.2026.120115
source
GeoParams.MaterialParameters.Solubility.GasMixture Type
julia
GasMixture(; Cp_h2o=3880J/kg/K, Cp_co2=1200J/kg/K, M_h2o=18.02e-3kg/mol, M_co2=44.01e-3kg/mol)

H2O–CO2 gas-mixture properties keyed on the CO2 mole fraction of the gas X_co2 (Degruyter & Huber 2014). The effective molar mass is

mg=MH2O(1−Xco2)+MCO2Xco2

and the mass-weighted specific heat is

cg=MH2OcH2O(1−Xco2)+MCO2cCO2Xco2mg

with the reference convention cg=0 at Xco2=0 — a discontinuity, since the formula's own limit as Xco2→0 is cH2O.

All fields are GeoUnits, so the struct nondimensionalizes, but both accessors read values rather than Quantitys: neither return carries units.

source

SunYao2026_Solubility is the recommended law: it takes the melt composition, covers H2O and CO2 and is calibrated up to 2 GPa for H2O and 1 GPa for mixed H2O–CO2 fluids; above ~2 GPa its dissolved contents exceed 100 wt%. Liu2005_Solubility applies to rhyolite only and is useful to reproduce Degruyter & Huber (2014)-type models. Mafic_Solubility is a polynomial fit for mafic melts; its dissolved H2O does not vanish as the pressure goes to zero (2.7 wt% at 850 °C in the figure), so it is meaningful only at chamber pressures.

The figure compares the dissolved H2O in equilibrium with pure H2O gas at 850 °C.

julia
using GeoParams, CairoMakie
basalt = (50.42, 1.53, 15.13, 9.81, 7.76, 11.35, 2.83, 0.14, 0.0)
laws = (
    "Liu2005_Solubility" => Liu2005_Solubility(),
    "Mafic_Solubility" => Mafic_Solubility(),
    "SunYao2026_Solubility, rhyolite" => SunYao2026_Solubility(),
    "SunYao2026_Solubility, basalt" => SunYao2026_Solubility(; oxd_wt = basalt),
)
P = range(1.0e5, 4.0e8, 200)
fig = Figure(size = (800, 500))
ax = Axis(fig[1, 1]; xlabel = "pressure P (MPa)", ylabel = "dissolved H₂O (wt%)")
for (name, law) in laws
    lines!(ax, P ./ 1.0e6, [100 * compute_dissolved(law, p, 1123.15, 0.0)[1] for p in P]; label = name)
end
axislegend(ax; position = :lt)
fig

Computational routines ​

To evaluate dissolved H2O and CO2 (mass fractions) within a user routine, use this:

GeoParams.MaterialParameters.Solubility.compute_dissolved Function
julia
compute_dissolved(s::AbstractSolubility, P, T, X_co2) -> (m_h2o, m_co2)

Dissolved H2O and CO2 mass fractions of the melt (P in Pa, T in K, X_co2 the CO2 mole fraction of the gas). Also callable as compute_dissolved(s; P, T, X_co2) and compute_dissolved(s, args::NamedTuple).

source
GeoParams.MaterialParameters.Solubility.compute_dissolved! Function
julia
compute_dissolved!(m_h2o, m_co2, MatParam, Phases, args)

In-place dissolved H2O and CO2 over a domain. args is a NamedTuple of P, T, X_co2 index-matched to the output arrays. Also accepts a single solubility or phase struct in place of (MatParam, Phases).

source

Partial derivatives (via ForwardDiff, useful for implicit/Newton solves) are available for pressure, temperature, and gas composition:

GeoParams.MaterialParameters.Solubility.∂dissolved_∂P Function
julia
∂dissolved_∂P(s, P, T, X_co2) -> (∂m_h2o/∂P, ∂m_co2/∂P)

ForwardDiff partial derivatives of compute_dissolved with respect to pressure. Companions ∂dissolved_∂T, ∂dissolved_∂Xco2.

source
GeoParams.MaterialParameters.Solubility.∂dissolved_∂T Function
julia
∂dissolved_∂T(s, P, T, X_co2) -> (∂m_h2o/∂T, ∂m_co2/∂T)
source
GeoParams.MaterialParameters.Solubility.∂dissolved_∂Xco2 Function
julia
∂dissolved_∂Xco2(s, P, T, X_co2) -> (∂m_h2o/∂X_co2, ∂m_co2/∂X_co2)
source

Given a target dissolved H2O content, the gas composition X_co2 that produces it can be found with:

GeoParams.MaterialParameters.Solubility.find_Xco2 Function
julia
find_Xco2(s::AbstractSolubility, P, T, m_h2o_target; X0=0.5, tol=1e-8, max_iter=50) -> X_co2

Invert compute_dissolved for the gas composition: solve for X_co2 ∈ [0,1] such that compute_dissolved(s, P, T, X_co2)[1] == m_h2o_target, at fixed pressure P and temperature T. Uses a safeguarded Newton iteration (via ∂dissolved_∂Xco2) bracketed by bisection, so an out-of-bounds Newton step always falls back to a bisection halving instead of leaving [0,1].

Throws an ErrorException if m_h2o_target is infeasible at this P,T (outside the achievable range between X_co2=0 and X_co2=1) or if the iteration fails to converge within max_iter steps — this never returns a clamped or out-of-tolerance answer.

source

Given both dissolved contents, the saturation pressure and the gas composition follow from:

GeoParams.MaterialParameters.Solubility.compute_saturation_pressure Function
julia
compute_saturation_pressure(s::AbstractSolubility, m_h2o, m_co2, T; tol=100eps, max_iter=50) -> (P, X_co2)

Fluid-saturation pressure P of a melt with dissolved H2O and CO2 mass fractions m_h2o and m_co2 at temperature T, and the CO2 mole fraction X_co2 of the coexisting H2O–CO2 gas: the inverse of compute_dissolved in P and X_co2. P is in Pa and T in K, or both nondimensional for a nondimensionalized law. Applied to the volatile contents of melt inclusions, this is the saturation barometer of Sun & Yao (2026, sect. 3–4).

m_co2 = 0 gives a pure H2O gas (X_co2 = 0) and m_h2o = 0 a pure CO2 gas (X_co2 = 1), with P matching the nonzero content alone. Otherwise a Newton iteration in (ln⁡P,Xco2) drives both misfits ln⁡(m/mtarget) below tol, using ∂dissolved_∂P and ∂dissolved_∂Xco2. Each step changes P by at most a factor e and moves X_co2 at most halfway towards 0 or 1.

The solve is iterative and meant for analysis, such as melt-inclusion barometry or setting initial conditions, not for evaluation at every grid point of a solver. It throws a DomainError for negative or all-zero contents and an ErrorException if it does not converge within max_iter iterations; it never returns an unconverged answer. Outside its calibration, a polynomial law such as Mafic_Solubility can match the same contents at more than one pressure.

For rhyolite with SunYao2026_Solubility the solve converges up to ~1 GPa. Above ~1.5 GPa with small X_co2 it can fail although a solution exists, because the model's exp⁡(QSH2O) term diverges.

Example

julia
P, X_co2 = compute_saturation_pressure(SunYao2026_Solubility(), 0.04, 0.001, 1173.15)
# (2.76e8, 0.54): 4 wt% H2O and 1000 ppm CO2 saturate at 276 MPa in rhyolite at 900 °C

References

  • Sun, C., Yao, L. (2026), A unified H2O–CO2 solubility–speciation model for magmatic liquids: Constraints on magma storage architecture in continental rifts, EPSL 689, 120115, https://doi.org/10.1016/j.epsl.2026.120115
source

The figure applies it as a melt-inclusion barometer in rhyolite at 850 °C. The isobars are the dissolved contents in equilibrium with gases of all compositions at fixed pressure. Each of six illustrative inclusions, not measured data, is labeled with its saturation pressure and the depth z=P/(ρg) for a crust of density ρ=2600 kg/m³. The right panel compares these pressures with those of Liu2005_Solubility, which are up to 10 % higher.

julia
using GeoParams, CairoMakie
rhyolite, liu = SunYao2026_Solubility(), Liu2005_Solubility()
T = 1123.15                                  # 850 °C
ρ, g = 2600.0, 9.81                          # crust density (kg/m³), gravity (m/s²)
# illustrative melt inclusions, not data: (H2O wt%, CO2 ppm)
inclusions = [(2.5, 100.0), (3.0, 400.0), (4.0, 150.0), (4.5, 900.0), (5.5, 300.0), (6.0, 1200.0)]
fig = Figure(size = (1000, 520))
ax = Axis(fig[1, 1]; xlabel = "dissolved H₂O (wt%)", ylabel = "dissolved CO₂ (ppm)", title = "SunYao2026_Solubility, rhyolite, 850 °C")
X = range(0, 1, 201)
for (k, P) in enumerate((50.0e6, 100.0e6, 200.0e6, 300.0e6, 400.0e6))
    m = [compute_dissolved(rhyolite, P, T, x) for x in X]
    lines!(ax, 100 .* first.(m), 1.0e6 .* last.(m); color = k, colormap = :viridis, colorrange = (1, 5), label = "$(round(Int, P / 1.0e6)) MPa")
end
P_sy = [compute_saturation_pressure(rhyolite, h / 100, c / 1.0e6, T)[1] for (h, c) in inclusions]
P_liu = [compute_saturation_pressure(liu, h / 100, c / 1.0e6, T)[1] for (h, c) in inclusions]
scatter!(ax, inclusions; color = :black, label = "illustrative inclusions")
for ((h, c), P) in zip(inclusions, P_sy)
    text!(ax, h, c; text = "$(round(Int, P / 1.0e6)) MPa, $(round(P / (ρ * g) / 1.0e3; digits = 1)) km", offset = (6, 2), fontsize = 11)
end
Legend(fig[2, 1:2], ax; orientation = :horizontal, framevisible = false)
ax2 = Axis(fig[1, 2]; xlabel = "P, SunYao2026_Solubility (MPa)", ylabel = "P, Liu2005_Solubility (MPa)", title = "same inclusions, two laws", aspect = 1)
ablines!(ax2, 0, 1; color = :gray, linestyle = :dash)
scatter!(ax2, P_sy ./ 1.0e6, P_liu ./ 1.0e6; color = :black)
colsize!(fig.layout, 2, Relative(0.35))
fig

The equilibrium volume fraction of exsolved H2O gas, given the total water content, follows in closed form from a solubility law and the melt and gas densities of a ThreePhase_Density:

GeoParams.MaterialParameters.Solubility.compute_gas_fraction Function
julia
compute_gas_fraction(s::AbstractSolubility, ρ::ThreePhase_Density, args)

Equilibrium volume fraction of exsolved H2O gas in a melt + crystal + gas magma, the ϕ_gas input of ThreePhase_Density, Suspension and CriticalPorosityFragmentation. args holds the pressure P, the temperature T, the melt fraction ϕ of the condensed (melt + crystal) phases as returned by a melting law, and the total water mass fraction m_h2o_total of the melt + gas, i.e. on a crystal-free basis; crystals hold no water. args is also passed to the ρmelt and ρgas laws of ρ. Also callable as compute_gas_fraction(s, ρ; args...).

The gas is pure H2O, so the dissolved water mass fraction of the melt is meq= compute_dissolved(s, P, T, 0)[1]. The water mass balance of Degruyter & Huber (2014, eq. 18) gives the gas mass fraction of the melt + gas,

xg=max(0,mh2o,total−meq1−meq),

and with the crystal volume fraction ϕx=(1−ϕgas)(1−ϕ) of their melting curve (eq. A.4) the gas volume fraction of the whole magma is

ϕgas=ϕxgρmϕxgρm+(1−xg)ρg.

Pass ϕ_gas together with ϕ_x = (1 - ϕ_gas) * (1 - ϕ) to ThreePhase_Density and Suspension.

Undersaturated magma (mh2o,total≤meq) gives zero without evaluating ρgas. For the H2O gas density use HalbachChatterjee_Density, which is within 0.8 % of IAPWS-95 for 0.1–400 MPa and 600–1200 °C. The result is NaN for m_h2o_total outside [0,1), ϕ outside [0,1], or meq≥1, which SunYao2026_Solubility returns above ~2.5 GPa. It is dimensionless and the same for dimensional and nondimensionalized laws and inputs.

Example

julia
ρ = ThreePhase_Density(; ρgas = HalbachChatterjee_Density())
args = (; P = 1.0e8, T = 1100.0, ϕ = 0.6, m_h2o_total = 0.05)
ϕ_gas = compute_gas_fraction(SunYao2026_Solubility(), ρ, args)
ρ_magma = compute_density(ρ, (; args..., ϕ_gas, ϕ_x = (1 - ϕ_gas) * (1 - args.ϕ)))

References

source

The figure shows the gas fraction of crystal-free rhyolite (ϕ = 1) at 850 °C for the SunYao2026_Solubility law and a HalbachChatterjee_Density gas. Gas exsolves below the saturation pressure of each water content. The dashed line is the default critical gas fraction of CriticalPorosityFragmentation.

julia
using GeoParams, CairoMakie
ρ = ThreePhase_Density(; ρgas = HalbachChatterjee_Density())
solubility = SunYao2026_Solubility()
P = exp10.(range(5, log10(4.0e8), 200))
fig = Figure(size = (800, 500))
ax = Axis(fig[1, 1]; xscale = log10, xlabel = "pressure P (MPa)", ylabel = "gas volume fraction ϕ_gas (–)")
for m_h2o_total in (0.03, 0.05, 0.07)
    ϕ_gas = [compute_gas_fraction(solubility, ρ, (; P = p, T = 1123.15, ϕ = 1.0, m_h2o_total)) for p in P]
    lines!(ax, P ./ 1.0e6, ϕ_gas; label = "total H₂O = $(round(Int, 100 * m_h2o_total)) wt%")
end
hlines!(ax, 0.75; color = :black, linestyle = :dash, label = "ϕ_crit = 0.75")
axislegend(ax; position = :rc)
fig

Gas-mixture helpers for the energy equation:

GeoParams.MaterialParameters.Solubility.compute_gas_heatcapacity Function
julia
compute_gas_heatcapacity(s::GasMixture, X_co2)

Mass-weighted specific heat of the H2O–CO2 gas mixture; zero at X_co2 == 0 (reference convention).

source
GeoParams.MaterialParameters.Solubility.effective_molar_mass Function
julia
effective_molar_mass(s::GasMixture, X_co2)

Effective molar mass of the H2O–CO2 gas mixture at CO2 mole fraction X_co2.

source

Only for pure H2O gas in equilibrium does the exsolved-gas volume fraction ε_g close algebraically at a point, through compute_gas_fraction. With CO2, ε_g and X_co2 (CO2 mole fraction of the gas) are typically ODE state variables owned by the solver; the closures above are the entries to that mass balance, not a replacement for it.