NAG Library Routine Document
D03RAF
1 Purpose
D03RAF integrates a system of linear or nonlinear, time-dependent partial differential equations (PDEs) in two space dimensions on a rectangular domain. The method of lines is employed to reduce the PDEs to a system of ordinary differential equations (ODEs) which are solved using a backward differentiation formula (BDF) method. The resulting system of nonlinear equations is solved using a modified Newton method and a Bi-CGSTAB iterative linear solver with ILU preconditioning. Local uniform grid refinement is used to improve the accuracy of the solution. D03RAF originates from the VLUGR2 package (see
Blom and Verwer (1993) and
Blom et al. (1996)).
2 Specification
SUBROUTINE D03RAF ( |
NPDE, TS, TOUT, DT, XMIN, XMAX, YMIN, YMAX, NX, NY, TOLS, TOLT, PDEDEF, BNDARY, PDEIV, MONITR, OPTI, OPTR, RWK, LENRWK, IWK, LENIWK, LWK, LENLWK, ITRACE, IND, IFAIL) |
INTEGER |
NPDE, NX, NY, OPTI(4), LENRWK, IWK(LENIWK), LENIWK, LENLWK, ITRACE, IND, IFAIL |
REAL (KIND=nag_wp) |
TS, TOUT, DT(3), XMIN, XMAX, YMIN, YMAX, TOLS, TOLT, OPTR(3,NPDE), RWK(LENRWK) |
LOGICAL |
LWK(LENLWK) |
EXTERNAL |
PDEDEF, BNDARY, PDEIV, MONITR |
|
3 Description
D03RAF integrates the system of PDEs:
for
and
in the rectangular domain
,
, and time interval
, where the vector
is the set of solution values
and
denotes partial differentiation with respect to
, and similarly for
etc.
The functions
must be supplied by you in
PDEDEF. Similarly the initial values of the functions
must be specified at
in
PDEIV.
Note that whilst complete generality is offered by the master equations
(1), D03RAF is not appropriate for all PDEs. In particular, hyperbolic systems should not be solved using this routine. Also, at least one component of
must appear in the system of PDEs.
The boundary conditions must be supplied by you in
BNDARY in the form
for all
when
or
and for all
when
or
and
The domain is covered by a uniform coarse base grid of size
specified by you, and nested finer uniform subgrids are subsequently created in regions with high spatial activity. The refinement is controlled using a space monitor which is computed from the current solution and a user-supplied space tolerance
TOLS. A number of optional parameters, e.g., the maximum number of grid levels at any time, and some weighting factors, can be specified in the arrays
OPTI and
OPTR. Further details of the refinement strategy can be found in
Section 8.
The system of PDEs and the boundary conditions are discretized in space on each grid using a standard second-order finite difference scheme (centred on the internal domain and one-sided at the boundaries), and the resulting system of ODEs is integrated in time using a second-order, two-step, implicit BDF method with variable step size. The time integration is controlled using a time monitor computed at each grid level from the current solution and a user-supplied time tolerance
TOLT, and some further optional user-specified weighting factors held in
OPTR (see
Section 8 for details). The time monitor is used to compute a new step size, subject to restrictions on the size of the change between steps, and (optional) user-specified maximum and minimum step sizes held in
DT. The step size is adjusted so that the remaining integration interval is an integer number times
. In this way a solution is obtained at
.
A modified Newton method is used to solve the nonlinear equations arising from the time integration. You may specify (in
OPTI) the maximum number of Newton iterations to be attempted. A Jacobian matrix is calculated at the beginning of each time step. If the Newton process diverges or the maximum number of iterations is exceeded, a new Jacobian is calculated using the most recent iterates and the Newton process is restarted. If convergence is not achieved after the (optional) user-specified maximum number of new Jacobian evaluations, the time step is retried with
. The linear systems arising from the Newton iteration are solved using a Bi-CGSTAB iterative method, in combination with ILU preconditioning. The maximum number of iterations can be specified by you in
OPTI.
The solution at all grid levels is stored in the workspace arrays, along with other information needed for a restart (i.e., a continuation call). It is not intended that you extract the solution from these arrays, indeed the necessary information regarding these arrays is not included. The user-supplied monitor
MONITR should be used to obtain the solution at particular levels and times.
MONITR is called at the end of every time step, with the last step being identified via the input parameter
TLAST.
Within
PDEIV,
PDEDEF,
BNDARY and
MONITR the data structure is as follows. Each point on a particular grid is given an index (ranging from
to the total number of points on the grid) and all coordinate or solution information is stored in arrays according to this index, e.g.,
and
contain the
- and
coordinate of point
, and
contains the
th solution component
at point
.
Further details of the underlying algorithm can be found in
Section 8 and in
Blom and Verwer (1993) and
Blom et al. (1996) and the references therein.
4 References
Adjerid S and Flaherty J E (1988) A local refinement finite element method for two-dimensional parabolic systems SIAM J. Sci. Statist. Comput. 9 792–811
Blom J G, Trompert R A and Verwer J G (1996) Algorithm 758. VLUGR2: A vectorizable adaptive grid solver for PDEs in 2D Trans. Math. Software 22 302–328
Blom J G and Verwer J G (1993) VLUGR2: A vectorized local uniform grid refinement code for PDEs in 2D Report NM-R9306 CWI, Amsterdam
Brown P N, Hindmarsh A C and Petzold L R (1994) Using Krylov methods in the solution of large scale differential-algebraic systems SIAM J. Sci. Statist. Comput. 15 1467–1488
Trompert R A (1993) Local uniform grid refinement and systems of coupled partial differential equations Appl. Numer. Maths 12 331–355
Trompert R A and Verwer J G (1993) Analysis of the implicit Euler local uniform grid refinement method SIAM J. Sci. Comput. 14 259–278
5 Parameters
- 1: NPDE – INTEGERInput
On entry: the number of PDEs in the system.
Constraint:
.
- 2: TS – REAL (KIND=nag_wp)Input/Output
On entry: the initial value of the independent variable .
On exit: the value of which has been reached. Normally .
Constraint:
.
- 3: TOUT – REAL (KIND=nag_wp)Input
On entry: the final value of to which the integration is to be carried out.
- 4: DT() – REAL (KIND=nag_wp) arrayInput/Output
On entry: the initial, minimum and maximum time step sizes respectively.
- Specifies the initial time step size to be used on the first entry, i.e., when . If then the default value is used. On subsequent entries (), the value of is not referenced.
- Specifies the minimum time step size to be attempted by the integrator. If the default value is used.
- Specifies the maximum time step size to be attempted by the integrator. If the default value is used.
On exit: contains the time step size for the next time step. and are unchanged or set to their default values if zero on entry.
Constraints:
- if , ;
- if and , and , where the values of and will have been reset to their default values if zero on entry;
- .
- 5: XMIN – REAL (KIND=nag_wp)Input
- 6: XMAX – REAL (KIND=nag_wp)Input
On entry: the extents of the rectangular domain in the -direction, i.e., the coordinates of the left and right boundaries respectively.
Constraint:
and
XMAX must be sufficiently distinguishable from
XMIN for the precision of the machine being used.
- 7: YMIN – REAL (KIND=nag_wp)Input
- 8: YMAX – REAL (KIND=nag_wp)Input
On entry: the extents of the rectangular domain in the -direction, i.e., the coordinates of the lower and upper boundaries respectively.
Constraint:
and
YMAX must be sufficiently distinguishable from
YMIN for the precision of the machine being used.
- 9: NX – INTEGERInput
On entry: the number of grid points in the -direction (including the boundary points).
Constraint:
.
- 10: NY – INTEGERInput
On entry: the number of grid points in the -direction (including the boundary points).
Constraint:
.
- 11: TOLS – REAL (KIND=nag_wp)Input
On entry: the space tolerance used in the grid refinement strategy (
in equation
(4)). See
Section 8.2.
Constraint:
.
- 12: TOLT – REAL (KIND=nag_wp)Input
On entry: the time tolerance used to determine the time step size (
in equation
(7)). See
Section 8.3.
Constraint:
.
- 13: PDEDEF – SUBROUTINE, supplied by the user.External Procedure
PDEDEF must evaluate the functions
, for
, in equation
(1) which define the system of PDEs (i.e., the residuals of the resulting ODE system) at all interior points of the domain. Values at points on the boundaries of the domain are ignored and will be overwritten by
BNDARY.
PDEDEF is called for each subgrid in turn.
The specification of
PDEDEF is:
SUBROUTINE PDEDEF ( |
NPTS, NPDE, T, X, Y, U, UT, UX, UY, UXX, UXY, UYY, RES) |
INTEGER |
NPTS, NPDE |
REAL (KIND=nag_wp) |
T, X(NPTS), Y(NPTS), U(NPTS,NPDE), UT(NPTS,NPDE), UX(NPTS,NPDE), UY(NPTS,NPDE), UXX(NPTS,NPDE), UXY(NPTS,NPDE), UYY(NPTS,NPDE), RES(NPTS,NPDE) |
|
- 1: NPTS – INTEGERInput
On entry: the number of grid points in the current grid.
- 2: NPDE – INTEGERInput
On entry: the number of PDEs in the system.
- 3: T – REAL (KIND=nag_wp)Input
On entry: the current value of the independent variable .
- 4: X(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 5: Y(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 6: U(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of the th PDE component at the th grid point, for and .
- 7: UT(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 8: UX(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 9: UY(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 10: UXX(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 11: UXY(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 12: UYY(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 13: RES(NPTS,NPDE) – REAL (KIND=nag_wp) arrayOutput
On exit: must contain the value of , for , at the
th grid point, for , although the residuals at boundary points will be ignored (and overwritten later on) and so they need not be specified here.
PDEDEF must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D03RAF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 14: BNDARY – SUBROUTINE, supplied by the user.External Procedure
BNDARY must evaluate the functions
, for
, in equation
(2) which define the boundary conditions at all boundary points of the domain. Residuals at interior points must
not be altered by this subroutine.
The specification of
BNDARY is:
SUBROUTINE BNDARY ( |
NPTS, NPDE, T, X, Y, U, UT, UX, UY, NBPTS, LBND, RES) |
INTEGER |
NPTS, NPDE, NBPTS, LBND(NBPTS) |
REAL (KIND=nag_wp) |
T, X(NPTS), Y(NPTS), U(NPTS,NPDE), UT(NPTS,NPDE), UX(NPTS,NPDE), UY(NPTS,NPDE), RES(NPTS,NPDE) |
|
- 1: NPTS – INTEGERInput
On entry: the number of grid points in the current grid.
- 2: NPDE – INTEGERInput
On entry: the number of PDEs in the system.
- 3: T – REAL (KIND=nag_wp)Input
On entry: the current value of the independent variable .
- 4: X(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 5: Y(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 6: U(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of the th PDE component at the th grid point, for and .
- 7: UT(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 8: UX(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 9: UY(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: contains the value of for the th PDE component at the th grid point, for and .
- 10: NBPTS – INTEGERInput
On entry: the number of boundary points in the grid.
- 11: LBND(NBPTS) – INTEGER arrayInput
On entry: contains the grid index for the th boundary point, for . Hence the th boundary point has coordinates and , and the corresponding solution values are , etc.
- 12: RES(NPTS,NPDE) – REAL (KIND=nag_wp) arrayInput/Output
On entry:
contains the value of
, for
, at the
th grid point, for
, as returned by
PDEDEF. The residuals at the boundary points will be overwritten and so need not have been set by
PDEDEF.
On exit:
must contain the value of
, for
, at the
th boundary point, for
.
Note: elements of
RES corresponding to interior points must
not be altered.
BNDARY must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D03RAF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 15: PDEIV – SUBROUTINE, supplied by the user.External Procedure
PDEIV must specify the initial values of the PDE components
at all points in the grid.
PDEIV is not referenced if, on entry,
.
The specification of
PDEIV is:
INTEGER |
NPTS, NPDE |
REAL (KIND=nag_wp) |
T, X(NPTS), Y(NPTS), U(NPTS,NPDE) |
|
- 1: NPTS – INTEGERInput
On entry: the number of grid points in the grid.
- 2: NPDE – INTEGERInput
On entry: the number of PDEs in the system.
- 3: T – REAL (KIND=nag_wp)Input
On entry: the (initial) value of the independent variable .
- 4: X(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 5: Y(NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the coordinate of the th grid point, for .
- 6: U(NPTS,NPDE) – REAL (KIND=nag_wp) arrayOutput
On exit: must contain the value of the th PDE component at the th grid point, for and .
PDEIV must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D03RAF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 16: MONITR – SUBROUTINE, supplied by the user.External Procedure
MONITR is called by D03RAF at the end of every successful time step, and may be used to examine or print the solution or perform other tasks such as error calculations, particularly at the final time step, indicated by the parameter
TLAST. The input arguments contain information about the grid and solution at all grid levels used.
MONITR can also be used to force an immediate tidy termination of the solution process and return to the calling program.
The specification of
MONITR is:
SUBROUTINE MONITR ( |
NPDE, T, DT, DTNEW, TLAST, NLEV, NGPTS, XPTS, YPTS, LSOL, SOL, IERR) |
INTEGER |
NPDE, NLEV, NGPTS(NLEV), LSOL(NLEV), IERR |
REAL (KIND=nag_wp) |
T, DT, DTNEW, XPTS(*), YPTS(*), SOL(*) |
LOGICAL |
TLAST |
|
- 1: NPDE – INTEGERInput
On entry: the number of PDEs in the system.
- 2: T – REAL (KIND=nag_wp)Input
On entry: the current value of the independent variable , i.e., the time at the end of the integration step just completed.
- 3: DT – REAL (KIND=nag_wp)Input
On entry: the current time step size , i.e., the time step size used for the integration step just completed.
- 4: DTNEW – REAL (KIND=nag_wp)Input
On entry: the step size that will be used for the next time step.
- 5: TLAST – LOGICALInput
On entry: indicates if intermediate or final time step.
for an intermediate step,
for the last call to
MONITR before returning to your program.
- 6: NLEV – INTEGERInput
On entry: the number of grid levels used at time
T.
- 7: NGPTS(NLEV) – INTEGER arrayInput
On entry: contains the number of grid points at level , for .
- 8: XPTS() – REAL (KIND=nag_wp) arrayInput
On entry: contains the
coordinates of the grid points in each level in turn, i.e.,
, for
and
.
So for level , , where , for and .
- 9: YPTS() – REAL (KIND=nag_wp) arrayInput
On entry: contains the
coordinates of the grid points in each level in turn, i.e.,
, for
and
.
So for level , , where , for and .
- 10: LSOL(NLEV) – INTEGER arrayInput
On entry:
contains the pointer to the solution in
SOL at grid level
and time
T. (
actually contains the array index immediately preceding the start of the solution in
SOL.)
- 11: SOL() – REAL (KIND=nag_wp) arrayInput
On entry: contains the solution
at time
T for each grid level
in turn, positioned according to
LSOL, i.e., for level
,
, for
,
and
.
- 12: IERR – INTEGERInput/Output
On entry: will be set to .
On exit: should be set to
to force a tidy termination and an immediate return to the calling program with
.
IERR should remain unchanged otherwise.
MONITR must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D03RAF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 17: OPTI() – INTEGER arrayInput
On entry: may be set to control various options available in the integrator.
- All the default options are employed.
- The default value of
, for , can be obtained by setting .
- Specifies the maximum number of grid levels allowed (including the base grid). . The default value is .
- Specifies the maximum number of Jacobian evaluations allowed during each nonlinear equations solution. . The default value is .
- Specifies the maximum number of Newton iterations in each nonlinear equations solution. . The default value is .
- Specifies the maximum number of iterations in each linear equations solution. . The default value is .
Constraint:
and if , , for .
- 18: OPTR(,NPDE) – REAL (KIND=nag_wp) arrayInput
On entry: may be used to specify the optional vectors
,
and
in the space and time monitors (see
Section 8).
If an optional vector is not required then all its components should be set to .
, for
, specifies
, the approximate maximum absolute value of the
th component of
, as used in
(4) and
(7).
, for
.
, for
, specifies
, the weighting factors used in the space monitor (see
(4)) to indicate the relative importance of the
th component of
on the space monitor.
, for
.
, for
, specifies
, the weighting factors used in the time monitor (see
(6)) to indicate the relative importance of the
th component of
on the time monitor.
, for
.
Constraints:
- , for ;
- , for and .
- 19: RWK(LENRWK) – REAL (KIND=nag_wp) arrayCommunication Array
- 20: LENRWK – INTEGERInput
On entry: the dimension of the array
RWK as declared in the (sub)program from which D03RAF is called.
The required value of
LENRWK cannot be determined exactly in advance, but a suggested value is
where
if
and
otherwise, and
is the expected maximum number of grid points at any one level. If during the execution the supplied value is found to be too small then the routine returns with
and an estimated required size is printed on the current error message unit (see
X04AAF).
Constraint:
(the required size for the initial grid).
- 21: IWK(LENIWK) – INTEGER arrayCommunication Array
On entry: if
,
IWK need not be set. Otherwise
IWK must remain unchanged from a previous call to D03RAF.
On exit: the following components of the array
IWK concern the efficiency of the integration. Here,
is the maximum number of grid levels allowed (
if
and
otherwise), and
is a grid level taking the values
, where
is the number of levels used.
- Contains the number of steps taken in time.
- Contains the number of rejected time steps.
- Contains the total number of residual evaluations performed (i.e., the number of times PDEDEF was called) at grid level .
- Contains the total number of Jacobian evaluations performed at grid level .
- Contains the total number of Newton iterations performed at grid level .
- Contains the total number of linear solver iterations performed at grid level .
- Contains the maximum number of Newton iterations performed at any one time step at grid level .
- Contains the maximum number of linear solver iterations performed at any one time step at grid level .
Note: the total and maximum numbers are cumulative over all calls to D03RAF. If the specified maximum number of Newton or linear solver iterations is exceeded at any stage, then the maximums above are set to the specified maximum plus one.
- 22: LENIWK – INTEGERInput
On entry: the dimension of the array
IWK as declared in the (sub)program from which D03RAF is called.
The required value of
LENIWK cannot be determined exactly in advance, but a suggested value is
where
is the expected maximum number of grid points at any one level and
if
and
otherwise. If during the execution the supplied value is found to be too small then the routine returns with
and an estimated required size is printed on the current error message unit (see
X04AAF).
Constraint:
(the required size for the initial grid).
- 23: LWK(LENLWK) – LOGICAL arrayWorkspace
- 24: LENLWK – INTEGERInput
On entry: the dimension of the array
LWK as declared in the (sub)program from which D03RAF is called.
The required value of
LENLWK cannot be determined exactly in advanced, but a suggested value is
where
is the expected maximum number of grid points at any one level. If during the execution the supplied value is found to be too small then the routine returns with
and an estimated required size is printed on the current error message unit (see
X04AAF).
Constraint:
(the required size for the initial grid).
- 25: ITRACE – INTEGERInput
On entry: the level of trace information required from D03RAF.
ITRACE may take the value
,
,
,
or
.
- No output is generated.
- Only warning messages are printed.
- Output from the underlying solver is printed on the current advisory message unit (see X04ABF). This output contains details of the time integration, the nonlinear iteration and the linear solver.
If , then is assumed and similarly if , then is assumed.
The advisory messages are given in greater detail as
ITRACE increases. Setting
allows you to monitor the progress of the integration without possibly excessive information.
- 26: IND – INTEGERInput/Output
On entry: must be set to
or
.
- Starts the integration in time.
- Continues the integration after an earlier exit from the routine. In this case, only the following parameters may be reset between calls to D03RAF: TOUT, , , TOLS, TOLT, OPTI, OPTR, ITRACE and IFAIL.
Constraint:
.
On exit: .
Note: for users of the NAG Library for SMP & Multicore only, additional values of
IND are allowed. See
Section 2.2.3 in the Introduction to the NAG Library for SMP & Multicore for further details.
- 27: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
On entry, | , |
or | , |
or | TOUT is too close to TS, |
or | and , |
or | , for , |
or | , |
or | and , |
or | and , |
or | and or , |
or | , |
or | XMAX too close to XMIN, |
or | , |
or | YMAX too close to YMIN, |
or | NX or , |
or | TOLS or , |
or | , |
or | and , for , or , |
or | , for some , |
or | , for some , |
or | , for some , |
or | LENRWK, LENIWK or LENLWK too small for initial grid level, |
or | or , |
or | on initial entry to D03RAF. |
The time step size to be attempted is less than the specified minimum size. This may occur following time step failures and subsequent step size reductions caused by one or more of the following:
- the requested accuracy could not be achieved, i.e., TOLT is too small,
- the maximum number of linear solver iterations, Newton iterations or Jacobian evaluations is too small,
- ILU decomposition of the Jacobian matrix could not be performed, possibly due to singularity of the Jacobian.
Setting
ITRACE to a higher value may provide further information.
In the latter two cases you are advised to check their problem formulation in
PDEDEF and/or
BNDARY, and the initial values in
PDEIV if appropriate.
One or more of the workspace arrays is too small for the required number of grid points. An estimate of the required sizes for the current stage is output, but more space may be required at a later stage.
IERR was set to
in
MONITR, forcing control to be passed back to calling program. Integration was successful as far as
.
The integration has been completed but the maximum number of levels specified in
was insufficient at one or more time steps, meaning that the requested space accuracy could not be achieved. To avoid this warning either increase the value of
or decrease the value of
TOLS.
7 Accuracy
There are three sources of error in the algorithm: space and time discretization, and interpolation (linear) between grid levels. The space and time discretization errors are controlled separately using the parameters
TOLS and
TOLT described in the following section, and you should test the effects of varying these parameters. Interpolation errors are generally implicitly controlled by the refinement criterion since in areas where interpolation errors are potentially large, the space monitor will also be large. It can be shown that the global spatial accuracy is comparable to that which would be obtained on a uniform grid of the finest grid size. A full error analysis can be found in
Trompert and Verwer (1993).
The local uniform grid refinement method is summarised as follows:
- Initialize the course base grid, an initial solution and an initial time step.
- Solve the system of PDEs on the current grid with the current time step.
- If the required accuracy in space and the maximum number of grid levels have not yet been reached:
(a) |
Determine new finer grid at forward time level. |
(b) |
Get solution values at previous time level(s) on new grid. |
(c) |
Interpolate internal boundary values from old grid at forward time. |
(d) |
Get initial values for the Newton process at forward time. |
(e) |
Go to . |
- Update the coarser grid solution using the finer grid values.
- Estimate error in time integration. If time error is acceptable advance time level.
- Determine new step size then go to with coarse base as current grid.
For each grid point
a space monitor
is determined by
where
and
are the grid widths in the
and
directions; and
,
are the
and
coordinates at grid point
. The parameter
is obtained from
where
is the user-supplied space tolerance;
is a weighting factor for the relative importance of the
th PDE component on the space monitor; and
is the approximate maximum absolute value of the
th component. A value for
must be supplied by you. Values for
and
must also be supplied but may be set to the value
if little information about the solution is known.
A new level of refinement is created if
depending on the grid level at the previous step in order to avoid fluctuations in the number of grid levels between time steps. If
(5) is satisfied then all grid points for which
are flagged and surrounding cells are quartered in size.
No derefinement takes place as such, since at each time step the solution on the base grid is computed first and new finer grids are then created based on the new solution. Hence derefinement occurs implicitly. See
Section 8.1.
The time integration is controlled using a time monitor calculated at each level
up to the maximum level used, given by
where
is the total number of points on grid level
;
;
is the current time step;
is the time derivative of
which is approximated by first-order finite differences;
is the time equivalent of the space weighting factor
; and
is given by
where
is as before, and
is the user-specified time tolerance.
An integration step is rejected and retried at all levels if
9 Example
Note: a modified example is supplied with the NAG Library for SMP & Multicore and links have been supplied in the following subsections.
For this routine two examples are presented, with a main program and two example problems given in Example 1 (EX1) and Example 2 (EX2).
Example 1 (EX1)
This example stems from combustion theory and is a model for a single, one-step reaction of a mixture of two chemicals (see
Adjerid and Flaherty (1988)). The PDE for the temperature of the mixture
is
for
and
, with initial conditions
for
, and boundary conditions
The heat release parameter
, the Damkohler number
, the activation energy
, the reaction rate
, and the diffusion parameter
.
For small times the temperature gradually increases in a circular region about the origin, and at about ‘ignition’ occurs causing the temperature to suddenly jump from near unity to , and a reaction front forms and propagates outwards, becoming steeper. Thus during the solution, just one grid level is used up to the ignition point, then two levels, and then three as the reaction front steepens.
Example 2 (EX2)
This example is taken from a multispecies food web model, in which predator-prey relationships in a spatial domain are simulated (see
Brown et al. (1994)). In this example there is just one species each of prey and predator, and the two PDEs for the concentrations
and
of the prey and the predator respectively are
with
where
and
, and
.
The initial conditions are taken to be simple peaked functions which satisfy the boundary conditions and very nearly satisfy the PDEs:
and the boundary conditions are of Neumann type, i.e., zero normal derivatives everywhere.
During the solution a number of peaks and troughs develop across the domain, and so the number of levels required increases with time. Since the solution varies rapidly in space across the whole of the domain, refinement at intermediate levels tends to occur at all points of the domain.
9.1 Program Text
Program Text (d03rafe.f90)
Program Text (d03rafe_smp.f90)
9.2 Program Data
Program Data (d03rafe.d)
Program Data (d03rafe_smp.d)
9.3 Program Results
Program Results (d03rafe.r)
Program Results (d03rafe_smp.r)