Loading thermodynamic databases
Contents
Loading thermodynamic databases#
Written by Allan Leal (ETH Zurich) on Jan 5th, 2022
Attention
Always make sure you are using the latest version of Reaktoro. Otherwise, some new features documented on this website will not work on your machine and you may receive unintuitive errors. Follow these update instructions to get the latest version of Reaktoro!
Reaktoro requires thermodynamic databases to calculate the thermodynamic properties of chemical species and reactions. These properties are necessary when performing chemical equilibrium and kinetics calculations.
Examples of such thermodynamic properties for a species \(i\) include:
standard molar Gibbs energy, \(G_i^\circ\)
standard molar Helmholtz energy, \(A_i^\circ\)
standard molar enthalpy, \(H_i^\circ\)
standard molar internal energy, \(U_i^\circ\)
standard molar entropy, \(S_i^\circ\)
standard molar volume, \(V_i^\circ\)
standard molar heat capacity (constant pressure), \(C_{P,i}^\circ\)
standard molar heat capacity (constant volume), \(C_{V,i}^\circ\)
The standard thermodynamic properties of the above species can be used to calculate reaction properties, such as the following for a reaction \(m\):
equilibrium constant of reaction, \(K_m\)
standard Gibbs energy of reaction, \(\Delta G_m^\circ\)
standard enthalpy of reaction, \(\Delta H_m^\circ\)
Reaktoro currently supports thermodynamic databases from the following providers:
The following classes exist for loading thermodynamic databases:
Note
All these classes derive from the Database
class. They exist to provide you additional convenience and functionality.
Read the next sections to learn how different thermodynamic databases from distinct providers can be loaded in Reaktoro.
PHREEQC Databases#
PHREEQC [Parkhurst and Appelo, 2013] is a well-known scientific software used for geochemical and biogeochemical modeling, and many thermodynamic databases have been compiled for it in the last decades. If you’d like to use Reaktoro with PHREEQC databases, we’ve got you covered. You can do this using a database file available on your computer or one of the following database files embedded into Reaktoro (those provided with PHREEQC v3):
Loading embedded PHREEQC database files#
The following are equivalent ways to load embedded PHREEEQC database files:
db = PhreeqcDatabase("phreeqc.dat")
db = PhreeqcDatabase.withName("phreeqc.dat")
Loading locally available PHREEQC database files#
The following are equivalent ways to load the same PHREEQC database file from your computer:
db = PhreeqcDatabase()
db.load("/home/username/databases/phreeqc.dat")
db = PhreeqcDatabase.fromFile("/home/username/databases/phreeqc.dat")
db = PhreeqcDatabase()
db.load("C:\\Users\\Username\\databases\\phreeqc.dat")
db = PhreeqcDatabase.fromFile("C:\\Users\\Username\\databases\\phreeqc.dat")
ThermoFun Databases#
ThermoFun is an open-source C++/Python library for the computation of thermodynamic properties of species and reactions. It supports many databases for a wide variety of applications. The following are the currently supported database files:
Loading embedded ThermoFun database files#
ThermoFun databases are also available in embedded form in Reaktoro for convenience. You need to use one of the following database names:
aq17
cemdata18
heracles
mines16
psinagra-12-07
slop98-organic
slop98
The following are equivalent ways to load the same embedded ThermoFun database file:
db = ThermoFunDatabase("cemdata18")
db = ThermoFunDatabase.withName("cemdata18")
Loading locally available ThermoFun database files#
The following are equivalent ways to load the same ThermoFun database file from your computer:
db = ThermoFunDatabase()
db.load("/home/username/databases/mines16-thermofun.json")
db = ThermoFunDatabase.fromFile("/home/username/databases/mines16-thermofun.json")
db = ThermoFunDatabase()
db.load("C:\\Users\\Username\\databases\\mines16-thermofun.json")
db = ThermoFunDatabase.fromFile("C:\\Users\\Username\\databases\\mines16-thermofun.json")
SUPCRT and SUPCRTBL Databases#
SUPCRT [Johnson et al., 1992] and SUPCRTBL [Zimmer et al., 2016] databases contain thousands of chemical species (aqueous species, gases, minerals) and are commonly used for biogeochemical modeling applications. These thermodynamic databases contain parameters for equations of state to permit the computation of standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000°C. The theory behind these equations and their derivation can be found across the following publications: Helgeson and Kirkham [1974], Helgeson and Kirkham [1976], Helgeson et al. [1981], Helgeson and Kirkham [1974], Shock et al. [1992], Tanger and Helgeson [1988].
Loading embedded SUPCRT and SUPCRTBL database files#
SUPCRT and SUPCRTBL databases are supported in Reaktoro’s database format using YAML. The currently available embedded database files are listed below:
Without organics aqueous species
With organics aqueous species
Note
Reaktoro provides SUPCRT and SUPCRTBL databases with and without organic species because, as we will see see later, when creating a chemical system with automatic selection of species based on a given list of chemical elements, a large number of aqueous organic species are selected and, in many cases, these species do not play any important role in the modeling.
The following are equivalent ways to load the same embedded SUPCRT/SUPCRTBL database file:
db = SupcrtDatabase("supcrtbl")
db = SupcrtDatabase.withName("supcrtbl")
Loading locally available SUPCRT and SUPCRTBL database files#
The following are equivalent ways to load the same SUPCRT or SUPCRTBL database file from your computer:
db = SupcrtDatabase()
db.load("/home/username/databases/supcrt98.yaml")
db = SupcrtDatabase.fromFile("/home/username/databases/supcrt98.yaml")
db = SupcrtDatabase()
db.load("C:\\Users\\Username\\databases\\supcrt98.yaml")
db = SupcrtDatabase.fromFile("C:\\Users\\Username\\databases\\supcrt98.yaml")
NASA Databases#
Reaktoro also supports the NASA-CEA thermochemical database [Gordon and McBride, 1996, Gordon and McBride, 1994]. These contain coefficients for NASA-CEA polynomials used to calculate the standard thermodynamic properties of gases and condensed phases. The NASA-CEA database is commonly used for modeling combustion processes in various applications, from rocket propellant combustion to explosives detonation.
The NASA-CEA database supported in Reaktoro has been converted to Reaktoro’s YAML database format:
This file was constructed by parsing the original NASA-CEA thermochemical database file and converting it to Reaktoro’s YAML format.
Attention
NASA-CEA database is organized differently in Reaktoro’s YAML database format. In the original NASA-CEA database, identical substances in different physical states and crystal structures (e.g., Mg(L)
and Mg(cr)
; MgSO4(II)
, MgSO4(I)
and MgSO4(L)
) are considered distinct chemical species. In Reaktoro’s YAML format, these chemical species are combined into one (e.g., Mg(cd)
, MgSO4(cd)
). This was done after observing improved performance and behavior in Reaktoro’s chemical equilibrium algorithm, while still producing identical results. More specifically, this improved the determination of stable phases at equilibrium, which Reaktoro determines during the calculation (not at the end with individual stability tests for currently unstable phases).
Loading embedded NASA database files#
The following are equivalent ways to load the same embedded NASA database file:
db = NasaDatabase("nasa-cea")
db = NasaDatabase.withName("nasa-cea")
Loading locally available NASA database files#
The following are equivalent ways to load the same NASA database file from your computer:
db = NasaDatabase()
db.load("/home/username/databases/nasa-cea.yaml")
db = NasaDatabase.fromFile("/home/username/databases/nasa-cea.yaml")
db = NasaDatabase()
db.load("C:\\Users\\Username\\databases\\nasa-cea.yaml")
db = NasaDatabase.fromFile("C:\\Users\\Username\\databases\\nasa-cea.yaml")