Solubility
Methods
Coupled H2O–CO2 volatile solubility (dissolved-content) closures can be set with:
GeoParams.MaterialParameters.Solubility.Liu2005_Solubility Type
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). 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:
with the dimensionless partial pressures 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
Liu, Y., Zhang, Y., Behrens, H. (2005), Solubility of H2O in rhyolitic melts at low pressures and a new empirical model for mixed H2O-CO2 solubility, JVGR 143, 219-235, https://doi.org/10.1016/j.jvolgeores.2004.09.019
Degruyter, W., Huber, C. (2014), A model for the eruption frequency of upper crustal silicic magma chambers, EPSL 403, 117-130, https://doi.org/10.1016/j.epsl.2014.06.047
GeoParams.MaterialParameters.Solubility.Mafic_Solubility Type
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 the Scholz/Degruyter–Huber reference in the dimensionless groups 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.
References
Degruyter, W., Huber, C. (2014), A model for the eruption frequency of upper crustal silicic magma chambers, EPSL 403, 117-130, https://doi.org/10.1016/j.epsl.2014.06.047
Liu, Y., Zhang, Y., Behrens, H. (2005), Solubility of H2O in rhyolitic melts at low pressures and a new empirical model for mixed H2O-CO2 solubility, JVGR 143, 219-235, https://doi.org/10.1016/j.jvolgeores.2004.09.019
GeoParams.MaterialParameters.Solubility.GasMixture Type
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
and the mass-weighted specific heat is
with the reference convention
All fields are GeoUnits, so the struct nondimensionalizes, but both accessors read values rather than Quantitys: neither return carries units.
Computational routines
To evaluate dissolved H2O and CO2 (mass fractions) within a user routine, use this:
GeoParams.MaterialParameters.Solubility.compute_dissolved Function
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).
GeoParams.MaterialParameters.Solubility.compute_dissolved! Function
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).
Partial derivatives (via ForwardDiff, useful for implicit/Newton solves) are available for pressure, temperature, and gas composition:
GeoParams.MaterialParameters.Solubility.∂dissolved_∂P Function
∂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.
GeoParams.MaterialParameters.Solubility.∂dissolved_∂T Function
∂dissolved_∂T(s, P, T, X_co2) -> (∂m_h2o/∂T, ∂m_co2/∂T)GeoParams.MaterialParameters.Solubility.∂dissolved_∂Xco2 Function
∂dissolved_∂Xco2(s, P, T, X_co2) -> (∂m_h2o/∂X_co2, ∂m_co2/∂X_co2)Given a target dissolved H2O content, the gas composition X_co2 that produces it can be found with:
GeoParams.MaterialParameters.Solubility.find_Xco2 Function
find_Xco2(s::AbstractSolubility, P, T, m_h2o_target; X0=0.5, tol=1e-8, max_iter=50) -> X_co2Invert 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.
Gas-mixture helpers for the energy equation:
GeoParams.MaterialParameters.Solubility.compute_gas_heatcapacity Function
compute_gas_heatcapacity(s::GasMixture, X_co2)Mass-weighted specific heat of the H2O–CO2 gas mixture; zero at X_co2 == 0 (reference convention).
GeoParams.MaterialParameters.Solubility.effective_molar_mass Function
effective_molar_mass(s::GasMixture, X_co2)Effective molar mass of the H2O–CO2 gas mixture at CO2 mole fraction X_co2.
Note that ε_g (exsolved-gas volume fraction) and X_co2 (CO2 mole fraction of the gas) are typically ODE state variables owned by the solver, not closed algebraically at a point — the closures above are the entries to that mass-balance, not a replacement for it.