Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - 日本語


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:

y_q(t) = y_q(t_0)+\int_{t_0}^t g(u,y(u))\,du.

and depending also on y' when solving a DAE

y_q(t) =  y_q(t_0)+\int_{t_0}^t g(u,y(u),y

These quantities could be added as new states and trivial equations in the original problem since y_q 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

  • arkode — SUNDIALS ordinary differential equation additive Runge-Kutta solver
  • cvode — SUNDIALS ordinary differential equation solver
  • ida — SUNDIALS differential-algebraic equation solver
  • User functions — Coding user functions used by SUNDIALS solvers
  • Options (ODE and DAE solvers) — Changing the default behavior of solver
  • SUN_Clink — Compiling and linking a C user function
Report an issue
<< Options (ODE and DAE solvers) Options, features and user functions Sensitivity (DAE) >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:17:39 CEST 2024