NAG CL Interface
d02tzc (bvp_coll_nlin_diag)
1
Purpose
d02tzc returns information about the solution of a general twopoint boundary value problem computed by
d02tlc.
2
Specification
The function may be called by the names: d02tzc or nag_ode_bvp_coll_nlin_diag.
3
Description
d02tzc and its associated functions (
d02tlc,
d02tvc,
d02txc and
d02tyc) solve the twopoint boundary value problem for a nonlinear mixed order system of ordinary differential equations
over an interval
$[a,b]$ subject to
$p$ (
$\text{}>0$) nonlinear boundary conditions at
$a$ and
$q$ (
$\text{}>0$) nonlinear boundary conditions at
$b$, where
$p+q={\displaystyle \sum _{i=1}^{n}}{m}_{i}$. Note that
${y}_{i}^{\left(m\right)}\left(x\right)$ is the
$m$th derivative of the
$i$th solution component. Hence
${y}_{i}^{\left(0\right)}\left(x\right)={y}_{i}\left(x\right)$. The left boundary conditions at
$a$ are defined as
and the right boundary conditions at
$b$ as
where
$y=({y}_{1},{y}_{2},\dots ,{y}_{n})$ and
First,
d02tvc must be called to specify the initial mesh, error requirements and other details. Then,
d02tlc can be used to solve the boundary value problem. After successful computation,
d02tzc can be used to ascertain details about the final mesh.
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 Twopoint Boundaryvalue Problems Dover, New York
5
Arguments

1:
$\mathbf{mxmesh}$ – Integer
Input

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
d02tvc.

2:
$\mathbf{nmesh}$ – Integer *
Output

On exit: the number of points in the mesh last used by
d02tlc.

3:
$\mathbf{mesh}\left[{\mathbf{mxmesh}}\right]$ – double
Output

On exit:
${\mathbf{mesh}}\left[\mathit{i}1\right]$ contains the
$\mathit{i}$th point of the mesh last used by
d02tlc, for
$\mathit{i}=1,2,\dots ,{\mathbf{nmesh}}$.
${\mathbf{mesh}}\left[0\right]$ will contain
$a$ and
${\mathbf{mesh}}\left[{\mathbf{nmesh}}1\right]$ will contain
$b$. The remaining elements of
mesh are not initialized.

4:
$\mathbf{ipmesh}\left[{\mathbf{mxmesh}}\right]$ – Integer
Output

On exit:
${\mathbf{ipmesh}}\left[\mathit{i}1\right]$ specifies the nature of the point
${\mathbf{mesh}}\left[\mathit{i}1\right]$, for
$\mathit{i}=1,2,\dots ,{\mathbf{nmesh}}$, in the final mesh computed by
d02tlc.
 ${\mathbf{ipmesh}}\left[i1\right]=1$
 Indicates that the $i$th point is a fixed point and was used by the solver before an extrapolationlike error test.
 ${\mathbf{ipmesh}}\left[i1\right]=2$
 Indicates that the $i$th point was used by the solver before an extrapolationlike error test.
 ${\mathbf{ipmesh}}\left[i1\right]=3$
 Indicates that the $i$th point was used by the solver only as part of an extrapolationlike 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:
$\mathbf{ermx}$ – double *
Output

On exit: an estimate of the maximum error in the solution computed by
d02tlc, that is
where
${v}_{i}$ is the approximate solution for the
$i$th solution component. If
d02tlc returned successfully with
${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR,
ermx will be less than
${\mathbf{tols}}\left[{\mathbf{ijermx}}1\right]$ in
d02tvc where
tols contains the error requirements as specified in
Sections 3 and
5 in
d02tvc.
If
d02tlc returned with
${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NW_MAX_SUBINT,
ermx will be greater than
${\mathbf{tols}}\left[{\mathbf{ijermx}}1\right]$ in
d02tvc.
If
d02tlc returned any other value for
fail.code then an error estimate is not available and
ermx is initialized to
$0.0$.

6:
$\mathbf{iermx}$ – Integer *
Output

On exit: indicates the mesh subinterval where the value of
ermx has been computed, that is
$[{\mathbf{mesh}}\left[{\mathbf{iermx}}1\right],{\mathbf{mesh}}\left[{\mathbf{iermx}}\right]]$.
If an estimate of the error is not available then
iermx is initialized to
$0$.

7:
$\mathbf{ijermx}$ – Integer *
Output

On exit: indicates the component
$i$ (
$\text{}={\mathbf{ijermx}}$) of the solution for which
ermx has been computed, that is the approximation of
${y}_{i}$ on
$[{\mathbf{mesh}}\left[{\mathbf{iermx}}1\right],{\mathbf{mesh}}\left[{\mathbf{iermx}}\right]]$ is estimated to have the largest error of all components
${y}_{i}$ over mesh subintervals defined by
mesh.
If an estimate of the error is not available then
ijermx is initialized to
$0$.

8:
$\mathbf{rcomm}\left[\mathit{dim}\right]$ – const double
Communication Array

Note: the dimension,
$\mathit{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
d02tlc.
On entry: this must be the same array as supplied to
d02tlc and
must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.

9:
$\mathbf{icomm}\left[\mathit{dim}\right]$ – const Integer
Communication Array

Note: the dimension,
$\mathit{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
d02tlc.
On entry: this must be the same array as supplied to
d02tlc and
must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.

10:
$\mathbf{fail}$ – NagError *
Input/Output

The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
 NE_ALLOC_FAIL

Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
 NE_BAD_PARAM

On entry, argument $\u27e8\mathit{\text{value}}\u27e9$ had an illegal value.
 NE_CONVERGENCE_SOL

The solver function did not produce any results suitable for interpolation.
 NE_INT_CHANGED

On entry,
${\mathbf{mxmesh}}=\u27e8\mathit{\text{value}}\u27e9$ and
${\mathbf{mxmesh}}=\u27e8\mathit{\text{value}}\u27e9$ in
d02tvc.
Constraint:
${\mathbf{mxmesh}}={\mathbf{mxmesh}}$ in
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.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
 NE_MISSING_CALL

The solver function does not appear to have been called.
 NE_NO_LICENCE

Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
 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
d02tzc is not threaded in any implementation.
Note that:
 if d02tlc returned ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, NW_MAX_SUBINT or NW_NOT_CONVERGED then it will always be the case that ${\mathbf{ipmesh}}\left[0\right]={\mathbf{ipmesh}}\left[{\mathbf{nmesh}}1\right]=1$;
 if d02tlc returned ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NW_MAX_SUBINT then it will always be the case that
${\mathbf{ipmesh}}\left[\mathit{i}1\right]=3$, for $\mathit{i}=2,4,\dots ,{\mathbf{nmesh}}1$ (even $i$) and
${\mathbf{ipmesh}}\left[\mathit{i}1\right]=1$ or $2$, for $\mathit{i}=3,5,\dots ,{\mathbf{nmesh}}2$ (odd $i$);
 if d02tlc returned ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NW_NOT_CONVERGED then it will always be the case that
${\mathbf{ipmesh}}\left[\mathit{i}1\right]=1$ or $2$, for $\mathit{i}=2,3,\dots ,{\mathbf{nmesh}}1$.
If
d02tzc returns
${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, then examination of the mesh may provide assistance in determining a suitable starting mesh for
d02tvc in any subsequent attempts to solve similar problems.
If the problem being treated by
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
d02txc. Using the mesh points not involved in the extrapolation error test is usually appropriate.
ipmesh and
mesh should be passed unchanged to
d02txc but
nmesh should be replaced by
$({\mathbf{nmesh}}+1)/2$.
If
d02tzc returns
${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NW_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
d02tvc in any subsequent attempts to solve the same problem.
If
d02tlc returns
${\mathbf{fail}}\mathbf{.}\mathbf{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
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
${\mathbf{tols}}\left[{\mathbf{ijermx}}1\right]$ 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
d02tlc,
d02tvc,
d02txc and
d02tyc, for the illustration of other facilities.
Consider the Lagerstrom–Cole equation
with the boundary conditions
where
$\epsilon $ is small and positive. The nature of the solution depends markedly on the values of
$\alpha ,\beta $. See
Cole (1968).
We choose
$\alpha =\frac{1}{3},\beta =\frac{1}{3}$ for which the solution is known to have corner layers at
$x=\frac{1}{3},\frac{2}{3}$. 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
$\epsilon =\text{1.0e\u22124}$ using in
guess the initial approximation
$y\left(x\right)=\alpha +(\beta \alpha )x$ which satisfies the boundary conditions. Then we use simple continuation to compute the solution for
$\epsilon =\text{1.0e\u22125}$. We use the suggested values for
nmesh,
ipmesh and
mesh in the call to
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
10.2
Program Data
10.3
Program Results