Wrapper for lsoda
This is a wrapper to call lsoda
from deSolve and solve the ODE. Package deSolve
needs to be installed to run this wrapper.
lsoda_wrapper(t, y, model, verbose = FALSE, ...)
t
: vector of times.y
: vector of biomasses.model
: object of class ATN (Rcpp_parameters_prefs).verbose
: Boolean, whether a message should be printed when all checks were successful...
: additional arguments to pass to lsoda
A matrix for the ODE solution with species as columns and times as rows.
library(ATNr) set.seed(123) masses <- runif(20, 10, 100) #body mass of species L <- create_Lmatrix(masses, 10, Ropt = 10) L[L > 0] <- 1 mod <- create_model_Unscaled_nuts(20, 10, 3, masses, L) mod <- initialise_default_Unscaled_nuts(mod, L) biomasses <- masses ^ -0.75 * 10 ^ 4 #biomasses of species biomasses <- append(runif(3, 20, 30), biomasses) times <- seq(0, 100, 1) sol <- lsoda_wrapper(times, biomasses, mod) range(sol[, -1]) mod$ext <- 1e-3 sol <- lsoda_wrapper(times, biomasses, mod)
Useful links