swms2d {SoPhy}R Documentation

SWMS2D function call

Description

Modelling of water flow and solute transport by SWMS2D

Usage

swms2d(d, max.iteration = 1e+05, iter.print = max.iteration, ShortF = TRUE, 
       message = NULL, breakpoint = 1e+10, intermediate.result = NULL)

Arguments

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 may allow 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 x 1)-array where the first dimension gives 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 at calculation time.

Details

d is a profile definition of a type as the return list of link{xswms2d}, or it is a list that should contain the following elements

Value

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 solute transport, 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.
flux d$flux; different from NULL if the function is called with the output of create.waterflow or with a profile definition, see the return value of xswms2d.
water.x d$water.x; different from NULL if the function is called with the output of create.waterflow or with a profile definition, see the return value of xswms2d.
water.y d$water.y; different from NULL if the function is called with the output of create.waterflow or with a profile definition, see the return value of xswms2d.

Acknowledgement

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 financially supported by the German Federal Ministry of Research and Technology (BMFT) grant PT BEO 51-0339476C during 2000-2002.

Author(s)

Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/institute

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.

References

See Also

xswms2d, read.swms2d.table, SoPhy

Examples

##################################################################
##  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 <- if (interactive()) 100 else 10 # 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)


[Package SoPhy version 1.0.34 Index]