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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 15 10:12:58 CEST 2024


Author: jedick
Date: 2024-05-15 10:12:58 +0200 (Wed, 15 May 2024)
New Revision: 837

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/util.data.R
   pkg/CHNOSZ/inst/NEWS.Rd
Log:
check.EOS() uses X and Q consistent with SUPCRT92 or DEW


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2024-04-09 01:14:36 UTC (rev 836)
+++ pkg/CHNOSZ/DESCRIPTION	2024-05-15 08:12:58 UTC (rev 837)
@@ -1,6 +1,6 @@
-Date: 2024-04-09
+Date: 2024-04-17
 Package: CHNOSZ
-Version: 2.1.0-9
+Version: 2.1.0-10
 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/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2024-04-09 01:14:36 UTC (rev 836)
+++ pkg/CHNOSZ/R/diagram.R	2024-05-15 08:12:58 UTC (rev 837)
@@ -720,6 +720,8 @@
 
         # No predominance matrix, so we're contouring properties
         contour.method <- rep(contour.method, length.out = length(plotvals))
+        drawlabels <- TRUE
+        if(identical(contour.method, NULL) | identical(contour.method[1], NA) | identical(contour.method[1], "")) drawlabels <- FALSE
         if(type == "saturation") {
           # For saturation plot, contour affinity = 0 for all species
           for(i in 1:length(plotvals)) {
@@ -733,16 +735,15 @@
               message("diagram: beyond range for saturation line of ", names[i])
               next
             }
-            if(identical(contour.method, NULL) | identical(contour.method[1], NA) | identical(contour.method[1], ""))
-              contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, levels = 0, labels = names[i], drawlabels = FALSE)
-            else contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, levels = 0, labels = names[i], method = contour.method[i])
+print(drawlabels)
+            if(drawlabels) contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, levels = 0, labels = names[i], method = contour.method[i])
+            else contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, levels = 0, labels = names[i], drawlabels = FALSE)
+print('hello')
           }
         } else {
           # Contour solubilities (loga.balance), or properties using first species only
           if(length(plotvals) > 1) warning("showing only first species in 2-D property diagram")
           zs <- plotvals[[1]]
-          drawlabels <- TRUE
-          if(identical(contour.method, NULL) | identical(contour.method[1], NA) | identical(contour.method[1], "")) drawlabels <- FALSE
           if(is.null(levels)) {
             if(drawlabels) contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, method = contour.method[1])
             else contour(xs, ys, zs, add = TRUE, col = col, lty = lty, lwd = lwd, labcex = cex, drawlabels = FALSE)

Modified: pkg/CHNOSZ/R/util.data.R
===================================================================
--- pkg/CHNOSZ/R/util.data.R	2024-04-09 01:14:36 UTC (rev 836)
+++ pkg/CHNOSZ/R/util.data.R	2024-05-15 08:12:58 UTC (rev 837)
@@ -172,8 +172,8 @@
     if(prop == "Cp") {
       ## Value of X consistent with IAPWS95
       #X <- -2.773788E-7
-      # We use the value of X consistent with SUPCRT
-      X <- -3.055586E-7
+      # Choose a value of X consistent with SUPCRT92 or DEW 2019 20240417
+      X <- switch(model, HKF = -3.055586E-7, DEW = -3.09E-7)
       refval <- eos$Cp
       calcval <- eos$c1 + eos$c2/(298.15-Theta)^2 + eos$omega*298.15*X
       tol <- thermo$opt$Cp.tol
@@ -181,8 +181,8 @@
     } else if(prop == "V") {
       ## Value of Q consistent with IAPWS95
       #Q <- 0.00002483137
-      # Value of Q consistent with SUPCRT92
-      Q <- 0.00002775729
+      # Choose a value of Q consistent with SUPCRT92 or DEW 2019 20240417
+      Q <- switch(model, HKF = 0.00002775729, DEW = 0.0000005903 * 41.84)
       refval <- eos$V
       calcval <- 41.84*eos$a1 + 41.84*eos$a2/2601 + 
         (41.84*eos$a3 + 41.84*eos$a4/2601) / (298.15-Theta) - Q * eos$omega

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2024-04-09 01:14:36 UTC (rev 836)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2024-05-15 08:12:58 UTC (rev 837)
@@ -15,7 +15,7 @@
 \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
 \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{Δ<I>G</I>°}}{ΔG°}}}
 
-\section{Changes in CHNOSZ version 2.1.0-8 (2024-04-01)}{
+\section{Changes in CHNOSZ version 2.1.0-10 (2024-04-17)}{
 
     \itemize{
 
@@ -28,6 +28,8 @@
       
       \item Add FAQ question: Why are mineral stability boundaries curved on mosaic diagrams?
 
+      \item \code{check.EOS()} now uses values of Born coefficients \emph{X} and \emph{Q} that are consistent with either SUPCRT92 or DEW, depending on the \code{model} defined in OBIGT (HKF or DEW, respectively).
+
     }
 
 }



More information about the CHNOSZ-commits mailing list