pdsolve/numeric/method  find a numerical solution of a PDE using a specified method

Calling Sequence


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


Parameters


PDE



single partial differential equations in two independent variables

conditions



set or list initial and boundary conditions

numeric



keyword indicating a numerical solution is to be obtained

meth



name (symbol or indexed) of the form method=; select method to use for solution

options



(optional) equations of the form keyword = value





Description


•

In addition to the default interface to pdsolve/numeric, which uses the default theta methods (the theta family of methods), additional functionality is available for use of numerical pdsolve for educational purposes.

•

This additional functionality includes the use of 11 standard methods, specification of numerical boundary conditions, specification of startup schemes for twostage methods, and extensibility for your custom methods.

•

The use of pdsolve/numeric with these methods is restricted to a single parabolic/hyperbolic PDE that is first order in time.

•

As with the default method, pdsolve/numeric/method returns a module that can be used to plot solutions, or obtain procedures that provide their values. For information on the plot, animate, , value, and settings module members, see pdsolve/numeric.

•

The method argument specifies the method to use for the problem. The available methods are:

ForwardTime1Space[backward/forward]

CenteredTime1Space[backward/forward]

BackwardTime1Space[backward/forward]

Euler/ForwardTimeCenteredSpace

CrankNicholson/CenteredTimeCenteredSpace

BackwardEuler/BackwardTimeCenteredSpace

Box[backward/forward]

LaxFriedrichs

LaxWendroff

Leapfrog

DuFortFrankel




For a description of each method, including related problems, and instructions on creating a custom scheme, see pdsolve/numeric/methods.



Options


•

The options available to pdsolve/numeric/method for these additional methods are as follows.

'time'

=

name

'range'

=

l..r

'spacestep'

=

numeric

'timestep'

=

numeric

'bcpts'

=

integer

'optimize'

=

boolean/symbol

'numericalbcs'

=

set, list or expression

'startup'

=

symbol

'startupsteps'

=

integer

'startupnumbc'

=

set, list or expression



•

The time=name, range=l..r, spacestep=numeric, timestep=numeric, bcpts=integer, and optimize=boolean/symbol options are the same as for the default method.


 The time and range options must be specified for problems that are first order in time and space with a boundary condition that involves only one end point (otherwise the time/space variables and range are detected automatically).


 The value of the spacestep option is the size of the spatial step to use for the discrete problem. It defaults to 1/20th the spatial range.


 The value of the timestep option is the size of the temporal step to use for the discrete problem. It defaults to the value of spacestep.


 The value of the bcpts option is the number of points used in the approximation of derivatives present in the boundary conditions.


 The optimize option controls the level of optimization used for generating the solution module. For more information, see pdsolve/numeric.

•

The numericalbcs=set, list or expression argument describes the numerical boundary conditions. It is required for the use of some methods with some PDEs.


For example, the Euler method relates the values of the solution for 3 consecutive points in the spatial domain. This means that boundary conditions must specify solution values at 2 points in the spatial domain. If the PDE is first order in space, only one natural boundary condition can be specified, and the scheme cannot be used directly.


Numerical boundary conditions allow specification of additional discrete equations, on the spatial mesh, which allow the method to be used for the PDE problem. These are often derived from an extrapolation, or a discretization of the PDE at or near the boundary that requires the additional condition.


The pdsolve command currently accepts two forms of numerical boundary conditions.


The first form specifies that the numerical boundary condition be obtained from one of the specified methods (likely more compact) applied to the input PDE near the boundary.


The second form allows significantly more control, but requires that numerical boundary condition be provided as a discrete equation that is a relationship amongst the discrete values of the dependent variable at the boundary. This form of numerical boundary condition can depend on the time and space variables of the problem, as well as the time and space step sizes (though the names used for the step sizes must be specified), and must be linear in the discrete dependent variable values.


The numericalbcs argument can be specified using the following forms:

`numericalbcs` =

[method, point]

`numericalbcs` =

expression

`numericalbcs` =

{expression, 'timestep'=symbol, 'spacestep'=symbol}

`numericalbcs` =

{[method[1], point[1]], ..., [method[n], point[n]],


expression[1], ..., expression[m],


'timestep'=symbol, 'spacestep'=symbol}




where method describes a method accepted by pdsolve (for example, Euler) or a custom method, point describes the boundary and offset to be used for the scheme generated by the method, , specify the names used for the time and space step sizes in the numerical boundary condition, and the expression arguments are discrete forms of the numerical boundary conditions.

•

For the method specified numerical boundary conditions, the value of point indicates the leftmost or rightmost point to be used in the discrete formula obtained by the method. For example, if point is specified as 'n'1 (where 'n' is some symbol) and the specified method has a width of 2, the condition is applied at the right boundary, and the solution values at the discrete points 'n'1 and 'n'2 are used in the discrete formula. As another example, if point is specified as 1 for the same method, the condition is applied at the left boundary, and the solution values at the discrete points 1, 2 are used in the discrete formula.


As a more detailed example, consider solution of the PDE using the LaxFriedrichs method. Since this problem is first order in space, only one natural boundary condition can be applied (one boundary condition on the left boundary). However, the method has a width of 3, so two conditions are needed, thus requiring the specification of a numerical boundary condition.


The additional argument specifies the use of the Box method to obtain the required additional relation for the right boundary, and in fact is equivalent to the more complicated specification
that corresponds to using expression specified numerical boundary conditions.


For example, a numerical boundary condition that forces the value of the solution on the right boundary to be the same as the value of the solution at the first interior point can be specified as . A similar condition for the left boundary can be specified as .


Note: This condition can be specified using the method form as .


Numerical boundary conditions must be provided if needed. Otherwise, Maple returns an error.

•

The startup=symbol, startupsteps=integer, and startupnumbc=set, list or expression arguments specify how to compute the additional stage required for two stage methods, such as Leapfrog and DuFortFrankel. Methods such as these require the solution values at the current and prior time step to compute the solution at a future time step. This is an issue in the first step of the time integration of the PDE, as only values at one time step are known (that is, the initial condition of the problem).


The startup argument can take two forms, a method specified form, or a function specified form. For the method specified form, the argument must be specified as , where method is any of the one stage methods available for use with numerical pdsolve. For the function specified form, the argument must be specified as , where expression is any fully specified function of the time and space variables of the problem. If no startup argument is provided, the method form is used with the default Theta scheme.


The startupsteps argument (default value is ) improves the accuracy of the computed solution if the startup method is of lower accuracy than the two stage method. It specifies one greater than the number of doubling steps used to compute the additional stage required by the main method, and is best described through an example.


Consider a PDE where the Leapfrog method is to be used as the primary method, and the Euler method is to be used as the startup method.


This approach allows lower accuracy methods to be used as startup methods with little or no accuracy loss.


The startupnumbc argument specifies the numerical boundary conditions to use for the startup scheme. By default, pdsolve first attempts to obtain the startup solution using the startup method and the same numerical boundary conditions as the primary method. If this fails, pdsolve attempts to obtain the startup solution using the startup method with no numerical boundary conditions. This option is provided to cover cases where neither of these approaches are sufficient. For example, if the primary method requires two numerical boundary conditions, and the startup method requires only one, this approach fails, and startupnumbc must be used. Note that the specification of startupnumbc with the incorrect number of conditions, or use of the option if it is not needed, results in an error.



Examples


Basic oneway wave equation with boundary condition on the left using the ForwardTime1Space[backward] method.
>


 (1) 
>


 (2) 
>


 (3) 
The exact solution to this problem is known. Obtain an error function at
>


 (4) 
>


 (5) 
>


 (6) 
Compute the maxnorm error over the interval.
>


 (7) 
Adjust half the step sizes and check that the error halves.
>


 (8) 
>


 (9) 
>


 (10) 
>


 (11) 
Use the CrankNicholson method on an inhomogeneous oneway wave equation. This requires a numerical boundary condition.
>


 (12) 
>


 (13) 
As a numerical boundary condition, choose a Box discretization of the PDE at the right boundary using the first interior point.
>


 (14) 
>


 (15) 
Note: You do not need to specify time and range. They are implicitly defined using the periodic boundary condition.
>


 (16) 
Again the exact solution of this problem is known. Examine the error.
>


 (17) 
>


 (18) 
>


 (19) 
And with half the step size:
>


 (20) 
>


 (21) 
>


 (22) 
The improvement is better than expected.
The Box scheme on the right boundary (without explicitly deriving the scheme) can be specified by using numericalbcs=[Box,n].
>


 (23) 
>


 (24) 
>


 (25) 
As an example of a two stage scheme, apply the DuFortFrankel method to a convection/diffusion equation with insulated boundary conditions.
>


 (26) 
>


 (27) 
>


 (28) 
From this solution a series of plots at different times can be generated and displayed in the same plot.

