NAG FL Interface
d02uef (bvp_​ps_​lin_​solve)

1 Purpose

d02uef finds the solution of a linear constant coefficient boundary value problem by using the Chebyshev integration formulation on a Chebyshev Gauss–Lobatto grid.

2 Specification

Fortran Interface
Subroutine d02uef ( n, a, b, m, c, bmat, y, bvec, f, uc, resid, ifail)
Integer, Intent (In) :: n, m
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: a, b, c(n+1), y(m), bvec(m)
Real (Kind=nag_wp), Intent (Inout) :: bmat(m,m+1), f(m+1)
Real (Kind=nag_wp), Intent (Out) :: uc(n+1,m+1), resid
C Header Interface
#include <nag.h>
void  d02uef_ (const Integer *n, const double *a, const double *b, const Integer *m, const double c[], double bmat[], const double y[], const double bvec[], double f[], double uc[], double *resid, Integer *ifail)
The routine may be called by the names d02uef or nagf_ode_bvp_ps_lin_solve.

3 Description

d02uef solves the constant linear coefficient ordinary differential problem
j=0 m fj+1 dju dxj = fx ,  x a,b  
subject to a set of m linear constraints at points yia,b , for i=1,2,,m:
j=0 m B i,j+1 dju dxj x=yi = βi ,  
where 1m4, B is an m×m+1 matrix of constant coefficients and βi are constants. The points yi are usually either a or b.
The function fx is supplied as an array of Chebyshev coefficients cj, j=0,1,,n for the function discretized on n+1 Chebyshev Gauss–Lobatto points (as returned by d02ucf); the coefficients are normally obtained by a previous call to d02uaf. The solution and its derivatives (up to order m) are returned, in the form of their Chebyshev series representation, as arrays of Chebyshev coefficients; subsequent calls to d02ubf will return the corresponding function and derivative values at the Chebyshev Gauss–Lobatto discretization points on a,b. Function and derivative values can be obtained on any uniform grid over the same range a,b by calling the interpolation routine d02uwf.

4 References

Clenshaw C W (1957) The numerical solution of linear differential equations in Chebyshev series Proc. Camb. Phil. Soc. 53 134–149
Coutsias E A, Hagstrom T and Torres D (1996) An efficient spectral method for ordinary differential equations with rational function coefficients Mathematics of Computation 65(214) 611–635
Greengard L (1991) Spectral integration and two-point boundary value problems SIAM J. Numer. Anal. 28(4) 1071–80
Lundbladh A, Hennigson D S and Johannson A V (1992) An efficient spectral integration method for the solution of the Navier–Stokes equations Technical report FFA–TN 1992–28 Aeronautical Research Institute of Sweden
Muite B K (2010) A numerical comparison of Chebyshev methods for solving fourth-order semilinear initial boundary value problems Journal of Computational and Applied Mathematics 234(2) 317–342

5 Arguments

1: n Integer Input
On entry: n, where the number of grid points is n+1.
Constraint: n8 and n is even.
2: a Real (Kind=nag_wp) Input
On entry: a, the lower bound of domain a,b.
Constraint: a<b.
3: b Real (Kind=nag_wp) Input
On entry: b, the upper bound of domain a,b.
Constraint: b>a.
4: m Integer Input
On entry: the order, m, of the boundary value problem to be solved.
Constraint: 1m4.
5: cn+1 Real (Kind=nag_wp) array Input
On entry: the Chebyshev coefficients cj, j=0,1,,n, for the right-hand side of the boundary value problem. Usually these are obtained by a previous call of d02uaf.
6: bmatmm+1 Real (Kind=nag_wp) array Input/Output
On entry: bmatij+1 must contain the coefficients Bi,j+1, for i=1,2,,m and j=0,1,,m, in the problem formulation of Section 3.
On exit: the coefficients have been scaled to form an equivalent problem defined on the domain -1,1.
7: ym Real (Kind=nag_wp) array Input
On entry: the points, yi, for i=1,2,,m, where the boundary conditions are discretized.
8: bvecm Real (Kind=nag_wp) array Input
On entry: the values, βi, for i=1,2,,m, in the formulation of the boundary conditions given in Section 3.
9: fm+1 Real (Kind=nag_wp) array Input/Output
On entry: the coefficients, fj, for j=1,2,,m+1, in the formulation of the linear boundary value problem given in Section 3. The highest order term, fm+1, needs to be nonzero to have a well posed problem.
On exit: the coefficients have been scaled to form an equivalent problem defined on the domain -1,1.
10: ucn+1m+1 Real (Kind=nag_wp) array Output
On exit: the Chebyshev coefficients in the Chebyshev series representations of the solution and derivatives of the solution to the boundary value problem. The n+1 elements uc1:n+11 contain the coefficients representing the solution Uxi, for i=0,1,,n. uc1:n+1j+1 contains the coefficients representing the jth derivative of U, for j=1,2,,m.
11: resid Real (Kind=nag_wp) Output
On exit: the maximum residual resulting from substituting the solution vectors returned in uc into both linear equations of Section 3 representing the linear boundary value problem and associated boundary conditions. That is
max max i=1,m j=0 m B i,j+1 dju dxj x=yi - βi , max i=1, n+1 j=0 m f j+1 dju dxj x=xi - fx .  
12: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, n=value.
Constraint: n is even.
On entry, n=value.
Constraint: n8.
ifail=2
On entry, a=value and b=value.
Constraint: a<b.
ifail=3
On entry, fm+1=0.0.
ifail=6
On entry, m=value.
Constraint: 1m4.
ifail=7
Internal error while unpacking matrix during iterative refinement.
Please contact NAG.
ifail=8
Singular matrix encountered during iterative refinement.
Please check that your system is well posed.
ifail=9
During iterative refinement, the maximum number of iterations was reached.
Number of iterations=value and residual achieved=value.
ifail=10
During iterative refinement, convergence was achieved, but the residual is more than 100×machine precision. Residual achieved on convergence=value.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

The accuracy should be close to machine precision for well conditioned boundary value problems.

8 Parallelism and Performance

d02uef is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
d02uef 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 implementation-specific information.

9 Further Comments

The number of operations is of the order n logn and the memory requirements are On; thus the computation remains efficient and practical for very fine discretizations (very large values of n). Collocation methods will be faster for small problems, but the method of d02uef should be faster for larger discretizations.

10 Example

This example solves the third-order problem 4Uxxx + 3Uxx + 2Ux + U = 2sinx - 2cosx on -π/2,π/2 subject to the boundary conditions U -π/2 = 0 , 3Uxx -π/2 + 2Ux -π/2 + U -π/2 =2, and 3Uxx π/2 + 2Ux π/2 + U π/2 =-2 using the Chebyshev integration formulation on a Chebyshev Gauss–Lobatto grid of order 16.

10.1 Program Text

Program Text (d02uefe.f90)

10.2 Program Data

Program Data (d02uefe.d)

10.3 Program Results

Program Results (d02uefe.r)