<< Differential calculus, Integration Differential calculus, Integration dae >>

Scilab Help >> Differential calculus, Integration > bvode

bvode

boundary value problems for ODE using collocation method

bvodeS

Simplified call to bvode

Syntax

zu = bvode(xpoints,N,m,x_low,x_up,zeta,ipar,ltol,tol,fixpnt,fsub,dfsub,gsub,dgsub,guess)

zu = bvodeS(xpoints,m,N,x_low,x_up,fsub,gsub,zeta, <optional_args>)

Arguments

zu

a column vector of size M. The solution of the ode evaluated on the mesh given by points. It contains z(u(x)) for each requested points.

xpoints

an array which gives the points for which we want to observe the solution.

N

a scalar with integer value, number of differential equations (N <= 20).

m

a vector of size N with integer elements. It is the vector of order of each differential equation: m(i) gives the order of the i-th differential equation. In the following, M will represent the sum of the elements of m.

x_low

a scalar: left end of interval

x_up

a scalar: right end of interval

zeta

a vector of size M, zeta(j) gives j-th side condition point (boundary point). One must have x_low<=zeta(j) <=zeta(j+1)<=x_up

All side condition points must be mesh points in all meshes used, see description of ipar(11) and fixpnt below.

ipar

an array with 11 integer elements:

[nonlin, collpnt, subint, ntol, ndimf, ndimi, iprint, iread, iguess, rstart,nfxpnt]

nonlin: ipar(1)

0 if the problem is linear, 1 if the problem is nonlinear

collpnt: ipar(2)

Gives the number of collocation points per subinterval where max(m(j)) <= collpnt <= 7.

If ipar(2)=0 then collpnt is set to max( max(m(j))+1, 5-max(m(j)) ).

subint: ipar(3)

Gives the number of subintervals in the initial mesh. If ipar(3) = 0 then bvode arbitrarily sets subint = 5.

ntol: ipar(4)

Gives the number of solution and derivative tolerances. We require 0 < ntol <= M. ipar(4) must be set to the dimension of the tol argument or to 0. In the latter case the actual value will automatically be set to size(tol,'*').

ndimf: ipar(5)

Gives the dimension of fspace (a real work array). Its value provides a constraint on nmax the maximum number of subintervals.

The ipar(5) value must respect the constraint ipar(5)>=nmax*nsizef where nsizef=4 + 3*M + (5+collpnt*N)*(collpnt*N+M) + (2*M-nrec)*2*M (nrec is the number of right end boundary conditions).

ndimi: ipar(6)

Gives the dimension of ispace (an integer work array). Its value provides a constraint on nmax, the maximum number of subintervals.

The ipar(6) value must respect the constraint ipar(6)>=nmax*nsizei where nsizei= 3 + collpnt*N + M.

iprint: ipar(7)

output control, may take the following values:

-1

for full diagnostic printout

0

for selected printout

1

for no printout

iread: ipar(8)
= 0

causes bvode to generate a uniform initial mesh.

= xx

Other values are not implemented yet in Scilab

= 1

if the initial mesh is provided by the user it is defined in fspace as follows: the mesh will occupy fspace(1), ..., fspace(n+1). The user needs to supply only the interior mesh points fspace(j) = x(j),j = 2, ..., n.

= 2

if the initial mesh is supplied by the user as with ipar(8)=1, and in addition no adaptive mesh selection is to be done.

iguess: ipar(9)
= 0

if no initial guess for the solution is provided.

= 1

if an initial guess is provided by the user through the argument guess.

= 2

if an initial mesh and approximate solution coefficients are provided by the user in fspace (the former and new mesh are the same).

= 3

if a former mesh and approximate solution coefficients are provided by the user in fspace, and the new mesh is to be taken twice as coarse; i.e. every second point from the former mesh.

= 4

if in addition to a former initial mesh and approximate solution coefficients, a new mesh is provided in fspace as well (see description of output for further details on iguess = 2, 3 and 4).

ireg: ipar(10)
= 0

if the problem is regular

= 1

if the first relaxation factor is equal to ireg, and the nonlinear iteration does not rely on past convergence (use for an extra-sensitive nonlinear problem only)

= 2

if we are to return immediately upon (a) two successive nonconvergences, or (b) after obtaining an error estimate for the first time.

nfxpnt: ipar(11)

Gives the number of fixed points in the mesh other than x_low and x_up (the dimension of fixpnt). ipar(11) must be set to the dimension of the fixpnt argument or to 0. In the latter case the actual value will automatically be set to size(fixpnt,'*').

ltol

an array of dimension ntol=ipar(4). ltol(j) = l specifies that the j-th tolerance in the tol array controls the error in the l-th component of . It is also required that:

1 <= ltol(1) < ltol(2) < ... < ltol(ntol) <= M

tol

an array of dimension ntol=ipar(4).

tol(j) is the error tolerance on the ltol(j)-th component of . Thus, the code attempts to satisfy on each subinterval

where is the approximate solution vector and is the exact solution (unknown).

fixpnt

an array of dimension nfxpnt=ipar(11). It contains the points, other than x_low and x_up, which are to be included in every mesh. The code requires that all side condition points other than x_low and x_up (see description of zeta) be included as fixed points in fixpnt.

fsub

an external used to evaluate the column vector f= for any x such as x_low <= x <= x_up and for any z=z(u(x)) (see description below).

The external must have the headings:

  • In Fortran the calling sequence must be:

    subroutine fsub(x,zu,f)
    double precision zu(*), f(*),x
  • In C the function prototype must be:

    void fsub(double *x, double *zu, double *f)
  • And in Scilab:

    function f=fsub(x, zu, parameters)
dfsub

an external used to evaluate the Jacobian of f(x,z(u)) at a point x. Where z(u(x)) is defined as for fsub and the N by M array df should be filled by the partial derivatives of f:

The external must have the headings:

  • In Fortran the calling sequence must be:

    subroutine dfsub(x,zu,df)
    double precision zu(*), df(*),x
  • In C the function prototype must be:

    void dfsub(double *x, double *zu, double *df)
  • And in Scilab:

    function df=dfsub(x, zu, parameters)
gsub

an external used to evaluate given z= z = zeta(i) for 1<=i<=M.

The external must have the headings:

  • In Fortran the calling sequence must be:

    subroutine gsub(i,zu,g)
    double precision zu(*), g(*)
    integer i
  • In C the function prototype must be:

    void gsub(int *i, double *zu, double *g)
  • And in Scilab:

    function g=gsub(i, zu, parameters)

    Note that in contrast to f in fsub, here only one value per call is returned in g.

dgsub

an external used to evaluate the i-th row of the Jacobian of g(x,u(x)). Where z(u) is as for fsub, i as for gsub and the M-vector dg should be filled with the partial derivatives of g, viz, for a particular call one calculates

The external must have the headings:

  • In Fortran the calling sequence must be:

    subroutine dgsub(i,zu,dg)
    double precision zu(*), dg(*)
  • In C the function prototype must be

    void dgsub(int *i, double *zu, double *dg)
  • And in Scilab

    function dg=dgsub(i, zu, parameters)
guess

An external used to evaluate the initial approximation for z(u(x)) and dmval(u(x)) the vector of the mj-th derivatives of u(x). Note that this subroutine is used only if ipar(9) = 1, and then all M components of zu and N components of dmval should be computed for any x such as x_low <= x <= x_up.

The external must have the headings:

  • In Fortran the calling sequence must be:

    subroutine guess(x,zu,dmval)
    double precision x,z(*), dmval(*)
  • In C the function prototype must be

    void fsub(double *x, double *zu, double *dmval)
  • And in Scilab

    function [dmval, zu]=fsub(x, parameters)
<optional_args>

It should be either:

  • any left part of the ordered sequence of values: guess, dfsub, dgsub, fixpnt, ndimf, ndimi, ltol, tol, ntol,nonlin, collpnt, subint, iprint, ireg, ifail

  • or any sequence of arg_name=argvalue with arg_name in: guess, dfsub, dgsub, fixpnt, ndimf, ndimi, ltol, tol, ntol, nonlin, collpnt, subint, iprint, ireg, ifail

where all these arguments excepted ifail are described above. ifail can be used to display the bvode call corresponding to the selected optional arguments. If guess is given iguess is set to 1

Description

These functions solve a multi-point boundary value problem for a mixed order system of ode-s given by

where

The argument zu used by the external functions and returned by bvode is the column vector formed by the components of z(u(x)) for a given x.

The method used to approximate the solution u is collocation at gaussian points, requiring m(i)-1 continuous derivatives in the i-th component, i = 1:N. here, k is the number of collocation points (stages) per subinterval and is chosen such that k ≥ max(m(i)). A runge-kutta-monomial solution representation is utilized.

Examples

The first two problems below are taken from the paper [1] of the Bibliography.

See also

Used Functions

This function is based on the Fortran routine colnew developed by

U. Ascher, Department of Computer Science, University of British Columbia, Vancouver, B.C. V6T 1W5, Canada

G. Bader, institut f. Angewandte mathematik university of Heidelberg; im Neuenheimer feld 294d-6900 Heidelberg 1

Bibliography

  1. U. Ascher, J. Christiansen and R.D. Russell, collocation software for boundary-value ODEs, acm trans. math software 7 (1981), 209-222. this paper contains EXAMPLES where use of the code is demonstrated.

  2. G. Bader and U. Ascher, a new basis implementation for a mixed order boundary value ode solver, siam j. scient. stat. comput. (1987).

  3. U. Ascher, J. Christiansen and R.D. Russell, a collocation solver for mixed order systems of boundary value problems, math. comp. 33 (1979), 659-679.

  4. U. Ascher, J. Christiansen and R.D. russell, colsys - a collocation code for boundary value problems, lecture notes comp.sc. 76, springer verlag, b. children et. al. (eds.) (1979), 164-185.

  5. C. Deboor and R. Weiss, solveblok: a package for solving almost block diagonal linear systems, acm trans. math. software 6 (1980), 80-87.


Report an issue
<< Differential calculus, Integration Differential calculus, Integration dae >>