Description Usage Arguments Value Examples
Track particle mass along a MODPATH-5 generated pathline
1 2 3 4 |
ptl |
a data.frame, data.table or string giving the path to a data file containing a pathline data set produced by MODPATH |
gwnc |
a NetCDF of MODFLOW simulation data produced by GW.nc, or a path to one |
wtop |
a NetCDF of water height or path to one (MassTrack can generate one if this hasn't been made) |
phi |
porosity: single value, layer by layer (vector) or distributed array |
m0 |
initial mass of particles: single value, vector of values or function of time only |
retain.storage |
should mass flux to storage be retained on a pathline? |
truncate |
if TRUE, once a particle is completely drained, further trajectory information is not returned with the result |
confined |
not yet implemented |
outmass |
return cell referenced information about where the mass is abstracted? |
loss |
return information about where particle mass is not released |
outmass.array |
logical |
tlumpoutmass |
logical |
linear.decay |
double |
react.loss |
logical |
end.t |
double |
A list of results:
$trace, data.table: the pathline data table with new columns for mass
and, if outmass.array = FALSE
, mass loss and reactive mass
loss
$outmass, numeric array: if outmass = TRUE
and
outmass.array = TRUE
, the mass removed from the system by
column, row and layer and, if tlumpoutmass = FALSE
, time step
$react.loss, numeric array: as with outmass but for reactive loss
$loss, numeric [Np]
: mass which is lost otherwise (e.g. particle
wasn't released)
Only requested outputs are returned and if only traces are returned, then the data table is not put in a list.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # MODFLOW NetCDF dataset
library("RNetCDF")
mfdata <- open.nc(system.file("masstrack_mf_demo.nc",
package = "MassTrack"))
# pathline file
library("data.table")
ptl <- fread(system.file("masstrack_mp_demo.ptl",
package = "MassTrack"), skip = 1L)
# run MassTrack
# - this will generate a new NetCDF for the water top (see wtop
# argument)
# - a simple example in which all particles start with mass 1, and there
# is no degradationg
mt <- MassTrack(ptl, mfdata, "MT_EXAMPLE_wtop.nc", phi = .1, end.t = 1500)
# plot results
# - plot MODFLOW model boundaries
library("Rflow")
MFimage(is.na(var.get.nc(mfdata, "Head",
c(NA, NA, 1L, 1L),
c(NA, NA, 1L, 1L))),
gccs(mfdata), grcs(mfdata), 0:1,
c("transparent", "grey"), asp = 1)
MFimage(var.get.nc(mfdata, "ConstantHead",
c(NA, NA, 1L, 1L),
c(NA, NA, 1L, 1L)) != 0,
gccs(mfdata), grcs(mfdata), 0:1,
c("transparent", "blue"), add = TRUE)
MFimage(var.get.nc(mfdata, "RiverLeakage",
c(NA, NA, 1L, 1L),
c(NA, NA, 1L, 1L)) != 0,
gccs(mfdata), grcs(mfdata), 0:1,
c("transparent", "green"), add = TRUE)
MFimage(var.get.nc(mfdata, "Wells",
c(NA, NA, 1L, 1L),
c(NA, NA, 1L, 1L)) != 0,
gccs(mfdata), grcs(mfdata), 0:1,
c("transparent", "red"), add = TRUE)
# plot pathlines
# - note that data.table subsetting often doesn't work with lines
ptl <- fread(system.file("masstrack_mp_demo.ptl",
package = "MassTrack"), skip = 1L)
setnames(ptl, c("ptlno", "x", "y", "z_off", "z",
"t", "C", "R", "L", "timestep"))
for(p in unique(ptl$ptlno)) ptl[ptlno == p, lines(x, y)]
# plot particle masses
mt$traces[, points(x, y, pch = 16L, col = "darkgreen", cex = m)]
# you can save the results to file using rlist::list.save, for example
## Not run:
rlist::list.save(mt, "MT_EXAMPLE.rds")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.