Learn R Programming

CHNOSZ (version 0.9-7)

util.args: Functions for Processing Argument Lists

Description

Handle arguments referring to temperature, pressure, states, and equations of state.

Usage

eos.args(eos, property = NULL, T = NULL, P = NULL)
  TP.args(T = NULL, P = NULL)
  state.args(state = NULL)

Arguments

eos
character, name of equation of state (one of hkf, cgl, water).
property
character, name(s) of thermodynamic properties.
T
numeric, temperature (K).
P
numeric, pressure (bar) (can also be character, Psat in TP.args).
state
character, name(s) of states (e.g., cr, aq).

Value

  • A list is return by eos.args and TP.args, and character is returned by state.args.

Details

The *.args functions are used to normalize user-input arguments, which are case-insensitive. eos.args returns a list with elements named props, for all the properties available for the specified equations-of-state, prop for the lower-case version of property, and Prop, for the upper-case (of first letter) version of property. eos.args produces an error if one of the propertys is not in the list of available properties. (See water and subcrt for the available properties for different species.) TP.args forces T and P to equal length. This function also looks for the keyword Psat in the value of P and substitutes calculated values of the saturation vapor pressure (see water). state.args makes its argument lowercase, then transforms a, c, g, and l to aq, gas, cr, and liq, respectively.

Examples

Run this code
data(thermo)
  ## argument processing
  eos.args("hkf",c("g","H","S","cP","V","kT","e"))
  ## produces an error because "Q" is not allowed in water.SUPCRT92
eos.args("hkf",c("G","H","S","Cp","V","kT","E","Q"))
  thermo$opt$water <- "IAPWS"  # needed for p and n in next line
  eos.args("water",c("p","u","cv","psat","rho","n","q","x","y","epsilon"))
  TP.args(c(273.15,373.15))
  TP.args(c(273.15,373.15),"Psat")
  TP.args(c(273.15,373.15),c(100,100,200,200))
  state.args(c("AQ","GAS"))
  state.args(c("a","l","liq"))

Run the code above in your browser using DataLab