NAG Library Function Document

1Purpose

nag_pde_interp_1d_fd (d03pzc) 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 nag_pde_parab_1d_fd (d03pcc), nag_pde_parab_1d_fd_ode (d03phc) or nag_pde_parab_1d_fd_ode_remesh (d03ppc), or one of the Keller box schemes nag_pde_parab_1d_keller (d03pec), nag_pde_parab_1d_keller_ode (d03pkc) or nag_pde_parab_1d_keller_ode_remesh (d03prc).

2Specification

 #include #include
 void nag_pde_interp_1d_fd (Integer npde, Integer m, const double u[], Integer npts, const double x[], const double xp[], Integer intpts, Integer itype, double up[], NagError *fail)

3Description

nag_pde_interp_1d_fd (d03pzc) is an interpolation function 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. nag_pde_interp_1d_fd (d03pzc) 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.

5Arguments

Note: the arguments x, m, u, npts and npde must be supplied unchanged from the PDE function.
1:    $\mathbf{npde}$IntegerInput
On entry: the number of PDEs.
Constraint: ${\mathbf{npde}}\ge 1$.
2:    $\mathbf{m}$IntegerInput
On entry: the coordinate system used. If the call to nag_pde_interp_1d_fd (d03pzc) follows one of the finite difference functions then m must be the same argument 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 nag_pde_interp_1d_fd (d03pzc) 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 function;
• ${\mathbf{m}}=0$ following a Keller box scheme function.
3:    $\mathbf{u}\left[{\mathbf{npde}}×{\mathbf{npts}}\right]$const doubleInput
Note: the $\left(i,j\right)$th element of the matrix $U$ is stored in ${\mathbf{u}}\left[\left(j-1\right)×{\mathbf{npde}}+i-1\right]$.
On entry: the PDE part of the original solution returned in the argument u by the PDE function.
Constraint: ${\mathbf{npde}}\ge 1$.
4:    $\mathbf{npts}$IntegerInput
On entry: the number of mesh points.
Constraint: ${\mathbf{npts}}\ge 3$.
5:    $\mathbf{x}\left[{\mathbf{npts}}\right]$const doubleInput
On entry: ${\mathbf{x}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{npts}}$, must contain the mesh points as used by the PDE function.
6:    $\mathbf{xp}\left[{\mathbf{intpts}}\right]$const doubleInput
On entry: ${\mathbf{xp}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{intpts}}$, must contain the spatial interpolation points.
Constraint: ${\mathbf{x}}\left[0\right]\le {\mathbf{xp}}\left[0\right]<{\mathbf{xp}}\left[1\right]<\cdots <{\mathbf{xp}}\left[{\mathbf{intpts}}-1\right]\le {\mathbf{x}}\left[{\mathbf{npts}}-1\right]$.
7:    $\mathbf{intpts}$IntegerInput
On entry: the number of interpolation points.
Constraint: ${\mathbf{intpts}}\ge 1$.
8:    $\mathbf{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:    $\mathbf{up}\left[\mathit{dim}\right]$doubleOutput
Note: the dimension, dim, of the array up must be at least ${\mathbf{npde}}×{\mathbf{intpts}}×{\mathbf{itype}}$.
The element ${\mathbf{UP}}\left(i,j,k\right)$ is stored in the array element ${\mathbf{up}}\left[\left(k-1\right)×{\mathbf{npde}}×{\mathbf{intpts}}+\left(j-1\right)×{\mathbf{npde}}+i-1\right]$.
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}-1\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:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_EXTRAPOLATION
On entry, interpolating point $〈\mathit{\text{value}}〉$ with the value $〈\mathit{\text{value}}〉$ is outside the x range.
NE_INT
On entry, ${\mathbf{intpts}}\le 0$: ${\mathbf{intpts}}=〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{itype}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{itype}}=1$ or $2$.
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}=0$, $1$ or $2$.
On entry, ${\mathbf{npde}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npde}}>0$.
On entry, ${\mathbf{npts}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npts}}>2$.
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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_NOT_STRICTLY_INCREASING
On entry, interpolation points xp badly ordered: $\mathit{I}=〈\mathit{\text{value}}〉$, ${\mathbf{xp}}\left[\mathit{I}-1\right]=〈\mathit{\text{value}}〉$, $\mathit{J}=〈\mathit{\text{value}}〉$ and ${\mathbf{xp}}\left[\mathit{J}-1\right]=〈\mathit{\text{value}}〉$.
On entry, mesh points x badly ordered: $\mathit{I}=〈\mathit{\text{value}}〉$, ${\mathbf{x}}\left[\mathit{I}-1\right]=〈\mathit{\text{value}}〉$, $\mathit{J}=〈\mathit{\text{value}}〉$ and ${\mathbf{x}}\left[\mathit{J}-1\right]=〈\mathit{\text{value}}〉$.

7Accuracy

See the PDE function documents.

8Parallelism and Performance

nag_pde_interp_1d_fd (d03pzc) is not threaded in any implementation.