next up previous
Next: taxonomy Up: CHNOSZ examples Previous: util.stat

util.units

utl.nt>   ## Don't show: 
utl.nt> data(thermo)
thermo$obigt has 1800 aqueous, 2925 total species

utl.nt> ## End Don't show
utl.nt>   ## examples using convert
utl.nt>   # temperature (Kelvin) to degrees C
utl.nt>   convert(273.15,"C")
[1] 0

utl.nt>   # temperature (degrees C) to Kelvin
utl.nt>   convert(100,"K")
[1] 373.15

utl.nt>   # Gibbs energy (cal mol-1) to/from logK
utl.nt>   convert(1000,"logK")
[1] -0.7330067

utl.nt>   convert(1000,"logK",T=373.15)
[1] -0.5856785

utl.nt>   convert(1,"G") 
[1] -1364.244

utl.nt>   # Eh (volt) to pe 
utl.nt>   convert(-1,"pe")
[1] -16.90445

utl.nt>   convert(-1,"pe",T=373.15)
[1] -13.5068

utl.nt>   # logfO2 to E0 (volt)
utl.nt>   convert(-80,"E0")             
subcrt: 4 species at 298.15 K and 1 bar (wet) 
[1] -0.3681732

utl.nt>   convert(-80,"E0",pH=5)
subcrt: 4 species at 298.15 K and 1 bar (wet) 
[1] -0.2498612

utl.nt>   convert(-80,"E0",pH=5,logaH2O=-5)
subcrt: 4 species at 298.15 K and 1 bar (wet) 
[1] -0.1019711

utl.nt>   # calorie to/from joule
utl.nt>   convert(10,"j")
[1] 41.84

utl.nt>   convert(10,"cal")
[1] 2.390057

utl.nt>   # cm3bar to calories
utl.nt>   convert(10,"calories")
[1] 0.2390057

utl.nt>   ## examples showing user unit preference
utl.nt>   nuts("K")  # set temperature units
nuts: temperature in K 

utl.nt>   nuts("J")  # set energy units
nuts: energy in J 

utl.nt>   # return the name of the (E)nergy units
utl.nt>   nuts("E")
[1] "J"

utl.nt>   # print names of all units (NULL return)
utl.nt>   nuts()
nuts: temperature in K 
nuts: energy in J 
nuts: pressure in bar 

utl.nt>   # defaults
utl.nt>   nuts("K"); nuts("bar"); nuts("cal")
nuts: temperature in K 
nuts: pressure in bar 
nuts: energy in cal


next up previous
Next: taxonomy Up: CHNOSZ examples Previous: util.stat