numeric error control - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


pdsolve/numeric/errorcontrol

find a numerical solution of PDE with an error approximation, or within a certain tolerance

 

Calling Sequence

Parameters

Description

Options

Details

Examples

Calling Sequence

pdsolve(PDE, conditions, numeric, meth, options)

Parameters

PDE

-

single or set or list of time-dependent partial differential equations in two independent variables

conditions

-

set or list of initial and boundary conditions

numeric

-

keyword indicating a numerical solution is to be obtained

meth

-

(optional) method description of the form method=theta or method=θv

options

-

(optional) equations of the form keyword = value where keyword is one of 'errorest, 'errortype', 'abstol', mintimestep, and maxtimestep

Description

• 

This page describes options and capabilities specific to use of error estimation and error control with numeric PDE solution.

• 

Solution of PDE with error estimation is restricted to the theta family of schemes, where the index of the theta (the v in meth=θv) gives the relative time value of the point used for the approximation as a ratio of the total step. The default is 12, which gives second order accuracy and fair stability. The value 0 represents an explicit method, while the value 1 is a fully implicit method with the best stability (in general).

• 

There are two main operating modes for PDE solution with error estimation. The first simply provides viewable information on the approximate errors of the solution, while the second provides an automatic control mechanism, whereby the time step is adjusted to keep the error per unit step within a specified bound.

• 

Information on the error estimation process is provided in Details below.

Options

  

The relevant options are as follows.

• 

'errorest'= boolean

  

Specifies whether error estimates are to be computed. If error control is in use (that is, 'abstol' was specified), then this is true automatically.

• 

'errortype'= keyword

  

Specifies the form of the error estimates to be viewed.

  

-  The option 'accumulated' (the default) provides an error estimate at any given time as the sum of the error estimates for all prior time steps from the start of the problem. This option is most useful in obtaining solutions with approximate error bounds.

  

-  The option 'singlestep' provides a local error estimate for the current step. This option is most useful in determining where the local error in a solution is most problematic.

• 

'abstol'=numeric

  

In addition to providing an upper bound on the local estimate of the time and spatial errors per unit step, use of this option indicates that time adaptation should be used.

  

Note: This upper bound is used independently on the two error estimators, meaning that it is used to control errors due to the spatial discretization and errors due to the time discretization separately. If an overall total error bound is required, then 'abstol' should be specified as half the desired value.

  

Another consideration here is that only the time step can be adjusted to reduce the error (the spatial mesh is fixed), so if the spatial error estimate exceeds the tolerance, then the integration halts with an appropriate error message.

• 

'mintimestep'=numeric

  

This option provides an absolute minimum value for the time step taken to compute a requested solution. By default, the value is 1/1000th the initial time step (either the default, or specified by the timestep value).

• 

'maxtimestep'=numeric

  

This option provides an absolute maximum value for the time step taken to compute a requested solution. By default, the value is 100 times the initial time step (either the default, or specified by the timestep value).

• 

Error estimates can be used in the dependent variable specification of the plot, animate, plot3d and value methods of the returned module.

  

Quite simply, for a dependent variable ux,t, the time error can be specified as terrux,t, the spatial error can be specified as serrux,t, and the total error (just the sum of the time and space errors) can be specified as errux,t.

  

The additional shortcuts terr(), serr, and err() are provided to display the maximum time, space, or total error for all solution components. This is only useful if the input PDE is higher than first order, or the input PDE is a system.

Details

  

The error estimators used, in both the visual error estimates and the error control, are simply local truncation error estimates for the PDE or PDE system. Essentially, what is done is to compute the solution on a different mesh, and use the difference between solutions to estimate the error.

  

The spatial error estimate is obtained by comparing the solution to another computed on a coarser spatial mesh, but for the same time step. This gives an estimate of the Oh2 local truncation error (where h is the mesh spacing for the spatial variable).

  

The time error estimate is obtained by comparing the solution to another computed with a larger time step, but the same spatial mesh. This gives an estimate of the Ok2 or Ok local truncation error (where k is the time step).

  

It is important to note that these estimates are local, so they do not account for situations where a small perturbation in the solution at a time t=t1 can result in a large change in the solution at a later time t=t2.

Examples

Simple one-way wave equation with error estimates. Comparison at two sets of step sizes.

PDEdiffux,t,t=diffux,t,x

PDEtux,t=xux,t

(1)

IBCu0,t=sin2πt,ux,0=sin2πx

IBCu0,t=sin2πt,ux,0=sin2πx

(2)

pdspdsolvePDE,IBC,numeric,time=t,range=0..1,errorest=true,timestep=116,spacestep=116

pdsmoduleexportplot,plot3d,animate,value,settings;...end module

(3)

pds:-plotux,t,ux,t+errux,t,color=grey,ux,terrux,t,color=grey,t=5

pds:-settingstimestep=132,spacestep=132

pds:-plotux,t,ux,t+errux,t,color=grey,ux,terrux,t,color=grey,t=5

Comparison of error estimate and true error (for this problem the exact solution is known).

esolsin2πxt

esolsin2πxt

(4)

pds:-plotux,tsin2πxt,errux,t,color=grey,t=5

In this case, the error estimate is somewhat pessimistic.

A nonlinear PDE with a forming shock layer using error control

PDEdiffux,t,t=diffux,t,xux,t

PDEtux,t=xux,tux,t

(5)

IBCu0,t=exp42exp8exp4t,ux,0=exp16x1222

IBCu0,t=ⅇ−4ⅇ8ⅇ−4t2,ux,0=ⅇ16x1222

(6)

pdspdsolvePDE,IBC,numeric,time=t,range=0..2,spacestep=1128,timestep=164,abstol=0.01

pdsmoduleexportplot,plot3d,animate,value,settings;...end module

(7)

pds:-plott=0.5

Error, (in `pdsolve/numeric/plot`) unable to compute solution for t>.383973957308842:
spatial error estimate exceeds tolerance. consider decreasing 'spacestep'

You must decrease the space step size. A little experimentation shows that you can get to t=0.5 with:

pds:-settingsspacestep=11024:pds:-plott=0.5,numpoints=256

And at that time, the spatial error looks like

pds:-plotserr,t=0.5,numpoints=256

See Also

pdsolve

pdsolve/numeric

plot

plot3d

plots[animate]