D03 Chapter Contents
D03 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD03PZF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

D03PZF interpolates in the spatial coordinate the solution and derivative of a system of partial differential equations (PDEs). The solution must first be computed using one of the finite difference schemes D03PCF/D03PCA, D03PHF/D03PHA or D03PPF/D03PPA, or one of the Keller box schemes D03PEF, D03PKF or D03PRF.

## 2  Specification

 SUBROUTINE D03PZF ( NPDE, M, U, NPTS, X, XP, INTPTS, ITYPE, UP, IFAIL)
 INTEGER NPDE, M, NPTS, INTPTS, ITYPE, IFAIL REAL (KIND=nag_wp) U(NPDE,NPTS), X(NPTS), XP(INTPTS), UP(NPDE,INTPTS,ITYPE)

## 3  Description

D03PZF is an interpolation routine for evaluating the solution of a system of partial differential equations (PDEs), at a set of user-specified points. The solution of the system of equations (possibly with coupled ordinary differential equations) must be computed using a finite difference scheme or a Keller box scheme on a set of mesh points. D03PZF can then be employed to compute the solution at a set of points anywhere in the range of the mesh. It can also evaluate the first spatial derivative of the solution. It uses linear interpolation for approximating the solution.

None.

## 5  Parameters

Note: the parameters X, M, U, NPTS and NPDE must be supplied unchanged from the PDE routine.
1:     NPDE – INTEGERInput
On entry: the number of PDEs.
Constraint: ${\mathbf{NPDE}}\ge 1$.
2:     M – INTEGERInput
On entry: the coordinate system used. If the call to D03PZF follows one of the finite difference routines then M must be the same parameter M as used in that call. For the Keller box scheme only Cartesian coordinate systems are valid and so M must be set to zero. No check will be made by D03PZF in this case.
${\mathbf{M}}=0$
Indicates Cartesian coordinates.
${\mathbf{M}}=1$
Indicates cylindrical polar coordinates.
${\mathbf{M}}=2$
Indicates spherical polar coordinates.
Constraints:
• $0\le {\mathbf{M}}\le 2$ following a finite difference routine;
• ${\mathbf{M}}=0$ following a Keller box scheme routine.
3:     U(NPDE,NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: the PDE part of the original solution returned in the parameter U by the PDE routine.
Constraint: ${\mathbf{NPDE}}\ge 1$.
4:     NPTS – INTEGERInput
On entry: the number of mesh points.
Constraint: ${\mathbf{NPTS}}\ge 3$.
5:     X(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{X}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NPTS}}$, must contain the mesh points as used by the PDE routine.
6:     XP(INTPTS) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{XP}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{INTPTS}}$, must contain the spatial interpolation points.
Constraint: ${\mathbf{X}}\left(1\right)\le {\mathbf{XP}}\left(1\right)<{\mathbf{XP}}\left(2\right)<\cdots <{\mathbf{XP}}\left({\mathbf{INTPTS}}\right)\le {\mathbf{X}}\left({\mathbf{NPTS}}\right)$.
7:     INTPTS – INTEGERInput
On entry: the number of interpolation points.
Constraint: ${\mathbf{INTPTS}}\ge 1$.
8:     ITYPE – INTEGERInput
On entry: specifies the interpolation to be performed.
${\mathbf{ITYPE}}=1$
The solutions at the interpolation points are computed.
${\mathbf{ITYPE}}=2$
Both the solutions and their first derivatives at the interpolation points are computed.
Constraint: ${\mathbf{ITYPE}}=1$ or $2$.
9:     UP(NPDE,INTPTS,ITYPE) – REAL (KIND=nag_wp) arrayOutput
On exit: if ${\mathbf{ITYPE}}=1$, ${\mathbf{UP}}\left(\mathit{i},\mathit{j},1\right)$, contains the value of the solution ${U}_{\mathit{i}}\left({x}_{\mathit{j}},{t}_{\mathrm{out}}\right)$, at the interpolation points ${x}_{\mathit{j}}={\mathbf{XP}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{INTPTS}}$ and $\mathit{i}=1,2,\dots ,{\mathbf{NPDE}}$.
If ${\mathbf{ITYPE}}=2$, ${\mathbf{UP}}\left(\mathit{i},\mathit{j},1\right)$ contains ${U}_{\mathit{i}}\left({x}_{\mathit{j}},{t}_{\mathrm{out}}\right)$ and ${\mathbf{UP}}\left(\mathit{i},\mathit{j},2\right)$ contains $\frac{\partial {U}_{\mathit{i}}}{\partial x}$ at these points.
10:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{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}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{ITYPE}}\ne 1$ or $2$, or ${\mathbf{INTPTS}}<1$, or ${\mathbf{NPDE}}<1$, or ${\mathbf{NPTS}}<3$, or ${\mathbf{M}}\ne 0$, $1$ or $2$, or the mesh points ${\mathbf{X}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NPTS}}$, are not in strictly increasing order.
${\mathbf{IFAIL}}=2$
On entry, the interpolation points ${\mathbf{XP}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{INTPTS}}$, are not in strictly increasing order.
${\mathbf{IFAIL}}=3$
You are attempting extrapolation, that is, one of the interpolation points ${\mathbf{XP}}\left(i\right)$, for some $i$, lies outside the interval [${\mathbf{X}}\left(1\right),{\mathbf{X}}\left({\mathbf{NPTS}}\right)$]. Extrapolation is not permitted.

## 7  Accuracy

See the PDE routine documents.