logKcalc-package: Package Overview and Datasets

logKcalc-packageR Documentation

Package Overview and Datasets

Description

The thermodynamic data files for The Geochemist's Workbench® (Bethke et al., 2020) are part of a family of datasets for geochemical modeling programs that store reaction properties as logarithms of equilibrium constants (\logK values) for specified temperatures (\T) and pressures (\P) (see Hörbrand et al., 2018 for an overview). Users of GWB may want to add species to a data file, or change the temperature range, which is 0–300 \degC for the data files distributed with GWB. Therefore, there is a need for programs to update GWB data files with \logK values calculated from thermodynamic databases. Two previously previously programs that do this are K2GWB (Cleverley and Bastrakov, 2005) and DBCreate (Kong et al., 2013).

The aim of logKcalc is to make this functionality available in a free R package and provide additional features such as listing data references and comparison of \logK values from different files. The main function is logKcalc, which requires an existing GWB data file as input and creates an output file with the equilibrium constants of dissociation reactions recalculated using the OBIGT database in CHNOSZ. There are accessory functions to add missing species to OBIGT and to add other species from OBIGT to the output. Another function, logKcomp, makes plots to compare equilibrium constants from two files.

Details

Some data files used for the examples and vignettes are available in the extdata directory of the package.

⁠thermo_24elements.tdat⁠’, with dataset format jan19, was generated from the GWB data file ‘⁠thermo.tdat⁠’ using GWB's TEdit program to remove elements other than Ag, Al, As, Au, C, Ca, Cl, Cu, F, Fe, H, K, Mg, Mn, N, Na, O, P, Pb, S, Si, Sn, U, and Zn. The elements include those present in many of the GWB example scripts along with some others of particular interest for developing the OBIGT database (e.g. Au). The original GWB data file ‘⁠thermo.tdat⁠’ is available in the Gtdata directory of the GWB installation and at https://www.gwb.com/thermo.php.

⁠thermo_24swapped.tdat⁠’ is based on the previous file, with As(OH)\s3, Sn\S++, and UO\s2\S++ swapped for the basis species As(OH)\s4\S-, Sn\S++++, and U\S++++, respectively. The result is a data file with basis species that are all in the default UNITHERM and OBIGT databases. This file is used by addOBIGT to fit thermodynamic parameters to \logK values for species that are not in OBIGT.

⁠thermo_24noredox.tdat⁠’ is based on the previous file, with basis species swapped for all redox species appearing in the dissociation reactions of other species. The former redox species, which no longer appear in any reactions, were moved into the aqueous species block. By writing all dissociation reactions in terms of basis species, the \logK values in this file can be compared with those in the file produced by K2GWB, where no redox species are present (see logKcomp).

⁠ThermoGWB_15_6_2020.tdat⁠’, with dataset format oct94, was created using K2GWB (Cleverley and Bastrakov, 2005) from the default UNITHERM database in HCh version 4.4 (Shvarov, 2008). This data file has the same basis species as ‘⁠thermo_24noredox.tdat⁠’. The suffix of the file output by K2GWB was changed from dat to tdat. To match the names used in ‘⁠thermo_24noredox.tdat⁠’, the output of K2GWB was manually modified to rename H\s2O(g), Oxygen(g), and H\s3AsO\s3(aq) to Steam, O\s2(g), and As(OH)\s3, respectively.

⁠thermo_12elements.tdat⁠’ is an even smaller extract of ‘⁠thermo.tdat⁠’ with the elements Al, Au, C, Cl, Fe, H, K, N, Na, O, S, and Si. This file is used for some examples and tests.

The directory extdata/tests contains files generated by logKcalc that are used for the package tests in tests/testthat.

References

Bethke, C. M., Farrell, B. and Sharifi, M. (2020) The Geochemist's Workbench® Release 14 GWB Essentials Guide, Aqeuous Solutions, LLC, Champaign, Illinois.

Cleverley, J. S. and Bastrakov, E. N. (2005) K2GWB: Utility for generating thermodynamic data files for The Geochemist's Workbench® at 0-1000 °C and 1-5000 bar from UT2K and the UNITHERM database. Computers & Geosciences 31, 756–767. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2005.01.007")}

Hörbrand, T., Baumann, T. and Moog, H. C. (2018) Validation of hydrogeochemical databases for problems in deep geothermal energy. Geotherm. Energy 6, 20. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1186/s40517-018-0106-3")}

Kong, X.-Z., Tutulo, B. M. and Saar, M. O. (2013) DBCreate: A SUPCRT92-based program for producing EQ3/6, TOUGHREACT, and GWB thermodynamic databases at user-defined \T and \P. Computers & Geosciences 51, 415–417. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2012.08.004")}

Shvarov, Yu. V. (2008) HCh: New potentialities for the thermodynamic simulation of geochemical systems offered by Windows. Geochemistry International 46, 834–839. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1134/S0016702908080089")}


jedick/logKcalc documentation built on Jan. 19, 2025, 10:41 a.m.