[CHNOSZ-commits] r399 - in pkg/CHNOSZ: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 19 12:12:12 CET 2019


Author: jedick
Date: 2019-02-19 12:12:12 +0100 (Tue, 19 Feb 2019)
New Revision: 399

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/water.Rd
Log:
water(): add 'P1' argument (set Psat to 1 bar below 100 degrees C)


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2019-02-18 11:59:47 UTC (rev 398)
+++ pkg/CHNOSZ/DESCRIPTION	2019-02-19 11:12:12 UTC (rev 399)
@@ -1,6 +1,6 @@
-Date: 2019-02-18
+Date: 2019-02-19
 Package: CHNOSZ
-Version: 1.2.0-5
+Version: 1.2.0-6
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/water.R
===================================================================
--- pkg/CHNOSZ/R/water.R	2019-02-18 11:59:47 UTC (rev 398)
+++ pkg/CHNOSZ/R/water.R	2019-02-19 11:12:12 UTC (rev 399)
@@ -2,7 +2,7 @@
 # calculate thermodynamic and electrostatic properties of H2O
 # 20061016 jmd
 
-water <- function(property = NULL, T = 298.15, P = "Psat") {
+water <- function(property = NULL, T = 298.15, P = "Psat", P1 = TRUE) {
   # calculate the properties of liquid H2O as a function of T and P
   # T in Kelvin, P in bar
   if(is.null(property)) return(get("thermo", CHNOSZ)$opt$water)
@@ -25,7 +25,7 @@
     # change 273.15 K to 273.16 K (needed for water.SUPCRT92 at Psat)
     if(identical(P, "Psat")) T[T == 273.15] <- 273.16
     # get properties using SUPCRT92
-    w.out <- water.SUPCRT92(property, T, P)
+    w.out <- water.SUPCRT92(property, T, P, P1)
   }
   if(grepl("IAPWS", wopt)) {
     # get properties using IAPWS-95 
@@ -38,7 +38,7 @@
   w.out
 }
 
-water.SUPCRT92 <- function(property=NULL, T=298.15, P=1) {
+water.SUPCRT92 <- function(property=NULL, T=298.15, P=1, P1=TRUE) {
   ### interface to H2O92D.f : FORTRAN subroutine taken from 
   ### SUPCRT92 for calculating the thermodynamic and 
   ### electrostatic properties of H2O. 
@@ -105,7 +105,7 @@
         w.P <- H2O[[2]][2]
         w.P[w.P==0] <- NA
         # Psat specifies P=1 below 100 degC
-        w.P[w.P < 1] <- 1
+        if(P1) w.P[w.P < 1] <- 1
         P.out[i] <- w.P
       }
     }

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2019-02-18 11:59:47 UTC (rev 398)
+++ pkg/CHNOSZ/inst/NEWS	2019-02-19 11:12:12 UTC (rev 399)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.2.0-5 (2019-02-18)
+CHANGES IN CHNOSZ 1.2.0-6 (2019-02-19)
 --------------------------------------
 
 CRAN COMPLIANCE
@@ -18,6 +18,10 @@
 - Add retrieve() to retrieve all the species with given elements. Thanks
   to Evgeniy Bastrakov for the suggestion.
 
+- water() and water.SUPCRT92(): add 'P1' argument to choose whether to
+  output 1 bar for Psat at temperatures less than 100 degrees C
+  (default is TRUE).
+
 THERMODYNAMIC DATA
 
 - Revert to using SiO2(aq) from SUPCRT92 (i.e. Shock et al., 1989) in

Modified: pkg/CHNOSZ/man/water.Rd
===================================================================
--- pkg/CHNOSZ/man/water.Rd	2019-02-18 11:59:47 UTC (rev 398)
+++ pkg/CHNOSZ/man/water.Rd	2019-02-19 11:12:12 UTC (rev 399)
@@ -10,8 +10,8 @@
 }
 
 \usage{
-  water(property = NULL, T = 298.15, P = "Psat")
-  water.SUPCRT92(property=NULL, T = 298.15, P = 1)
+  water(property = NULL, T = 298.15, P = "Psat", P1 = TRUE)
+  water.SUPCRT92(property=NULL, T = 298.15, P = 1, P1 = TRUE)
   water.IAPWS95(property=NULL, T = 298.15, P = 1)
   water.DEW(property=NULL, T = 373.15, P = 1000)
 }
@@ -20,6 +20,7 @@
   \item{property}{character, computational setting or property(s) to calculate}
   \item{T}{numeric, temperature (K)}
   \item{P}{numeric, pressure (bar), or \samp{Psat} for vapor-liquid saturation}
+  \item{P1}{logical, output pressure of 1 bar below 100 \degC instead of calculated values of \samp{Psat}?}
 }
 
 \details{



More information about the CHNOSZ-commits mailing list