Rphree-package: Rphree: R interface to the PHREEQC geochemical modeling...

Description Details Author(s) References Examples

Description

The Rphree package comprises an interface and utility functions for the geochemical simulator PHREEQC. PHREEQC (version 2.17) itself is shipped in this package and compiled as shared library to achieve online calculations. Some functions for visualization and database manipulations are included.

Details

PHREEQC is a geochemical modeling program developed by the US Geological Survey designed to perform a wide variety of aqueous geochemical calculations, including speciation, batch-reaction, one-dimensional reactive-transport, and inverse geochemical calculations.

This package is distinct from the official "phreeqc" package on CRAN, and which is the mere R interface to IPhreeqc module (version 3.15 at the moment of this writing). However, Rphree can be used in combination with it.

Author(s)

Marco De Lucia delucia@gfz-potsdam.de

References

http://doi.org/10.1016/j.egypro.2013.08.053
http://rphree.r-forge.r-project.org/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
## start R and load Rphree
library(Rphree)

## Load a database
llndb <- RPhreeFile(system.file("extdata", "llnl_rphree.dat", package="Rphree"), is.db=TRUE)
## Load an example phreeqc script
ex1 <- RPhreeFile(system.file("extdata", "ex1.phrq", package="Rphree"), is.db=FALSE)

## First of all understand how the "selection" for the outputs is coded
## One needs to define a named logical vector exactly like this:
mysel <- c(kin=FALSE, tot=TRUE, desc=TRUE, species = TRUE, pphases = TRUE, SI=TRUE, punch =FALSE)

## NB: EQUILIBRIUM_PHASES is coded as "pphases" in Rphree
## Your first Rphree simulation:
equilln <- Rphree(ex1, db=llndb, sel=mysel, write=TRUE, out="ex1")

## Distribute: assign specific values to a property in input
## The argument "values" in function "Distribute" must be of length 1
## OR the same length as the solutions already in the input!
ext_range <- Distribute(ex1,"Cl",seq(1,4,0.1))
ext_range <- Distribute(ext_range,"Na",seq(1,4,0.1))

## ext_range now is an input containing 31 solutions. This can be run at once:
equi_extrange_llnl <- Rphree(ext_range, db=llndb,sel=mysel)

## The same but interfacing to "phreeqc" package, IPhreeqc version 3.15
library(phreeqc)

## load the same llnl database
phrLoadDatabaseString(llndb)
phrSetOutputStringsOn(TRUE)
phrRunString(ext_range)
phrOut <- phrGetOutputStrings()

## Use Rphree's functions to parse the output buffer in a suitable
## structure for further R manipulation or visualization
res <- RReadOut(out=phrOut)

## End(Not run)

Rphree documentation built on May 2, 2019, 6:09 p.m.