<< Options (ODE and DAE solvers) Options, features and user functions Sensitivity (DAE) >>

Scilab Help >> Equações Diferenciais > SUite of Nonlinear and DIfferential/ALgebraic equation - SUNDIALS solvers > Options, features and user functions > Pure quadrature

Pure quadrature

Integration of quadrature equations

Syntax

... = cvode( ... , quadRhs = fun, options)
... = ida( ... , quadRhs = fun, options)

Arguments

fun

A Scilab function, a list, a string.

options

a sequence of optional named arguments (see the solvers options) and below for quadrature specific options.

t

vector of time points used by the solver.

y

array of solution at time values in t

info

MList of _odeSolution type with solver information, user events information (if applicable), statistics and pure quadratures of the solution at solver time points.

sol

MList of _odeSolution type

Description

During integration, the solver can compute simultaneously quadratures/integrals of a function g depending on time t and solution when solving an ODE or a DAE:

and depending also on y' when solving a DAE

These quantities could be added as new states and trivial equations in the original problem since but giving them separately avoids computing useless Jacobians and saves the solver effort. The value of g is given by the output of fun, which has the same prototype as a classical ODE rhs or DAE residual. After the solver call the quadrature variables are retrieved in the "q" field of either the info or sol output argument, as in the following examples (typically, only the final value of q will be of interest). The initial values of the quadrature variables are zero by default but can be set with the option yQ0. Note

Examples

function dyqdt=g(t, y)
    dyqdt = t*y(1);
end
[t,y,info] = cvode(%SUN_vdp1, [0 1], [1 2], quadRhs=g);
info.q

function dyqdt=g(t, y, yp)
    dyqdt = y(2);
end
y0  = [1-1e-6; 1e-6; 0];
yp0 = [-2e-7; 1.5e-7; 5e-8];
[t,y,info] = ida(%SUN_sir, [0,200], y0, yp0, quadRhs=g);
info.q

Options

yQ0

a double array giving the initial state of the quadrature variable.

quadErrCon

By default, QuadErrCon is set to %f. If quadErrCon=%t then quadrature variables are included in the error tests.

rtolQ

The scalar relative tolerance to control the local error estimator when quadErrCon=%t (default value is 1e-4).

atolQ

The absolute tolerance controlling the local error when quadErrCon=%t. It can be a scalar or an array of the same dimension as the quadrature variable (default value is 1e-6).

See also


Report an issue
<< Options (ODE and DAE solvers) Options, features and user functions Sensitivity (DAE) >>