hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_pde_1d_parab_fd_interp (d03pz)

Purpose

nag_pde_1d_parab_fd_interp (d03pz) 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_1d_parab_fd (d03pc), nag_pde_1d_parab_dae_fd (d03ph) or nag_pde_1d_parab_remesh_fd (d03pp), or one of the Keller box schemes nag_pde_1d_parab_keller (d03pe), nag_pde_1d_parab_dae_keller (d03pk) or nag_pde_1d_parab_remesh_keller (d03pr).

Syntax

[up, ifail] = d03pz(m, u, x, xp, itype, 'npde', npde, 'npts', npts, 'intpts', intpts)
[up, ifail] = nag_pde_1d_parab_fd_interp(m, u, x, xp, itype, 'npde', npde, 'npts', npts, 'intpts', intpts)

Description

nag_pde_1d_parab_fd_interp (d03pz) 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_1d_parab_fd_interp (d03pz) 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.

References

None.

Parameters

Note: the parameters x, m, u, npts and npde must be supplied unchanged from the PDE function.

Compulsory Input Parameters

1:     m – int64int32nag_int scalar
The coordinate system used. If the call to nag_pde_1d_parab_fd_interp (d03pz) follows one of the finite difference functions 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 nag_pde_1d_parab_fd_interp (d03pz) in this case.
m = 0m=0
Indicates Cartesian coordinates.
m = 1m=1
Indicates cylindrical polar coordinates.
m = 2m=2
Indicates spherical polar coordinates.
Constraints:
  • 0m20m2 following a finite difference function;
  • m = 0m=0 following a Keller box scheme function.
2:     u(npde,npts) – double array
npde, the first dimension of the array, must satisfy the constraint npde1npde1.
The PDE part of the original solution returned in the parameter u by the PDE function.
Constraint: npde1npde1.
3:     x(npts) – double array
npts, the dimension of the array, must satisfy the constraint npts3npts3.
x(i)xi, for i = 1,2,,nptsi=1,2,,npts, must contain the mesh points as used by the PDE function.
4:     xp(intpts) – double array
intpts, the dimension of the array, must satisfy the constraint intpts1intpts1.
xp(i)xpi, for i = 1,2,,intptsi=1,2,,intpts, must contain the spatial interpolation points.
Constraint: x(1)xp(1) < xp(2) < < xp(intpts)x(npts)x1xp1<xp2<<xpintptsxnpts.
5:     itype – int64int32nag_int scalar
Specifies the interpolation to be performed.
itype = 1itype=1
The solutions at the interpolation points are computed.
itype = 2itype=2
Both the solutions and their first derivatives at the interpolation points are computed.
Constraint: itype = 1itype=1 or 22.

Optional Input Parameters

1:     npde – int64int32nag_int scalar
Default: The first dimension of the array u.
The number of PDEs.
Constraint: npde1npde1.
2:     npts – int64int32nag_int scalar
Default: The dimension of the array x and the second dimension of the array u. (An error is raised if these dimensions are not equal.)
The number of mesh points.
Constraint: npts3npts3.
3:     intpts – int64int32nag_int scalar
Default: The dimension of the array xp.
The number of interpolation points.
Constraint: intpts1intpts1.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     up(npde,intpts,itype) – double array
If itype = 1itype=1, up(i,j,1)upij1, contains the value of the solution Ui(xj,tout)Ui(xj,tout), at the interpolation points xj = xp(j)xj=xpj, for j = 1,2,,intptsj=1,2,,intpts and i = 1,2,,npdei=1,2,,npde.
If itype = 2itype=2, up(i,j,1)upij1 contains Ui(xj,tout)Ui(xj,tout) and up(i,j,2)upij2 contains (Ui)/(x) Ui x at these points.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,itype1itype1 or 22,
orintpts < 1intpts<1,
ornpde < 1npde<1,
ornpts < 3npts<3,
orm0m0, 11 or 22,
or the mesh points x(i)xi, for i = 1,2,,nptsi=1,2,,npts, are not in strictly increasing order.
  ifail = 2ifail=2
On entry, the interpolation points xp(i)xpi, for i = 1,2,,intptsi=1,2,,intpts, are not in strictly increasing order.
  ifail = 3ifail=3
You are attempting extrapolation, that is, one of the interpolation points xp(i)xpi, for some ii, lies outside the interval [x(1),x(npts)x1,xnpts]. Extrapolation is not permitted.

Accuracy

See the PDE function documents.

Further Comments

None.

Example

function nag_pde_1d_parab_fd_interp_example
m = int64(1);
u = [0, 0.1760021889329504, 0.3341579089708593, 0.4937980719530722, ...
    0.6511403366936832, 0.8044807535486175, 0.9525489765885864, ...
    1.09423368983943, 1.228514538086573, 1.35444287807973, ...
    1.471137345520289, 1.577784110954285, 1.673622501349812, ...
    1.757611424145824, 1.825804783497759, 1.867752956803207, ...
    1.878359678117952, 1.868385424753035, 1.854505240663775, ...
    1.84852820454846;
     0.9997119383379945, 0.9996043818707437, 0.9995887346960896, ...
    0.9995733176158295, 0.9995516033644839, 0.9995217547212679, ...
    0.9994816709262737, 0.999428326601514, 0.9993571885011239, ...
    0.9992612549235844, 0.9991292197833584, 0.9989381167530054, ...
    0.9984790503092739, 0.9936254861425254, 0.9449226608879052, ...
    0.7493216873033168, 0.4582225956678795, 0.2084439018937778, ...
    0.05247378844653194, 0];
x = [0;
     0.08257934547233232;
     0.1645945902807339;
     0.2454854871407991;
     0.3246994692046835;
     0.4016954246529694;
     0.4759473930370735;
     0.5469481581224268;
     0.6142127126896678;
     0.6772815716257411;
     0.7357239106731316;
     0.7891405093963936;
     0.8371664782625285;
     0.879473751206489;
     0.9157733266550574;
     0.9458172417006346;
     0.9694002659393304;
     0.9863613034027223;
     0.9965844930066698;
     1];
xp = [0;
     0.4;
     0.6;
     0.8;
     0.9;
     1];
itype = int64(1);
[up, ifail] = nag_pde_1d_parab_fd_interp(m, u, x, xp, itype)
 

up =

         0    0.8008    1.1988    1.5990    1.7958    1.8485
    0.9997    0.9995    0.9994    0.9988    0.9663   -0.0000


ifail =

                    0


function d03pz_example
m = int64(1);
u = [0, 0.1760021889329504, 0.3341579089708593, 0.4937980719530722, ...
    0.6511403366936832, 0.8044807535486175, 0.9525489765885864, ...
    1.09423368983943, 1.228514538086573, 1.35444287807973, ...
    1.471137345520289, 1.577784110954285, 1.673622501349812, ...
    1.757611424145824, 1.825804783497759, 1.867752956803207, ...
    1.878359678117952, 1.868385424753035, 1.854505240663775, ...
    1.84852820454846;
     0.9997119383379945, 0.9996043818707437, 0.9995887346960896, ...
    0.9995733176158295, 0.9995516033644839, 0.9995217547212679, ...
    0.9994816709262737, 0.999428326601514, 0.9993571885011239, ...
    0.9992612549235844, 0.9991292197833584, 0.9989381167530054, ...
    0.9984790503092739, 0.9936254861425254, 0.9449226608879052, ...
    0.7493216873033168, 0.4582225956678795, 0.2084439018937778, ...
    0.05247378844653194, 0];
x = [0;
     0.08257934547233232;
     0.1645945902807339;
     0.2454854871407991;
     0.3246994692046835;
     0.4016954246529694;
     0.4759473930370735;
     0.5469481581224268;
     0.6142127126896678;
     0.6772815716257411;
     0.7357239106731316;
     0.7891405093963936;
     0.8371664782625285;
     0.879473751206489;
     0.9157733266550574;
     0.9458172417006346;
     0.9694002659393304;
     0.9863613034027223;
     0.9965844930066698;
     1];
xp = [0;
     0.4;
     0.6;
     0.8;
     0.9;
     1];
itype = int64(1);
[up, ifail] = d03pz(m, u, x, xp, itype)
 

up =

         0    0.8008    1.1988    1.5990    1.7958    1.8485
    0.9997    0.9995    0.9994    0.9988    0.9663   -0.0000


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013