Learn R Programming

SoilR (version 1.0-0)

solver: solver

Description

This function applies one of its arguments (which is an ode solver) to its other arguments, the righthand side of an ode system and a vector of the initial values and the times where a value is sought. Its main purpose is to provide a very easy and flexible interface to the toplevel functions that use it. A user can thus decide which method is used to solve his model by providing the method as an argument.

Usage

solver(times, ydot, startValues, solverFunc = deSolve.lsoda.wrapper)

Arguments

times
A vector containing the points in time where the solution is sought.
ydot
The function used by the odesolver to compute the derivative. For an example how such a function should look like have a look at NpYdot which creates such a function for the n pool example.
startValues
a vector containing the initial amounts of carbon for the n pools. The length of this vector has to be equal to the number of pools and thus compatible with ydot. At the moment this is not checked by the function.
solverFunc
The function used by to actually solve the ODE system. This can be euler or ode or any other user provided function with the same interface.