Numerical PDE Methods Available for pdsolve/numeric
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, h is used as the space step, and k as the time step. In addition, the differential order of the PDE in the spatial variable is denoted by xord.
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 O⁡h,k 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 k<a⁢h for some a depending upon the problem.
The scheme used to compute the value at the mesh point 1,i is the result of applying differencing to the PDE about the point t,xi and can obtained by substitution of the discretizations
ut=u1,i−u0,ik,
ux=u0,i−u0,i−1h,
u=u0,i
into the PDE for the backward method. The forward method simply replaces the discretization for ux by
ux=u0,i+1−u0,ih
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 u,ux,ut,uxt.
The method is O⁡h,k2 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 1,i is the result of applying differencing to the PDE about the point t+k2,xi and is obtained by substitution of the discretizations
uxt=u1,i−u1,i−1−u0,i+u0,i−1k⁢h,
ux=v1,i−v1,i−1+v0,i−v0,i−12⁢h,
u=u1,i2+u0,i2,
t=t+k2
into the PDE for the backward method. The forward method simply replaces the discretizations for uxt and ux by
uxt=u1,i+1−u1,i−u0,i+1+u0,ik⁢h,
ux=v1,i+1−v1,i+v0,i+1−v0,i2⁢h
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 u,ux,ut,uxt.
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.
The scheme used to compute the value at the mesh point 1,i is the result of applying differencing to the PDE about the point t+k,xi and is obtained by substitution of the discretizations
ux=v1,i−v1,i−1h,
u=u1,i,
t=t+k
ux=v1,i+1−v1,ih
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 O⁡h2,k 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 xord is odd. For PDEs that are even order in space, stability requires a restriction of the form k<a⁢hxord for some a depending upon the problem.
The scheme used to compute the value at the mesh point 1,i is the result of applying central differencing to the PDE about the point t,xi using 1+2⁢xord2 points (that is, the mesh uses xord2 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 O⁡h2,k2 accurate.
The scheme used to compute the value at the mesh point 1,i is the result of applying central differencing to the PDE about the point t+k2,xi using 1+2⁢xord2 points (that is, the mesh uses xord2 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 scheme used to compute the value at the mesh point 1,i is the result of applying central differencing to the PDE about the point t+k,xi using 1+2⁢xord2 points (that is, the mesh uses xord2 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 u0,i, all other points are of the form u[1,⁢*].
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 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.
The scheme used to compute the value at the mesh point 1,i 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 t+k2,xi−h2 using 1+xord2 points to the left of i, and xord2 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 t+k2,xi+h2 using xord2 points to the left of i, and 1+xord2 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 O⁡h2,k,h2⁢xord2k 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 O⁡1 due to the O⁡h2⁢xord2k 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 k<a⁢hxord for some a depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be O⁡h2,a'⁢⁢hxord,ha'⁢, or simply O⁡h when k=a'⁢⁢hxord,a'⁢<a.
The scheme used to compute the value at the mesh point 1,i is identical to that of the Euler scheme with the exception that the value u0,i is replaced by the interpolation of the value at u0,i using all other points in the Euler stencil u0,j where j≠i.
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 O⁡h2,k⁢h,k2 accurate.
The Lax-Wendroff method always requires a numerical boundary condition so that one boundary condition is specified for each boundary.
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 O⁡h2,k2 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 xord is even. For PDEs that are odd order in space, stability requires a restriction of the form k<a⁢hxord for some a depending upon the problem.
The scheme used to compute the value at the mesh point 1,i uses the formula
ut=u1,i−u−1,i2⁢k
for the time derivative, and uses central differencing over 1+2⁢xord2 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 O⁡h2,k2,k2h2⁢xord2 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 O⁡1 due to the O⁡k2h2⁢xord2 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 k<a⁢hxord for some a depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be O⁡h2,a'2⁢hxord, or simply O⁡h2 when k=a'⁢⁢hxord,a'⁢<a.
The scheme used to compute the value at the mesh point 1,i is identical to that of the Leapfrog scheme with the exception that the value u0,i is replaced by the average of the values u1,i and u−1,i 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 1,ξ, 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;
# 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:
Input Data
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 D1⁡u⁡x,t is present in the input PDE, this routine sees ∂∂xu⁡x,t instead.
The v 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 1,ix should be denoted as v1,ix.
The returned expression is to be used to compute the discrete solution value at v1,ix, where ix 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 directional flag can be set as output.
The INFO table has the following entries that can be used by this routine.
"timeord"
The INFO["timeord"] entry holds an integer giving the differential order of the PDE with respect to the time variable.
"spaceord"
The INFO["spaceord"] entry holds an integer giving the differential order of the PDE with respect to the space variable.
"mixed"
The INFO["mixed"] entry holds boolean value indicating if mixed partial derivatives are present in the PDE.
"directional"
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, vtimeidx,spaceidx, the step sizes h,k, the time value at the 0 time step t, and the space value on the mesh xspaceidx.
Additional Notes
The value of t used in the application of the output scheme is as at the 0 time step, that is, if the discretization is to be used to compute the discrete solution values at t=tv+k, the time value t used in computing with the scheme would be tv. This means that schemes that are derived as differences at half mesh points or backward schemes that use the time value at the future solution point must adjust the t value in the output scheme. In the latter case this can be accomplished by setting t to t+k.
The pdsolve command performs well for a direct discretization of the PDE, due to the optimization settings, so use of expand or normal on the discretized PDE within the method procedure can degrade performance. It is best to experiment with this when writing a custom method.
See Also
pdsolve
pdsolve/numeric
pdsolve/numeric/education
pdsolve/numeric/method
Download Help Document