|
Description
|
|
•
|
This page contains a description of all numerical PDE methods available for time dependent problems, including information on the order of accuracy, applicable PDE problems, if numerical boundary conditions are required, and the differencing scheme used. For more information on specifying a specific numeric method for solving a PDE, see pdsolve/numeric/method.
|
|
All methods can be applied to variable coefficient inhomogeneous PDEs, which are first order in time. In the following, is used as the space step, and as the time step. In addition, the differential order of the PDE in the spatial variable is denoted by .
|
|
ForwardTime1Space[forward/backward]
|
|
•
|
The forward time forward/backward space method is an explicit single stage method that can be used to find solutions to first order time/space PDEs.
|
•
|
The method is accurate.
|
•
|
First order PDEs that describe right-traveling waves should use the backward method (specified as ForwardTime1Space[backward]), and specify the boundary condition at the left boundary, while left-traveling waves require the forward method (specified as ForwardTime1Space[forward]), and the boundary condition at the right boundary. Numerical boundary conditions are not required.
|
•
|
As this is an explicit scheme, stability requires a restriction of the form for some depending upon the problem.
|
•
|
The scheme used to compute the value at the mesh point is the result of applying differencing to the PDE about the point and can obtained by substitution of the discretizations
|
|
into the PDE for the backward method. The forward method simply replaces the discretization for by
|
|
|
CenteredTime1Space[forward/backward]
|
|
•
|
The centered time forward/backward space method is an implicit single stage method that can be used to find solutions to PDEs containing the derivatives .
|
•
|
The method is accurate.
|
•
|
PDEs that describe right-traveling waves should use the backward method (specified as CenteredTime1Space[backward]), and specify the boundary condition at the left boundary, while left-traveling waves require the forward method (specified as CenteredTime1Space[forward]), and the boundary condition at the right boundary. Numerical boundary conditions are not required.
|
•
|
This is an implicit scheme, and is unconditionally stable for many problems (though this may need to be checked).
|
•
|
The scheme used to compute the value at the mesh point is the result of applying differencing to the PDE about the point and is obtained by substitution of the discretizations
|
|
into the PDE for the backward method. The forward method simply replaces the discretizations for and by
|
|
|
BackwardTime1Space[forward/backward]
|
|
•
|
The backward time forward/backward space method is an implicit single stage method that can be used to find solutions to PDEs containing the derivatives .
|
•
|
The method is accurate.
|
•
|
PDEs that describe right-traveling waves should use the backward method (specified as BackwardTime1Space[backward]), and specify the boundary condition at the left boundary, while left-traveling waves require the forward method (specified as BackwardTime1Space[forward]), and the boundary condition at the right boundary. Numerical boundary conditions are not required.
|
•
|
This is an implicit scheme, and is unconditionally stable for many problems (though this may need to be checked).
|
•
|
The scheme used to compute the value at the mesh point is the result of applying differencing to the PDE about the point and is obtained by substitution of the discretizations
|
|
into the PDE for the backward method. The forward method simply replaces the discretizations for and by
|
|
|
ForwardTimeCenteredSpace or Euler
|
|
•
|
The forward time centered space method is an explicit single stage method that can be used to find solutions to PDEs that are first order in time, and arbitrary order in space, with no mixed partial derivatives.
|
•
|
The method is accurate.
|
•
|
PDEs that are odd order in space require that numerical boundary conditions be specified so that each boundary has the same total number of conditions, and that the total number of boundary conditions is one greater than the differential order in the space variable. PDEs that are second order in space require no numerical boundary conditions, but still require the same number of conditions on each boundary.
|
•
|
As this is an explicit scheme, stability imposes a restriction on the time step of the problem relative to the space step. In general, this scheme is unstable for PDEs where is odd. For PDEs that are even order in space, stability requires a restriction of the form for some depending upon the problem.
|
•
|
The scheme used to compute the value at the mesh point is the result of applying central differencing to the PDE about the point using points (that is, the mesh uses points on either side of the center).
|
|
|
CenteredTimeCenteredSpace or CrankNicholson
|
|
•
|
The centered time centered space method is an implicit single stage method that can be used to find solutions to PDEs that are first order in time, and arbitrary order in space, with mixed partial derivatives.
|
•
|
The method is accurate.
|
•
|
PDEs that are odd order in space require that numerical boundary conditions be specified so that each boundary has the same total number of conditions, and that the total number of boundary conditions is one greater than the differential order in the space variable. PDEs that are second order in space require no numerical boundary conditions, but still require the same number of conditions on each boundary.
|
•
|
This is an implicit scheme, and is unconditionally stable for many problems (though this may need to be checked).
|
•
|
The scheme used to compute the value at the mesh point is the result of applying central differencing to the PDE about the point using points (that is, the mesh uses points on either side of the center).
|
|
|
BackwardTimeCenteredSpace or BackwardEuler
|
|
•
|
The backward time centered space method is an implicit method that can be used to find solutions to PDEs that are first order in time, and arbitrary order in space, with mixed partial derivatives.
|
•
|
The method is accurate.
|
•
|
PDEs that are odd order in space require that numerical boundary conditions be specified so that each boundary has the same total number of conditions, and that the total number of boundary conditions is one greater than the differential order in the space variable. PDEs that are second order in space require no numerical boundary conditions, but still require the same number of conditions on each boundary.
|
•
|
This is an implicit scheme, and is unconditionally stable for many problems (though this may need to be checked).
|
•
|
The scheme used to compute the value at the mesh point is the result of applying central differencing to the PDE about the point using points (that is, the mesh uses points on either side of the center). For PDEs having no mixed partial derivatives, the only point in the discretization that is at the current time step is , all other points are of the form .
|
|
|
Box
|
|
•
|
The box method is an implicit single stage method that can be used to find solutions to PDEs that are first order in time, and arbitrary order in space, with mixed partial derivatives.
|
•
|
The method is accurate.
|
•
|
The method uses a spatial mesh with an even number of points, so necessarily one boundary must have one condition more than the other. Since the method is symmetric (would be no different if one boundary had the extra condition versus the other) the method is automatically adjusted to accommodate the boundary conditions.
|
•
|
PDEs that are even order in space require one additional numerical boundary condition, while PDEs that are odd order in space require no numerical boundary conditions.
|
•
|
This is an implicit scheme, and is unconditionally stable for many problems (though this may need to be checked).
|
•
|
The scheme used to compute the value at the mesh point is different depending if the extra boundary condition (or numerical boundary condition for even order problems) is given at the left or right boundaries. If the extra condition is on the left, the scheme can be obtained through application of central differencing of the PDE about the point using points to the left of , and points to the right. If the extra condition is on the right, the scheme can be obtained through application of central differencing of the PDE about the point using points to the left of , and points to the right.
|
|
|
LaxFriedrichs
|
|
•
|
The Lax-Friedrichs method is an explicit single stage method that can be used to find solutions to PDEs that are first order in time, and odd order in space, with no mixed partial derivatives.
|
•
|
The method is accurate. Note: The method can be applied to PDEs with odd order in space, but the stability requirement (see below) forces the error to be due to the term.
|
•
|
PDEs that are odd order in space require that numerical boundary conditions be specified so that each boundary has the same total number of conditions, and that the total number of boundary conditions is one greater than the differential order in the space variable. PDEs that are second order in space require no numerical boundary conditions, but do require the same number of conditions on each boundary.
|
•
|
As this is an explicit scheme, stability imposes a restriction on the time step of the problem relative to the space step. For PDEs that are odd order in space, stability requires a restriction of the form for some depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be , or simply when .
|
•
|
The scheme used to compute the value at the mesh point is identical to that of the Euler scheme with the exception that the value is replaced by the interpolation of the value at using all other points in the Euler stencil where .
|
|
|
LaxWendroff
|
|
•
|
The Lax-Wendroff method is an explicit single stage method that can be used to find solutions to linear PDEs that are first order in time and space.
|
•
|
The method is accurate.
|
•
|
The Lax-Wendroff method always requires a numerical boundary condition so that one boundary condition is specified for each boundary.
|
•
|
As this is an explicit scheme, stability requires a restriction of the form for some depending upon the problem.
|
•
|
The derivation of this scheme is complex, and involves computing difference schemes of derivatives of the input PDE, (which results in the linearity restriction), but is available in many standard textbooks.
|
|
|
Leapfrog
|
|
•
|
The Leapfrog method is an explicit two stage method that can be used to find solutions to PDEs that are first order in time, and arbitrary order in space, with no mixed partial derivatives.
|
•
|
The method is accurate, and as it is a two stage method, a startup method must be used.
|
•
|
PDEs that are odd order in space require that numerical boundary conditions be specified so that each boundary has the same total number of conditions, and that the total number of boundary conditions is one greater than the differential order in the space variable. PDEs that are even order in space require no numerical boundary conditions, but still require the same number of conditions on each boundary.
|
•
|
As this is an explicit scheme, stability imposes a restriction on the time step of the problem relative to the space step. In general, this scheme is unstable for PDEs where is even. For PDEs that are odd order in space, stability requires a restriction of the form for some depending upon the problem.
|
•
|
The scheme used to compute the value at the mesh point uses the formula
|
|
for the time derivative, and uses central differencing over points to compute all spatial derivatives.
|
|
|
DuFortFrankel
|
|
•
|
The DuFort-Frankel method is an explicit two stage method that can be used to find solutions to linear PDEs that are first order in time, and even order in space, with no mixed partial derivatives. In some cases it can be used to find solutions of nonlinear PDEs.
|
•
|
The method is accurate, and as it is a two stage method, a startup method must be used. Note: The method can be applied to PDEs with odd order in space, but the stability requirement (see below) forces the error to be due to the term. Note, however, that if no even order derivatives appear in the PDE at all, then the resulting scheme is identical to the scheme generated by the Leapfrog method for the same PDE, so in that case those comments apply.
|
•
|
Since this method is restricted to PDEs that are even order in space, no numerical boundary conditions are required, but the number of conditions on each boundary must be the same.
|
•
|
As this is an explicit scheme, stability imposes a restriction on the time step of the problem relative to the space step. The restriction is of the form for some depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be , or simply when .
|
•
|
The scheme used to compute the value at the mesh point is identical to that of the Leapfrog scheme with the exception that the value is replaced by the average of the values and for all occurrences in the scheme.
|
|
|
Constructing a Custom Method
|
|
•
|
Construction of a new method or scheme for use by pdsolve is somewhat involved, and requires some basic Maple programming knowledge. In essence, you must construct a routine that derives the desired method for an arbitrary point , for an input PDE, and returns that information, and information on the method itself in the entries of an input table.
|
•
|
Construction of new methods has the following limitations.
|
|
- The PDE must be first order in time.
|
|
- The scheme cannot use more than two additional stages.
|
|
- The time and space step sizes are constant.
|
|
- The scheme cannot use discrete values of the space variable that are outside the stencil of the method.
|
•
|
The following is the code for the CenteredTime1Space method and is used as an example to describe what is needed.
|
`pdsolve/numeric/findif/CenteredTime1Space` := proc(
|
PDE, # The PDE to be discretized
|
u, # The dependent variable, with dependencies (e.g. u(x,t))
|
x, # The space independent variable
|
t, # The time independent variable
|
v, # The name to be used for discretization, v[timeidx,spaceidx]
|
ix, # The value of the central space index
|
h, # The space step size (symbolic)
|
k, # The time step size (symbolic)
|
parms, # List of additional parameters for the method (the index
|
# for the 'method' argument.
|
# e.g. for "method=CenteredTime1Space[forward]" the list
|
# is ['forward'].
|
INFO) # Input/Output table of information
|
local sb;
|
# First validate that this method works for the input PDE
|
if INFO["timeord"]<>1 or INFO["spaceord"]<>1 then
|
error("The CenteredTime1Space scheme can only be used with first-order PDE");
|
elif parms=[] or not member(parms,{['forward'],['backward']}) then
|
error("The CenteredTime1Space scheme requires a parameter, 'forward' or 'backward'");
|
end if;
|
# Set output parameters
|
INFO["directional"] := true;
|
# Now compute the discretization of derivatives that may
|
# appear in the PDE
|
sb := diff(u,t)=(v[1,ix]-v[0,ix])/k,u=(v[1,ix]+v[0,ix])/2;
|
if parms=['forward'] then
|
sb := sb,diff(u,x)=(v[1,ix+1]-v[1,ix] + v[0,ix+1]-v[0,ix])/2/h,
|
diff(u,x,t)=(v[1,ix+1]-v[1,ix]-v[0,ix+1]+v[0,ix])/k/h;
|
else
|
sb := sb,diff(u,x)=(v[1,ix]-v[1,ix-1] + v[0,ix]-v[0,ix-1])/2/h,
|
diff(u,x,t)=(v[1,ix]-v[1,ix-1]-v[0,ix]+v[0,ix-1])/k/h;
|
end if;
|
# Now evaluate the PDE with respect to the discretization schemes and
|
# adjust explicit occurrences of the time/space variables
|
eval(PDE,{sb,x=x[ix],t=t+k/2});
|
end proc:
|
|
|
|
The input data is fairly well described by the comments present in the parameter list of the example, only a few items need be discussed.
|
|
The name of the procedure for the method must be of the form `pdsolve/numeric/findif/<method name>`, as pdsolve checks for the presence of the routine based on the argument of the 'method' option.
|
|
The input PDE is an expression (not an equation) that is equivalent to the PDE being numerically solved by pdsolve. If the input to pdsolve is an equation, it is converted to an expression. It is converted to diff notation (not operator notation), so if is present in the input PDE, this routine sees instead.
|
|
The input is the base name that should be used to construct the indexed names for the discretization, that is, the value at the mesh point should be denoted as .
|
|
The returned expression is to be used to compute the discrete solution value at , where is the input parameter.
|
|
The INFO table has entries that can be used to more easily determine if the method being derived is valid for the input PDE and is also used to output certain information about the discretization. In addition, the flag can be set as output.
|
•
|
The INFO table has the following entries that can be used by this routine.
|
|
The INFO["timeord"] entry holds an integer giving the differential order of the PDE with respect to the time variable.
|
|
The INFO["spaceord"] entry holds an integer giving the differential order of the PDE with respect to the space variable.
|
|
The INFO["mixed"] entry holds boolean value indicating if mixed partial derivatives are present in the PDE.
|
|
The INFO["directional"] flag should be set to 'true' by the routine for any implicit methods where the specific solving unknown is important. Otherwise, numeric may shift the method depending on the location of the boundary conditions. If not set, it is assumed to be false.
|
|
For example, the Box method applied to a first order PDE is of the same form if the boundary condition is given on the left, as if the boundary condition is given on the right. As a result, for this scheme, INFO["directional"] should be false (the default).
|
|
Note: Explicit methods have INFO["directional"] set to true automatically, as there is only ever one discrete dependent variable value present in the scheme for a future time step.
|
•
|
The rest is fairly straightforward. The routine should generate a difference scheme for the PDE, and the only unknowns present in the scheme should be the value of the dependent variable at mesh points, , the step sizes , the time value at the 0 time step , and the space value on the mesh .
|
|
The value of used in the application of the output scheme is as at the time step, that is, if the discretization is to be used to compute the discrete solution values at , the time value used in computing with the scheme would be . This means that schemes that are derived as differences at half mesh points or backward schemes that use the time value at the solution point must adjust the value in the output scheme. In the latter case this can be accomplished by setting to .
|
|
The pdsolve command performs well for a direct discretization of the PDE, due to the optimization settings, so use of or on the discretized PDE within the method procedure can degrade performance. It is best to experiment with this when writing a custom method.
|
|
|
|
|