NAG Library Routine Document
D02TKF
1 Purpose
D02TKF solves a general twopoint boundary value problem for a nonlinear mixed order system of ordinary differential equations.
2 Specification
INTEGER 
ICOMM(*), IFAIL 
REAL (KIND=nag_wp) 
RCOMM(*) 
EXTERNAL 
FFUN, FJAC, GAFUN, GBFUN, GAJAC, GBJAC, GUESS 

3 Description
D02TKF and its associated routines (
D02TVF,
D02TXF,
D02TYF and
D02TZF) solve the twopoint boundary value problem for a nonlinear mixed order system of ordinary differential equations
over an interval
$\left[a,b\right]$ 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=\left({y}_{1},{y}_{2},\dots ,{y}_{n}\right)$ and
First,
D02TVF must be called to specify the initial mesh, error requirements and other details. Note that the error requirements apply only to the solution components
${y}_{1},{y}_{2},\dots ,{y}_{n}$ and that no error control is applied to derivatives of solution components. (If error control is required on derivatives then the system must be reduced in order by introducing the derivatives whose error is to be controlled as new variables. See
Section 9 in D02TVF.) Then, D02TKF can be used to solve the boundary value problem. After successful computation,
D02TZF can be used to ascertain details about the final mesh and other details of the solution procedure, and
D02TYF can be used to compute the approximate solution anywhere on the interval
$\left[a,b\right]$.
A description of the numerical technique used in D02TKF is given in
Section 3 in D02TVF.
D02TKF can also be used in the solution of a series of problems, for example in performing continuation, when the mesh used to compute the solution of one problem is to be used as the initial mesh for the solution of the next related problem.
D02TXF should be used in between calls to D02TKF in this context.
See
Section 9 in D02TVF for details of how to solve boundary value problems of a more general nature.
The routines 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
Keller H B (1992) Numerical Methods for Twopoint Boundaryvalue Problems Dover, New York
5 Arguments
 1: $\mathrm{FFUN}$ – SUBROUTINE, supplied by the user.External Procedure

FFUN must evaluate the functions
${f}_{i}$ for given values
$x,z\left(y\left(x\right)\right)$.
The specification of
FFUN is:
INTEGER 
NEQ, M(NEQ) 
REAL (KIND=nag_wp) 
X, Y(NEQ,*), F(NEQ) 

 1: $\mathrm{X}$ – REAL (KIND=nag_wp)Input

On entry: $x$, the independent variable.
 2: $\mathrm{Y}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{Y}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(x\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(x\right)={y}_{i}\left(x\right)$.
 3: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 4: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 5: $\mathrm{F}\left({\mathbf{NEQ}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{F}}\left(\mathit{i}\right)$ must contain ${f}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
FFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 2: $\mathrm{FJAC}$ – SUBROUTINE, supplied by the user.External Procedure

FJAC must evaluate the partial derivatives of
${f}_{i}$ with respect to the elements of
$z\left(y\left(x\right)\right)=\left({y}_{1}\left(x\right),{y}_{1}^{1}\left(x\right),\dots ,{y}_{1}^{\left({m}_{1}1\right)}\left(x\right),{y}_{2}\left(x\right),\dots ,{y}_{n}^{\left({m}_{n}1\right)}\left(x\right)\right)$.
The specification of
FJAC is:
INTEGER 
NEQ, M(NEQ) 
REAL (KIND=nag_wp) 
X, Y(NEQ,*), DFDY(NEQ,NEQ,*) 

 1: $\mathrm{X}$ – REAL (KIND=nag_wp)Input

On entry: $x$, the independent variable.
 2: $\mathrm{Y}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{Y}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(x\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(x\right)={y}_{i}\left(x\right)$.
 3: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 4: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 5: $\mathrm{DFDY}\left({\mathbf{NEQ}},{\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{DFDY}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the partial derivative of ${f}_{\mathit{i}}$ with respect to ${y}_{\mathit{j}}^{\left(\mathit{k}\right)}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$, $\mathit{j}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{k}=0,1,\dots ,{\mathbf{M}}\left(\mathit{j}\right)1$. Only nonzero partial derivatives need be set.
FJAC must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 3: $\mathrm{GAFUN}$ – SUBROUTINE, supplied by the user.External Procedure

GAFUN must evaluate the boundary conditions at the lefthand end of the range, that is functions
${g}_{i}\left(z\left(y\left(a\right)\right)\right)$ for given values of
$z\left(y\left(a\right)\right)$.
The specification of
GAFUN is:
INTEGER 
NEQ, M(NEQ), NLBC 
REAL (KIND=nag_wp) 
YA(NEQ,*), GA(NLBC) 

 1: $\mathrm{YA}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{YA}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(a\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(a\right)={y}_{i}\left(a\right)$.
 2: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 3: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 4: $\mathrm{NLBC}$ – INTEGERInput

On entry: the number of boundary conditions at $a$.
 5: $\mathrm{GA}\left({\mathbf{NLBC}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{GA}}\left(\mathit{i}\right)$ must contain ${g}_{\mathit{i}}\left(z\left(y\left(a\right)\right)\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NLBC}}$.
GAFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 4: $\mathrm{GBFUN}$ – SUBROUTINE, supplied by the user.External Procedure

GBFUN must evaluate the boundary conditions at the righthand end of the range, that is functions
${\stackrel{}{g}}_{i}\left(z\left(y\left(b\right)\right)\right)$ for given values of
$z\left(y\left(b\right)\right)$.
The specification of
GBFUN is:
INTEGER 
NEQ, M(NEQ), NRBC 
REAL (KIND=nag_wp) 
YB(NEQ,*), GB(NRBC) 

 1: $\mathrm{YB}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{YB}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(b\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(b\right)={y}_{i}\left(b\right)$.
 2: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 3: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 4: $\mathrm{NRBC}$ – INTEGERInput

On entry: the number of boundary conditions at $b$.
 5: $\mathrm{GB}\left({\mathbf{NRBC}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{GB}}\left(\mathit{i}\right)$ must contain ${\stackrel{}{g}}_{\mathit{i}}\left(z\left(y\left(b\right)\right)\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NRBC}}$.
GBFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 5: $\mathrm{GAJAC}$ – SUBROUTINE, supplied by the user.External Procedure

GAJAC must evaluate the partial derivatives of
${g}_{i}\left(z\left(y\left(a\right)\right)\right)$ with respect to the elements of
$z\left(y\left(a\right)\right)=\left({y}_{1}\left(a\right),{y}_{1}^{1}\left(a\right),\dots ,{y}_{1}^{\left({m}_{1}1\right)}\left(a\right),{y}_{2}\left(a\right),\dots ,{y}_{n}^{\left({m}_{n}1\right)}\left(a\right)\right)$.
The specification of
GAJAC is:
INTEGER 
NEQ, M(NEQ), NLBC 
REAL (KIND=nag_wp) 
YA(NEQ,*), DGADY(NLBC,NEQ,*) 

 1: $\mathrm{YA}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{YA}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(a\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(a\right)={y}_{i}\left(a\right)$.
 2: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 3: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 4: $\mathrm{NLBC}$ – INTEGERInput

On entry: the number of boundary conditions at $a$.
 5: $\mathrm{DGADY}\left({\mathbf{NLBC}},{\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{DGADY}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the partial derivative of ${g}_{\mathit{i}}\left(z\left(y\left(a\right)\right)\right)$ with respect to ${y}_{\mathit{j}}^{\left(\mathit{k}\right)}\left(a\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NLBC}}$, $\mathit{j}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{k}=0,1,\dots ,{\mathbf{M}}\left(\mathit{j}\right)1$. Only nonzero partial derivatives need be set.
GAJAC must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 6: $\mathrm{GBJAC}$ – SUBROUTINE, supplied by the user.External Procedure

GBJAC must evaluate the partial derivatives of
${\stackrel{}{g}}_{i}\left(z\left(y\left(b\right)\right)\right)$ with respect to the elements of
$z\left(y\left(b\right)\right)=\left({y}_{1}\left(b\right),{y}_{1}^{1}\left(b\right),\dots ,{y}_{1}^{\left({m}_{1}1\right)}\left(b\right),{y}_{2}\left(b\right),\dots ,{y}_{n}^{\left({m}_{n}1\right)}\left(b\right)\right)$.
The specification of
GBJAC is:
INTEGER 
NEQ, M(NEQ), NRBC 
REAL (KIND=nag_wp) 
YB(NEQ,*), DGBDY(NRBC,NEQ,*) 

 1: $\mathrm{YB}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: ${\mathbf{YB}}\left(\mathit{i},\mathit{j}\right)$ contains ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(b\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(b\right)={y}_{i}\left(b\right)$.
 2: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 3: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 4: $\mathrm{NRBC}$ – INTEGERInput

On entry: the number of boundary conditions at $b$.
 5: $\mathrm{DGBDY}\left({\mathbf{NRBC}},{\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{DGBDY}}\left(\mathit{i},\mathit{j},\mathit{k}\right)$ must contain the partial derivative of ${\stackrel{}{g}}_{\mathit{i}}\left(z\left(y\left(b\right)\right)\right)$ with respect to ${y}_{\mathit{j}}^{\left(\mathit{k}\right)}\left(b\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NRBC}}$, $\mathit{j}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{k}=0,1,\dots ,{\mathbf{M}}\left(\mathit{j}\right)1$. Only nonzero partial derivatives need be set.
GBJAC must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 7: $\mathrm{GUESS}$ – SUBROUTINE, supplied by the user.External Procedure

GUESS must return initial approximations for the solution components
${y}_{\mathit{i}}^{\left(\mathit{j}\right)}$ and the derivatives
${y}_{\mathit{i}}^{\left({m}_{\mathit{i}}\right)}$, for
$\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and
$\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$. Try to compute each derivative
${y}_{i}^{\left({m}_{i}\right)}$ such that it corresponds to your approximations to
${y}_{i}^{\left(\mathit{j}\right)}$, for
$\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(i\right)1$. You should
not call
FFUN to compute
${y}_{i}^{\left({m}_{i}\right)}$.
If D02TKF is being used in conjunction with
D02TXF as part of a continuation process, then
GUESS is not called by D02TKF after the call to
D02TXF.
The specification of
GUESS is:
INTEGER 
NEQ, M(NEQ) 
REAL (KIND=nag_wp) 
X, Y(NEQ,*), DYM(NEQ) 

 1: $\mathrm{X}$ – REAL (KIND=nag_wp)Input

On entry: $x$, the independent variable; $x\in \left[a,b\right]$.
 2: $\mathrm{NEQ}$ – INTEGERInput

On entry: the number of differential equations.
 3: $\mathrm{M}\left({\mathbf{NEQ}}\right)$ – INTEGER arrayInput

On entry:
${\mathbf{M}}\left(\mathit{i}\right)$ contains ${m}_{\mathit{i}}$, the order of the $\mathit{i}$th differential equation, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
 4: $\mathrm{Y}\left({\mathbf{NEQ}},*\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{Y}}\left(\mathit{i},\mathit{j}\right)$ must contain ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(x\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$ and $\mathit{j}=0,1,\dots ,{\mathbf{M}}\left(\mathit{i}\right)1$.
Note: ${y}_{i}^{\left(0\right)}\left(x\right)={y}_{i}\left(x\right)$.
 5: $\mathrm{DYM}\left({\mathbf{NEQ}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{DYM}}\left(\mathit{i}\right)$ must contain ${y}_{\mathit{i}}^{\left({m}_{\mathit{i}}\right)}\left(x\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NEQ}}$.
GUESS must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D02TKF is called. Arguments denoted as
Input must
not be changed by this procedure.
 8: $\mathrm{RCOMM}\left(*\right)$ – REAL (KIND=nag_wp) arrayCommunication Array

On entry: this must be the same array as supplied to
D02TVF and
must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated routines.
 9: $\mathrm{ICOMM}\left(*\right)$ – INTEGER arrayCommunication Array

On entry: this must be the same array as supplied to
D02TVF and
must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated routines.
 10: $\mathrm{IFAIL}$ – INTEGERInput/Output

On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output arguments may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}1$ is used it is essential to test the value of IFAIL on exit.
On exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}=0$ or
$1$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: D02TKF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}=1$

On entry, an invalid call was made to D02TKF, for example, without a previous call to the setup routine
D02TVF.
 ${\mathbf{IFAIL}}=2$

Numerical singularity has been detected in the Jacobian used in the underlying Newton iteration. No meaningful results have been computed. You should check carefully how you have coded
FJAC,
GAJAC and
GBJAC. If the usersupplied routines have been coded correctly then supplying a different initial approximation to the solution in
GUESS might be appropriate. See also
Section 9.
 ${\mathbf{IFAIL}}=3$

The nonlinear iteration has failed to converge. At no time during the computation was convergence obtained and no meaningful results have been computed. You should check carefully how you have coded procedures
FJAC,
GAJAC and
GBJAC. If the procedures have been coded correctly then supplying a better initial approximation to the solution in
GUESS might be appropriate. See also
Section 9.
 ${\mathbf{IFAIL}}=4$

The nonlinear iteration has failed to converge. At some earlier time during the computation convergence was obtained and the corresponding results have been returned for diagnostic purposes and may be inspected by a call to
D02TZF. Nothing can be said regarding the suitability of these results for use in any subsequent computation for the same problem. You should try to provide a better mesh and initial approximation to the solution in
GUESS. See also
Section 9.
 ${\mathbf{IFAIL}}=5$

The expected number of subintervals required exceeds the maximum number specified by the argument
MXMESH in the setup routine
D02TVF. Results for the last mesh on which convergence was obtained have been returned. Nothing can be said regarding the suitability of these results for use in any subsequent computation for the same problem. An indication of the error in the solution on the last mesh where convergence was obtained can be obtained by calling
D02TZF. The error requirements may need to be relaxed and/or the maximum number of mesh points may need to be increased. See also
Section 9.
 ${\mathbf{IFAIL}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
 ${\mathbf{IFAIL}}=399$
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
 ${\mathbf{IFAIL}}=999$
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7 Accuracy
The accuracy of the solution is determined by the argument
TOLS in the prior call to
D02TVF (see
Sections 3 and
9 in D02TVF for details and advice). Note that error control is applied only to solution components (variables) and not to any derivatives of the solution. An estimate of the maximum error in the computed solution is available by calling
D02TZF.
8 Parallelism and Performance
D02TKF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
D02TKF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
If D02TKF returns with ${\mathbf{IFAIL}}={\mathbf{2}}$, ${\mathbf{3}}$, ${\mathbf{4}}$ or ${\mathbf{5}}$ and the call to D02TKF was a part of some continuation procedure for which successful calls to D02TKF have already been made, then it is possible that the adjustment(s) to the continuation argument(s) between calls to D02TKF is (are) too large for the problem under consideration. More conservative adjustment(s) to the continuation argument(s) might be appropriate.
10 Example
The following example is used to illustrate the treatment of a highorder system, control of the error in a derivative of a component of the original system, and the use of continuation. See also
D02TVF,
D02TXF,
D02TYF and
D02TZF, for the illustration of other facilities.
Consider the steady flow of an incompressible viscous fluid between two infinite coaxial rotating discs. See
Ascher et al. (1979) and the references therein. The governing equations are
subject to the boundary conditions
where
$R$ is the Reynolds number and
${\Omega}_{0},{\Omega}_{1}$ are the angular velocities of the disks.
We consider the case of counterrotation and a symmetric solution, that is
${\Omega}_{0}=1,{\Omega}_{1}=1$. This problem is more difficult to solve, the larger the value of
$R$. For illustration, we use simple continuation to compute the solution for three different values of
$R$ (
$={10}^{6},{10}^{8},{10}^{10}$). However, this problem can be addressed directly for the largest value of
$R$ considered here. Instead of the values suggested in
Section 5 in D02TXF for
NMESH,
IPMESH and
MESH in the call to
D02TXF prior to a continuation call, we use every point of the final mesh for the solution of the first value of
$R$, that is we must modify the contents of
IPMESH. For illustrative purposes we wish to control the computed error in
${f}^{\prime}$ and so recast the equations as
subject to the boundary conditions
For the symmetric boundary conditions considered, there exists an odd solution about
$x=0.5$. Hence, to satisfy the boundary conditions, we use the following initial approximations to the solution in
GUESS:
10.1 Program Text
Program Text (d02tkfe.f90)
10.2 Program Data
Program Data (d02tkfe.d)
10.3 Program Results
Program Results (d02tkfe.r)