pygcc

Init file

Submodules

Package Contents

Classes

db_reader

Class to read direct-access and source thermodynamic database

iapws95

Implementation of IAPWS Formulation 1995 for ordinary water substance, revised release of 2016

ZhangDuan

Implementation of Zhang & Duan model Formulation for water at higher Temperature and Pressure conditions, i.e, Deep Earth Water - DEW

water_dielec

Class Implementation of Water dielectric constants, the Debye-Huckel "A" and "B" parameters and their derivatives at ambient to deep-earth Temperature and Pressure conditions with three different formulations

heatcap

Class to heat capacity for mineral and gases using Maier-Kelley powerlaw, Haas-Fisher powerlaw, Holland and Powell and Berman's function

solidsolution_thermo

Class to calculate Ideal mixing model for solid-solutions, supporting multisite ideal formalism

db_reader

Class to read direct-access and source thermodynamic database

iapws95

Implementation of IAPWS Formulation 1995 for ordinary water substance, revised release of 2016

ZhangDuan

Implementation of Zhang & Duan model Formulation for water at higher Temperature and Pressure conditions, i.e, Deep Earth Water - DEW

water_dielec

Class Implementation of Water dielectric constants, the Debye-Huckel "A" and "B" parameters and their derivatives at ambient to deep-earth Temperature and Pressure conditions with three different formulations

heatcap

Class to heat capacity for mineral and gases using Maier-Kelley powerlaw, Haas-Fisher powerlaw, Holland and Powell and Berman's function

solidsolution_thermo

Class to calculate Ideal mixing model for solid-solutions, supporting multisite ideal formalism

calcRxnlogK

This class implemetation calculates logK values for any reaction with the option for extrapolation where rho < 350kg/m3

write_database

Class to write the new database for either GWB, EQ3/6, ToughReact, Pflotran into

Functions

readIAPWS95data()

returns all constants and coefficients needed for the IAPWS95 formulation, packed into a dictionary

convert_temperature(T[, Out_Unit])

This function converts temperatures from Celsius to Kelvin and vice-versa

supcrtaq(TC, P, specieppt[, Dielec_method, ThermoInUnit])

This function evaluates the Gibbs free energy of aqueous species at T and P

Element_counts(formula)

This function calculates the elemental composition of a substance given by its chemical formula

calclogKclays(TC, P, *elem[, dbaccessdic, group, ...])

This function calculates logK values and reaction parameters of clay reactions using below references:

readIAPWS95data()

returns all constants and coefficients needed for the IAPWS95 formulation, packed into a dictionary

convert_temperature(T[, Out_Unit])

This function converts temperatures from Celsius to Kelvin and vice-versa

supcrtaq(TC, P, specieppt[, Dielec_method, ThermoInUnit])

This function evaluates the Gibbs free energy of aqueous species at T and P

calclogKclays(TC, P, *elem[, dbaccessdic, group, ...])

This function calculates logK values and reaction parameters of clay reactions using below references:

calc_elem_count_molewt(formula, **kwargs)

This function calculates the molecular mass and the elemental composition of a substance given

importconfile(filename, *Rows)

This function imports numeric data from a text file as column vectors.

var_name(var)

feval(funcName, *args)

roundup_tenth(x)

roundup_hundredth(x)

read_specific_lines(file, lines_to_read)

derivative(f, a[, method, h])

Compute the derivative of f, f'(a) with step size h.

info(name, dic)

This function checks for naming convention of the species in the direct-access or source database

drummondgamma(TK, I)

This function models solubility of CO2 gas in brine using Drummond equation

Henry_duan_sun(TK, P, I)

This function evaluates the solubility of CO2 gase in brine using Duan_Sun Formulation

co2fugacity(TK, P[, poy])

This function computes the fugacity and density of CO2 by Duan and Sun 2003

gamma_correlation(TC, P[, method])

This function calculates the CO2 activity correlation coefficients at

Helgeson_activity(TC, P, I[, Dielec_method])

This function calculates the solute activity coefficient, solvent osmotic coefficient,

aw_correlation(TC, P[, Dielec_method])

Calculates the water activity correlation coefficients at given temperature and pressure

outputfmt(fid, logK, Rxn, *T[, dataset, logK_form])

This function writes logK and Rxn data to any file using GWB, EQ36, Pflotran and ToughReact format

main_function_name(module)

print main_function name

Attributes

MW

eps

J_to_cal

IAPWS95_COEFFS

__version__

class pygcc.db_reader(**kwargs)[source]

Class to read direct-access and source thermodynamic database

Parameters:
  • dbaccess (string) – filename and location of the direct-access/sequential-access database, optional, default is speq21

  • dbBerman_dir (string) – filename and location of the Berman mineral database, optional

  • dbHP_dir (string) – filename and location of the supcrtbl mineral and gas database, optional

  • sourcedb (string) – filename of the source database, optional

  • sourcedb – filename of the source database, optional

  • sourceformat (string) – specify the source database format, either ‘GWB’ or ‘EQ36’, optional

  • dbaccessformat (string, optional) – specify the direct-access/sequential-access database format, either ‘speq’ or ‘supcrtbl’, default is ‘speq’

  • sourcedb_codecs (string) – specify the name of the encoding used to decode or encode the sourcedb file, optional

  • dbaccess_codecs (string) – specify the name of the encoding used to decode or encode the dbaccess file, optional

Returns:

  • dbaccessdic (dict) – dictionary of minerals, gases, redox and aqueous species

  • dbaccess (string) – direct-access database file name

  • sourcedic (dict) – dictionary of reaction coefficients and species

  • specielist (list) – list of species segmented into the different categories [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list) – list of species categories listed in ‘specielist’

  • chargedic (dict) – dictionary of charges of species

  • MWdic (dict) – dictionary of MW of species

  • Mineraltype (dict) – mineral type for minerals

  • fugacity_info (dict) – fugacity information as stored in new tdat database for chi and critical ppts

  • Sptype (dict) – specie types and eq3/6 and revised date info

  • Elemlist (dict) – dictionary of elements and coefficients

Examples

>>> ps = db_reader(sourcedb = './default_db/thermo.com.dat',
                   sourceformat = 'gwb',
                   dbaccess = './default_db/speq21.dat')
>>> ps.sourcedic, ps.dbaccessdic, ps.specielist
kwargs
__calc__(**kwargs)[source]
readAqspecdb()[source]

This function reads direct access thermodynamic database and can add other database sources at the bottom returns all constants of Maier-Kelley power function for minerals and gases (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol] a [cal/mol-K], b [*10**3 cal/mol/K^2],

c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ) and

aqueous species (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol], a1 [10 cal/mol/bar], a2 [*10*-2 cal/mol], a3 [cal-K/mol/bar], a4 [10*-4 cal-K/mol], c1 [cal/mol/K], c2 [10*-4 cal-K/mol], ω [10*-5 cal/mol] ) packed into a dbacess dictionary. In addition, the function can read Berman’s mineral properties such as (dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3, v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]). In addition, the function can read supcrtbl’s mineral and gas properties such as (dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K], b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-])

Parameters:
  • database (dbHP_dir filename and location of the supcrtbl (Holland and Powell) mineral and gas) –

  • database

  • database

Returns:

  • dbaccessdic dictionary of minerals, gases, redox and aqueous species

  • dbaccess dat file name

Usage:

[dbaccessdic, dbname] = readAqspecdb(dbaccess)

readSourceGWBdb()[source]

This function reads source GWB thermodynamic database and reaction coefficients of ‘eh’ and ‘e-’ has been added at the bottom returns all reaction coefficients and species, group species into redox, minerals, gases, oxides and aqueous species :param sourcedb: :type sourcedb: filename of the source database

Returns:

  • sourcedic (dictionary of reaction coefficients and species)

  • specielist (list of species segmented into the different categories) – [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list of species categories listed in ‘specielist’)

  • chargedic (dictionary of charges of species)

  • MWdic (dictionary of MW of species)

  • Mineraltype (mineral type for minerals)

  • fugacity_info (fugacity information as stored in new tdat database for chi and critical ppts)

Usage:

[sourcedic, specielist, chargedic, MWdic, Mineraltype, fugacity_info, activity_model] = readSourceGWBdb()

readSourceEQ36db()[source]

This function reads source EQ3/6 thermodynamic database and reaction coefficients of ‘eh’ and ‘e-’ has been added at the bottom returns all reaction coefficients and species, group species into basis, auxiliary basis, minerals, gases, liquids and aqueous species :param sourcedb: :type sourcedb: filename of the source database

Returns:

  • sourcedic (dictionary of reaction coefficients and species)

  • specielist (list of species segmented into the different categories) – [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list of species categories listed in ‘specielist’)

  • chargedic (dictionary of charges of species and DHazero info)

  • MWdic (dictionary of MW of species)

  • Sptype (specie types and eq3/6 and revised date info)

  • Elemlist (dictionary of elements and coefficients)

Usage:

[sourcedic, specielist, chargedic, MWdic, block_info, Elemlist, act_param] = readSourceEQ36db(sourcedb)

class pygcc.iapws95(**kwargs)[source]

Implementation of IAPWS Formulation 1995 for ordinary water substance, revised release of 2016

Notes

Temperature and Pressure input limits
  • -22 ≤ TC ≤ 1000 and 0 ≤ P ≤ 100,000

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • rho0 (float, vector) – Starting estimate of density [kg/m³]

  • rhom (float, vector) – Molar density [kg/m³]

  • delta (float, vector) – Reduced density, rho/rhoc

  • tau (float, vector) – Reduced temperature, Tc/T

  • v (float, vector) – Specific volume [m³/kg]

  • vm (float, vector) – Specific molar volume [m³/mol]

  • Out_Unit (string) – Expected units (‘standard’ or ‘kilogram’)

  • FullEOSppt (bool) – Option to output all or essential water properties [False or True]

Returns:

  • The calculated instance has the following potential properties

  • rho (float, vector) – Density [kg/m3]

  • G (float, vector) – Gibbs energy [cal/mol] or [kJ/kg]

  • H (float, vector) – Enthalpy [cal/mol] or [kJ/kg]

  • S (float, vector) – Entropy [cal/mol/K] or [kJ/kg/K]

  • V (float, vector) – Volume [m3/mol] or [m3/kg]

  • P (float, vector) – Pressure [bar]

  • TC (float, vector) – Temperature [°C]

  • TK (float, vector) – Temperature [K]

  • U (float, vector) – Internal energy [cal/mol] or [kJ/kg] if FullEOSppt is True

  • F (float, vector) – Helmholtz energy [cal/mol/K] or [kJ/kg-K] if FullEOSppt is True

  • Cp (float, vector) – Isobaric heat capacity [cal/mol/K]

  • rhosl (float, vector) – Density of liquid [kg/m3]

  • rhosv (float, vector) – Density of vapor [kg/m3]

  • pdx (float, vector) – Derivative of pressure with respect to delta in bar

  • adx (float, vector) – Helmholtz energy derivative with respect to delta

  • ztx (float, vector) – zeta value (needed to calculate viscosity)

  • ptx (float, vector) – Derivative of pressure with respect to tau in bar

  • gdx (float, vector) – Gibbs energy derivative [kJ/kg] if FullEOSppt is True

  • ktx (float, vector) – Compressibility [/bar]

  • avx (float, vector) – Thermal expansion coefficient (thermal expansivity)

  • mu (float, vector) – viscosity [Pa-s] if FullEOSppt is True

  • bsx (float, vector) – Isentropic temperature-pressure coefficient [K-m3/kJ] if FullEOSppt is True

  • dtx (float, vector) – Isothermal throttling coefficient [kJ/kg/bar] if FullEOSppt is True

  • mux (float, vector) – Joule-Thomsen coefficient [K-m3/kJ] if FullEOSppt is True

  • cvx (float, vector) – Isochoric heat capacity [kJ/kg/K] if FullEOSppt is True

  • wx (float, vector) – Speed of sound [m/s] if FullEOSppt is True

Usage:

The general usage of iapws95 is as follows:

  1. For water properties at any Temperature and Pressure not on steam saturation curve:

    water = iapws95(T = T, P = P),

    where T is temperature in celsius and P is pressure in bar

  2. For water properties at any Temperature and Pressure on steam saturation curve:

    water = iapws95(T = T, P = ‘T’),

    where T is temperature in celsius, followed with a quoted character ‘T’ to reflect steam saturation pressure

    water = iapws95(T = ‘P’, P = P),

    where P is pressure in bar, followed with a quoted character ‘P’ to reflect steam saturation temperature

  3. For water properties at any Temperature and density :

    water = iapws95(T = T, rho = rho),

    where T is temperature in celsius and rho is density in kg/m³

  4. For water properties at any Pressure and density :

    water = iapws95(P = P, rho = rho),

    where P is pressure in bar and rho is density in kg/m³

  5. For water saturation properties at any saturation Temperature :

    water = iapws95(T = T),

    where T is temperature in celsius

  6. For water saturation properties at any saturation Pressure :

    water = iapws95(P = P),

    where P is pressure in bar

Examples

>>> water = iapws95(T = 200., P = 50, FullEOSppt = True)
>>> water.rho, water.G, water.H, water.S, water.V, water.P, water.T, water.mu
    867.2595, -60368.41787, -65091.03895,  25.14869,  4.96478e-03,  50.00000,
    200.000, 0.00013546
>>> water = iapws95(T=200, rho=996.5560, Out_Unit='kilogram', FullEOSppt=True)
>>> water.P, water.F, water.S, water.H, water.G, water.V, water.Cp, water.pdx
    2872.063, -234.204, 2.051, 1024.747, 53.994, 1.0035e-03, 3.883, 10079.17
>>> water.adx, water.ztx, water.ptx, water.ktx, water.avx, water.mu, water.gdx
    93.120, 2.189e-03, -7.348e+03,  3.205e-05,  6.809e-04, 1.914e-04, 1011.40
>>> water = iapws95(T = 350)
>>> water.P, water.rhosl, water.rhosv
    165.2942 574.7065 113.6056
>>> water = iapws95(P = 150)
>>> water.TC, water.rhosl, water.rhosv
    342.1553, 603.5179, 96.7271

References

  1. Wagner, W., Pruß, A., 2002. The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. J. Phys. Chem. Ref. Data 31, 387–535. https://doi.org/10.1063/1.1461829

kwargs
mwH2O = 18.015268
__checker__(**kwargs)[source]
__calc__(**kwargs)[source]
class pygcc.ZhangDuan(**kwargs)[source]

Implementation of Zhang & Duan model Formulation for water at higher Temperature and Pressure conditions, i.e, Deep Earth Water - DEW

Notes

Temperature and Pressure input limits
  • 0 ≤ TC ≤ 1726.85 and 1000 ≤ P ≤ 300,000

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • rho0 (float, vector) – Starting estimate of density [kg/m³]

  • densityEquation (string) – specify either ‘ZD05’ to use Zhang & Duan (2005) or ‘ZD09’ to use Zhang & Duan (2009)

Returns:

  • The calculated instance has the following potential properties

  • rho (float, vector) – Density [kg/m3]

  • rhohat (float, vector) – Density [g/cm³]

  • G (float, vector) – Gibbs energy [cal/mol]

  • drhodP_T (float, vector) – Partial derivative of density with respect to pressure at constant temperature

  • drhodT_P (float, vector) – Partial derivative of density with respect to temperature at constant pressure

Usage:

The general usage of ZhangDuan is as follows:

  1. For water properties at any Temperature and Pressure:

    deepearth = ZhangDuan(T = T, P = P),

    where T is temperature in celsius and P is pressure in bar

  2. For water properties at any Temperature and density :

    deepearth = ZhangDuan(T = T, rho = rho),

    where T is temperature in celsius and rho is density in kg/m³

Examples

>>> deepearth = ZhangDuan(T = 25, P = 5000)
>>> deepearth.rho, deepearth.G, deepearth.drhodP_T, deepearth.drhodT_P
    1145.3065, -54631.5351, 2.3283e-05, -0.0004889
>>> deepearth = ZhangDuan(T = 200, rho = 1100)
>>> deepearth.P, deepearth.G, deepearth.drhodP_T, deepearth.drhodT_P
    7167.2231, -57319.0980, 2.3282e-05, -0.0005122

References

  1. Zhang, Z., Duan, Z., 2005. Prediction of the PVT properties of water over wide range of temperatures and pressures from molecular dynamics simulation. Phys. Earth Planet. Inter. 149, 335–354. https://doi.org/10.1016/j.pepi.2004.11.003.

  2. Zhang, C. and Duan, Z., 2009. “A model for C-O-H fluid in the Earth’s mantle”, Geochimica et Cosmochimica Acta, vol. 73, no. 7, pp. 2089–2102, doi:10.1016/j.gca.2009.01.021.

  3. Sverjensky, D.A., Harrison, B., Azzolini, D., 2014. Water in the deep Earth: The dielectric constant and the solubilities of quartz and corundum to 60kb and 1200°C. Geochim. Cosmochim. Acta 129, 125–145. https://doi.org/10.1016/j.gca.2013.12.019

kwargs
__calc__(**kwargs)[source]
ZD_Pressure_drhodP(TC, rhohat, method=None)[source]
ZD_Density(TC, P, method='ZD05', error=None)[source]
GibbsEnergy(TC, P, method='VolumeIntegral')[source]
class pygcc.water_dielec(**kwargs)[source]

Class Implementation of Water dielectric constants, the Debye-Huckel “A” and “B” parameters and their derivatives at ambient to deep-earth Temperature and Pressure conditions with three different formulations

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified, default - ‘JN91’

  • Dielec_DEWoutrange (string) – specify either ‘FGL97’ or ‘JN91’ as the method to calculate dielectric constant for out of range for ‘DEW’ method if any

Returns:

  • The calculated instance has the following potential properties

  • E (float, vector) – dielectric constant of water

  • rhohat (float, vector) – density [g/cm³]

  • Ah (float, vector) – Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

  • Bh (float, vector) – Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

  • bdot (float, vector) – bdot at any given temperature T

  • Adhh (float, vector) – Debye-Huckel “A” parameters associated with apparent molar enthalpy

  • Adhv (float, vector) – Debye-Huckel “A” parameters associated with apparent molar volume

  • Bdhh (float, vector) – Debye-Huckel “B” parameters associated with apparent molar enthalpy

  • Bdhv (float, vector) – Debye-Huckel “B” parameters associated with apparent molar volume

  • dEdP_T (float, vector) – Partial derivative of dielectric constant with respect to pressure at constant temperature

  • dEdT_P (float, vector) – Partial derivative of dielectric constant with respect to temperature at constant pressure

Notes

FGL97 Temperature and Pressure input limits:
  • -35 ≤ TC ≤ 600 and 0 ≤ P ≤ 12000

DEW Temperature and Pressure input limits:
  • 100 ≤ TC ≤ 1200 and 1000 ≤ P ≤ 60000

JN91 Temperature and Pressure input limits:
  • 0 ≤ TC ≤ 1000 and 0 ≤ P ≤ 5000

Usage

The general usage of water_dielec is as follows:

  1. For water dielectric properties at any Temperature and Pressure:

    dielect = water_dielec(T = T, P = P, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is pressure in bar

  2. For water dielectric properties at any Temperature and density :

    dielect = water_dielec(T = T, rho = rho, Dielec_method = ‘JN91’),

    where T is temperature in celsius and rho is density in kg/m³

  3. For water dielectric properties at any Temperature and Pressure on steam saturation curve:

    dielect = water_dielec(T = T, P = ‘T’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is assigned a quoted character ‘T’ to reflect steam saturation pressure

    dielect = water_dielec(P = P, T = ‘P’, Dielec_method = ‘JN91’),

    where P is pressure in bar and T is assigned a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> dielect = water_dielec(T = 50, P = 500, Dielec_method = 'JN91')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot
    71.547359, 1.00868586, 0.52131899,   0.33218072,   0.04088528
>>> dielect.Adhh, dielect.Adhv, dielect.Bdhh, dielect.Bdhv
    0.64360153,   2.13119279,  15.6936832 , -14.52571678
>>> dielect.dEdP_T, dielect.dEdT_P
    0.03293026,   -0.32468033
>>> dielect = water_dielec(T = 200, rho = 1100, Dielec_method = 'FGL97')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot
    49.73131404,  1.1,  0.5302338, 0.34384714,  0.04452579
>>> dielect.Adhh, dielect.Adhv, dielect.Bdhh, dielect.Bdhv
    1.21317825,  2.21165281, 28.0047878, -34.21216547
>>> dielect.dEdP_T, dielect.dEdT_P
    0.01444368, -0.16864644
>>> dielect = water_dielec(T = 250, P = 5000, Dielec_method = 'DEW')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot, dielect.Adhh
    39.46273008,  1.0238784,  0.62248141,   0.35417088, 0.02878662, 0.80688122
>>> dielect.Adhv, dielect.Bdhh, dielect.Bdhv, dielect.dEdP_T, dielect.dEdT_P
     3.13101408, 39.76402294, -35.29670957, 0.0129006 , -0.08837842

References

  1. Release on the Static Dielectric Constant of Ordinary Water Substance for Temperatures from 238 K to 873 K and Pressures up to 1000 MPa” (IAPWS R8-97, 1997).

  2. Fernandez D. P., Goodwin A. R. H., Lemmon E. W., Levelt Sengers J. M. H., and Williams R. C. (1997) A Formulation for the Permittivity of Water and Steam at Temperatures from 238 K to 873 K at Pressures up to 1200 MPa, including Derivatives and Debye-Hückel Coefficients. J. Phys. Chem. Ref. Data 26, 1125-1166.

  3. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

  4. Johnson JW, Norton D (1991) Critical phenomena in hydrothermal systems: State, thermodynamic, electrostatic, and transport properties of H2O in the critical region. American Journal of Science 291:541-648

  5. D. A. Sverjensky, B. Harrison, and D. Azzolini, “Water in the deep Earth: the dielectric constant and the solubilities of quartz and corundum to 60 kb and 1200 °C,” Geochimica et Cosmochimica Acta, vol. 129, pp. 125–145, 2014

kwargs
__checker__(**kwargs)[source]
__calc__(**kwargs)[source]
dielec_FGL97(TC, rho)[source]

This function employs the FGL91 formulation to calculate the dielectric constant of water (E), the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters (3) and their derivatives as a function of temperature and pressure

Notes

Temperature and Pressure input limits:
  • -35 ≤ TC ≤ 600 and 0 ≤ P ≤ 12000

Parameters:
  • TC (temperature [°C]) –

  • rho (density [kg/m3]) –

Returns:

  • E (dielectric constant of water)

  • rhohat (density [g/cm³])

  • Ah (Debye-Huckel “A” parameters [kg^1/2 mol^-1/2])

  • Bh (Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1])

  • bdot (bdot at any given temperature T)

  • Adhh (Debye-Huckel “A” parameters associated with apparent molar enthalpy)

  • Adhv (Debye-Huckel “A” parameters associated with apparent molar volume)

  • Bdhh (Debye-Huckel “B” parameters associated with apparent molar enthalpy)

  • Bdhv (Debye-Huckel “B” parameters associated with apparent molar volume)

  • dEdP_T (Partial derivative of dielectric constant with respect to pressure at constant temperature)

  • dEdT_P (Partial derivative of dielectric constant with respect to temperature at constant pressure)

Usage

[E, rhohat, Ah, Bh, bdot, Adhh, Adhv, Bdhh, Bdhv, dEdP_T, dEdT_P] = dielec_FGL97( TC, rho)

References

  1. Release on the Static Dielectric Constant of Ordinary Water Substance for Temperatures from 238 K to 873 K and Pressures up to 1000 MPa” (IAPWS R8-97, 1997).

  2. Fernandez D. P., Goodwin A. R. H., Lemmon E. W., Levelt Sengers J. M. H., and Williams R. C. (1997) A Formulation for the Permittivity of Water and Steam at Temperatures from 238 K to 873 K at Pressures up to 1200 MPa, including Derivatives and Debye-Hückel Coefficients. J. Phys. Chem. Ref. Data 26, 1125-1166.

  3. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

dielec_JN91(TC, rho)[source]

This dielec_JN91 implementation employs the JN91 formulation to calculate the dielectric properties of water and steam, the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters and their derivatives

Notes

Temperature and Pressure input limits:
  • 0 ≤ TC ≤ 1000 and 0 ≤ P ≤ 5000

Parameters:
  • TC (temperature [°C]) –

  • rho

rhohat : density [g/cm³]

Ah : Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

Bh : Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

bdot : bdot at any given temperature T

Adhh : Debye-Huckel “A” parameters associated with apparent molar enthalpy

Adhv : Debye-Huckel “A” parameters associated with apparent molar volume

Bdhh : Debye-Huckel “B” parameters associated with apparent molar enthalpy

Bdhv : Debye-Huckel “B” parameters associated with apparent molar volume

dEdP_T : Partial derivative of dielectric constant with respect to pressure at constant temperature

dEdT_P : Partial derivative of dielectric constant with respect to temperature at constant pressure

Usage

References

  1. Johnson JW, Norton D (1991) Critical phenomena in hydrothermal systems: State, thermodynamic, electrostatic, and transport properties of H2O in the critical region. American Journal of Science 291:541-648

  2. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

dielec_DEW()[source]

This watercalc implementation employs the DEW formulation embedded in Sverjensky et al. (2014) to calculate the dielectric properties of water and steam, the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters and their derivatives. This function has been set up to use either Johnson and Norton (1991) or Fernandez et al. (1997) formulation below 5000 bar and Sverjensky et al. (2014) formulation above 5000 bar.

Notes

Temperature and Pressure input limits:
  • 100 ≤ TC ≤ 1200 and 1000 ≤ P ≤ 60000

Parameters:
  • TC (temperature [°C]) –

  • P

rhohat : density [g/cm³]

Ah : Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

Bh : Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

bdot : bdot at any given temperature T

Adhh : Debye-Huckel “A” parameters associated with apparent molar enthalpy

Adhv : Debye-Huckel “A” parameters associated with apparent molar volume

Bdhh : Debye-Huckel “B” parameters associated with apparent molar enthalpy

Bdhv : Debye-Huckel “B” parameters associated with apparent molar volume

dEdP_T : Partial derivative of dielectric constant with respect to pressure at constant temperature

dEdT_P : Partial derivative of dielectric constant with respect to temperature at constant pressure

Usage

References

  1. D. A. Sverjensky, B. Harrison, and D. Azzolini, “Water in the deep Earth: the dielectric constant and the solubilities of quartz and corundum to 60 kb and 1200 °C,” Geochimica et Cosmochimica Acta, vol. 129, pp. 125–145, 2014

  2. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

pygcc.readIAPWS95data()[source]

returns all constants and coefficients needed for the IAPWS95 formulation, packed into a dictionary

pygcc.convert_temperature(T, Out_Unit='C')[source]

This function converts temperatures from Celsius to Kelvin and vice-versa

Parameters:
  • T (float, vector) – Temperature in °C or K

  • Out_Unit (string) – Expected temperature unit (C or K)

Returns:

T – Temperature in °C or K

Return type:

float, vector

Examples

>>> TC = 100; convert_temperature( TC, Out_Unit = 'K' )
    373.15
>>> TK = 520; convert_temperature( TK, Out_Unit = 'C' )
    246.85
class pygcc.heatcap(**kwargs)[source]

Class to heat capacity for mineral and gases using Maier-Kelley powerlaw, Haas-Fisher powerlaw, Holland and Powell and Berman’s function

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • Species_ppt (array) –

    Properties such as Supcrt92 (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol] a [cal/mol-K], b [*10**3 cal/mol/K^2],

    c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ): Berman’s database

    properties such as (dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3, v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]): Supcrtbl’s database properties such as (dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K], b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-]), etc

  • Species (string) – species name, optional for all cases except gases, Coesite and Quartz

  • method (string) – specify either ‘SUPCRT’ or ‘berman88’ or ‘HP11’ or ‘HF76’ to carry-out any mineral or gas heat capacity calculations, default is ‘SUPCRT’

Returns:

  • dG (float, vector) – Gibbs Energy [cal/mol]

  • dCp (float, vector) – Heat capacity [cal/mol/K]

Examples

>>> # Example with Maier-Kelley powerlaw function as implemented in SUPCRT92
>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> sp = heatcap( T = 100, P = 50, Species = 'H2S(g)', Species_ppt = ps.dbaccessdic['H2S(g)'], method = 'SUPCRT')
>>> sp.dG, sp.dCp
    -11782.47165818, 8.58416135
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Quartz'], method = 'SUPCRT',
                      Species = 'Quartz')
>>> sp.dG, sp.dCp
    -205292.75498942, 12.34074489
>>> # Example with Haas-Fisher powerlaw function
>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['ss_Anorthite'], method = 'HF76',
                 Species = 'ss_Anorthite')
>>> sp.dG, sp.dCp
    -960440.79915641, 57.46776903
>>> # Example with Berman's function
>>> from pygcc.pygcc_utils import db_reader
>>> # utilizes the default speq21 and specified Berman dataset database
>>> ps = db_reader(dbBerman_dir = './default_db/Berman.dat')
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Quartz'], method = 'berman88',
                 Species = 'Quartz')
>>> sp.dG, sp.dCp
    -205472.3365716, 12.32381279
>>> # Example with Holland and Powell's function
>>> from pygcc.pygcc_utils import db_reader
>>> # utilizes the default speq21 and specified SUPCRTBL (HP2011) dataset database
>>> ps = db_reader(dbHP_dir = './default_db/supcrtbl.dat')
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Hematite'], method = 'HP11',
                 Species = 'Hematite')
>>> sp.dG, sp.dCp
    -179494.62259123, 28.09545987

References

  1. Helgeson, H. C., Delany, J. M., Nesbitt, H. W. and Bird, D. K.(1978). Summary and critique of the thermodynamic properties of rock-forming minerals.

  2. Kelley K. K (1960) Contributions to the data on theoretical metallurgy. XIII. High temperature heat content, heat capacity and entropy data for elements and inorganic compounds US Bur Mines Bull 548: 232 p

  3. Haas JL Jr, Fisher JR (1976) Simultaneous evaluation and correlation of thermodynamic data. American Journal of Science 276:525-545

  4. Berman, R. G. (1988). Internally-consistent thermodynamic data for minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2. Journal of petrology, 29(2), 445-522.

  5. Berman RG, Brown TH (1985) Heat Capacities of minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2: Representation, estimation, and high temperature extrapolation. Contrib Mineral Petrol 89:168-183

  6. Holland, T. and Powell, R., 2011. An improved and extended internally consistent thermodynamic dataset for phases of petrological interest, involving a new equation of state for solids. Journal of Metamorphic Geology. 29, 333–383.

  7. Holland, T.J.B. and Powell, R., 1998. An internally-consistent thermodynamic dataset for phases of petrological interest. Journal of Metamorphic Geology, 16, 309–344.

  8. Zimmer, K., Zhang, Y.L., Lu, P., Chen, Y.Y., Zhang, G.R., Dalkilic, M. and Zhu, C. (2016) SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. Computer and Geosciences 90:97-111

kwargs
__calc__(**kwargs)[source]
heatcapusgscal(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Haas and Fisher (1976)’s heat capacity parameter fit (utilized for solid-solutions)

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) – Properties such as [dG [cal/ml], dH [cal/mol], S [cal/mol-K], V [cm³/mol], a [cal/mol-K], b [cal/mol/K^2], c [cal/mol/K], g [cal/mol/K^0.5], f [cal/mol/K^3] )

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Haas JL Jr, Fisher JR (1976) Simultaneous evaluation and correlation of thermodynamic data. American Journal of Science 276:525-545

heatcap_Berman(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Berman (1988) equations and datasets with Berman and Brown (1985)’s heat capacity parameter fit

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as [dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3,

    v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]]

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Berman, R. G. (1988). Internally-consistent thermodynamic data for minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2. Journal of petrology, 29(2), 445-522.

  2. Berman RG, Brown TH (1985) Heat Capacities of minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2: Representation, estimation, and high temperature extrapolation. Contrib Mineral Petrol 89:168-183

heatcapsup(TC, P, species, **kwargs)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Helgeson et al (1978) equations and Maier-Kelley power function for heat capacity as implemented in SUPCRT92

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as ( dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm³/mol], a [cal/mol-K],

    b [*10^3 cal/mol/K^2], c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ), etc

  • spec_name (string) – species name, optional for all cases except gases, Coesite and Quartz

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Helgeson, H. C., Delany, J. M., Nesbitt, H. W. and Bird, D. K.(1978). Summary and critique of the thermodynamic properties of rock-forming minerals.

  2. Kelley K. K (1960) Contributions to the data on theoretical metallurgy. XIII. High temperature heat content, heat capacity and entropy data for elements and inorganic compounds US Bur Mines Bull 548: 232 p

heatcaphp(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Holland and Powell (2011)’s heat capacity parameter fit and database based on SUPCRTBL

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as [dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K],

    b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-]]

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Holland, T. and Powell, R., 2011. An improved and extended internally consistent thermodynamic dataset for phases of petrological interest, involving a new equation of state for solids. Journal of Metamorphic Geology. 29, 333–383.

  2. Zimmer, K., Zhang, Y.L., Lu, P., Chen, Y.Y., Zhang, G.R., Dalkilic, M. and Zhu, C. (2016) SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. Computer and Geosciences 90:97-111

  3. Holland, T.J.B. and Powell, R., 1998. An internally-consistent thermodynamic dataset for phases of petrological interest. Journal of Metamorphic Geology, 16, 309–344.

pygcc.supcrtaq(TC, P, specieppt, Dielec_method=None, ThermoInUnit='cal', **rhoE)[source]

This function evaluates the Gibbs free energy of aqueous species at T and P using the revised HKF equation of state

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • specieppt (array) – Properties such as (dG [cal/mol], dH [cal/mol], S [cal/mol-K], a1 [10 cal/mol/bar], a2 [*10*-2 cal/mol], a3 [cal-K/mol/bar], a4 [10*-4 cal-K/mol], c1 [cal/mol/K], c2 [10*-4 cal-K/mol], ω [10*-5 cal/mol] )

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified default - ‘JN91’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), if not specified default - ‘cal’

  • rhoE (dict) – dictionary of water properties like density (rho) and dielectric factor (E) (optional)

Returns:

delG – Gibbs energy [cal/mol]

Return type:

float, vector

Usage

The general usage of supcrtaq without the optional arguments is as follows:

  1. Not on steam saturation curve:

    delG = supcrtaq(TC, P, specieppt)

    where T is temperature in celsius and P is pressure in bar

  2. On steam saturation curve:

    delG = supcrtaq(TC, ‘T’, specieppt),

    where T is temperature in celsius, followed with a quoted char ‘T’

    delG = supcrtaq(P, ‘P’, specieppt),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    delG = supcrtaq(TC, P, specieppt, Dielec_method = ‘FGL97’)

Examples

>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> delG = supcrtaq( 100, 50, ps.dbaccessdic['H2S(aq)'], Dielec_method = 'JN91')
    -9221.81721068
>>> delG = supcrtaq( 100, 50, ps.dbaccessdic['H2S(aq)'], Dielec_method = 'FGL97')
    -9221.6542038

References

  1. Johnson JW, Oelkers EH, Helgeson HC. 1992. SUPCRT92: A software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000°C. Computers & Geosciences 18(7): 899-947. doi: 10.1016/0098-3004(92)90029-Q

pygcc.Element_counts(formula)[source]

This function calculates the elemental composition of a substance given by its chemical formula It was a modified version of https://github.com/cgohlke/molmass/blob/master/molmass/molmass.py

Parameters:

formula (string) – Chemical formula

Returns:

elements – dictionary of elemental composition and their respective number of atoms

Return type:

dict

Usage:

[elements] = Element_counts(formula)

Examples of valid formulas are “H2O”, “[2H]2O”, “CH3COOH”, “EtOH”, “CuSO4:5H2O”, “(COOH)2”, “AgCuRu4(H)2[CO]12{PPh3}2”, “CGCGAATTCGCG”, and, “MDRGEQGLLK” .

class pygcc.solidsolution_thermo(**kwargs)[source]

Class to calculate Ideal mixing model for solid-solutions, supporting multisite ideal formalism

Parameters:
  • X (float) – End member mineral volume fraction or mole fraction of Mg in clinopyroxene

  • cpx_Ca (float) – number of moles of Ca in clinopyroxene formula unit (=1 for Di, Hed)

  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • dbaccessdic (dict) – dictionary of species from direct-access database, optional, default is speq21

  • solidsolution_type (string) – specify either ‘All’ or ‘plagioclase’ or ‘olivine’ or ‘pyroxene’ or ‘cpx’ or ‘alk-feldspar’ or ‘biotite’ to carry-out all or any solid-solution calculations, default is ‘All’

  • Dielec_method – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified default - ‘JN91’

Returns:

  • if ‘All’ is specified for solidsolution_type, each case has the follwowing prefix - AnAb_, FoFa_, EnFe_, cpx_, AlkFed_, Biotite_

  • logK (float, vector) – logarithmic K values

  • Rxn (dict) – The calculated dictionary of reaction thermodynamic properties has the following properties:

    • type: solid-solution mineral type, [-]

    • name: solid-solution name, [K]

    • formula: solid-solution mineral formula, [-]

    • MW: Molecular weight, [g/mol]

    • min: solid-solution mineral properties, [‘formula’, ‘source date’, dG[cal/ml], dH[cal/mol], S[cal/mol-K], V[cm3/mol], a[cal/mol-K], b[10^3 cal/mol/K^2], c[10^-5 cal/mol/K]]

    • spec: list of species, [-]

    • coeff: list of corresponding coefficients of species above, [-]

    • nSpec: Total number of species, [-]

    • V: Molar volume, [cm3/mol]

    • source: Source of thermo data, [kJ/kg·K]

    • elements: list of elements and their total numbers, [-]

Usage

The general usage of water_dielec is as follows:

  1. For water dielectric properties at any Temperature and Pressure:

    ss = solidsolution_thermo(T = T, P = P, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is pressure in bar

  2. For water dielectric properties at any Temperature and density :

    ss = solidsolution_thermo(T = T, rho = rho, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and rho is density in kg/m³

  3. For water dielectric properties at any Temperature and Pressure on steam saturation curve:

    ss = solidsolution_thermo(T = T, P = ‘T’, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is assigned a quoted character ‘T’ to reflect steam saturation pressure

    ss = solidsolution_thermo(P = P, T = ‘P’, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where P is pressure in bar and T is assigned a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> ss = solidsolution_thermo(cpx_Ca = 0.5, X = 0.85, T = 30, P = 50,
                              solidsolution_type = 'All')
>>> ss.AnAb_logK, ss.FoFa_logK, ss.EnFe_logK, ss.cpx_logK, ss.AlkFed_logK,
    ss.Biotite_logK
    21.750590, 26.570902, 10.793372, 20.577152,  3.756792, 32.96363
>>> ss = solidsolution_thermo(cpx_Ca = 1, X = 0.85, T = 50, P = 100,
                              solidsolution_type = 'cpx')
>>> ss.logK
    18.81769186
>>> ss.Rxn
    {'type': 'cpx', 'name': 'Di85Hed15',
     'formula': 'Ca1.00Mg0.85Fe0.15Si2O6', 'MW': 221.2817,
     'min': ['Ca1.00Mg0.85Fe0.15Si2O6', ' R&H95, Stef2001',
             -711392.7391800061, nan, 37.032850185405415, 66.369,
             106.66383843212236, -0.019588551625239002, -16326.4818355,
             -1052.9517208413004, 5.714746653919693e-06],
     'spec': ['H+', 'Ca++', 'Mg++', 'Fe++', 'SiO2(aq)', 'H2O'],
     'coeff': [-4, 1.0, 0.85, 0.15, 2, 2], 'nSpec': 6, 'V': 66.369,
     'source': ' R&H95, Stef2001', 'elements': ['1.0000', 'Ca', '0.8500',
                                                'Mg', '0.1500', 'Fe', '2.0000',
                                                'Si', '6.0000', 'O']}
>>> ss = solidsolution_thermo(X = 0.5, T = 50, P = 100,
                              solidsolution_type = 'plagioclase')
>>> ss.logK
    12.62488394
>>> ss.Rxn
    {'type': 'plag', 'name': 'An50', 'formula': 'Ca0.50Na0.50Al1.50Si2.50O8',
     'MW': 270.215145, 'min': ['Ca0.50Na0.50Al1.50Si2.50O8', ' R&H95,
                               Stef2001', -919965.222804649, nan,
                               47.33081919017781, 100.43, 131.53908221797,
                               -0.022148661567686426, 32265.761759082205,
                               -1316.0836615678777, 7.719885114722753e-06],
     'spec': ['H+', 'Al+++', 'Na+', 'Ca++', 'SiO2(aq)', 'H2O'],
     'coeff': [-6.0, 1.5, 0.5, 0.5, 2.5, 3.0], 'nSpec': 6, 'V': 100.43,
     'source': ' R&H95, Stef2001', 'elements': ['0.5000', 'Ca', '0.5000',
                                                'Na', '1.5000', 'Al', '2.5000',
                                                'Si', '8.0000', 'O']}
kwargs
__calc__(**kwargs)[source]
__checker__(**kwargs)[source]
calclogKAnAb(XAn, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Plagioclase minerals

Parameters:
  • XAn (volume fraction of Anorthite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKplag (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAnAb(XAn, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAnAb(XAn, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAnAb(XAn, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAnAb(XAn, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKFoFa(XFo, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of olivine minerals

Parameters:
  • XFo (volume fraction of Forsterite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_ol (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKFoFa without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKFoFa(XFo, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKFoFa(XFo, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKFoFa(XFo, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKFoFa(XFo, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKEnFe(XEn, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of pyroxene minerals

Parameters:
  • XEn (volume fraction of Enstatite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_opx (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKEnFe without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKEnFe(XEn, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKEnFe(XEn, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKEnFe(XEn, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKEnFe(XEn, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of clinopyroxene minerals (Di, Hed, En and Fe)

Parameters:
  • nCa (number of moles of Ca in formula unit (=1 for Di, Hed)) – and must be greater than zero

  • XMg (mole fraction of Mg) – XMg = (nMg/(nFe + nMg))

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_cpx (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKDiHedEnFe without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKAbOr(XAb, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Alkaline-Feldspar minerals

Parameters:
  • XAb (volume fraction of Albite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKalkfeld (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAbOr(XAb, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKBiotite(XPh, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Biotite minerals

Parameters:
  • XAb (volume fraction of Albite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKalkfeld (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAbOr(XAb, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

pygcc.calclogKclays(TC, P, *elem, dbaccessdic=None, group=None, cation_order=None, Dielec_method=None, ClayMintype=None, ThermoInUnit='cal', **rhoEG)[source]

This function calculates logK values and reaction parameters of clay reactions using below references:

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • elem (list) – list containing nine parameters with clay names and elements compositions with the following format [‘Montmorillonite_Lc_MgK’, ‘Si’, ‘Al’, ‘FeIII’, ‘FeII’, ‘Mg’, ‘K’, ‘Na’, ‘Ca’, ‘Li’]

  • dbacessdic (dict) – dictionary of species from direct-access database, optional, default is speq21

  • group (string) – specify the structural layering of the phyllosilicate, for layers composed of 1 tetrahedral + 1 octahedral sheet (1:1 layer) - specify ‘7A’, 2 tetrahedral + 1 octahedral sheet (2:1 layer) - specify ‘10A’, or the latter with a brucitic sheet in the interlayer (2:1:1 layer) - specify ‘14A’ (optional), if not specified, default is based on charge balance on the cations and anions

  • cation_order (string) – specify ordering of Si and Al ions either ‘Eastonite’, ‘Ordered’, ‘Random’, or ‘HDC’ (optional), if not specified, default is based on guidelines by Vinograd (1995)

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified, default - ‘JN91’

  • ClayMintype (string) – specify either ‘Smectite’ or ‘Chlorite’ or ‘Mica’ as the clay type, if not specified default - ‘Smectites’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), particularly used to covert KJ data to cal by supcrtaq function if not specified default - ‘cal’

  • rhoEG (dict) – dictionary of water properties like density (rho), dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_clay (float, vector) – logarithmic K values

  • Rxn (dict) – dictionary of reaction thermodynamic properties

Usage

The general usage of calclogKclays is as follows:

  1. Without the optional arguments, not on steam saturation curve:

    [logK, Rxn] = calclogKclays(TC, P, *elem),

    where T is temperature in celsius and P is pressure in bar;

  2. Without the optional arguments, on steam saturation curve:

    [logK, Rxn] = calclogKclays(TC, ‘T’, *elem),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKclays(P, ‘P’, *elem),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKclays(TC, P, *elem, dbacessdic = dbacessdic, group = ‘10A’, cation_order = ‘HDC’, Dielec_method = ‘FGL97’)

Examples

>>> logK, Rxn = calclogKclays(50, 'T', *['Clinochlore', '3', '2', '0', '0',
                                         '5', '0', '0', '0', '0'],
                              group = '14A')
>>> logK
    57.56820225

References

  1. Blanc, P., Vieillard, P., Gailhanou, H., Gaboreau, S., Gaucher, É., Fialips, C. I., Madé, B & Giffaut, E. (2015). A generalized model for predicting the thermodynamic properties of clay minerals. American journal of science, 315(8), 734-780.

  2. Blanc, P., Gherardi, F., Vieillard, P., Marty, N. C. M., Gailhanou, H., Gaboreau, S., Letat, B., Geloni, C., Gaucher, E.C. and Madé, B. (2021). Thermodynamics for clay minerals: calculation tools and application to the case of illite/smectite interstratified minerals. Applied Geochemistry, 104986.

  3. Vinograd, V.L., 1995. Substitution of [4]Al in layer silicates: Calculation of the Al-Si configurational entropy according to 29Si NMR Spectra. Physics and Chemistry of Minerals 22, 87-98.

pygcc.MW
class pygcc.db_reader(**kwargs)[source]

Class to read direct-access and source thermodynamic database

Parameters:
  • dbaccess (string) – filename and location of the direct-access/sequential-access database, optional, default is speq21

  • dbBerman_dir (string) – filename and location of the Berman mineral database, optional

  • dbHP_dir (string) – filename and location of the supcrtbl mineral and gas database, optional

  • sourcedb (string) – filename of the source database, optional

  • sourcedb – filename of the source database, optional

  • sourceformat (string) – specify the source database format, either ‘GWB’ or ‘EQ36’, optional

  • dbaccessformat (string, optional) – specify the direct-access/sequential-access database format, either ‘speq’ or ‘supcrtbl’, default is ‘speq’

  • sourcedb_codecs (string) – specify the name of the encoding used to decode or encode the sourcedb file, optional

  • dbaccess_codecs (string) – specify the name of the encoding used to decode or encode the dbaccess file, optional

Returns:

  • dbaccessdic (dict) – dictionary of minerals, gases, redox and aqueous species

  • dbaccess (string) – direct-access database file name

  • sourcedic (dict) – dictionary of reaction coefficients and species

  • specielist (list) – list of species segmented into the different categories [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list) – list of species categories listed in ‘specielist’

  • chargedic (dict) – dictionary of charges of species

  • MWdic (dict) – dictionary of MW of species

  • Mineraltype (dict) – mineral type for minerals

  • fugacity_info (dict) – fugacity information as stored in new tdat database for chi and critical ppts

  • Sptype (dict) – specie types and eq3/6 and revised date info

  • Elemlist (dict) – dictionary of elements and coefficients

Examples

>>> ps = db_reader(sourcedb = './default_db/thermo.com.dat',
                   sourceformat = 'gwb',
                   dbaccess = './default_db/speq21.dat')
>>> ps.sourcedic, ps.dbaccessdic, ps.specielist
kwargs
__calc__(**kwargs)[source]
readAqspecdb()[source]

This function reads direct access thermodynamic database and can add other database sources at the bottom returns all constants of Maier-Kelley power function for minerals and gases (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol] a [cal/mol-K], b [*10**3 cal/mol/K^2],

c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ) and

aqueous species (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol], a1 [10 cal/mol/bar], a2 [*10*-2 cal/mol], a3 [cal-K/mol/bar], a4 [10*-4 cal-K/mol], c1 [cal/mol/K], c2 [10*-4 cal-K/mol], ω [10*-5 cal/mol] ) packed into a dbacess dictionary. In addition, the function can read Berman’s mineral properties such as (dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3, v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]). In addition, the function can read supcrtbl’s mineral and gas properties such as (dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K], b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-])

Parameters:
  • database (dbHP_dir filename and location of the supcrtbl (Holland and Powell) mineral and gas) –

  • database

  • database

Returns:

  • dbaccessdic dictionary of minerals, gases, redox and aqueous species

  • dbaccess dat file name

Usage:

[dbaccessdic, dbname] = readAqspecdb(dbaccess)

readSourceGWBdb()[source]

This function reads source GWB thermodynamic database and reaction coefficients of ‘eh’ and ‘e-’ has been added at the bottom returns all reaction coefficients and species, group species into redox, minerals, gases, oxides and aqueous species :param sourcedb: :type sourcedb: filename of the source database

Returns:

  • sourcedic (dictionary of reaction coefficients and species)

  • specielist (list of species segmented into the different categories) – [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list of species categories listed in ‘specielist’)

  • chargedic (dictionary of charges of species)

  • MWdic (dictionary of MW of species)

  • Mineraltype (mineral type for minerals)

  • fugacity_info (fugacity information as stored in new tdat database for chi and critical ppts)

Usage:

[sourcedic, specielist, chargedic, MWdic, Mineraltype, fugacity_info, activity_model] = readSourceGWBdb()

readSourceEQ36db()[source]

This function reads source EQ3/6 thermodynamic database and reaction coefficients of ‘eh’ and ‘e-’ has been added at the bottom returns all reaction coefficients and species, group species into basis, auxiliary basis, minerals, gases, liquids and aqueous species :param sourcedb: :type sourcedb: filename of the source database

Returns:

  • sourcedic (dictionary of reaction coefficients and species)

  • specielist (list of species segmented into the different categories) – [element, basis, redox, aqueous, minerals, gases, oxides]

  • speciecat (list of species categories listed in ‘specielist’)

  • chargedic (dictionary of charges of species and DHazero info)

  • MWdic (dictionary of MW of species)

  • Sptype (specie types and eq3/6 and revised date info)

  • Elemlist (dictionary of elements and coefficients)

Usage:

[sourcedic, specielist, chargedic, MWdic, block_info, Elemlist, act_param] = readSourceEQ36db(sourcedb)

class pygcc.iapws95(**kwargs)[source]

Implementation of IAPWS Formulation 1995 for ordinary water substance, revised release of 2016

Notes

Temperature and Pressure input limits
  • -22 ≤ TC ≤ 1000 and 0 ≤ P ≤ 100,000

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • rho0 (float, vector) – Starting estimate of density [kg/m³]

  • rhom (float, vector) – Molar density [kg/m³]

  • delta (float, vector) – Reduced density, rho/rhoc

  • tau (float, vector) – Reduced temperature, Tc/T

  • v (float, vector) – Specific volume [m³/kg]

  • vm (float, vector) – Specific molar volume [m³/mol]

  • Out_Unit (string) – Expected units (‘standard’ or ‘kilogram’)

  • FullEOSppt (bool) – Option to output all or essential water properties [False or True]

Returns:

  • The calculated instance has the following potential properties

  • rho (float, vector) – Density [kg/m3]

  • G (float, vector) – Gibbs energy [cal/mol] or [kJ/kg]

  • H (float, vector) – Enthalpy [cal/mol] or [kJ/kg]

  • S (float, vector) – Entropy [cal/mol/K] or [kJ/kg/K]

  • V (float, vector) – Volume [m3/mol] or [m3/kg]

  • P (float, vector) – Pressure [bar]

  • TC (float, vector) – Temperature [°C]

  • TK (float, vector) – Temperature [K]

  • U (float, vector) – Internal energy [cal/mol] or [kJ/kg] if FullEOSppt is True

  • F (float, vector) – Helmholtz energy [cal/mol/K] or [kJ/kg-K] if FullEOSppt is True

  • Cp (float, vector) – Isobaric heat capacity [cal/mol/K]

  • rhosl (float, vector) – Density of liquid [kg/m3]

  • rhosv (float, vector) – Density of vapor [kg/m3]

  • pdx (float, vector) – Derivative of pressure with respect to delta in bar

  • adx (float, vector) – Helmholtz energy derivative with respect to delta

  • ztx (float, vector) – zeta value (needed to calculate viscosity)

  • ptx (float, vector) – Derivative of pressure with respect to tau in bar

  • gdx (float, vector) – Gibbs energy derivative [kJ/kg] if FullEOSppt is True

  • ktx (float, vector) – Compressibility [/bar]

  • avx (float, vector) – Thermal expansion coefficient (thermal expansivity)

  • mu (float, vector) – viscosity [Pa-s] if FullEOSppt is True

  • bsx (float, vector) – Isentropic temperature-pressure coefficient [K-m3/kJ] if FullEOSppt is True

  • dtx (float, vector) – Isothermal throttling coefficient [kJ/kg/bar] if FullEOSppt is True

  • mux (float, vector) – Joule-Thomsen coefficient [K-m3/kJ] if FullEOSppt is True

  • cvx (float, vector) – Isochoric heat capacity [kJ/kg/K] if FullEOSppt is True

  • wx (float, vector) – Speed of sound [m/s] if FullEOSppt is True

Usage:

The general usage of iapws95 is as follows:

  1. For water properties at any Temperature and Pressure not on steam saturation curve:

    water = iapws95(T = T, P = P),

    where T is temperature in celsius and P is pressure in bar

  2. For water properties at any Temperature and Pressure on steam saturation curve:

    water = iapws95(T = T, P = ‘T’),

    where T is temperature in celsius, followed with a quoted character ‘T’ to reflect steam saturation pressure

    water = iapws95(T = ‘P’, P = P),

    where P is pressure in bar, followed with a quoted character ‘P’ to reflect steam saturation temperature

  3. For water properties at any Temperature and density :

    water = iapws95(T = T, rho = rho),

    where T is temperature in celsius and rho is density in kg/m³

  4. For water properties at any Pressure and density :

    water = iapws95(P = P, rho = rho),

    where P is pressure in bar and rho is density in kg/m³

  5. For water saturation properties at any saturation Temperature :

    water = iapws95(T = T),

    where T is temperature in celsius

  6. For water saturation properties at any saturation Pressure :

    water = iapws95(P = P),

    where P is pressure in bar

Examples

>>> water = iapws95(T = 200., P = 50, FullEOSppt = True)
>>> water.rho, water.G, water.H, water.S, water.V, water.P, water.T, water.mu
    867.2595, -60368.41787, -65091.03895,  25.14869,  4.96478e-03,  50.00000,
    200.000, 0.00013546
>>> water = iapws95(T=200, rho=996.5560, Out_Unit='kilogram', FullEOSppt=True)
>>> water.P, water.F, water.S, water.H, water.G, water.V, water.Cp, water.pdx
    2872.063, -234.204, 2.051, 1024.747, 53.994, 1.0035e-03, 3.883, 10079.17
>>> water.adx, water.ztx, water.ptx, water.ktx, water.avx, water.mu, water.gdx
    93.120, 2.189e-03, -7.348e+03,  3.205e-05,  6.809e-04, 1.914e-04, 1011.40
>>> water = iapws95(T = 350)
>>> water.P, water.rhosl, water.rhosv
    165.2942 574.7065 113.6056
>>> water = iapws95(P = 150)
>>> water.TC, water.rhosl, water.rhosv
    342.1553, 603.5179, 96.7271

References

  1. Wagner, W., Pruß, A., 2002. The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. J. Phys. Chem. Ref. Data 31, 387–535. https://doi.org/10.1063/1.1461829

kwargs
mwH2O = 18.015268
__checker__(**kwargs)[source]
__calc__(**kwargs)[source]
class pygcc.ZhangDuan(**kwargs)[source]

Implementation of Zhang & Duan model Formulation for water at higher Temperature and Pressure conditions, i.e, Deep Earth Water - DEW

Notes

Temperature and Pressure input limits
  • 0 ≤ TC ≤ 1726.85 and 1000 ≤ P ≤ 300,000

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • rho0 (float, vector) – Starting estimate of density [kg/m³]

  • densityEquation (string) – specify either ‘ZD05’ to use Zhang & Duan (2005) or ‘ZD09’ to use Zhang & Duan (2009)

Returns:

  • The calculated instance has the following potential properties

  • rho (float, vector) – Density [kg/m3]

  • rhohat (float, vector) – Density [g/cm³]

  • G (float, vector) – Gibbs energy [cal/mol]

  • drhodP_T (float, vector) – Partial derivative of density with respect to pressure at constant temperature

  • drhodT_P (float, vector) – Partial derivative of density with respect to temperature at constant pressure

Usage:

The general usage of ZhangDuan is as follows:

  1. For water properties at any Temperature and Pressure:

    deepearth = ZhangDuan(T = T, P = P),

    where T is temperature in celsius and P is pressure in bar

  2. For water properties at any Temperature and density :

    deepearth = ZhangDuan(T = T, rho = rho),

    where T is temperature in celsius and rho is density in kg/m³

Examples

>>> deepearth = ZhangDuan(T = 25, P = 5000)
>>> deepearth.rho, deepearth.G, deepearth.drhodP_T, deepearth.drhodT_P
    1145.3065, -54631.5351, 2.3283e-05, -0.0004889
>>> deepearth = ZhangDuan(T = 200, rho = 1100)
>>> deepearth.P, deepearth.G, deepearth.drhodP_T, deepearth.drhodT_P
    7167.2231, -57319.0980, 2.3282e-05, -0.0005122

References

  1. Zhang, Z., Duan, Z., 2005. Prediction of the PVT properties of water over wide range of temperatures and pressures from molecular dynamics simulation. Phys. Earth Planet. Inter. 149, 335–354. https://doi.org/10.1016/j.pepi.2004.11.003.

  2. Zhang, C. and Duan, Z., 2009. “A model for C-O-H fluid in the Earth’s mantle”, Geochimica et Cosmochimica Acta, vol. 73, no. 7, pp. 2089–2102, doi:10.1016/j.gca.2009.01.021.

  3. Sverjensky, D.A., Harrison, B., Azzolini, D., 2014. Water in the deep Earth: The dielectric constant and the solubilities of quartz and corundum to 60kb and 1200°C. Geochim. Cosmochim. Acta 129, 125–145. https://doi.org/10.1016/j.gca.2013.12.019

kwargs
__calc__(**kwargs)[source]
ZD_Pressure_drhodP(TC, rhohat, method=None)[source]
ZD_Density(TC, P, method='ZD05', error=None)[source]
GibbsEnergy(TC, P, method='VolumeIntegral')[source]
class pygcc.water_dielec(**kwargs)[source]

Class Implementation of Water dielectric constants, the Debye-Huckel “A” and “B” parameters and their derivatives at ambient to deep-earth Temperature and Pressure conditions with three different formulations

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • rho (float, vector) – Density [kg/m³]

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified, default - ‘JN91’

  • Dielec_DEWoutrange (string) – specify either ‘FGL97’ or ‘JN91’ as the method to calculate dielectric constant for out of range for ‘DEW’ method if any

Returns:

  • The calculated instance has the following potential properties

  • E (float, vector) – dielectric constant of water

  • rhohat (float, vector) – density [g/cm³]

  • Ah (float, vector) – Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

  • Bh (float, vector) – Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

  • bdot (float, vector) – bdot at any given temperature T

  • Adhh (float, vector) – Debye-Huckel “A” parameters associated with apparent molar enthalpy

  • Adhv (float, vector) – Debye-Huckel “A” parameters associated with apparent molar volume

  • Bdhh (float, vector) – Debye-Huckel “B” parameters associated with apparent molar enthalpy

  • Bdhv (float, vector) – Debye-Huckel “B” parameters associated with apparent molar volume

  • dEdP_T (float, vector) – Partial derivative of dielectric constant with respect to pressure at constant temperature

  • dEdT_P (float, vector) – Partial derivative of dielectric constant with respect to temperature at constant pressure

Notes

FGL97 Temperature and Pressure input limits:
  • -35 ≤ TC ≤ 600 and 0 ≤ P ≤ 12000

DEW Temperature and Pressure input limits:
  • 100 ≤ TC ≤ 1200 and 1000 ≤ P ≤ 60000

JN91 Temperature and Pressure input limits:
  • 0 ≤ TC ≤ 1000 and 0 ≤ P ≤ 5000

Usage

The general usage of water_dielec is as follows:

  1. For water dielectric properties at any Temperature and Pressure:

    dielect = water_dielec(T = T, P = P, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is pressure in bar

  2. For water dielectric properties at any Temperature and density :

    dielect = water_dielec(T = T, rho = rho, Dielec_method = ‘JN91’),

    where T is temperature in celsius and rho is density in kg/m³

  3. For water dielectric properties at any Temperature and Pressure on steam saturation curve:

    dielect = water_dielec(T = T, P = ‘T’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is assigned a quoted character ‘T’ to reflect steam saturation pressure

    dielect = water_dielec(P = P, T = ‘P’, Dielec_method = ‘JN91’),

    where P is pressure in bar and T is assigned a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> dielect = water_dielec(T = 50, P = 500, Dielec_method = 'JN91')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot
    71.547359, 1.00868586, 0.52131899,   0.33218072,   0.04088528
>>> dielect.Adhh, dielect.Adhv, dielect.Bdhh, dielect.Bdhv
    0.64360153,   2.13119279,  15.6936832 , -14.52571678
>>> dielect.dEdP_T, dielect.dEdT_P
    0.03293026,   -0.32468033
>>> dielect = water_dielec(T = 200, rho = 1100, Dielec_method = 'FGL97')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot
    49.73131404,  1.1,  0.5302338, 0.34384714,  0.04452579
>>> dielect.Adhh, dielect.Adhv, dielect.Bdhh, dielect.Bdhv
    1.21317825,  2.21165281, 28.0047878, -34.21216547
>>> dielect.dEdP_T, dielect.dEdT_P
    0.01444368, -0.16864644
>>> dielect = water_dielec(T = 250, P = 5000, Dielec_method = 'DEW')
>>> dielect.E, dielect.rhohat, dielect.Ah, dielect.Bh, dielect.bdot, dielect.Adhh
    39.46273008,  1.0238784,  0.62248141,   0.35417088, 0.02878662, 0.80688122
>>> dielect.Adhv, dielect.Bdhh, dielect.Bdhv, dielect.dEdP_T, dielect.dEdT_P
     3.13101408, 39.76402294, -35.29670957, 0.0129006 , -0.08837842

References

  1. Release on the Static Dielectric Constant of Ordinary Water Substance for Temperatures from 238 K to 873 K and Pressures up to 1000 MPa” (IAPWS R8-97, 1997).

  2. Fernandez D. P., Goodwin A. R. H., Lemmon E. W., Levelt Sengers J. M. H., and Williams R. C. (1997) A Formulation for the Permittivity of Water and Steam at Temperatures from 238 K to 873 K at Pressures up to 1200 MPa, including Derivatives and Debye-Hückel Coefficients. J. Phys. Chem. Ref. Data 26, 1125-1166.

  3. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

  4. Johnson JW, Norton D (1991) Critical phenomena in hydrothermal systems: State, thermodynamic, electrostatic, and transport properties of H2O in the critical region. American Journal of Science 291:541-648

  5. D. A. Sverjensky, B. Harrison, and D. Azzolini, “Water in the deep Earth: the dielectric constant and the solubilities of quartz and corundum to 60 kb and 1200 °C,” Geochimica et Cosmochimica Acta, vol. 129, pp. 125–145, 2014

kwargs
__checker__(**kwargs)[source]
__calc__(**kwargs)[source]
dielec_FGL97(TC, rho)[source]

This function employs the FGL91 formulation to calculate the dielectric constant of water (E), the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters (3) and their derivatives as a function of temperature and pressure

Notes

Temperature and Pressure input limits:
  • -35 ≤ TC ≤ 600 and 0 ≤ P ≤ 12000

Parameters:
  • TC (temperature [°C]) –

  • rho (density [kg/m3]) –

Returns:

  • E (dielectric constant of water)

  • rhohat (density [g/cm³])

  • Ah (Debye-Huckel “A” parameters [kg^1/2 mol^-1/2])

  • Bh (Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1])

  • bdot (bdot at any given temperature T)

  • Adhh (Debye-Huckel “A” parameters associated with apparent molar enthalpy)

  • Adhv (Debye-Huckel “A” parameters associated with apparent molar volume)

  • Bdhh (Debye-Huckel “B” parameters associated with apparent molar enthalpy)

  • Bdhv (Debye-Huckel “B” parameters associated with apparent molar volume)

  • dEdP_T (Partial derivative of dielectric constant with respect to pressure at constant temperature)

  • dEdT_P (Partial derivative of dielectric constant with respect to temperature at constant pressure)

Usage

[E, rhohat, Ah, Bh, bdot, Adhh, Adhv, Bdhh, Bdhv, dEdP_T, dEdT_P] = dielec_FGL97( TC, rho)

References

  1. Release on the Static Dielectric Constant of Ordinary Water Substance for Temperatures from 238 K to 873 K and Pressures up to 1000 MPa” (IAPWS R8-97, 1997).

  2. Fernandez D. P., Goodwin A. R. H., Lemmon E. W., Levelt Sengers J. M. H., and Williams R. C. (1997) A Formulation for the Permittivity of Water and Steam at Temperatures from 238 K to 873 K at Pressures up to 1200 MPa, including Derivatives and Debye-Hückel Coefficients. J. Phys. Chem. Ref. Data 26, 1125-1166.

  3. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

dielec_JN91(TC, rho)[source]

This dielec_JN91 implementation employs the JN91 formulation to calculate the dielectric properties of water and steam, the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters and their derivatives

Notes

Temperature and Pressure input limits:
  • 0 ≤ TC ≤ 1000 and 0 ≤ P ≤ 5000

Parameters:
  • TC (temperature [°C]) –

  • rho

rhohat : density [g/cm³]

Ah : Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

Bh : Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

bdot : bdot at any given temperature T

Adhh : Debye-Huckel “A” parameters associated with apparent molar enthalpy

Adhv : Debye-Huckel “A” parameters associated with apparent molar volume

Bdhh : Debye-Huckel “B” parameters associated with apparent molar enthalpy

Bdhv : Debye-Huckel “B” parameters associated with apparent molar volume

dEdP_T : Partial derivative of dielectric constant with respect to pressure at constant temperature

dEdT_P : Partial derivative of dielectric constant with respect to temperature at constant pressure

Usage

References

  1. Johnson JW, Norton D (1991) Critical phenomena in hydrothermal systems: State, thermodynamic, electrostatic, and transport properties of H2O in the critical region. American Journal of Science 291:541-648

  2. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

dielec_DEW()[source]

This watercalc implementation employs the DEW formulation embedded in Sverjensky et al. (2014) to calculate the dielectric properties of water and steam, the Debye-Huckel “A” parameters and Debye-Huckel “B” parameters and their derivatives. This function has been set up to use either Johnson and Norton (1991) or Fernandez et al. (1997) formulation below 5000 bar and Sverjensky et al. (2014) formulation above 5000 bar.

Notes

Temperature and Pressure input limits:
  • 100 ≤ TC ≤ 1200 and 1000 ≤ P ≤ 60000

Parameters:
  • TC (temperature [°C]) –

  • P

rhohat : density [g/cm³]

Ah : Debye-Huckel “A” parameters [kg^1/2 mol^-1/2]

Bh : Debye-Huckel “B” parameters [kg^1/2 mol^-1/2 Angstrom^-1]

bdot : bdot at any given temperature T

Adhh : Debye-Huckel “A” parameters associated with apparent molar enthalpy

Adhv : Debye-Huckel “A” parameters associated with apparent molar volume

Bdhh : Debye-Huckel “B” parameters associated with apparent molar enthalpy

Bdhv : Debye-Huckel “B” parameters associated with apparent molar volume

dEdP_T : Partial derivative of dielectric constant with respect to pressure at constant temperature

dEdT_P : Partial derivative of dielectric constant with respect to temperature at constant pressure

Usage

References

  1. D. A. Sverjensky, B. Harrison, and D. Azzolini, “Water in the deep Earth: the dielectric constant and the solubilities of quartz and corundum to 60 kb and 1200 °C,” Geochimica et Cosmochimica Acta, vol. 129, pp. 125–145, 2014

  2. Helgeson H. C. and Kirkham D. H. (1974) Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel Parameters for Activity Coefficients and Relative Partial Molal Properties. Am. J. Sci. 274, 1199-1251.

pygcc.readIAPWS95data()[source]

returns all constants and coefficients needed for the IAPWS95 formulation, packed into a dictionary

pygcc.convert_temperature(T, Out_Unit='C')[source]

This function converts temperatures from Celsius to Kelvin and vice-versa

Parameters:
  • T (float, vector) – Temperature in °C or K

  • Out_Unit (string) – Expected temperature unit (C or K)

Returns:

T – Temperature in °C or K

Return type:

float, vector

Examples

>>> TC = 100; convert_temperature( TC, Out_Unit = 'K' )
    373.15
>>> TK = 520; convert_temperature( TK, Out_Unit = 'C' )
    246.85
class pygcc.heatcap(**kwargs)[source]

Class to heat capacity for mineral and gases using Maier-Kelley powerlaw, Haas-Fisher powerlaw, Holland and Powell and Berman’s function

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • Species_ppt (array) –

    Properties such as Supcrt92 (dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm3/mol] a [cal/mol-K], b [*10**3 cal/mol/K^2],

    c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ): Berman’s database

    properties such as (dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3, v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]): Supcrtbl’s database properties such as (dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K], b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-]), etc

  • Species (string) – species name, optional for all cases except gases, Coesite and Quartz

  • method (string) – specify either ‘SUPCRT’ or ‘berman88’ or ‘HP11’ or ‘HF76’ to carry-out any mineral or gas heat capacity calculations, default is ‘SUPCRT’

Returns:

  • dG (float, vector) – Gibbs Energy [cal/mol]

  • dCp (float, vector) – Heat capacity [cal/mol/K]

Examples

>>> # Example with Maier-Kelley powerlaw function as implemented in SUPCRT92
>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> sp = heatcap( T = 100, P = 50, Species = 'H2S(g)', Species_ppt = ps.dbaccessdic['H2S(g)'], method = 'SUPCRT')
>>> sp.dG, sp.dCp
    -11782.47165818, 8.58416135
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Quartz'], method = 'SUPCRT',
                      Species = 'Quartz')
>>> sp.dG, sp.dCp
    -205292.75498942, 12.34074489
>>> # Example with Haas-Fisher powerlaw function
>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['ss_Anorthite'], method = 'HF76',
                 Species = 'ss_Anorthite')
>>> sp.dG, sp.dCp
    -960440.79915641, 57.46776903
>>> # Example with Berman's function
>>> from pygcc.pygcc_utils import db_reader
>>> # utilizes the default speq21 and specified Berman dataset database
>>> ps = db_reader(dbBerman_dir = './default_db/Berman.dat')
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Quartz'], method = 'berman88',
                 Species = 'Quartz')
>>> sp.dG, sp.dCp
    -205472.3365716, 12.32381279
>>> # Example with Holland and Powell's function
>>> from pygcc.pygcc_utils import db_reader
>>> # utilizes the default speq21 and specified SUPCRTBL (HP2011) dataset database
>>> ps = db_reader(dbHP_dir = './default_db/supcrtbl.dat')
>>> sp = heatcap( T = 100, P = 50, Species_ppt = ps.dbaccessdic['Hematite'], method = 'HP11',
                 Species = 'Hematite')
>>> sp.dG, sp.dCp
    -179494.62259123, 28.09545987

References

  1. Helgeson, H. C., Delany, J. M., Nesbitt, H. W. and Bird, D. K.(1978). Summary and critique of the thermodynamic properties of rock-forming minerals.

  2. Kelley K. K (1960) Contributions to the data on theoretical metallurgy. XIII. High temperature heat content, heat capacity and entropy data for elements and inorganic compounds US Bur Mines Bull 548: 232 p

  3. Haas JL Jr, Fisher JR (1976) Simultaneous evaluation and correlation of thermodynamic data. American Journal of Science 276:525-545

  4. Berman, R. G. (1988). Internally-consistent thermodynamic data for minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2. Journal of petrology, 29(2), 445-522.

  5. Berman RG, Brown TH (1985) Heat Capacities of minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2: Representation, estimation, and high temperature extrapolation. Contrib Mineral Petrol 89:168-183

  6. Holland, T. and Powell, R., 2011. An improved and extended internally consistent thermodynamic dataset for phases of petrological interest, involving a new equation of state for solids. Journal of Metamorphic Geology. 29, 333–383.

  7. Holland, T.J.B. and Powell, R., 1998. An internally-consistent thermodynamic dataset for phases of petrological interest. Journal of Metamorphic Geology, 16, 309–344.

  8. Zimmer, K., Zhang, Y.L., Lu, P., Chen, Y.Y., Zhang, G.R., Dalkilic, M. and Zhu, C. (2016) SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. Computer and Geosciences 90:97-111

kwargs
__calc__(**kwargs)[source]
heatcapusgscal(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Haas and Fisher (1976)’s heat capacity parameter fit (utilized for solid-solutions)

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) – Properties such as [dG [cal/ml], dH [cal/mol], S [cal/mol-K], V [cm³/mol], a [cal/mol-K], b [cal/mol/K^2], c [cal/mol/K], g [cal/mol/K^0.5], f [cal/mol/K^3] )

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Haas JL Jr, Fisher JR (1976) Simultaneous evaluation and correlation of thermodynamic data. American Journal of Science 276:525-545

heatcap_Berman(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Berman (1988) equations and datasets with Berman and Brown (1985)’s heat capacity parameter fit

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as [dG [J/mol], dH [J/mol], S [J/mol-K], V [cm³/mol], k0, k1, k2, k3,

    v1 [*10^5 K^-1], v2 [*10^5 K^-2], v3 [*10^5 bar^-1], v4 [*10^8 bar^-2], dTdP [K/bar], Tlambda [K], Tref [K], l1 [(J/mol)^0.5/K], l2 [(J/mol)^0.5/K^2], DtH, d0 [J/mol], d1 [J/mol], d2 [J/mol], d3 [J/mol], d4 [J/mol], d5 [J/mol], Tmin [K], Tmax [K]]

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Berman, R. G. (1988). Internally-consistent thermodynamic data for minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2. Journal of petrology, 29(2), 445-522.

  2. Berman RG, Brown TH (1985) Heat Capacities of minerals in the system Na2O-K2O-CaO-MgO-FeO-Fe2O3-Al2O3-SiO2-TiO2-H2O-CO2: Representation, estimation, and high temperature extrapolation. Contrib Mineral Petrol 89:168-183

heatcapsup(TC, P, species, **kwargs)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Helgeson et al (1978) equations and Maier-Kelley power function for heat capacity as implemented in SUPCRT92

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as ( dG [cal/mol], dH [cal/mol], S [cal/mol-K], V [cm³/mol], a [cal/mol-K],

    b [*10^3 cal/mol/K^2], c [*10^-5 cal/mol/K], Ttrans [K], Htr [cal/mol], Vtr [cm³/mol], dPdTtr [bar/K] ), etc

  • spec_name (string) – species name, optional for all cases except gases, Coesite and Quartz

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Helgeson, H. C., Delany, J. M., Nesbitt, H. W. and Bird, D. K.(1978). Summary and critique of the thermodynamic properties of rock-forming minerals.

  2. Kelley K. K (1960) Contributions to the data on theoretical metallurgy. XIII. High temperature heat content, heat capacity and entropy data for elements and inorganic compounds US Bur Mines Bull 548: 232 p

heatcaphp(TC, P, species)[source]

This function evaluates Gibbs energy and heat capacity as a function of temperature and pressure for any mineral or gas specie using Holland and Powell (2011)’s heat capacity parameter fit and database based on SUPCRTBL

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • species (array) –

    Properties such as [dG [kJ/mol], dH [kJ/mol], S [J/mol-K], V [J/bar], a [kJ/mol-K],

    b [*10^5 kJ/mol/K^2], c [kJ-mol-K], d [kJ/mol/K^0.5], alpha [*10^5 K^-1], kappa0 [kbar], kappa0_d [kbar], kappa0_dd [kbar], n_atom [-], Tc0 [K], Smax [J/mol-K], Vmax [J/bar], dH [KJ/mol], dV [J/bar], W [kJ/mol], Wv [J/bar], n [-], SF [-]]

Returns:

  • delGfPT (float, vector) – Gibbs Energy [cal/mol]

  • delCp (float, vector) – Heat capacity [cal/mol/K]

References

  1. Holland, T. and Powell, R., 2011. An improved and extended internally consistent thermodynamic dataset for phases of petrological interest, involving a new equation of state for solids. Journal of Metamorphic Geology. 29, 333–383.

  2. Zimmer, K., Zhang, Y.L., Lu, P., Chen, Y.Y., Zhang, G.R., Dalkilic, M. and Zhu, C. (2016) SUPCRTBL: A revised and extended thermodynamic dataset and software package of SUPCRT92. Computer and Geosciences 90:97-111

  3. Holland, T.J.B. and Powell, R., 1998. An internally-consistent thermodynamic dataset for phases of petrological interest. Journal of Metamorphic Geology, 16, 309–344.

pygcc.supcrtaq(TC, P, specieppt, Dielec_method=None, ThermoInUnit='cal', **rhoE)[source]

This function evaluates the Gibbs free energy of aqueous species at T and P using the revised HKF equation of state

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • specieppt (array) – Properties such as (dG [cal/mol], dH [cal/mol], S [cal/mol-K], a1 [10 cal/mol/bar], a2 [*10*-2 cal/mol], a3 [cal-K/mol/bar], a4 [10*-4 cal-K/mol], c1 [cal/mol/K], c2 [10*-4 cal-K/mol], ω [10*-5 cal/mol] )

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified default - ‘JN91’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), if not specified default - ‘cal’

  • rhoE (dict) – dictionary of water properties like density (rho) and dielectric factor (E) (optional)

Returns:

delG – Gibbs energy [cal/mol]

Return type:

float, vector

Usage

The general usage of supcrtaq without the optional arguments is as follows:

  1. Not on steam saturation curve:

    delG = supcrtaq(TC, P, specieppt)

    where T is temperature in celsius and P is pressure in bar

  2. On steam saturation curve:

    delG = supcrtaq(TC, ‘T’, specieppt),

    where T is temperature in celsius, followed with a quoted char ‘T’

    delG = supcrtaq(P, ‘P’, specieppt),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    delG = supcrtaq(TC, P, specieppt, Dielec_method = ‘FGL97’)

Examples

>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> delG = supcrtaq( 100, 50, ps.dbaccessdic['H2S(aq)'], Dielec_method = 'JN91')
    -9221.81721068
>>> delG = supcrtaq( 100, 50, ps.dbaccessdic['H2S(aq)'], Dielec_method = 'FGL97')
    -9221.6542038

References

  1. Johnson JW, Oelkers EH, Helgeson HC. 1992. SUPCRT92: A software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000°C. Computers & Geosciences 18(7): 899-947. doi: 10.1016/0098-3004(92)90029-Q

class pygcc.solidsolution_thermo(**kwargs)[source]

Class to calculate Ideal mixing model for solid-solutions, supporting multisite ideal formalism

Parameters:
  • X (float) – End member mineral volume fraction or mole fraction of Mg in clinopyroxene

  • cpx_Ca (float) – number of moles of Ca in clinopyroxene formula unit (=1 for Di, Hed)

  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • dbaccessdic (dict) – dictionary of species from direct-access database, optional, default is speq21

  • solidsolution_type (string) – specify either ‘All’ or ‘plagioclase’ or ‘olivine’ or ‘pyroxene’ or ‘cpx’ or ‘alk-feldspar’ or ‘biotite’ to carry-out all or any solid-solution calculations, default is ‘All’

  • Dielec_method – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified default - ‘JN91’

Returns:

  • if ‘All’ is specified for solidsolution_type, each case has the follwowing prefix - AnAb_, FoFa_, EnFe_, cpx_, AlkFed_, Biotite_

  • logK (float, vector) – logarithmic K values

  • Rxn (dict) – The calculated dictionary of reaction thermodynamic properties has the following properties:

    • type: solid-solution mineral type, [-]

    • name: solid-solution name, [K]

    • formula: solid-solution mineral formula, [-]

    • MW: Molecular weight, [g/mol]

    • min: solid-solution mineral properties, [‘formula’, ‘source date’, dG[cal/ml], dH[cal/mol], S[cal/mol-K], V[cm3/mol], a[cal/mol-K], b[10^3 cal/mol/K^2], c[10^-5 cal/mol/K]]

    • spec: list of species, [-]

    • coeff: list of corresponding coefficients of species above, [-]

    • nSpec: Total number of species, [-]

    • V: Molar volume, [cm3/mol]

    • source: Source of thermo data, [kJ/kg·K]

    • elements: list of elements and their total numbers, [-]

Usage

The general usage of water_dielec is as follows:

  1. For water dielectric properties at any Temperature and Pressure:

    ss = solidsolution_thermo(T = T, P = P, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is pressure in bar

  2. For water dielectric properties at any Temperature and density :

    ss = solidsolution_thermo(T = T, rho = rho, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and rho is density in kg/m³

  3. For water dielectric properties at any Temperature and Pressure on steam saturation curve:

    ss = solidsolution_thermo(T = T, P = ‘T’, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where T is temperature in celsius and P is assigned a quoted character ‘T’ to reflect steam saturation pressure

    ss = solidsolution_thermo(P = P, T = ‘P’, X = X, solidsolution_type = ‘All’, Dielec_method = ‘JN91’),

    where P is pressure in bar and T is assigned a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> ss = solidsolution_thermo(cpx_Ca = 0.5, X = 0.85, T = 30, P = 50,
                              solidsolution_type = 'All')
>>> ss.AnAb_logK, ss.FoFa_logK, ss.EnFe_logK, ss.cpx_logK, ss.AlkFed_logK,
    ss.Biotite_logK
    21.750590, 26.570902, 10.793372, 20.577152,  3.756792, 32.96363
>>> ss = solidsolution_thermo(cpx_Ca = 1, X = 0.85, T = 50, P = 100,
                              solidsolution_type = 'cpx')
>>> ss.logK
    18.81769186
>>> ss.Rxn
    {'type': 'cpx', 'name': 'Di85Hed15',
     'formula': 'Ca1.00Mg0.85Fe0.15Si2O6', 'MW': 221.2817,
     'min': ['Ca1.00Mg0.85Fe0.15Si2O6', ' R&H95, Stef2001',
             -711392.7391800061, nan, 37.032850185405415, 66.369,
             106.66383843212236, -0.019588551625239002, -16326.4818355,
             -1052.9517208413004, 5.714746653919693e-06],
     'spec': ['H+', 'Ca++', 'Mg++', 'Fe++', 'SiO2(aq)', 'H2O'],
     'coeff': [-4, 1.0, 0.85, 0.15, 2, 2], 'nSpec': 6, 'V': 66.369,
     'source': ' R&H95, Stef2001', 'elements': ['1.0000', 'Ca', '0.8500',
                                                'Mg', '0.1500', 'Fe', '2.0000',
                                                'Si', '6.0000', 'O']}
>>> ss = solidsolution_thermo(X = 0.5, T = 50, P = 100,
                              solidsolution_type = 'plagioclase')
>>> ss.logK
    12.62488394
>>> ss.Rxn
    {'type': 'plag', 'name': 'An50', 'formula': 'Ca0.50Na0.50Al1.50Si2.50O8',
     'MW': 270.215145, 'min': ['Ca0.50Na0.50Al1.50Si2.50O8', ' R&H95,
                               Stef2001', -919965.222804649, nan,
                               47.33081919017781, 100.43, 131.53908221797,
                               -0.022148661567686426, 32265.761759082205,
                               -1316.0836615678777, 7.719885114722753e-06],
     'spec': ['H+', 'Al+++', 'Na+', 'Ca++', 'SiO2(aq)', 'H2O'],
     'coeff': [-6.0, 1.5, 0.5, 0.5, 2.5, 3.0], 'nSpec': 6, 'V': 100.43,
     'source': ' R&H95, Stef2001', 'elements': ['0.5000', 'Ca', '0.5000',
                                                'Na', '1.5000', 'Al', '2.5000',
                                                'Si', '8.0000', 'O']}
kwargs
__calc__(**kwargs)[source]
__checker__(**kwargs)[source]
calclogKAnAb(XAn, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Plagioclase minerals

Parameters:
  • XAn (volume fraction of Anorthite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKplag (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAnAb(XAn, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAnAb(XAn, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAnAb(XAn, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAnAb(XAn, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKFoFa(XFo, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of olivine minerals

Parameters:
  • XFo (volume fraction of Forsterite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_ol (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKFoFa without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKFoFa(XFo, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKFoFa(XFo, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKFoFa(XFo, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKFoFa(XFo, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKEnFe(XEn, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of pyroxene minerals

Parameters:
  • XEn (volume fraction of Enstatite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_opx (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKEnFe without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKEnFe(XEn, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKEnFe(XEn, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKEnFe(XEn, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKEnFe(XEn, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of clinopyroxene minerals (Di, Hed, En and Fe)

Parameters:
  • nCa (number of moles of Ca in formula unit (=1 for Di, Hed)) – and must be greater than zero

  • XMg (mole fraction of Mg) – XMg = (nMg/(nFe + nMg))

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_cpx (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKDiHedEnFe without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKDiHedEnFe(nCa, XMg, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKAbOr(XAb, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Alkaline-Feldspar minerals

Parameters:
  • XAb (volume fraction of Albite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKalkfeld (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAbOr(XAb, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

calclogKBiotite(XPh, TC, P, dbaccessdic, rhoEG, Dielec_method=None)[source]

This function calculates thermodynamic properties of solid solution of Biotite minerals

Parameters:
  • XAb (volume fraction of Albite) –

  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • dbaccessdic (dictionary of species from direct-access database) –

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method to calculate) – dielectric constant (optional), if not specified default - ‘JN91’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logKalkfeld (logarithmic K values)

  • Rxn (dictionary of reaction thermodynamic properties)

Usage

The general usage of calclogKAnAb without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic),

    where T is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, Rxn] = calclogKAbOr(XAb, TC, ‘T’, dbaccessdic),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKAbOr(XAb, P, ‘P’, dbaccessdic),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKAbOr(XAb, TC, P, dbaccessdic, Dielec_method = ‘FGL97’)

pygcc.calclogKclays(TC, P, *elem, dbaccessdic=None, group=None, cation_order=None, Dielec_method=None, ClayMintype=None, ThermoInUnit='cal', **rhoEG)[source]

This function calculates logK values and reaction parameters of clay reactions using below references:

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • elem (list) – list containing nine parameters with clay names and elements compositions with the following format [‘Montmorillonite_Lc_MgK’, ‘Si’, ‘Al’, ‘FeIII’, ‘FeII’, ‘Mg’, ‘K’, ‘Na’, ‘Ca’, ‘Li’]

  • dbacessdic (dict) – dictionary of species from direct-access database, optional, default is speq21

  • group (string) – specify the structural layering of the phyllosilicate, for layers composed of 1 tetrahedral + 1 octahedral sheet (1:1 layer) - specify ‘7A’, 2 tetrahedral + 1 octahedral sheet (2:1 layer) - specify ‘10A’, or the latter with a brucitic sheet in the interlayer (2:1:1 layer) - specify ‘14A’ (optional), if not specified, default is based on charge balance on the cations and anions

  • cation_order (string) – specify ordering of Si and Al ions either ‘Eastonite’, ‘Ordered’, ‘Random’, or ‘HDC’ (optional), if not specified, default is based on guidelines by Vinograd (1995)

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant (optional), if not specified, default - ‘JN91’

  • ClayMintype (string) – specify either ‘Smectite’ or ‘Chlorite’ or ‘Mica’ as the clay type, if not specified default - ‘Smectites’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), particularly used to covert KJ data to cal by supcrtaq function if not specified default - ‘cal’

  • rhoEG (dict) – dictionary of water properties like density (rho), dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK_clay (float, vector) – logarithmic K values

  • Rxn (dict) – dictionary of reaction thermodynamic properties

Usage

The general usage of calclogKclays is as follows:

  1. Without the optional arguments, not on steam saturation curve:

    [logK, Rxn] = calclogKclays(TC, P, *elem),

    where T is temperature in celsius and P is pressure in bar;

  2. Without the optional arguments, on steam saturation curve:

    [logK, Rxn] = calclogKclays(TC, ‘T’, *elem),

    where T is temperature in celsius, followed with a quoted char ‘T’

    [logK, Rxn] = calclogKclays(P, ‘P’, *elem),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, Rxn] = calclogKclays(TC, P, *elem, dbacessdic = dbacessdic, group = ‘10A’, cation_order = ‘HDC’, Dielec_method = ‘FGL97’)

Examples

>>> logK, Rxn = calclogKclays(50, 'T', *['Clinochlore', '3', '2', '0', '0',
                                         '5', '0', '0', '0', '0'],
                              group = '14A')
>>> logK
    57.56820225

References

  1. Blanc, P., Vieillard, P., Gailhanou, H., Gaboreau, S., Gaucher, É., Fialips, C. I., Madé, B & Giffaut, E. (2015). A generalized model for predicting the thermodynamic properties of clay minerals. American journal of science, 315(8), 734-780.

  2. Blanc, P., Gherardi, F., Vieillard, P., Marty, N. C. M., Gailhanou, H., Gaboreau, S., Letat, B., Geloni, C., Gaucher, E.C. and Madé, B. (2021). Thermodynamics for clay minerals: calculation tools and application to the case of illite/smectite interstratified minerals. Applied Geochemistry, 104986.

  3. Vinograd, V.L., 1995. Substitution of [4]Al in layer silicates: Calculation of the Al-Si configurational entropy according to 29Si NMR Spectra. Physics and Chemistry of Minerals 22, 87-98.

pygcc.eps = 2.220446049250313e-16
pygcc.J_to_cal = 4.184
pygcc.IAPWS95_COEFFS
pygcc.calc_elem_count_molewt(formula, **kwargs)[source]

This function calculates the molecular mass and the elemental composition of a substance given by its chemical formula. This is modified from https://github.com/cgohlke/molmass/blob/master/molmass/molmass.py

Parameters:
  • formula (string) – chemical formula

  • Elementdic (dict) – dictionary, containing the atomic mass of element database

Returns:

  • elements (dict) – dictionary of elemental composition and their respective number of atoms

  • molewt (float) – Calculated Molecular Weights [g/mol]

Usage:

[elements, molewt] = calc_elem_count_molewt(formula)

Examples of valid formulas are “H2O”, “[2H]2O”, “CH3COOH”, “EtOH”, “CuSO4:5H2O”, “(COOH)2”, “AgCuRu4(H)2[CO]12{PPh3}2”, “CGCGAATTCGCG”, and, “MDRGEQGLLK” .

Examples

>>> elements, molewt = calc_elem_count_molewt("CuSO4:5H2O")
>>> elements, molewt
    {'O': 9.0, 'H': 10.0, 'S': 1, 'Cu': 1}, 249.6773
pygcc.importconfile(filename, *Rows)[source]
This function imports numeric data from a text file as column vectors.

[Var1, Var2] = importconfile(filename) Reads data from text file filename for the default selection.

[Var1, Var2] = importconfile(filename, StartRow, EndRow) Reads data from rows StartRow through EndRow of text file filename.

Example:

[Var1, Var2] = importconfile(‘100bar.con’, 6, 13);

pygcc.var_name(var)[source]
pygcc.feval(funcName, *args)[source]
pygcc.roundup_tenth(x)[source]
pygcc.roundup_hundredth(x)[source]
pygcc.read_specific_lines(file, lines_to_read)[source]
pygcc.derivative(f, a, method='central', h=0.001)[source]

Compute the derivative of f, f’(a) with step size h. :param f: Vectorized function of one variable :type f: function :param a: Compute derivative at x = a :type a: number :param method: Difference formula: ‘forward’, ‘backward’ or ‘central’ :type method: string :param h: Step size in difference formula :type h: number

Returns:

Difference formula:

central: f(a + h) - f(a - h))/2h forward: f(a + h) - f(a))/h backward: f(a) - f(a-h))/h

Return type:

float

pygcc.info(name, dic)[source]

This function checks for naming convention of the species in the direct-access or source database

Parameters:
  • name (string) – species name

  • dic (dict) – dictionary of species from direct-access or source database

Returns:

lst – resulting search of all species with the input name

Return type:

list

Examples

>>> from pygcc.pygcc_utils import db_reader
>>> ps = db_reader() # utilizes the default direct-access database, speq21
>>> info('ss_', ps.dbaccessdic)
    ['ss_Anorthite',  'ss_Albite_high', 'ss_K-feldspar', 'ss_Ferrosilite',
     'ss_Enstatite', 'ss_Clinoenstatite', 'ss_Hedenbergite', 'ss_Diopside',
     'ss_Forsterite', 'ss_Fayalite', 'ss_Annite',  'ss_Phlogopite',
     'ss_Anorthite',  'ss_Albite_high', 'ss_K-feldspar', 'ss_Ferrosilite',
     'ss_Enstatite', 'ss_Clinoenstatite', 'ss_Hedenbergite', 'ss_Diopside',
     'ss_Forsterite',  'ss_Fayalite', 'ss_Annite', 'ss_Phlogopite']
pygcc.drummondgamma(TK, I)[source]

This function models solubility of CO2 gas in brine using Drummond equation

Parameters:
  • TK (float, vector) – Temperature [K]

  • I – Ionic strength

Examples

>>> log10_gamma = drummondgamma( 500, 0.5)
>>> log10_gamma
    0.0781512920184902
pygcc.Henry_duan_sun(TK, P, I)[source]

This function evaluates the solubility of CO2 gase in brine using Duan_Sun Formulation

Parameters:
  • TK (float, vector) – Temperature [K]

  • P (float, vector) – Pressure [bar]

  • I (float) – Ionic strength

Returns:

  • log10_co2_gamma (float, vector) – co2 aqueous activity coefficients in log10

  • mco2 (float, vector) – co2 aqueous molalities

Usage

log10_co2_gamma, mco2 = Henry_duan_sun( TK, P, I)

Examples

>>> log10_co2_gamma, mco2 = Henry_duan_sun( 500, 250, 0.5)
>>> log10_co2_gamma, mco2
    0.06202532, 1.6062557

References

  1. Duan, Z. and Sun, R., 2003. An improved model calculating CO2 solubility in pure water and aqueous NaCl solutions from 273 to 533 K and from 0 to 2000 bar. Chemical geology, 193(3-4), pp.257-271.

pygcc.co2fugacity(TK, P, poy=True)[source]

This function computes the fugacity and density of CO2 by Duan and Sun 2003 Also Calculate the Saturation Index SI and partial pressure of CO2(g) at any given T, P using the Duan equation of state. A Poynting correction factor is also applied. :param TK: Temperature [K] :type TK: float, vector :param P: pressure [bar] :type P: float, vector :param poy: Option to apply a Poynting correction factor [True is the default] :type poy: bool

Returns:

  • fCO2 (float, vector) – co2 fugacity [bar]

  • denCO2 (float, vector) – co2 density [g/cm3]

  • SI (float, vector) – co2 saturation index

  • pCO2 (float, vector) – co2 partial pressure [bar]

Usage

[fCO2, denCO2, SI, pCO2] = co2fugacity( TK, P)

Examples

>>> fCO2, denCO2, SI, pCO2 = co2fugacity( np.array([400,420]), np.array([150, 200]))
>>> fCO2
    array([114.50387423, 150.87672517])
>>> denCO2
    array([2.6741242 , 3.33134397])
>>> SI
    array([1.73291553, 1.84597591])
>>> pCO2
    array([54.78127571, 71.0710152])
pygcc.gamma_correlation(TC, P, method=None)[source]

This function calculates the CO2 activity correlation coefficients at given temperature T and pressure P

Parameters:
  • TC (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • method – specify the activity model ['Duan_Sun' or 'Drummond']

Usage

Examples

>>> log10_co2_gamma, mco2 = Henry_duan_sun( 500, 250, 0.5)
>>> log10_co2_gamma, mco2
    0.06202532, 1.6062557

References

  1. Segal Edward Drummond, 1981, Boiling and Mixing of Hydrothermal Fluids: Chemical Effects on Mineral Precipitation, page 19

  2. Wolery, T. J., Lawrence Livermore National Laboratory, United States Dept. of Energy, 1992. EQ3/6: A software package for geochemical modeling of aqueous systems: package overview and installation guide (version 7.0)

pygcc.Helgeson_activity(TC, P, I, Dielec_method=None, **rhoEDB)[source]

This function calculates the solute activity coefficient, solvent osmotic coefficient, and solvent activity at given temperature and pressure using equations 298, 190 and 106 in Helgeson, Kirkham and Flowers, 1981, A.J.S. p.1249-1516 Parameters: ———-

TC : Temperature [°C] P : pressure [bar] I : ionic strength Dielec_method : specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric

constant (optional), if not specified default - ‘JN91’

rhoEDBdictionary of water properties like density (rho), dielectric factor (E) and

Debye–Hückel coefficients (optional)

Returns:

aw : solvent activity phi : solvent osmotic coefficient mean_act : solute activity coefficient

Usage

[aw, phi, mean_act] = Helgeson_activity( TC, P, I)

pygcc.aw_correlation(TC, P, Dielec_method=None, **rhoEDB)[source]

Calculates the water activity correlation coefficients at given temperature and pressure Parameters: ———-

TC : Temperature [°C] P : pressure [bar] Dielec_method : specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric

constant (optional), if not specified default - ‘JN91’

rhoEDBdictionary of water properties like density (rho), dielectric factor (E) and

Debye–Hückel coefficients (optional)

Returns:

ch20 : water activity correlation coefficients

Usage

[ch20] = aw_correlation( TC, P)

class pygcc.calcRxnlogK(**kwargs)[source]

This class implemetation calculates logK values for any reaction with the option for extrapolation where rho < 350kg/m3

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • Specie (string) – specify the species for logK calculation, either the Product species of any reaction or solid solutions or clay like ‘AnAb’ or ‘AbOr’ or ‘FoFa’ or ‘EnFe’ or ‘DiHedEnFe’ or ‘clay’

  • Specie_class (string, optional) – specify the class of species like ‘aqueous’, ‘minerals’, ‘liquids’, or ‘gases’

  • elem (list) – list containing nine parameters with clay names and elements compositions with the following format [‘Montmorillonite_Lc_MgK’, ‘Si’, ‘Al’, ‘FeIII’, ‘FeII’, ‘Mg’, ‘K’, ‘Na’, ‘Ca’, ‘Li’]

  • dbaccessdic (dict) – direct-acess database dictionary

  • rhoEGextrap (dict) – dictionary of water properties like density (rho), dielectric factor (E) and Gibbs Energy for density region 350-550kg/m3

  • group (string) – specify the structural layering of the phyllosilicate, for layers composed of 1 tetrahedral + 1 octahedral sheet (1:1 layer) - specify '7A', 2 tetrahedral + 1 octahedral sheet (2:1 layer) - specify '10A', or the latter with a brucitic sheet in the interlayer (2:1:1 layer) - specify '14A' (optional), if not specified, default is ‘10A’ for smectites, micas, et cetera

  • ClayMintype (string) – specify either ‘Smectite’ or ‘Chlorite’ or ‘Mica’ as the clay type, if not specified default - ‘Smectites’

  • X (float) – volume fractions of any (Anorthite, Albite, Forsterite, Enstatite) or mole fraction of Mg

  • cpx_Ca (float) – number of moles of Ca in formula unit (=1 for Di, Hed), must be greater than zero

  • sourcedic (dict) – source database reactions dictionary

  • specielist (list of list, optional) – source database species grouped into categories [element, basis, redox, aqueous, minerals, gases, oxides]

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant, default is ‘JN91’

  • heatcap_method (string) – specify either ‘SUPCRT’ or ‘Berman88’ or ‘HP11’ or ‘HF76’ as the method to calculate thermodynamic properties of any mineral or gas, default is ‘SUPCRT’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), particularly used to covert KJ data to cal by supcrtaq function if not specified default - ‘cal’

  • Al_Si (string) – specify either ‘pygcc’ or ‘Arnórsson_Stefánsson’ as the input to express Al and Si species in solid solution (optional), ‘Arnórsson_Stefánsson’ expresses them as ‘Al(OH)4-’ and ‘H4SiO4(aq)’, respectively while pygcc uses ‘Al3+’ and ‘SiO2(aq)’, respectively if not specified default - ‘pygcc’

  • sourceformat (string) – specify the source database format, either ‘GWB’ or ‘EQ36’

  • densityextrap (float, vector) – specify the extrapolation option for density-logK, ‘Yes’/True or ‘No’/False

Returns:

  • log_K (float, vector) – logarithmic K value(s)

  • dGrxn (float, vector) – Total reaction Gibbs energy [cal/mol]

Usage

The general usage of water_dielec is as follows:

  1. For water dielectric properties at any Temperature and Pressure:

    calclogK = calcRxnlogK(T = T, P = P, Dielec_method = ‘JN91’, **kwargs),

    where T is temperature in celsius and P is pressure in bar

  2. For water dielectric properties at any Temperature and density :

    calclogK = calcRxnlogK(T = T, rho = rho, Dielec_method = ‘JN91’, **kwargs),

    where T is temperature in celsius and rho is density in kg/m³

  3. For water dielectric properties at any Temperature and Pressure on steam saturation curve:

    calclogK = calcRxnlogK(T = T, P = ‘T’, Dielec_method = ‘JN91’, **kwargs),

    where T is temperature in celsius, followed with a quoted character ‘T’ to reflect steam saturation pressure

    calclogK = calcRxnlogK(P = P, T = ‘P’, Dielec_method = ‘JN91’, **kwargs),

    where P is pressure in bar, followed with a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> ps = db_reader(sourcedb = './default_db/thermo.com.dat',
                   sourceformat = 'gwb', dbaccess = './default_db/speq21.dat')
>>> calclogK = calcRxnlogK(T = 100, P = 50, Specie = 'H2S(aq)',
                           Specie_class = 'aqueous',
                           dbaccessdic = ps.dbaccessdic,
                           sourcedic = ps.sourcedic, specielist = ps.specielist)
>>> calclogK.logK, calclogK.dGrxn
     -6.4713,       11049.3168
kwargs
__calc__(**kwargs)[source]
AllRxnslogK(TC, P, rhoEG)[source]

This function calculates logK values of all reactions including solid-solution and clay minerals

Parameters:
  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK (logarithmic K value(s))

  • dGrxn (Total reaction Gibbs energy [cal/mol])

  • dGP (Product specie Gibbs energy [cal/mol])

  • dGRs (Reactant species Gibbs energy [cal/mol])

  • Rxn (dict)

  • The calculated dictionary of reaction thermodynamic properties has the following properties

    • type: solid-solution mineral type, [-]

    • name: solid-solution name, [K]

    • formula: solid-solution mineral formula, [-]

    • MW: Molecular weight, [g/mol]

    • min: solid-solution mineral properties, [‘formula’, ‘source date’, dG[cal/ml], dH[cal/mol], S[cal/mol-K], V[cm3/mol], a[cal/mol-K], b[10^3 cal/mol/K^2], c[10^-5 cal/mol/K]]

    • spec: list of species, [-]

    • coeff: list of corresponding coefficients of species above, [-]

    • nSpec: Total number of species, [-]

    • V: Molar volume, [cm3/mol]

    • source: Source of thermo data, [kJ/kg·K]

    • elements: list of elements and their total numbers, [-]

Usage

The general usage of calcRxnlogK without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, dGrxn, dGP, dGRs] = AllRxnslogK(TC, P, Prod, dbaccessdic, sourcedic, specielist),

    where TC is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, dGrxn, dGP, dGRs] = AllRxnslogK(TC, ‘T’, Prod, dbaccessdic, sourcedic, specielist),

    where TC is temperature in celsius, followed with a quoted char ‘T’

    [logK, dGrxn, dGP, dGRs] = AllRxnslogK(P, ‘P’, Prod, dbaccessdic, sourcedic, specielist),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, dGrxn, dGP, dGRs] = AllRxnslogK( TC, P, Prod, dbaccessdic, sourcedic, specielist, Dielec_method = ‘FGL97’)

RxnlogK(TC, P, Prod, rhoEG)[source]

This function calculates logK values of any reaction

Parameters:
  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • Prod (Product species of the reaction) –

  • dbaccessdic (direct-acess database dictionary) –

  • sourcedic (source database reactions dictionary) –

  • specielist (source database species grouped into) – [element, basis, redox, aqueous, minerals, gases, oxides]

  • Dielec_method (specify either 'FGL97' or 'JN91' or 'DEW' as the method) – to calculate dielectric constant, default is ‘JN91’

  • sourceformat (source database format, either 'GWB' or 'EQ36', default is 'GWB') –

  • heatcap_method (specify either 'SUPCRT' or 'Berman88' or 'HP11' or 'HF76' as the method to calculate thermodynamic properties) – of any mineral, default is ‘SUPCRT’

  • rhoEG (dictionary of water properties like density (rho),) – dielectric factor (E) and Gibbs Energy (optional)

Returns:

  • logK (logarithmic K value(s))

  • dGrxn (Total reaction Gibbs energy [cal/mol])

  • dGP (Product specie Gibbs energy [cal/mol])

  • dGRs (Reactant species Gibbs energy [cal/mol])

Usage

The general usage of calcRxnlogK without the optional argument is as follows:

  1. Not on steam saturation curve:

    [logK, dGrxn, dGP, dGRs] = RxnlogK(TC, P, Prod, dbaccessdic, sourcedic, specielist),

    where TC is temperature in celsius and P is pressure in bar;

  2. On steam saturation curve:

    [logK, dGrxn, dGP, dGRs] = RxnlogK(TC, ‘T’, Prod, dbaccessdic, sourcedic, specielist),

    where TC is temperature in celsius, followed with a quoted char ‘T’

    [logK, dGrxn, dGP, dGRs] = RxnlogK(P, ‘P’, Prod, dbaccessdic, sourcedic, specielist),

    where P is pressure in bar, followed with a quoted char ‘P’.

  3. Meanwhile, usage with any specific dielectric constant method (‘FGL97’) for condition not on steam saturation curve is as follows. Default method is ‘JN91’

    [logK, dGrxn, dGP, dGRs] = RxnlogK( TC, P, Prod, dbaccessdic, sourcedic, specielist, Dielec_method = ‘FGL97’)

densitylogKextrap(TC, P, rhoEGextrap)[source]

This function calculates logK values extrapolation for conditions where rho < 350kg/m3

Parameters:
  • TC (temperature [°C]) –

  • P (pressure [bar]) –

  • rhoEGextrap (dictionary of water properties like density (rho), dielectric factor (E) and) – Gibbs Energy for density region 350-550kg/m3

Returns:

logK

Return type:

extrapolated logarithmic K value(s)

Usage

[logK] = densitylogKextrap(TC, P, ‘H2S(aq)’, dbaccessdic = dbaccessdic, sourcedic = sourcedic, specielist = specielist),

pygcc.outputfmt(fid, logK, Rxn, *T, dataset=None, logK_form=None)[source]

This function writes logK and Rxn data to any file using GWB, EQ36, Pflotran and ToughReact format

Parameters:
  • fid (string) – file ID

  • logK (float, vector) – logarithmic K value(s)

  • Rxn (dict) – dictionary of reaction thermodynamic properties

  • T (float, vector) – Temperature value(s), optional, required when ‘polycoeffs’ is specified for logK_form

  • dataset (string) – specify the dataset format, either ‘GWB’, ‘EQ36’, ‘Pflotran’ or ‘ToughReact’

  • logK_form (string) – specify the format of logK either as a set of eight values one for each of the dataset’s principal temperatures, or blocks of polynomial coefficients, [values, polycoeffs], default is ‘a set of eight values’ (optional)

Return type:

Output data to the file with filename described in fid with any format mentioned above.

Examples

>>> fid = open('./logK_details.txt', 'w')
>>> logKRxn = calcRxnlogK(T = 100, P = 'T', X = 0.634,
                          Specie = 'Plagioclase', densityextrap = True)
>>> # output in EQ36 format
>>> outputfmt(fid, logKRxn.logK, logKRxn.Rxn, dataset = 'EQ36')
>>> fid.close()
class pygcc.write_database(**kwargs)[source]

Class to write the new database for either GWB, EQ3/6, ToughReact, Pflotran into a new folder called “output”

Parameters:
  • T (float, vector) – Temperature [°C]

  • P (float, vector) – Pressure [bar]

  • cpx_Ca (string) – number of moles of Ca in solid solution of clinopyroxene (optional) if it is ommitted solid solution of clinopyroxene will not be included, 0 < nCa >=1

  • solid_solution (string, bool) – specify the inclusion of solid-solution [Yes/True or No/False], default is ‘No’

  • clay_thermo (float, vector) – specify the inclusion of clay thermodynamic properties [Yes/True or No/False], default is ‘No’

  • logK_form (float, vector) – specify the format of logK either as a set of eight values one for each of the dataset’s principal temperatures, or blocks of polynomial coefficients, [values, polycoeffs] default is ‘a set of eight values’

  • densityextrap (float, vector) – specify the utilization of density extrapolation [Yes/True or No/False], default is ‘Yes’

  • dbaccess (string) – direct-access database filename and location (optional)

  • dbBerman_dir (string) – filename and location of the Berman mineral database (optional)

  • dbHP_dir (string) – filename and location of the supcrtbl mineral and gas database, optional

  • dbaccessformat (string, optional) – specify the direct-access/sequential-access database format, either ‘speq’ or ‘supcrtbl’, default is ‘speq’

  • sourcedb (string) – source database filename and location (optional)

  • sourceformat (string) – source database format, either ‘GWB’ or ‘EQ36’, default is ‘GWB’

  • sourcedb_codecs (string) – specify the name of the encoding used to decode or encode the sourcedb file, optional

  • objdb (string) – new database filename and location (optional)

  • co2actmodel (string) – co2 activity model equation [Duan_Sun or Drummond] (optional), if not specified, default is ‘Drummond’

  • Dielec_method (string) – specify either ‘FGL97’ or ‘JN91’ or ‘DEW’ as the method to calculate dielectric constant, default is ‘JN91’ (optional)

  • heatcap_method (string) – specify either ‘SUPCRT’ or ‘Berman88’ or ‘HP11’ or ‘HF76’ the method to calculate thermodynamic properties of any mineral, default is ‘SUPCRT’

  • ThermoInUnit (string) – specify either ‘cal’ or ‘KJ’ as the input units for species properties (optional), particularly used to covert KJ data to cal by supcrtaq function if not specified default - ‘cal’

  • dataset (string) – specify the dataset format, either ‘GWB’, ‘EQ36’, ‘Pflotran’ or ‘ToughReact’, default is old GWB database [‘GWB’] (optional)

  • print_msg (string, bool) – print debug message [True or False], default is False

Return type:

Output the new database to an ASCII file with filename described in ‘objdb’ if specified.

Usage

With any Temperature and Pressure:
  1. General format with default dielectric constant and CO2 activity model and exclusions of solid solutions for GWB

    write_database(T = T, P = P, cpx_Ca = nCa, dataset = ‘GWB’, sourceformat = ‘GWB’)

  2. Inclusion of solid solutions and exclusion of solid solution of clinopyroxene and clay thermo

    write_database(T = T, P = P, solid_solution = ‘Yes’, clay_thermo = ‘Yes’, dataset = ‘GWB’, sourceformat = ‘GWB’)

  3. Inclusion of all solid solutions and clay thermo with emph{‘Duan_Sun’} CO2 activity model and ‘FGL97’ dielectric constant calculation

    write_database(T = T, P = P, cpx_Ca = nCa, solid_solution = ‘Yes’, clay_thermo = ‘Yes’, co2actmodel = ‘Duan_Sun’, Dielec_method = ‘FGL97’, dataset = ‘GWB’, sourceformat = ‘GWB’)

With any Temperature or Pressure on the steam saturation curve:
  1. General format with default dielectric constant and CO2 activity model

    write_database(T = T, P = ‘T’, cpx_Ca = nCa, dataset = ‘GWB’, sourceformat = ‘GWB’),

    where T is temperature in celsius and P is assigned a quoted character ‘T’ to reflect steam saturation pressure

    write_database(P = P, T = ‘P’, cpx_Ca = nCa, dataset = ‘GWB’, sourceformat = ‘GWB’),

    where P is pressure in bar and T is assigned a quoted character ‘P’ to reflect steam saturation temperature

Examples

>>> write_database(T=np.array([ 0.010, 25., 60., 100., 150.,  200.,
                               250.,  300.]), P=200, cpx_Ca = 0.5,
                   sourceformat = 'GWB', solid_solution = True,
                   clay_thermo = True, dataset = 'GWB')
>>> write_database(T=np.array([ 0.010, 25., 60., 100., 150.,  200.,  250.,
                               300.]), P=200, cpx_Ca = 0.5,
                   sourceformat = 'GWB', solid_solution = True,
                   clay_thermo = True, dataset = 'Pflotran',
                   sourcedb = './pygcc/default_db/thermo.2021.dat')
kwargs
__calc__(**kwargs)[source]
write_GWBdb(T, P)[source]

This function writes the new GWB database into a new folder called “output”

Parameters:
  • T (temperature [°C]) –

  • P (pressure [bar]) –

Return type:

Outputs the new database to an ASCII file with filename described in ‘objdb’.

Usage
Example:
  1. General format with default dielectric constant and CO2 activity model and exclusions of solid solutions

    write_GWBdb(T, P)

  2. Inclusion of solid solutions and clay thermo and exclusion of solid solution of clinopyroxene

    write_GWBdb(T, P)

  3. Inclusion of all solid solutions and clay thermo with emph{‘Duan_Sun’} CO2 activity model and ‘JN91’ dielectric constant calculation

    write_GWBdb(T, P)

write_EQ36db(T, P)[source]

This function writes the new EQ3/6 database into a new folder called “output”

Parameters:
  • T (temperature [°C]) –

  • P (pressure [bar]) –

Return type:

Outputs the new database to an ASCII file with filename described in ‘objdb’.

Usage
Example:
  1. General format with default dielectric constant and CO2 activity model and exclusions of solid solutions

    write_EQ36db(T, P )

  2. Inclusion of solid solutions and clay thermo and exclusion of solid solution of clinopyroxene

    write_EQ36db(T, P )

  3. Inclusion of all solid solutions and clay thermo with emph{‘Duan_Sun’} CO2 activity model and ‘FGL97’ dielectric constant calculation

    write_EQ36db(T, P )

write_pflotrandb(T, P)[source]

This function writes the new pflotran database into a new folder called “output”

Parameters:
  • T (temperature [°C]) –

  • P (pressure [bar]) –

Return type:

Outputs the new database to an ASCII file with filename described in ‘objdb’.

Usage
Example:
  1. General format with default dielectric constant and CO2 activity model and exclusions of solid solutions

    write_pflotrandb(T, P )

  2. Inclusion of solid solutions and clay thermo and exclusion of solid solution of clinopyroxene

    write_pflotrandb(T, P )

  3. Inclusion of all solid solutions and clay thermo with emph{‘Duan_Sun’} CO2 activity model and ‘FGL97’ dielectric constant calculation

    write_pflotrandb(T, P )

write_ToughReactdb(T, P)[source]

This function writes the new ToughReact database into a new folder called “output”

Parameters:
  • T (temperature [°C]) –

  • P (pressure [bar]) –

Return type:

Outputs the new database to an ASCII file with filename described in ‘objdb’.

Usage
Example:
  1. General format with default dielectric constant and CO2 activity model and exclusions of solid solutions

    write_ToughReactdb(T, P, dbaccess = ‘location’, sourcedb = ‘location’,

    objdb = ‘location’, sourceformat = ‘GWB’)

  2. Inclusion of solid solutions and clay thermo and exclusion of solid solution of clinopyroxene

    write_ToughReactdb(T, P, solid_solution = ‘Yes’, clay_thermo = ‘Yes’, dbaccess = ‘location’,

    sourcedb = ‘location’, objdb = ‘location’, sourceformat = ‘GWB’)

  3. Inclusion of all solid solutions and clay thermo with emph{‘Duan_Sun’} CO2 activity model and ‘FGL97’ dielectric constant calculation

    write_ToughReactdb(T, P, nCa, solid_solution = ‘Yes’, clay_thermo = ‘Yes’, dbaccess = ‘location’,

    sourcedb = ‘location’, objdb = ‘location’, co2actmodel = ‘Duan_Sun’, Dielec_method = ‘FGL97’, sourceformat = ‘GWB’)

pygcc.main_function_name(module)[source]

print main_function name

pygcc.__version__