diff --git a/DESCRIPTION b/DESCRIPTION index d7fcd62..9cff1ca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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@R: c( person("Jeffrey", "Dick", , "j3ffdick@gmail.com", role = c("aut", "cre"), diff --git a/R/diagram.R b/R/diagram.R index 207546e..c3d0a9d 100644 --- a/R/diagram.R +++ b/R/diagram.R @@ -720,6 +720,8 @@ diagram <- function( # 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 @@ diagram <- function( 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) diff --git a/R/util.data.R b/R/util.data.R index 1f173c8..2c5fb30 100644 --- a/R/util.data.R +++ b/R/util.data.R @@ -172,8 +172,8 @@ check.EOS <- function(eos, model, prop, return.difference = TRUE) { 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 @@ check.EOS <- function(eos, model, prop, return.difference = TRUE) { } 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 diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index a055cfa..23ea9bf 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -15,7 +15,7 @@ \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{CP}}{Cp}}} \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{ΔG°}}{Δ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). + } }