Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco De Lucia
RedModRphree
Commits
6914c303
Commit
6914c303
authored
Dec 12, 2018
by
Marco De Lucia
Browse files
Added option "verbose" to splitMulti* to suppress some messages
parent
a8bd1388
Changes
26
Show whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
6914c303
...
...
@@ -8,4 +8,4 @@ Depends: R (>= 3.2.0), doParallel, plyr, data.table, phreeqc, caret, mgcv, rando
License: LGPL-2.1
Encoding: UTF-8
LLazyData: true
RoxygenNote: 6.
0
.1
RoxygenNote: 6.
1
.1
R/Rphree_Kinetics.R
View file @
6914c303
## Functions for dealing with simulations with kinetics
### Marco De Lucia, delucia@gfz-potsdam.de, 2009-2018
### Time-stamp: "Last modified 2018-
08-15 00:16:25
delucia"
### Time-stamp: "Last modified 2018-
12-12 14:25:38
delucia"
##' This function just runs the generated input buffer - or a list
##' thereof - through \code{phreeqc}. Obviously it requires the
...
...
@@ -131,10 +131,11 @@ DistributeKin <- function(input, prop=NULL, values, ident="-m0")
##' @param dt time step
##' @param ann optional annotation to be postponed to the values
##' @param nmax minimum number of simulations in one "split"
##' @param verbose logical, defaulting to FALSE. If TRUE, some message are displayed
##' @return a list of length "procs" with the inputs, ready to be run in parallel
##' @author MDL
##' @export
splitMultiKin
<-
function
(
data
,
procs
,
base
,
first
,
prop
,
minerals
,
kin
,
dt
,
ann
,
nmax
=
200
)
splitMultiKin
<-
function
(
data
,
procs
,
base
,
first
,
prop
,
minerals
,
kin
,
dt
,
ann
,
nmax
=
200
,
verbose
=
FALSE
)
{
if
(
is.matrix
(
data
))
ntot
<-
dim
(
data
)[
1
]
## the total number of pqc simulations
...
...
@@ -182,6 +183,7 @@ splitMultiKin <- function(data, procs, base, first, prop, minerals, kin, dt, ann
}
if
(
ntot
>
max
(
nmax
,
procs
*
2
)
&&
procs
>
1
)
{
if
(
verbose
)
msg
(
" Splitting up "
,
ntot
,
"simulations to"
,
procs
,
"processes..."
)
## find best division in n
nsim
<-
ntot
%/%
procs
...
...
@@ -209,6 +211,7 @@ splitMultiKin <- function(data, procs, base, first, prop, minerals, kin, dt, ann
return
(
inputlist
)
}
else
{
if
(
verbose
)
msg
(
"won't parallelize... procs="
,
procs
,
" ntot="
,
ntot
)
BigInp
<-
RepSol
(
base
,
ntot
)
tmp
<-
DistributeKinMatrix
(
input
=
BigInp
,
prop
=
prop
,
values
=
data
,
minerals
=
minerals
,
kin
=
kin
,
dt
=
dt
,
ann
=
ann
)
...
...
@@ -352,10 +355,11 @@ DistributeKinMatrix <- function(input, prop, values, minerals, kin, dt, ann)
##' @param prop vector containing the names of the properties
##' @param minerals indeces of EQUILIBRIUM minerals
##' @param nmax max number of simulations in each input
##' @param verbose logical, defaulting to FALSE. If TRUE, some message are displayed
##' @return a list with n=procs inputs
##' @author MDL
##' @export
splitMultiFix
<-
function
(
data
,
procs
,
base
,
first
,
prop
,
minerals
,
nmax
=
200
)
splitMultiFix
<-
function
(
data
,
procs
,
base
,
first
,
prop
,
minerals
,
nmax
=
200
,
verbose
=
FALSE
)
{
if
(
is.matrix
(
data
))
ntot
<-
dim
(
data
)[
1
]
## the total number of pqc simulations
...
...
@@ -369,6 +373,7 @@ splitMultiFix <- function(data, procs, base, first, prop, minerals, nmax=200)
if
(
ntot
==
1
)
## try and call normal Distribute (i.e., ##!is.matrix(data) ||
## just 1 simulation!)
{
if
(
verbose
)
msg
(
"just 1 simulation, reverting back to normal Distribute"
)
BigInp
<-
RepSol
(
base
,
1
,
first
=
first
)
namdis
<-
colnames
(
data
)
...
...
@@ -385,6 +390,7 @@ splitMultiFix <- function(data, procs, base, first, prop, minerals, nmax=200)
}
if
(
ntot
>
nmax
&&
procs
>
1
)
{
if
(
verbose
)
msg
(
"Splitting up "
,
ntot
,
"simulations to"
,
procs
,
"processes..."
)
## find best division in n
nsim
<-
ntot
%/%
procs
...
...
man/AnalyticalLogK.Rd
View file @
6914c303
...
...
@@ -15,6 +15,9 @@ logK}
\value{
The logK at wanted temperature
}
\description{
Calculates the logK of reaction for a given temperature
}
\author{
MDL
}
man/BalanceEquations.Rd
View file @
6914c303
...
...
@@ -16,6 +16,10 @@ defaults to c("C","Ca","Mg","Cl")}
\value{
a structure (list) containing the balance equations
}
\description{
Form the balance equations from a full stoichiometric
matrix
}
\author{
MDL
}
man/CheckBalance.Rd
View file @
6914c303
...
...
@@ -21,6 +21,10 @@ mass balance check}
a matrix containing a mass balance error, one column for
each tested equation (=element)
}
\description{
Check mass balance between design and results for
surrogates
}
\author{
MDL
}
man/DistributeMatrix.Rd
View file @
6914c303
...
...
@@ -20,6 +20,9 @@ DistributeMatrix(input, prop, values, minerals, SI = FALSE)
\value{
input buffer with the values in correct places
}
\description{
Distribute all values from a matrix into a buffer, EQUILIBRIUM case
}
\author{
MDL
}
man/ElementalBalanceMin.Rd
View file @
6914c303
...
...
@@ -5,7 +5,8 @@
\title{Returns the composition of a mineral in terms of chemical
elements (not of species)}
\usage{
ElementalBalanceMin(pphase, stoichmat, elements = c("C", "Ca", "Mg", "Cl"))
ElementalBalanceMin(pphase, stoichmat, elements = c("C", "Ca", "Mg",
"Cl"))
}
\arguments{
\item{pphase}{name of the mineral to parse}
...
...
@@ -19,6 +20,10 @@ defaults to c("C","Ca","Mg","Cl")}
named vector with stoichiometric coefficients of chemical
elements for the pphase mineral
}
\description{
Returns the composition of a mineral in terms of chemical
elements (not of species)
}
\author{
MDL
}
man/ExtractPphases.Rd
View file @
6914c303
...
...
@@ -15,6 +15,9 @@ for}
\value{
matix with one pphases per column
}
\description{
Extract all phases from a flatted Rphree list
}
\author{
MDL
}
man/ExtractSamples.Rd
View file @
6914c303
...
...
@@ -21,6 +21,10 @@ variables are selected}
\value{
a list with 2 elements: design and result
}
\description{
Extracts input/output tables from a list of Reactive
Transport Simulations
}
\author{
MDL
}
man/ExtractSpecies.Rd
View file @
6914c303
...
...
@@ -15,6 +15,9 @@ search for}
\value{
matix with one species per column
}
\description{
Extract species from a flatted Rphree list
}
\author{
MDL
}
man/ExtractTotals.Rd
View file @
6914c303
...
...
@@ -16,6 +16,10 @@ search for}
\value{
Matrix with one element per column
}
\description{
Extract total element concentrations from a flatted Rphree
list
}
\author{
MDL
}
man/FindAllMinNames.Rd
View file @
6914c303
...
...
@@ -12,6 +12,9 @@ FindAllMinNames(flatlist)
\value{
vector with unique occurrences of pphases names
}
\description{
Find all pphases occurring in the ensemble
}
\author{
MDL
}
man/FindAllSpeciesNames.Rd
View file @
6914c303
...
...
@@ -12,6 +12,9 @@ FindAllSpeciesNames(flatlist)
\value{
vector with unique occurrences of species names
}
\description{
Find all species occurring in the ensemble
}
\author{
MDL
}
man/FindAllTotNames.Rd
View file @
6914c303
...
...
@@ -12,6 +12,9 @@ FindAllTotNames(flatlist)
\value{
vector with unique occurrences of element names
}
\description{
Find all totals occurring in the ensemble
}
\author{
MDL
}
man/FindLogK.Rd
View file @
6914c303
...
...
@@ -17,6 +17,10 @@ FindLogK(species, db, type = c("analytical"))
\value{
the requested logK
}
\description{
Finds the expression of a logK of a given compound/mineral
in a PHREEQC database
}
\author{
MDL
}
man/FindPhase.Rd
View file @
6914c303
...
...
@@ -16,6 +16,9 @@ a list with the components of the formula and the
stoichiometric coefficients, plus the corresponding line in
the db as attr(,"line")
}
\description{
Find a PURE_PHASE in a database and parses its formula
}
\author{
MDL
}
man/FormulaFromBal.Rd
View file @
6914c303
...
...
@@ -14,6 +14,9 @@ minerals}
a named vector with the stoichiometric formula of the
minerals
}
\description{
Figures out the formula from a baleq structure
}
\author{
MDL
}
man/Matplot.Rd
View file @
6914c303
...
...
@@ -5,8 +5,8 @@
\title{Display the profiles of some variables for 2 reactive
transport simulation (one using surrogates)}
\usage{
Matplot(sur, sim, sample = 1L, vars = c("Ca", "Mg", "Calcite",
"Dolomite"),
...)
Matplot(sur, sim, sample = 1L, vars = c("Ca", "Mg", "Calcite",
"Dolomite"),
...)
}
\arguments{
\item{sur}{The simulation with surrogate}
...
...
@@ -22,6 +22,10 @@ variables to display (up to 7)}
\item{...}{further parameters passed to \code{matplot}, such as
main, xlab, ylab...}
}
\description{
Display the profiles of some variables for 2 reactive
transport simulation (one using surrogates)
}
\author{
MDL
}
man/MatplotSingle.Rd
View file @
6914c303
...
...
@@ -5,8 +5,8 @@
\title{Display the profiles of some variables along a 1D reactive
transport simulation}
\usage{
MatplotSingle(sim, sample = 1L, vars = c("Ca", "Mg", "Calcite",
"Dolomite"),
...)
MatplotSingle(sim, sample = 1L, vars = c("Ca", "Mg", "Calcite",
"Dolomite"),
...)
}
\arguments{
\item{sim}{The simulation to display}
...
...
@@ -20,6 +20,10 @@ variables to display (up to 7)}
\item{...}{further parameters passed to \code{matplot}, such as
main, xlab, ylab...}
}
\description{
Display the profiles of some variables along a 1D reactive
transport simulation
}
\author{
MDL
}
man/ParseFormula.Rd
View file @
6914c303
...
...
@@ -15,6 +15,9 @@ ParseFormula(line, type = "all")
a list containing components and coefficients.
Coefficients of left hand side are negated.
}
\description{
Parses a formula as it is written in a PHREEQC database
}
\author{
MDL
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment