r2sundials-package: Wrapper for 'SUNDIALS' Solving ODE and Sensitivity Problem

r2sundials-packageR Documentation

Wrapper for 'SUNDIALS' Solving ODE and Sensitivity Problem

Description

Wrapper for widely used 'SUNDIALS' software (SUite of Nonlinear and DIfferential/ALgebraic Equation Solvers) and more precisely to its 'CVODES' solver. It is aiming to solve ordinary differential equations (ODE) and optionally pending forward sensitivity problem. The wrapper is made 'R' friendly by allowing to pass custom parameters to user's callback functions. Such functions can be both written in 'R' and in 'C++' ('RcppArmadillo' flavor). In case of 'C++', performance is greatly improved so this option is highly advisable when performance matters. If provided, Jacobian matrix can be calculated either in dense or sparse format. In the latter case 'rmumps' package is used to solve corresponding linear systems. Root finding and pending event management are optional and can be specified as 'R' or 'C++' functions too. This makes them a very flexible tool for controlling the ODE system during the time course simulation. 'SUNDIALS' library was published in Hindmarsh et al. (2005) <doi:10.1145/1089014.1089020>. Interface for commonly used SUNDIALS library for solving ODE system. It is made R friendly by allowing to pass custom parameters to user's callback functions. They can be both written in R and in C++ (Rcpp flavor). In case of C++, performance is greatly improved so this option is highly advisable when performance matters. Jacobian matrix can be specified as either dense or sparse matrix. In the latter case rmumps package is used to solve corresponding linear systems. Root finding and corresponding event management are optional and can be too specified as R or C++ functions which makes them a very flexible tool for controlling the ODE system during the time course simulation.

Details

The DESCRIPTION file: This package was not yet installed at build time.
Index: This package was not yet installed at build time.
The main function of the package is r2cvodes() which wraps and converts its arguments in data structures and parameters convenient for calling cvodes() from SUNDIALS library.

When using r2sundials::r2cvodes(), some callback functions have to be written by the user either in R or in C++ (RcppArmadillo flavor). One of them is mandatory and defines the rhs of the ODE system to solve. Others are optional and can be used to

  • calculate Jacobian matrix in sparse or dense format;

  • calculate root vector for tracking particular events and

  • handle them in a way defined by the user himself;

  • calculate sensitivity rhs if sensitivity to some parameters is required and user does not want to rely on internal procedures for estimating such rhs.

Note that if 'SUNDIALS' 'CVODES' is compiled with parameter SUNDIALS_INDEX_SIZE set to 32, some memory copying is spared if a C++ function calculating sparse Jacobian is provided by user.

The version number of this package if made of CVODES original version, e.g. 5.0.0 followed by one digit for R wrapper release. This can give 5.0.0-1.

Author(s)

Serguei Sokol [cre, aut], Carol S. Woodward [ctb], Daniel R. Reynolds [ctb], Alan C. Hindmarsh [ctb], David J. Gardner [ctb], Cody J. Balos [ctb], Radu Serban [ctb], Scott D. Cohen [ctb], Peter N. Brown [ctb], George Byrne [ctb], Allan G. Taylor [ctb], Steven L. Lee [ctb], Keith E. Grant [ctb], Aaron Collier [ctb], Lawrence E. Banks [ctb], Steve Smith [ctb], Cosmin Petra [ctb], Slaven Peles [ctb], John Loffeld [ctb], Dan Shumaker [ctb], Ulrike Yang [ctb], James Almgren-Bell [ctb], Shelby L. Lockhart [ctb], Hilari C. Tiedeman [ctb], Ting Yan [ctb], Jean M. Sexton [ctb], Chris White [ctb], Lawrence Livermore National Security [cph], Southern Methodist University [cph], INSA [cph], INRAE [cph], CNRS [cph] Maintainer: Serguei Sokol <sokol@insa-toulouse.fr>

References

Original SUNDIALS CVODES user documentation (search for cvs_guide.pdf)

See Also

deSolve

Examples

  # a very simple ODE for exponential transition from 0 to 1: y'=1-y, y(0)=0
  frhs=function(t, y, param, psens) 1-y
  ti=seq(0, 5, length.out=101)
  y0=0
  res_exp=r2sundials::r2cvodes(y0, ti, frhs)
  plot(ti, res_exp[1,], t="l", xlab="Time", ylab="Y")

r2sundials documentation built on Sept. 11, 2024, 5:22 p.m.