The Chicken sundials library provides bindings to the solvers from the SUNDIALS library. SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation Solvers) is a collection of solvers for systems of ordinary differential equations and differential-algebraic equations.

The Chicken sundials library provides interfaces to the CVODE and IDA solvers and has been tested with SUNDIALS version 2.4.0.

Creates and initializes an object representing a problem to be solved with the IDA solver.

Arguments TSTART and TSTOP must be real numbers that represent the beginning and end of the independent variable range.

Arguments VARIABLES and DERIVATIVES must be SRFI-4 f64vector objects that hold respectively the initial values and derivatives of the system variables.

Argument RESIDUAL-MAIN is used to compute the residual function F and must be a procedure of the following form:

(LAMBDA T YY YP DATA)

or

(LAMBDA T YY YP)

depending on whether the USER-DATA optional argument is set, where

T

real-valued independent variable

YY

SRFI-4 f64vector with current variable values

YP

SRFI-4 f64vector with current variable derivatives

DATA

is a user data object (if set)

This procedure must return a SRFI-4 f64vector containing the residual vector.

Optional keyword argument RESIDUAL-EVENT must be a procedure of the same form as RESIDUAL-MAIN, which computes a rootfinding problem to be solved during the integration of the system. It is set only if argument EVENTS is given.

Optional keyword argument EVENTS is an SRFI-4 s32vector that is used for storage of root finding solutions. It must be given if RESIDUAL-EVENT is given.

Optional keyword argument ALG-OR-DIFF must be an SRFI-4 s32vector which indicates the algebraic and differential variables in the system. A value of 1 indiciates differential variable, and a value of 0 indicates an algebraic one. This is required if the SUPPRESS argument is given and true.

Optional keyword argument SUPPRESS is a boolean flag that indicates whether algebraic variables must be suppressed in the local error test. If it is true (suppress), then the argument ALG-OR-DIFF must be given.

Optional keyword argument IC is a boolean flag that indicates whether the solver must calculate consistent initial conditions, or whether it must use the initial conditions given by VARIABLES.

Optional keyword argument USER-DATA is an object that will be passed as an additional argument to the residual functions.

Creates and initializes an object representing a problem to be solved with the CVODE solver.

Arguments TSTART and TSTOP must be real numbers that represent the beginning and end of the independent variable range.

Arguments VARIABLES must be a SRFI-4 f64vector object that holds the initial values of the system variables.

Argument RHS-FN is used to compute the right-hand side of the equations, and must be a procedure of the following form:

(LAMBDA T YY DATA)

or

(LAMBDA T YY)

depending on whether the USER-DATA optional argument is set, where

T

real-valued independent variable

YY

SRFI-4 f64vector with current variable values

DATA

is a user data object (if set)

This procedure must return a SRFI-4 f64vector containing the residual vector.

Optional keyword argument EWT-FN must be a procedure of the same form as (LAMBDA YY), which computes error weights for the system variables, and which can be used in place of relative and absolute error tolerance.

Optional keyword argument EVENT-FN must be a procedure of the same form as RHS-FN, which computes a rootfinding problem to be solved during the integration of the system. It is set only if argument EVENTS is given.

Optional keyword argument EVENTS is an SRFI-4 s32vector that is used for storage of root finding solutions. It must be given if EVENT-FN is given.

Optional keyword argument LMM specifies the linear multistep method to be used and can be one of cvode-lmm/adams (default) or cvode-lmm/bdf. cvode-lmm/bdf is recommended for stiff problems.

Optional keyword argument ITER specifies the iteration type to be used and can be one of cvode-iter/functional (default) or cvode-iter/newton. cvode-iter/newton is recommended for stiff problems.

Optional keyword argument USER-DATA is an object that will be passed as an additional argument to the residual functions.

Optional keyword arguments RELTOL and ABSTOL specify relative and absolute error tolerance, respectively. These both default to 1e-4. They are only set of EWT-FN is not specified.

[procedure](cvode-reinit-solver CVODE-SOLVER T0 Y0 YP0)

Re-initializes CVODE for the solution of a problem.

[procedure](cvode-destroy-solver CVODE-SOLVER)

Deallocates the memory associated with the given solver.

[procedure](cvode-solve CVODE-SOLVER T)

Integrates the system over an interval in the independent variable. This procedure returns either when the given T is reached, or when a root is found.

Copyright 2011 Ivan Raikov.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.