Functions for Processing Argument Lists

Share:

Description

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

Usage

1
2
3
  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).

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## argument processing
eos.args("hkf",c("g","H","S","cP","V","kT","e"))
## produces an error because "Q" is not allowed in water.SUPCRT92
## Not run: 
  eos.args("hkf",c("G","H","S","Cp","V","kT","E","Q")) 
## End(Not run)
  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"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.