[CHNOSZ-commits] r455 - in pkg/CHNOSZ: . demo inst inst/extdata/OBIGT inst/extdata/thermo tests/testthat
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 28 10:31:53 CEST 2019
Author: jedick
Date: 2019-04-28 10:31:52 +0200 (Sun, 28 Apr 2019)
New Revision: 455
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/demo/aluminum.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/inst/extdata/OBIGT/AkDi.csv
pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_gas.csv.xz
pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
pkg/CHNOSZ/tests/testthat/test-eos.R
Log:
demo/aluminum.R: add calculations with Si(OH)4 from add.obigt("AkDi")
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/DESCRIPTION 2019-04-28 08:31:52 UTC (rev 455)
@@ -1,6 +1,6 @@
-Date: 2019-04-27
+Date: 2019-04-28
Package: CHNOSZ
-Version: 1.3.2-2
+Version: 1.3.2-3
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/demo/aluminum.R
===================================================================
--- pkg/CHNOSZ/demo/aluminum.R 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/demo/aluminum.R 2019-04-28 08:31:52 UTC (rev 455)
@@ -22,26 +22,32 @@
# kaolinite from Berman, 1988
# boehmite from Hemingway et al., 1991
r1 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
-## second calculation: minerals as in SUPCRT92
+## second calculation: get SiO2(aq) from Apps and Spycher, 2004
+add.obigt("AS04")
+r2 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
+reset()
+## third calculation: get Si(OH)4 from Akinfiev and Plyasunov, 2014
+add.obigt("AkDi")
+r3 <- subcrt(c("boehmite", "Si(OH)4", "H2O", "kaolinite"), c(-1, -1, 1.5, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
+reset()
+## fourth calculation: minerals as in SUPCRT92
add.obigt("SUPCRT92") # gets kaolinite and boehmite from HDNB78
# we need exceed.Ttr = TRUE because the T limit for boehmite is 500 K (Helgeson et al., 1978)
-r2 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
+r4 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
reset()
-## third calculation: get SiO2(aq) from Apps and Spycher, 2004
-add.obigt("AS04")
-r3 <- subcrt(c("boehmite", "H2O", "SiO2", "kaolinite"), c(-1, -0.5, -1, 0.5), T = T, P = 1000, exceed.Ttr = TRUE)
-reset()
## log activity of SiO2 is -ve logK
lines(T, -r1$out$logK, lwd = 1.5)
-lines(T, -r2$out$logK, col = "blue1", lty = 2)
-lines(T, -r3$out$logK, col = "red", lty = 2)
+lines(T, -r2$out$logK, col = "red", lty = 2)
+lines(T, -r3$out$logK, col = "purple", lty = 3)
+lines(T, -r4$out$logK, col = "blue1", lty = 4)
## add points calculated using the SUPCRTBL package
points(seq(125, 350, 25), -c(3.489, 3.217, 2.967, 2.734, 2.517, 2.314, 2.124, 1.946, 1.781, 1.628), pch = 4, col = "red")
## add legend and title
-title(main = describe.reaction(r2$reaction), cex.main = 1.1)
-legend("bottomright", lty = c(0, 2, 0, 1, 2), pch = c(1, NA, 4, NA, NA), lwd = c(1, 1, 1, 1.5, 1),
- col = c("black", "blue", "red", "black", "red"), bty = "n", cex = 0.9,
- legend = c("Hemley et al., 1980", "SUPCRT92", "SUPCRTBL", "CHNOSZ", 'add.obigt("AS04")'))
+title(main = describe.reaction(r4$reaction), cex.main = 1.1)
+legend("bottomright", lty = c(0, 0, 1, 2, 3, 0), pch = c(1, 4, NA, NA, NA, NA), lwd = c(1, 1, 1.5, 1, 1, 0),
+ col = c("black", "red", "black", "red", "purple", NA), bty = "n", cex = 0.9,
+ legend = c("Hemley et al., 1980", "SUPCRTBL", "CHNOSZ", 'add.obigt("AS04")', 'add.obigt("AkDi")', ""))
+legend("bottomright", lty = 4, pch = NA, lwd = 1, col = "blue", legend = 'add.obigt("SUPCRT92")', bty = "n", cex = 0.9)
legend("topleft", c("Boehmite - Kaolinite", "After Zhu and Lu, 2009 Fig. A1"), bty = "n")
# Helgeson et al., 1978 (HDNB78): http://www.worldcat.org/oclc/13594862
# Shock et al., 1989 (SHS89): doi:10.1016/0016-7037(89)90341-4
@@ -102,11 +108,18 @@
pK <- -sres$out$logK
lines(invTK, pK, col = "red", lty = 2)
reset()
+# plot line: Si(OH)4 from Akinfiev and Plyasunov, 2014
+add.obigt("AkDi")
+sres <- subcrt(c("kaolinite", "OH-", "H2O", "Al(OH)4-", "Si(OH)4"), c(-1, -2, -5, 2, 2), T = T)
+pK <- -sres$out$logK
+lines(invTK, pK, col = "purple", lty = 3)
+reset()
# plot line: SUPCRT92
add.obigt("SUPCRT92")
sres <- subcrt(c("kaolinite", "OH-", "H2O", "Al(OH)4-", "SiO2"), c(-1, -2, -1, 2, 2), T = T)
pK <- -sres$out$logK
-lines(invTK, pK, col = "blue", lty = 2)
+lines(invTK, pK, col = "blue", lty = 4)
+reset()
# add points calculated using the SUPCRTBL package
T <- seq(25, 300, 25)
invTK <- 1000/(T + 273.15)
@@ -116,9 +129,10 @@
title(main = describe.reaction(sres$reaction), cex.main = 1.1)
par(xpd = FALSE)
legend("topright", c("Kaolinite solubility", "After Tutolo et al., 2014 Fig. 2"), bty = "n")
-legend("bottomleft", lty = c(0, 0, 2, 0, 1, 2), pch = c(1, NA, NA, 4, NA, NA), lwd = c(1, 1, 1, 1, 1.5, 1), col = c("black", "black", "blue", "red", "black", "red"),
- legend = c("Various sources \u2013", " see Tutolo et al., 2014", "SUPCRT92", "SUPCRTBL", "CHNOSZ", 'add.obigt("AS04")'), bty = "n", cex = 0.9)
-reset()
+legend("bottomleft", lty = c(0, 0, 0, 1, 2, 3, 4), pch = c(1, NA, 4, NA, NA, NA, NA),
+ lwd = c(1, 1, 1, 1.5, 1, 1, 1), col = c("black", "black", "red", "black", "red", "purple", "blue"),
+ legend = c("Various sources \u2013", " see Tutolo et al., 2014", "SUPCRTBL", "CHNOSZ", 'add.obigt("AS04")', 'add.obigt("AkDi")', 'add.obigt("SUPCRT92")'),
+ bty = "n", cex = 0.9)
###########
### plot 4: albite - K-feldspar exchange
@@ -138,7 +152,7 @@
# plot line calculated using SUPCRT92 data
add.obigt("SUPCRT92")
a <- affinity("K+" = c(4, 7), "Na+" = c(6, 9), T = 100, P = 150)
-diagram(a, col = "blue", lty = 2, add = TRUE, names = NULL)
+diagram(a, col = "blue", lty = 4, add = TRUE, names = NULL)
# add SUPCRTBL calculation
logK_BL <- 2.092
logaK <- seq(4, 7, 0.5)
@@ -148,8 +162,9 @@
sres <- subcrt(c("albite", "K+", "K-feldspar", "Na+"), c(-1, -1, 1, 1))
title(main = describe.reaction(sres$reaction), cex.main = 1.1)
legend("topleft", c("Albite - K-feldspar", "After Tutolo et al., 2014 Fig. 5"), bty = "n", cex = 0.9)
-legend("bottomright", lty = c(0, 2, 0, 1), pch = c(1, NA, 4, NA), lwd = c(1, 1, 1, 1.5), col = c("black", "blue", "red", "black"),
- legend = c("Merino, 1975", "SUPCRT92", "SUPCRTBL", "CHNOSZ"), bty = "n", cex = 0.9)
+legend("bottomright", lty = c(0, 0, 1, 0), pch = c(1, 4, NA, NA), lwd = c(1, 1, 1.5, 0), col = c("black", "red", "black", NA),
+ legend = c("Merino, 1975", "SUPCRTBL", "CHNOSZ", ""), bty = "n", cex = 0.9)
+legend("bottomright", lty = 4, pch = NA, lwd = 1, col = "blue", legend = 'add.obigt("SUPCRT92")', bty = "n", cex = 0.9)
legend("left", describe.property(c("T", "P"), c(T, P)), bty = "n")
reset()
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/inst/NEWS 2019-04-28 08:31:52 UTC (rev 455)
@@ -1,3 +1,9 @@
+CHANGES IN CHNOSZ 1.3.2-3 (2019-04-28)
+--------------------------------------
+
+- demo/aluminum.R: add calculations using Si(OH)4 from Akinfiev-Diamond
+ model (SiO2 in these reactions is replaced by Si(OH)4 - 2 H2O).
+
CHANGES IN CHNOSZ 1.3.2 (2019-04-20)
------------------------------------
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/AkDi.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/AkDi.csv 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/AkDi.csv 2019-04-28 08:31:52 UTC (rev 455)
@@ -20,3 +20,6 @@
B(OH)3,NA,B(OH)3,aq,AP14,NA,22.Feb.19,NA,NA,NA,NA,NA,-4.2561,4.0194,-1.057,NA,NA,NA,NA,NA
Si(OH)4,NA,Si(OH)4,aq,AP14,NA,22.Feb.19,NA,NA,NA,NA,NA,0.9285,-0.9409,-1.8933,NA,NA,NA,NA,NA
As(OH)3,NA,As(OH)3,aq,AP14,NA,22.Feb.19,NA,NA,NA,NA,NA,-9.903,7.6818,-1.23,NA,NA,NA,NA,NA
+B(OH)3,NA,B(OH)3,gas,AP14,NA,22.Feb.19,-222523.9,NA,66.589,NA,0,46.7734,-0.097,0.5932,-522.4665,0,0,0,1000
+Si(OH)4,NA,Si(OH)4,gas,AP14,NA,22.Feb.19,-296285.9,NA,82.784,NA,0,22.9685,37.6434,-4.4407,0,-2.7782,7.923E-09,3,1000
+As(OH)3,NA,As(OH)3,gas,AP14,NA,22.Feb.19,-143112.8,NA,73.599,NA,0,22.6338,-16.3623,-3.7213,0,-1.0194,2.7414E-09,3,1000
Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_gas.csv.xz
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_gas.csv.xz 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_gas.csv.xz 2019-04-28 08:31:52 UTC (rev 455)
@@ -1,7 +1,5 @@
-ý7zXZ æÖ´F ! t/å£à Óv] 7Iýúb¿ñ9²¶Ë¦¨TB;qý"½qù¦cL;ù"ß<²ëbï¨gò;ø¥Kä¥f1Æw?ozÆCþaì]IبÝ5i*s@/¦L¶eßEEK8uÊAÂÂÑ*sÁæÓ7dõ/Ñô= ¨CÙxÇ+Z§x¢ù°:ÆyÏÏ;Hæw i«p/½|ÜýA¥ÍaCÄõG!âV- @´A"Iö#ÿ\zNù¢u© ¦õWu,a2¢
&T#IîéOå9Ä}©¾Ïv/ûC¹Ï8aUØGñ¯ç_ÒÕ¡Xå-:;t 2:ü²HbC*3¨ÈEôÓÖ0´T¨ÎÒ¬9~bÿ|øúm©Ý"qÙõ>ãWIªçãåþûÖuw(¦ÇkÐní§»Õf;¸
+ý7zXZ æÖ´F ! t/å£à|ò] 7Iýúb¿ñ9²¶Ë¦¨TB;qý"½qù¦cL;ù"ß<²ëbï¨gò;ø¥Kä¥f1Æw?ozÆCþaì]IبÝ5i*s@/¦L¶eßEEK8uÊAÂÂÑ*sÁæÓ7dõ/Ñô= ¨CÙxÇ+Z§x¢ù°:ÆyÏÏ;Hæw i«p/½|ÜýA¥ÍaCÄõG!âV- @´A"Iö#ÿ\zNù¢u© ¦õWu,a2¢
&T#IîéOå9Ä}©¾Ïv/ûC¹Ï8aUØGñ¯ç_ÒÕ¡Xå-:;t 2:ü²HbC*3¨ÈEôÓÖ0´T¨ÎÒ¬9~bÿ|øúm©Ý"qÙõ>ãWIªçãåþûÖuw(¦ÇkÐní§»Õf;¸
ëµ?«}zÕ
yõà`¦IxÓ}i£ÔçÕzÕ;vùÇ}ªüXÀÃqìQNI_ySÍ?Ù²¡ËqLHÒ0Óy ëÔ¼£
Y-¨W_4&}Ó_WVè]eF<Ö ¢ù%H¸ìEçÒÕ[(3«ÿÕ³u³D[C
-õDç´7r|\ì ÅQ»"½ku¥ú(&}Ϧ7Áùwã¿Ñ%U¾ ¼¨éEÀ1[£éTQü}_JÆ¢×$´õ}q§¥Dc`o*&:fDÐñ`7×=gòûÀþæVRHd·'ÚÚ&Ûïý/«¡H_ÈÇíÜ$º(pfÁÖ(ÍË¥ÎÏéð£
íÝáýþz×Êg×õé§gK÷üà mÌ;ôe_{&eÚyø#§vÎG6_{ôÉ溨#÷ð#s8mÆ"!vö]ó>®UcÂÇ´.ÍI at -¨°Ýµ*æ#¢/úz§P3cP¡¢ú ,oÍSMwç!ü?ýp¼ÿÂuÓyð.ê4¯¤Ù¾- ¸½ÛÉTídLÎB°å_ ll2w±°1Ûø ¯¿ÿ/eDæ·WWP×¾$mú9gy&
-¤fã'BhØd6»ÍAOGçñ³Î(-¯ôf3H¶p=¡®N_ >ç
-ÔÞøo Ô b±Ägû YZ
\ No newline at end of file
+õDç´7r|\ì ÅQ»"½ku¥ú(&}Ϧ7Áùwã¿Ñ%U¾ ¼¨éEÀ1[£éTQü}_JÆ¢×$´õ}q§¥Dc`o*&:fDÐñ`7×=gòûÀþæVRHd·'ÚÚ&Ûïý/«¡H_ÈÇíÜ$º(pfÁÖ(ÍË¥ÎÏéð£
íÝáýþz×Êg×õé§gK÷üà mÌ;ôe_{&eÚyø#§vÎG6_{ôÉ溨#÷ð#s8mÆ"!vö]ó>®UcÂÇ´.ÍI at -¨°Ýµ*æ#¢/úz§P3cP¡¢ú ,oÍSMwç +É$Åj ý ß9
±Ägû YZ
\ No newline at end of file
Modified: pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
===================================================================
(Binary files differ)
Modified: pkg/CHNOSZ/tests/testthat/test-eos.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-eos.R 2019-04-27 13:06:53 UTC (rev 454)
+++ pkg/CHNOSZ/tests/testthat/test-eos.R 2019-04-28 08:31:52 UTC (rev 455)
@@ -101,9 +101,10 @@
# compare Gibbs energies at 25 degrees calculated with AkDi model to database values
iAkDi <- add.obigt("AkDi")
- # remove Si(OH)4 and As(OH)3 because no HKF aqueous species are available
- iAkDi <- head(iAkDi, -2)
- # this would produce an error if any of the corresponding gases were unavailable
+ # remove hydroxides because they aren't in the default database (except B(OH)3(aq))
+ iAkDi <- iAkDi[-grep("OH", info(iAkDi)$name)]
+ # this would produce an error if any calculations failed
+ # (e.g. because gases corresponding to any aqueous species were unavailable)
sAkDi <- subcrt(iAkDi, T = 25)
GAkDi <- do.call(rbind, sAkDi$out)$G
# now get the parameters from default OBIGT
More information about the CHNOSZ-commits
mailing list