NAG AD Library
d03pp_a1w_f (dim1_parab_remesh_fd_a1w)

Note: a1w denotes that first order adjoints are computed in working precision; this has the corresponding argument type nagad_a1w_w_rtype. Also available is the t1w (first order tangent linear) mode, the interface of which is implied by replacing a1w by t1w throughout this document. Additionally, the p0w (passive interface, as alternative to the FL interface) mode is available and can be inferred by replacing of active types by the corresponding passive types. The method of codifying AD implementations in the routine name and corresponding argument types is described in the NAG AD Library Introduction.
Settings help

AD Name Style:


AD Specification Language:

1 Purpose

d03pp_a1w_f is the adjoint version of the primal routine d03ppf.

2 Specification

Fortran Interface
Integer, Intent (In) :: npde, m, npts, nv, nxi, neqn, itol, nxfix, nrmesh, ipminf, lrsave, lisave, itask, itrace
Integer, Intent (Inout) :: isave(lisave), ind, iuser(*), iwsav(505), ifail
Type (nagad_a1w_w_rtype), Intent (In) :: tout, xi(nxi), rtol(*), atol(*), algopt(30), xfix(nxfix), dxmesh, trmesh, xratio, con
Type (nagad_a1w_w_rtype), Intent (Inout) :: ts, u(neqn), x(npts), rsave(lrsave), ruser(*), rwsav(1100)
Logical, Intent (In) :: remesh
Logical, Intent (Inout) :: lwsav(100)
Character (1), Intent (In) :: norm, laopt
Character (80), Intent (Inout) :: cwsav(10)
Type (c_ptr), Intent (Inout) :: ad_handle
External :: pdedef, bndary, uvinit, odedef, monitf
C++ Header Interface
#include <nagad.h>
void d03pp_a1w_f_ ( void *&ad_handle, const Integer &npde, const Integer &m, nagad_a1w_w_rtype &ts, const nagad_a1w_w_rtype &tout,
void (NAG_CALL pdedef)(void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const nagad_a1w_w_rtype &x, const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype ux[], const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], nagad_a1w_w_rtype p[], nagad_a1w_w_rtype q[], nagad_a1w_w_rtype r[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[]),
void (NAG_CALL bndary)(void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype ux[], const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], const Integer &ibnd, nagad_a1w_w_rtype beta[], nagad_a1w_w_rtype gamma[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[]),
void (NAG_CALL uvinit)(void *&ad_handle, const Integer &npde, const Integer &npts, const Integer &nxi, const nagad_a1w_w_rtype x[], const nagad_a1w_w_rtype xi[], nagad_a1w_w_rtype u[], const Integer &nv, nagad_a1w_w_rtype v[], Integer iuser[], nagad_a1w_w_rtype ruser[]),
nagad_a1w_w_rtype u[], const Integer &npts, nagad_a1w_w_rtype x[], const Integer &nv,
void (NAG_CALL odedef)(void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], const Integer &nxi, const nagad_a1w_w_rtype xi[], const nagad_a1w_w_rtype ucp[], const nagad_a1w_w_rtype ucpx[], const nagad_a1w_w_rtype rcp[], const nagad_a1w_w_rtype ucpt[], const nagad_a1w_w_rtype ucptx[], nagad_a1w_w_rtype f[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[]),
const Integer &nxi, const nagad_a1w_w_rtype xi[], const Integer &neqn, const nagad_a1w_w_rtype rtol[], const nagad_a1w_w_rtype atol[], const Integer &itol, const char *norm, const char *laopt, const nagad_a1w_w_rtype algopt[], const logical &remesh, const Integer &nxfix, const nagad_a1w_w_rtype xfix[], const Integer &nrmesh, const nagad_a1w_w_rtype &dxmesh, const nagad_a1w_w_rtype &trmesh, const Integer &ipminf, const nagad_a1w_w_rtype &xratio, const nagad_a1w_w_rtype &con,
void (NAG_CALL monitf)(void *&ad_handle, const nagad_a1w_w_rtype &t, const Integer &npts, const Integer &npde, const nagad_a1w_w_rtype x[], const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype r[], nagad_a1w_w_rtype fmon[], Integer iuser[], nagad_a1w_w_rtype ruser[]),
nagad_a1w_w_rtype rsave[], const Integer &lrsave, Integer isave[], const Integer &lisave, const Integer &itask, const Integer &itrace, Integer &ind, char *cwsav[], logical lwsav[], Integer iwsav[], nagad_a1w_w_rtype rwsav[], Integer iuser[], nagad_a1w_w_rtype ruser[], Integer &ifail, const Charlen length_norm, const Charlen length_laopt, const Charlen length_cwsav)
The routine may be called by the names d03pp_a1w_f or nagf_pde_dim1_parab_remesh_fd_a1w. The corresponding t1w and p0w variants of this routine are also available.

3 Description

d03pp_a1w_f is the adjoint version of the primal routine d03ppf.
d03ppf integrates a system of linear or nonlinear parabolic partial differential equations (PDEs) in one space variable, with scope for coupled ordinary differential equations (ODEs), and automatic adaptive spatial remeshing. The spatial discretization is performed using finite differences, and the method of lines is employed to reduce the PDEs to a system of ODEs. The resulting system is solved using a Backward Differentiation Formula (BDF) method or a Theta method (switching between Newton's method and functional iteration). For further information see Section 3 in the documentation for d03ppf.

4 References

Berzins M (1990) Developments in the NAG Library software for parabolic equations Scientific Software Systems (eds J C Mason and M G Cox) 59–72 Chapman and Hall
Berzins M, Dew P M and Furzeland R M (1989) Developing software for time-dependent problems using the method of lines and differential-algebraic integrators Appl. Numer. Math. 5 375–397
Berzins M and Furzeland R M (1992) An adaptive theta method for the solution of stiff and nonstiff differential equations Appl. Numer. Math. 9 1–19
Furzeland R M (1984) The construction of adaptive space meshes TNER.85.022 Thornton Research Centre, Chester
Skeel R D and Berzins M (1990) A method for the spatial discretization of parabolic equations in one space variable SIAM J. Sci. Statist. Comput. 11(1) 1–32

5 Arguments

In addition to the arguments present in the interface of the primal routine, d03pp_a1w_f includes some arguments specific to AD.
A brief summary of the AD specific arguments is given below. For the remainder, links are provided to the corresponding argument from the primal routine. A tooltip popup for all arguments can be found by hovering over the argument name in Section 2 and in this section.
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object, as created by x10aa_a1w_f.
2: npde – Integer Input
3: m – Integer Input
4: tsType (nagad_a1w_w_rtype) Input/Output
5: toutType (nagad_a1w_w_rtype) Input
6: pdedef – Subroutine External Procedure
The specification of pdedef is:
Fortran Interface
Subroutine pdedef ( ad_handle, npde, t, x, u, ux, nv, v, vdot, p, q, r, ires, iuser, ruser)
Integer, Intent (In) :: npde, nv
Integer, Intent (Inout) :: ires, iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: t, x, u(npde), ux(npde), v(nv), vdot(nv)
Type (nagad_a1w_w_rtype), Intent (Inout) :: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: p(npde,npde), q(npde), r(npde)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void pdedef ( void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const nagad_a1w_w_rtype &x, const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype ux[], const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], nagad_a1w_w_rtype p[], nagad_a1w_w_rtype q[], nagad_a1w_w_rtype r[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: npde – Integer Input
3: tType (nagad_a1w_w_rtype) Input
4: xType (nagad_a1w_w_rtype) Input
5: uType (nagad_a1w_w_rtype) array Input
6: uxType (nagad_a1w_w_rtype) array Input
7: nv – Integer Input
8: vType (nagad_a1w_w_rtype) array Input
9: vdotType (nagad_a1w_w_rtype) array Input
10: pType (nagad_a1w_w_rtype) array Output
11: qType (nagad_a1w_w_rtype) array Output
12: rType (nagad_a1w_w_rtype) array Output
13: ires – Integer Input/Output
14: iuser(*) – Integer array User Workspace
15: ruser(*)Type (nagad_a1w_w_rtype) array User Workspace
7: bndary – Subroutine External Procedure
The specification of bndary is:
Fortran Interface
Subroutine bndary ( ad_handle, npde, t, u, ux, nv, v, vdot, ibnd, beta, gamma, ires, iuser, ruser)
Integer, Intent (In) :: npde, nv, ibnd
Integer, Intent (Inout) :: ires, iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: t, u(npde), ux(npde), v(nv), vdot(nv)
Type (nagad_a1w_w_rtype), Intent (Inout) :: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: beta(npde), gamma(npde)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void bndary ( void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype ux[], const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], const Integer &ibnd, nagad_a1w_w_rtype beta[], nagad_a1w_w_rtype gamma[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: npde – Integer Input
3: tType (nagad_a1w_w_rtype) Input
4: uType (nagad_a1w_w_rtype) array Input
5: uxType (nagad_a1w_w_rtype) array Input
6: nv – Integer Input
7: vType (nagad_a1w_w_rtype) array Input
8: vdotType (nagad_a1w_w_rtype) array Input
9: ibnd – Integer Input
10: betaType (nagad_a1w_w_rtype) array Output
11: gammaType (nagad_a1w_w_rtype) array Output
12: ires – Integer Input/Output
13: iuser(*) – Integer array User Workspace
14: ruser(*)Type (nagad_a1w_w_rtype) array User Workspace
8: uvinit – Subroutine External Procedure
The specification of uvinit is:
Fortran Interface
Subroutine uvinit ( ad_handle, npde, npts, nxi, x, xi, u, nv, v, iuser, ruser)
Integer, Intent (In) :: npde, npts, nxi, nv
Integer, Intent (Inout) :: iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: x(npts), xi(nxi)
Type (nagad_a1w_w_rtype), Intent (Inout) :: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: u(npde,npts), v(nv)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void uvinit ( void *&ad_handle, const Integer &npde, const Integer &npts, const Integer &nxi, const nagad_a1w_w_rtype x[], const nagad_a1w_w_rtype xi[], nagad_a1w_w_rtype u[], const Integer &nv, nagad_a1w_w_rtype v[], Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: npde – Integer Input
3: npts – Integer Input
4: nxi – Integer Input
5: xType (nagad_a1w_w_rtype) array Input
6: xiType (nagad_a1w_w_rtype) array Input
7: uType (nagad_a1w_w_rtype) array Output
8: nv – Integer Input
9: vType (nagad_a1w_w_rtype) array Output
10: iuser(*) – Integer array User Workspace
11: ruser(*)Type (nagad_a1w_w_rtype) array User Workspace
9: u(neqn) – Type (nagad_a1w_w_rtype) array Input/Output
10: npts – Integer Input
11: x(npts) – Type (nagad_a1w_w_rtype) array Input/Output
12: nv – Integer Input
13: odedef – Subroutine External Procedure
The specification of odedef is:
Fortran Interface
Subroutine odedef ( ad_handle, npde, t, nv, v, vdot, nxi, xi, ucp, ucpx, rcp, ucpt, ucptx, f, ires, iuser, ruser)
Integer, Intent (In) :: npde, nv, nxi
Integer, Intent (Inout) :: ires, iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: t, v(nv), vdot(nv), xi(nxi), ucp(npde,nxi), ucpx(npde,nxi), rcp(npde,nxi), ucpt(npde,nxi), ucptx(npde,nxi)
Type (nagad_a1w_w_rtype), Intent (Inout) :: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: f(nv)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void odedef ( void *&ad_handle, const Integer &npde, const nagad_a1w_w_rtype &t, const Integer &nv, const nagad_a1w_w_rtype v[], const nagad_a1w_w_rtype vdot[], const Integer &nxi, const nagad_a1w_w_rtype xi[], const nagad_a1w_w_rtype ucp[], const nagad_a1w_w_rtype ucpx[], const nagad_a1w_w_rtype rcp[], const nagad_a1w_w_rtype ucpt[], const nagad_a1w_w_rtype ucptx[], nagad_a1w_w_rtype f[], Integer &ires, Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: npde – Integer Input
3: tType (nagad_a1w_w_rtype) Input
4: nv – Integer Input
5: vType (nagad_a1w_w_rtype) array Input
6: vdotType (nagad_a1w_w_rtype) array Input
7: nxi – Integer Input
8: xiType (nagad_a1w_w_rtype) array Input
9: ucpType (nagad_a1w_w_rtype) array Input
10: ucpxType (nagad_a1w_w_rtype) array Input
11: rcpType (nagad_a1w_w_rtype) array Input
12: ucptType (nagad_a1w_w_rtype) array Input
13: ucptxType (nagad_a1w_w_rtype) array Input
14: fType (nagad_a1w_w_rtype) array Output
15: ires – Integer Input/Output
16: iuser(*) – Integer array User Workspace
17: ruser(*)Type (nagad_a1w_w_rtype) array User Workspace
14: nxi – Integer Input
15: xi(nxi) – Type (nagad_a1w_w_rtype) array Input
16: neqn – Integer Input
17: rtol(*) – Type (nagad_a1w_w_rtype) array Input
18: atol(*) – Type (nagad_a1w_w_rtype) array Input
19: itol – Integer Input
20: norm – character Input
21: laopt – character Input
22: algopt(30) – Type (nagad_a1w_w_rtype) array Input
23: remesh – logical Input
24: nxfix – Integer Input
25: xfix(nxfix) – Type (nagad_a1w_w_rtype) array Input
26: nrmesh – Integer Input
27: dxmeshType (nagad_a1w_w_rtype) Input
28: trmeshType (nagad_a1w_w_rtype) Input
29: ipminf – Integer Input
30: xratioType (nagad_a1w_w_rtype) Input
31: conType (nagad_a1w_w_rtype) Input
32: monitf – Subroutine External Procedure
The specification of monitf is:
Fortran Interface
Subroutine monitf ( ad_handle, t, npts, npde, x, u, r, fmon, iuser, ruser)
Integer, Intent (In) :: npts, npde
Integer, Intent (Inout) :: iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: t, x(npts), u(npde,npts), r(npde,npts)
Type (nagad_a1w_w_rtype), Intent (Inout) :: ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: fmon(npts)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void monitf ( void *&ad_handle, const nagad_a1w_w_rtype &t, const Integer &npts, const Integer &npde, const nagad_a1w_w_rtype x[], const nagad_a1w_w_rtype u[], const nagad_a1w_w_rtype r[], nagad_a1w_w_rtype fmon[], Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: tType (nagad_a1w_w_rtype) Input
3: npts – Integer Input
4: npde – Integer Input
5: xType (nagad_a1w_w_rtype) array Input
6: uType (nagad_a1w_w_rtype) array Input
7: rType (nagad_a1w_w_rtype) array Input
8: fmonType (nagad_a1w_w_rtype) array Output
9: iuser(*) – Integer array User Workspace
10: ruser(*)Type (nagad_a1w_w_rtype) array User Workspace
33: rsave(lrsave) – Type (nagad_a1w_w_rtype) array Communication Array
34: lrsave – Integer Input
35: isave(lisave) – Integer array Communication Array
36: lisave – Integer Input
37: itask – Integer Input
38: itrace – Integer Input
39: ind – Integer Input/Output
40: cwsav(10) – character array Communication Array
If ind = 0, cwsav, lwsav, iwsav and rwsav need not be set on entry.
41: lwsav(100) – logical array Communication Array
If ind = 0, cwsav, lwsav, iwsav and rwsav need not be set on entry.
42: iwsav(505) – Integer array Communication Array
If ind = 0, cwsav, lwsav, iwsav and rwsav need not be set on entry.
43: rwsav(1100) – Type (nagad_a1w_w_rtype) array Communication Array
If ind = 0, cwsav, lwsav, iwsav and rwsav need not be set on entry.
44: iuser(*) – Integer array User Workspace
User workspace.
45: ruser(*) – Type (nagad_a1w_w_rtype) array User Workspace
User workspace.
46: ifail – Integer Input/Output

6 Error Indicators and Warnings

d03pp_a1w_f preserves all error codes from d03ppf and in addition can return:
ifail=-89
An unexpected AD error has been triggered by this routine. Please contact NAG.
See Section 4.8.2 in the NAG AD Library Introduction for further information.
ifail=-899
Dynamic memory allocation failed for AD.
See Section 4.8.1 in the NAG AD Library Introduction for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

d03pp_a1w_f is not threaded in any implementation.

9 Further Comments

None.

10 Example

The following examples are variants of the example for d03ppf, modified to demonstrate calling the NAG AD Library.

10.1 Adjoint mode (a1w)

LanguageSource FileDataResults
Fortrand03pp_a1w_fe.f90d03pp_a1w_fe.dd03pp_a1w_fe.r

10.2 Tangent mode (t1w)

LanguageSource FileDataResults
Fortrand03pp_t1w_fe.f90d03pp_t1w_fe.dd03pp_t1w_fe.r

10.3 Passive mode (p0w)

LanguageSource FileDataResults
Fortrand03pp_p0w_fe.f90d03pp_p0w_fe.dd03pp_p0w_fe.r