util.data: Functions for Checking Thermodynamic Data

util.dataR Documentation

Functions for Checking Thermodynamic Data

Description

Show table of references in a web browser or get individual references for species. Check self consistency of individual entries in database.

Usage

  thermo.refs(key = NULL, keep.duplicates = FALSE)
  check.EOS(eos, model, prop, return.difference = TRUE)
  check.GHS(ghs, return.difference = TRUE)
  check.OBIGT()
  dumpdata(file)
  RH2OBIGT(compound = NULL, state = "cr", 
    file = system.file("extdata/adds/RH98_Table15.csv", package = "CHNOSZ"))

Arguments

key

character, numeric, or list; bibliographic reference key(s)

keep.duplicates

logical, keep duplicated references?

eos

dataframe, equations-of-state parameters in the format of thermo()$OBIGT

model

character, thermodynamic model (see thermo)

prop

character, property of interest (‘⁠Cp⁠’ or ‘⁠V⁠’)

return.difference

logical, return the difference between database and calculated values?

ghs

dataframe, containing G, H and S, in the format of thermo()$OBIGT

file

character, path to a file

compound

character, name of compound(s) in group additivity calculation

state

character, physical state of species

Details

thermo.refs with default arguments uses browseURL to display the sources of thermodynamic data in thermo()$refs, with the URLs in that table showing as hyperlinks in the browser. Otherwise, if key is character, the citation information for those reference keys (including URLs) are returned. If key is numeric, the values refer to the species in those rows of thermo()$OBIGT, and the citation information for each listed reference (thermo()$OBIGT$ref1, thermo()$OBIGT$ref2) is returned. If key is a list, it is interpreted as the result of a call to subcrt, and the citation information for each species involved in the calculation is returned. Only unique references are returned, unless keep.duplicates is TRUE. In that case, a single reference for each species is returned, ignoring anything in thermo()$OBIGT$ref2.

check.EOS calculates heat capacity (prop = "Cp") or volume (prop = "V") from equation-of-state parameters at 25 \degC and 1 bar. check.GHS calculates G (standard molal Gibbs energy of formation from the elements) from H (standard molal enthalpy of formation) and S (standard molal entropy) at 25 \degC and 1 bar. The calculated values of Cp, V, or G are then compared with the given values (i.e., database values). If return.difference is TRUE (the default), the difference between the database and calculated values is returned. If return.difference is FALSE, the difference is compared with a tolerance setting (see below). If the absolute value of the difference exceeds the tolerance, the function prints a message and returns the calculated value (not the difference) of the property. If the absolute value of the difference is less than the tolerance, the function returns NA with no message.

For check.EOS, the thermodynamic parameters should be provided in eos, which is a data frame with column names in the same format as thermo$OBIGT. For check.GHS, the data frame should include G, H, S, and the chemical formula of the species. The default tolerances are 1 J/K.mol or 1 cal/K.mol for Cp (depending on the E_units for the species), 1 cm3/mol for V, and 100 cal/mol for G. These can be changed by setting thermo()$opt$Cp.tol, thermo()$opt$V.tol, and thermo()$opt$G.tol.

check.OBIGT is a function to check self-consistency of each entry in the thermodynamic database, using check.EOS and check.GHS. The output is a table listing only species that exceed at least one of the tolerance limits, giving the species index (rownumber in 'thermo()$OBIGT'), species name and state, and DCp, DV and DG, for the calculated differences (only those above the tolerances are given). Values of DCp and DG are given in the units present in the data files. This function is used to generate the file found at extdata/thermo/OBIGT_check.csv.

dumpdata returns all of the available data, from both the default and optional data files, or writes it to a file if file is not NULL. The format is the same as thermo$OBIGT, except for a single prepended column named ‘⁠source⁠’, giving the source of the data (‘⁠OBIGT⁠’ refers to the default database, and ‘⁠DEW⁠’, ‘⁠SLOP98⁠’, and ‘⁠SUPCRT92⁠’ are the optional data files).

RH2OBIGT implements a group additivity algorithm for standard molal thermodynamic properties and equations of state parameters of crystalline and liquid organic molecules from Richard and Helgeson, 1998. The names of the compounds and their physical state are searched for in the indicated file, that also contains chemical formulas and group stoichiometries; the names of the groups are stored in the column names of this file, and must be present in thermo$OBIGT. The default file (extdata/thermo/RH98_Table15.csv) includes data taken from Table 15 of Richard and Helgeson, 1998 for high molecular weight compounds in ‘⁠cr⁠’ystalline and ‘⁠liq⁠’uid states. An error is produced if any of the compound-state combinations is not found in the file, if any of the group names for a given compound-state combination is not found in thermo()$OBIGT, or if the chemical formula calculated from group additivity (with the aid of i2A and as.chemical.formula) is not identical to that listed in the file.

Value

The values returned (invisible-y) by mod.OBIGT are the rownumbers of the affected species.

References

Richard, L. and Helgeson, H. C. (1998) Calculation of the thermodynamic properties at elevated temperatures and pressures of saturated and aromatic high molecular weight solid and liquid hydrocarbons in kerogen, bitumen, petroleum, and other organic matter of biogeochemical interest. Geochim. Cosmochim. Acta 62, 3591–3636. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0016-7037(97)00345-1")}

See Also

thermo, add.OBIGT, mod.buffer

Examples


# Citation information for Helgeson et al., 1998
thermo.refs("HOK+98")
# Two references for alanine
thermo.refs(info("alanine"))
# Three references for species in the reaction
s <- subcrt(c("O2","O2"),c("gas","aq"),c(-1,1))
thermo.refs(s) 
## Not run: 
## Marked dontrun because it opens a browser
# Show the contents of thermo()$refs
thermo.refs()

## End(Not run) 

## Calculate thermodynamic properties of organic compounds
## using group additivity, after Richard and Helgeson, 1998
RH2OBIGT()

CHNOSZ documentation built on May 29, 2024, 3:30 a.m.