run.streambugs | R Documentation |
Numerically solve streambugs ODE model (in either R or C version) for given
parameters, inputs and time points, using the ode
routine.
run.streambugs( y.names, times, par, inp = NA, C = FALSE, file.def = NA, file.res = NA, file.add = NA, return.res.add = FALSE, tout.add = NA, verbose = TRUE, method = "lsoda", rtol = 1e-04, atol = 1e-04, ... )
y.names |
state variables names, either as a vector encoded in the form
|
times |
vector with time points for which output is wanted; the first |
par |
vector with constant parameters and model inputs |
inp |
list with time-dependent parameters or model inputs with one list element for each parameter or input that includes a matrix where first column is the time and second the corresponding parameter or input value |
C |
identifier for C- or R-Version |
file.def |
file name for writing system definition |
file.res |
file name for results |
file.add |
file name for additional output (e.g. process rates) |
return.res.add |
returns |
tout.add |
optional identifier for specific output times for the
additional output, if |
verbose |
prints some outputs to console |
method |
method used by |
rtol |
argument of |
atol |
argument of |
... |
further arguments passed to |
A list with:
$res
matrix of class streambugs
with up
to as many rows aselements in times and as many columns as elements in
y.names
, plus an additional column for the time value.
There will be a row for each element in times unless the
FORTRAN routine "lsoda"
returns with an unrecoverable error.
$res.add
optional additional output matrix with process
rates and taxon specific factors, present only if return.res.add
input parameter is set to TRUE
.
See "docs/Streambugs_syntax.pdf" file in the package installation folder:
system.file("docs", "Streambugs_syntax.pdf", package="streambugs")
.
m <- streambugs.example.model.toy() # Display inputs: list of perturbed variables with time points and new values m$inp # Simluate res.C.default <- run.streambugs(y.names = m$y.names, times = m$times, par = m$par, inp = m$inp, C = TRUE) # Modify input (halve second perturbation size) and re-simulate m$inp$Reach3_w[2,2] <- m$inp$Reach3_w[2,2] / 2 m$inp res.C.modified <- run.streambugs(y.names = m$y.names, times = m$times, par = m$par, inp = m$inp, C = TRUE) # Compare examplary trajectory of organic matter in one of the habitats var.name <- "Reach3_Hab1_POM1_POM" plot(m$times,res.C.default$res[, var.name], type="l", col="red") lines(m$times, res.C.modified$res[, var.name], col="green")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.