Skip to content

Commit

Permalink
check.EOS() uses X and Q consistent with SUPCRT92 or DEW
Browse files Browse the repository at this point in the history
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/chnosz/pkg/CHNOSZ@837 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
  • Loading branch information
jedick committed May 15, 2024
1 parent 7d05045 commit bf62199
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre"),
Expand Down
11 changes: 6 additions & 5 deletions R/diagram.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions R/util.data.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,17 @@ 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
units <- paste(eos$E_units, "K-1 mol-1")
} 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
Expand Down
4 changes: 3 additions & 1 deletion inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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{&Delta;<I>G</I>&deg;}}{Δ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{

Expand All @@ -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).

}

}
Expand Down

0 comments on commit bf62199

Please sign in to comment.