swms2d {SoPhy} | R Documentation |
Modelling of water flow and solute transport by SWMS2D
swms2d(d, max.iteration = 1e+05, iter.print = max.iteration, ShortF = TRUE, message = NULL, breakpoint = 1e+10, intermediate.result = NULL)
d |
list; see details |
max.iteration |
maximum number of incremental time steps |
iter.print |
number of incremental time steps after which a short message of status is given |
ShortF |
logical. If TRUE information is provided only at
selected time points given by d$TPrint |
message |
NULL or a function that takes a scalar time
argument and returns a logical value.
The function is called in case max.iteration is exceeded.
The function allows the user to decide on the basis of the current
time whether the simulation should be continued. |
breakpoint |
number of incremental time steps after which
intermediate.result is called |
intermediate.result |
NULL or a function with two
parameters: the first one gives the time, the second is a (6 x NumNP )-matrix where the rows give
the (1) current pressure h, (2) discharge rate Q,
(3) water content theta, (4) x-component vx of Darcian flux,
(5) z-component vz of Darcian flux,
and (6) the solute concentration;
NumNP gives the number of nodes; intermediate.result
can be used to create movies of water flow. |
d
is a list that should contain the following elements
TRUE
transient water flow else
steady state.TRUE
if free drainage at the bottom.c(hTab1, hTabN)
, interval of pressure heads
within which a table of hydraulic properties is generated.c(dtmin, dtmax)
, minimum and maximum permitted
time increment.c(dMul, dMul2)
,
dMul >= 1
,
dMul2 <= 1
;
if number of required iterations is less than 4 or greater than 6
then the next time
step is multiplied by dMul
and dMul2
, respectively.
NA
) or
a list of vectors;
(length{ND} x 2)-matrix
drain information: first
column gives the effective diameter; second column gives the
dimension of the square in the finite element mesh.length(ND)
rows and arbitrary colums;
each row defines the surrounding finite
elements of the drain; values are either the global finite
element numbers or NA
or a list of vectors.TRUE
else Galkerin formulation.TRUE
if artificial dispersion is to be
added to fulfill the stability criterion PeCr
.lUpW
.Par
is a vector; other
wise (nrow(Par)
x 9)-matrix; chemical material properties:
bulk density, ionic diffusion coeffcient in free water,
longitudinal dispersivity, transverse dispersivity, Freundlich
isotherm coefficient, first-order rate constant for dissolved
phase, first-order rate constant for solid phase, zero-order rate
constant for dissolved phase, zero-order rate constant for solid
phase.sum(nCodeM[,2]!=0)
elements, defining
the chemical boundary conditions, see the SWMS2D manual.i
with chemical boundary
condition abs(KodCB[i])==j
.nCodeM
gives the nodal information;
the 12 columns contain: (1) nodal number (might be omitted), (2) code
giving the boundary condition (see the SWMS2D manual), (3) x-coordinate,
(4) z-coordinate, (5) initial pressure head, (6) initial concentration,
(7) prescribed recharge or discharge rate, (8) material number,
(9) water uptake distribution value, (10) pressure head scaling
factor, (11) conductivity scaling factor, (12) water content scaling
factor.
sum(nCodeM[,2]!=0)
elements;
width of the boundary associated with the boundary nodes
(in the order given by nCodeM).TRUE
.TRUE
then the discharge-groundwater
level relationship is used, see the SWMS2D manual.abs(nCodeM[,2])==3
), (8) ground water level,
(9) concentration of drainage flux
(for (abs(nCodeM[,2])==3) & (KodCB<0)
)
(10) concentration of drainage flux
(for (abs(nCodeM[,2])==3) & (KodCB>0)
).
nrow(nCodeM)
x 6)-matrix.
c(P0, P2H, P2L, P3, r2H, r2L)
information about
water uptake by roots, see the SWMS2D manual.is.vector(root)
then POptm
is a
scalar if Par
is a vector, and a vector of
nrow{Par}
elements otherwise;
if !is.vector(root)
then POptm
has
nrow(nCodeM)
elements.
If an error occured a string containing the error message is returned. Otherwise the result is a list of the following elements
hQThFlC |
array(dim=c(6, NumNP , n)) where n <= MPL + 2 (simulation output);
first dimension gives (i) water pressure H, (2) discharge rate Q,
(3) water content theta, (4) x-component vx of Darcian flux,
(5) z-component vz of Darcian flux,
and (6) concentration;
the third dimension gives the time points given by TPrint except the
first that gives the initial conditions.
|
TlSolObs |
matrix with 46 + 3 * NObs columns
(simulation output);
the columns are (1) time point, (2) rAtm, (3) rRoot,
(4-10) vK[Atm, Root, 3, 1, Seep, 5, 6],
(11-17) hK[Atm, Root, 3, 1, Seep, 5, 6],
(18) CumQAP, (19) CumQRP, (20-26) CumQ[Atm, Root, 3, 1, Seep, 5, 6],
(27) dt, (28) Iter, (29) ItCum, (30) Peclet, (31) Courant,
(32) CumCh0, (33) CumCh1, (34) ChumR, (35-40) ChemS[1:6],
(41-46) SMean[1:6], hNew[1:Nobs ] if Nobs > 0,
ThNew[1:Nobs ] if Nobs > 0,
ConcNew[1:Nobs ] if Nobs > 0;
see the SWMS2D manual for details.
|
atmOut |
(MaxAl x 9)-matrix (simulation output);
(1) AtmTime, (2) CumQAP, (3) CumQRP, (4) CumQA, (5) CumQR, (6) CumQ3,
(7) hAtm, (8) hRoot, (9) hKode3; see the SWMS2D manual for details.
|
balance |
matrix of balance.ncol columns and at most
boundary.n rows (simulation output);
first 5 columns are (1) time, (2) WatBalT, (3) WatBalT, (4) CncBalT, (5)
CncBalR; for each of the subjects (i) Area, (ii) Volume, (iii)
InFlow, (iv) hMean, and (v) ConcVol and (vi) cMean if lChem ,
NLay +1 subsequent columns are given for the total value and
the value of each subregion; see the SWMS2D manual for details.
|
boundary |
array(dim=c(NumBP , 11, n)) where n <= boundary.n (simulation output);
the second dimension gives (1) i, (2) n, (3) x, (4) z, (5) Code,
(6) Q, (7) v, (8) h, (9) th, (10) Conc, (11) time;
see the SWMS2D manual for details.
|
The author is grateful to Rien van Genuchten, Carl A. Mendoza, Rene Therrien, and Edward Sudicky for kindly changing the copyright of the modified SWMS2D code, as used in this package, to the GNU copyleft licence.
Note that, however, HYDRUS2D, an advanced development of SWMS2D, and its code is proprietary.
The work has been supported by the German Federal Ministry of Research and Technology (BMFT) grant PT BEO 51-0339476C during 2000–2002.
Martin Schlather, Martin.Schlather@cu.lu http://www.cu.lu/~schlathe
The Fortran code was published as `swms_2d' by Jirka Simunek, T. Vogel and Martinus Th. van Genuchten, http://www.ussl.ars.usda.gov/MODELS/MODELS.HTM; the file ORTHOFEM.f was written by Edward A. Sudicky and Carl A. Mendoza, based on code by Frank W. Letniowshi and contributions by Rene Therrien, and modified by Jirka Simunek.
################################################################## ## SWMS2D, Example 1, stochastically modified material properties ################################################################## # E = exp(mu + 1/2 * sd^2) # Var = exp(2*mu + sd^2)*(exp(sd^2) - 1) path <- paste(system.file(package='SoPhy'), 'swms2d', sep="/") x <- read.swms2d.table(path) x$TPrint <- 20 * 60 sd <- 0.3 ## then sd of log.gauss is 0.306878 mu <- log(x$nCodeM[, 10]) - 0.5 * sd^2 n <- 100 # better 10000 front <- integer(n) for (j in 1:n) { cat(j, "\n") x$nCodeM[, 10] <- rlnorm(length(x$nCodeM$z), m = mu, sd = sd) x$nCodeM[, 11] <- x$nCodeM[, 10]^(-2) z <- swms2d(x)$hQ[3, , ] front[j] <- (min(which(z[-1:-2, 2] / z[-1:-2, 1] < 1.005)) %/% 2) + 1 } idx <- 24 cat('The probability that the front advances at most', max(x$nCodeM$z) - x$nCodeM$z[2 * idx],'cm is about', format(mean(front <= idx), dig=2),'\n') par(cex=1, mar=c(4.2,4.2,1.2,0.4)) distance <- max(x$nCodeM$z) - x$nCodeM$z[2 * front] h <- sort(unique(distance)) dh <- min(diff(h) / 2) hist(distance, freq=FALSE, breaks=seq(h[1]-dh, h[length(h)]+dh, 2 * dh), main="Histogramm for the depth of the water front", xlab="depth", cex.axis=1.5, cex.main=1.2, cex.lab=1.5)