nag_ode_bvp_coll_nlin_diag (d02tzc) (PDF version)
d02 Chapter Contents
d02 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_ode_bvp_coll_nlin_diag (d02tzc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_ode_bvp_coll_nlin_diag (d02tzc) returns information about the solution of a general two-point boundary value problem computed by nag_ode_bvp_coll_nlin_solve (d02tlc).

2  Specification

#include <nag.h>
#include <nagd02.h>
void  nag_ode_bvp_coll_nlin_diag (Integer mxmesh, Integer *nmesh, double mesh[], Integer ipmesh[], double *ermx, Integer *iermx, Integer *ijermx, const double rcomm[], const Integer icomm[], NagError *fail)

3  Description

nag_ode_bvp_coll_nlin_diag (d02tzc) and its associated functions (nag_ode_bvp_coll_nlin_solve (d02tlc)nag_ode_bvp_coll_nlin_setup (d02tvc)nag_ode_bvp_coll_nlin_contin (d02txc) and nag_ode_bvp_coll_nlin_interp (d02tyc)) solve the two-point boundary value problem for a nonlinear mixed order system of ordinary differential equations
y1m1 x = f1 x,y1,y11,,y1m1-1,y2,,ynmn-1 y2m2 x = f2 x,y1,y11,,y1m1-1,y2,,ynmn-1 ynmn x = fn x,y1,y11,,y1m1-1,y2,,ynmn-1
over an interval a,b subject to p (>0) nonlinear boundary conditions at a and q (>0) nonlinear boundary conditions at b, where p+q = i=1 n mi . Note that yi m x is the mth derivative of the ith solution component. Hence yi 0 x=yix. The left boundary conditions at a are defined as
gizya=0,  i=1,2,,p,
and the right boundary conditions at b as
g-jzyb=0,  j=1,2,,q,
where y=y1,y2,,yn and
zyx = y1x, y11 x ,, y1m1-1 x ,y2x,, ynmn-1 x .
First, nag_ode_bvp_coll_nlin_setup (d02tvc) must be called to specify the initial mesh, error requirements and other details. Then, nag_ode_bvp_coll_nlin_solve (d02tlc) can be used to solve the boundary value problem. After successful computation, nag_ode_bvp_coll_nlin_diag (d02tzc) can be used to ascertain details about the final mesh. nag_ode_bvp_coll_nlin_interp (d02tyc) can be used to compute the approximate solution anywhere on the interval a,b using interpolation.
The functions are based on modified versions of the codes COLSYS and COLNEW (see Ascher et al. (1979) and Ascher and Bader (1987)). A comprehensive treatment of the numerical solution of boundary value problems can be found in Ascher et al. (1988) and Keller (1992).

4  References

Ascher U M and Bader G (1987) A new basis implementation for a mixed order boundary value ODE solver SIAM J. Sci. Stat. Comput. 8 483–500
Ascher U M, Christiansen J and Russell R D (1979) A collocation solver for mixed order systems of boundary value problems Math. Comput. 33 659–679
Ascher U M, Mattheij R M M and Russell R D (1988) Numerical Solution of Boundary Value Problems for Ordinary Differential Equations Prentice–Hall
Cole J D (1968) Perturbation Methods in Applied Mathematics Blaisdell, Waltham, Mass.
Keller H B (1992) Numerical Methods for Two-point Boundary-value Problems Dover, New York

5  Arguments

1:     mxmeshIntegerInput
On entry: the maximum number of points allowed in the mesh.
Constraint: this must be identical to the value supplied for the argument mxmesh in the prior call to nag_ode_bvp_coll_nlin_setup (d02tvc).
2:     nmeshInteger *Output
On exit: the number of points in the mesh last used by nag_ode_bvp_coll_nlin_solve (d02tlc).
3:     mesh[mxmesh]doubleOutput
On exit: mesh[i-1] contains the ith point of the mesh last used by nag_ode_bvp_coll_nlin_solve (d02tlc), for i=1,2,,nmesh. mesh[0] will contain a and mesh[nmesh-1] will contain b. The remaining elements of mesh are not initialized.
4:     ipmesh[mxmesh]IntegerOutput
On exit: ipmesh[i-1] specifies the nature of the point mesh[i-1], for i=1,2,,nmesh, in the final mesh computed by nag_ode_bvp_coll_nlin_solve (d02tlc).
ipmesh[i-1]=1
Indicates that the ith point is a fixed point and was used by the solver before an extrapolation-like error test.
ipmesh[i-1]=2
Indicates that the ith point was used by the solver before an extrapolation-like error test.
ipmesh[i-1]=3
Indicates that the ith point was used by the solver only as part of an extrapolation-like error test.
The remaining elements of ipmesh are initialized to -1.
See Section 9 for advice on how these values may be used in conjunction with a continuation process.
5:     ermxdouble *Output
On exit: an estimate of the maximum error in the solution computed by nag_ode_bvp_coll_nlin_solve (d02tlc), that is
ermx=maxyi-vi 1.0+vi
where vi is the approximate solution for the ith solution component. If nag_ode_bvp_coll_nlin_solve (d02tlc) returned successfully with fail.code= NE_NOERROR, then ermx will be less than tols[ijermx-1] where tols contains the error requirements as specified in Sections 3 and 5 in nag_ode_bvp_coll_nlin_setup (d02tvc).
If nag_ode_bvp_coll_nlin_solve (d02tlc) returned with fail.code= NW_MAX_SUBINT, then ermx will be greater than tols[ijermx-1].
If nag_ode_bvp_coll_nlin_solve (d02tlc) returned any other value for fail.code then an error estimate is not available and ermx is initialized to 0.0.
6:     iermxInteger *Output
On exit: indicates the mesh sub-interval where the value of ermx has been computed, that is mesh[iermx-1],mesh[iermx] .
If an estimate of the error is not available then iermx is initialized to 0.
7:     ijermxInteger *Output
On exit: indicates the component i (=ijermx) of the solution for which ermx has been computed, that is the approximation of yi on mesh[iermx-1],mesh[iermx] is estimated to have the largest error of all components yi over mesh sub-intervals defined by mesh.
If an estimate of the error is not available then ijermx is initialized to 0.
8:     rcomm[dim]const doubleCommunication Array
Note: the dimension, dim, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument rcomm in the previous call to nag_ode_bvp_coll_nlin_solve (d02tlc).
On entry: this must be the same array as supplied to nag_ode_bvp_coll_nlin_solve (d02tlc) and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.
9:     icomm[dim]const IntegerCommunication Array
Note: the dimension, dim, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument icomm in the previous call to nag_ode_bvp_coll_nlin_solve (d02tlc).
On entry: this must be the same array as supplied to nag_ode_bvp_coll_nlin_solve (d02tlc) and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.
10:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONVERGENCE_SOL
The solver function did not produce any results suitable for interpolation.
NE_INT_CHANGED
On entry, mxmesh=value and mxmesh=value in nag_ode_bvp_coll_nlin_setup (d02tvc).
Constraint: mxmesh=mxmesh in nag_ode_bvp_coll_nlin_setup (d02tvc).
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_MISSING_CALL
The solver function does not appear to have been called.
NW_NOT_CONVERGED
The solver function did not converge to a suitable solution.
A converged intermediate solution has been used.
Error estimate information is not available.
NW_TOO_MUCH_ACC_REQUESTED
The solver function did not satisfy the error requirements.
Information has been supplied on the last mesh used.

7  Accuracy

Not applicable.

8  Parallelism and Performance

Not applicable.

9  Further Comments

Note that:
If nag_ode_bvp_coll_nlin_diag (d02tzc) returns fail.code= NE_NOERROR, then examination of the mesh may provide assistance in determining a suitable starting mesh for nag_ode_bvp_coll_nlin_setup (d02tvc) in any subsequent attempts to solve similar problems.
If the problem being treated by nag_ode_bvp_coll_nlin_solve (d02tlc) is one of a series of related problems (for example, as part of a continuation process), then the values of ipmesh and mesh may be suitable as input arguments to nag_ode_bvp_coll_nlin_contin (d02txc). Using the mesh points not involved in the extrapolation error test is usually appropriate. ipmesh and mesh should be passed unchanged to nag_ode_bvp_coll_nlin_contin (d02txc) but nmesh should be replaced by nmesh+1/2.
If nag_ode_bvp_coll_nlin_diag (d02tzc) returns fail.code= NE_CONVERGENCE_SOLNE_MISSING_CALLNW_NOT_CONVERGED or NW_TOO_MUCH_ACC_REQUESTED, nothing can be said regarding the quality of the mesh returned. However, it may be a useful starting mesh for nag_ode_bvp_coll_nlin_setup (d02tvc) in any subsequent attempts to solve the same problem.
If nag_ode_bvp_coll_nlin_solve (d02tlc) returns fail.code= NW_MAX_SUBINT, this corresponds to the solver requiring more than mxmesh mesh points to satisfy the error requirements. If mxmesh can be increased and the preceding call to nag_ode_bvp_coll_nlin_solve (d02tlc) was not part, or was the first part, of a continuation process then the values in mesh may provide a suitable mesh with which to initialize a subsequent attempt to solve the same problem. If it is not possible to provide more mesh points then relaxing the error requirements by setting tols[ijermx-1] to ermx might lead to a successful solution. It may be necessary to reset the other components of tols. Note that resetting the tolerances can lead to a different sequence of meshes being computed and hence to a different solution being computed.

10  Example

The following example is used to illustrate the use of fixed mesh points, simple continuation and numerical approximation of a Jacobian. See also nag_ode_bvp_coll_nlin_solve (d02tlc)nag_ode_bvp_coll_nlin_setup (d02tvc)nag_ode_bvp_coll_nlin_contin (d02txc) and nag_ode_bvp_coll_nlin_interp (d02tyc), for the illustration of other facilities.
Consider the Lagerstrom–Cole equation
y=y-yy/ε
with the boundary conditions
y0=αy1=β, (1)
where ε is small and positive. The nature of the solution depends markedly on the values of α,β. See Cole (1968).
We choose α=-13,β=13  for which the solution is known to have corner layers at x=13,23 . We choose an initial mesh of seven points 0.0,0.15,0.3,0.5,0.7,0.85,1.0 and ensure that the points x=0.3,0.7 near the corner layers are fixed, that is the corresponding elements of the array ipmesh are set to 1. First we compute the solution for ε=1.0e−4 using in guess the initial approximation yx=α+β-αx which satisfies the boundary conditions. Then we use simple continuation to compute the solution for ε=1.0e−5. We use the suggested values for nmesh, ipmesh and mesh in the call to nag_ode_bvp_coll_nlin_contin (d02txc) prior to the continuation call, that is only every second point of the preceding mesh is used and the fixed mesh points are retained.
Although the analytic Jacobian for this system is easy to evaluate, for illustration the procedure fjac uses central differences and calls to ffun to compute a numerical approximation to the Jacobian.

10.1  Program Text

Program Text (d02tzce.c)

10.2  Program Data

Program Data (d02tzce.d)

10.3  Program Results

Program Results (d02tzce.r)

Produced by GNUPLOT 4.4 patchlevel 0 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 1.2 Solution Derivative x Example Program Lagerstrom-Cole Equation (-1/3,1/3) with e=0.0001 solution derivative
Produced by GNUPLOT 4.4 patchlevel 0 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 1.2 Solution Derivative x Lagerstrom-Cole Equation (-1/3,1/3) with e=0.00001 solution derivative

nag_ode_bvp_coll_nlin_diag (d02tzc) (PDF version)
d02 Chapter Contents
d02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014