
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 $\mathrm{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 $\mathrm{O}\left(h\,k\right)$ accurate.

•

First order PDEs that describe righttraveling waves should use the backward method (specified as ForwardTime1Space[backward]), and specify the boundary condition at the left boundary, while lefttraveling 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<ah$ for some $a$ depending upon the problem.

•

The scheme used to compute the value at the mesh point $\left[1\,i\right]$ is the result of applying differencing to the PDE about the point $t,{x}_{i}$ and can obtained by substitution of the discretizations

${u}_{t}=\frac{{u}_{1,i}{u}_{0,i}}{k},$
${u}_{x}=\frac{{u}_{0,i}{u}_{0,i1}}{h},$
$u={u}_{0,i}$

into the PDE for the backward method. The forward method simply replaces the discretization for ${u}_{x}$ by

${u}_{x}=\frac{{u}_{0,i+1}{u}_{0,i}}{h}$


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,{u}_{x},{u}_{t},{u}_{\mathrm{xt}}$.

•

The method is $\mathrm{O}\left(h\,{k}^{2}\right)$ accurate.

•

PDEs that describe righttraveling waves should use the backward method (specified as CenteredTime1Space[backward]), and specify the boundary condition at the left boundary, while lefttraveling 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 $\left[1\,i\right]$ is the result of applying differencing to the PDE about the point $t+\frac{k}{2},{x}_{i}$ and is obtained by substitution of the discretizations

${u}_{\mathrm{xt}}=\frac{{u}_{1,i}{u}_{1,i1}{u}_{0,i}+{u}_{0,i1}}{kh},$
${u}_{t}=\frac{{u}_{1,i}{u}_{0,i}}{k},$
${u}_{x}=\frac{{v}_{1,i}{v}_{1,i1}+{v}_{0,i}{v}_{0,i1}}{2h},$
$u=\frac{{u}_{1,i}}{2}+\frac{{u}_{0,i}}{2},$
$t=t+\frac{k}{2}$

into the PDE for the backward method. The forward method simply replaces the discretizations for ${u}_{\mathrm{xt}}$ and ${u}_{x}$ by

${u}_{\mathrm{xt}}=\frac{{u}_{1,i+1}{u}_{1,i}{u}_{0,i+1}+{u}_{0,i}}{kh},$
${u}_{x}=\frac{{v}_{1,i+1}{v}_{1,i}+{v}_{0,i+1}{v}_{0,i}}{2h}$


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,{u}_{x},{u}_{t},{u}_{\mathrm{xt}}$.

•

The method is $\mathrm{O}\left(h\,k\right)$ accurate.

•

PDEs that describe righttraveling waves should use the backward method (specified as BackwardTime1Space[backward]), and specify the boundary condition at the left boundary, while lefttraveling 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 $\left[1\,i\right]$ is the result of applying differencing to the PDE about the point $t+k,{x}_{i}$ and is obtained by substitution of the discretizations

${u}_{\mathrm{xt}}=\frac{{u}_{1,i}{u}_{1,i1}{u}_{0,i}+{u}_{0,i1}}{kh},$
${u}_{t}=\frac{{u}_{1,i}{u}_{0,i}}{k},$
${u}_{x}=\frac{{v}_{1,i}{v}_{1,i1}}{h},$
$u={u}_{1,i},$
$t=t+k$

into the PDE for the backward method. The forward method simply replaces the discretizations for ${u}_{\mathrm{xt}}$ and ${u}_{x}$ by

${u}_{\mathrm{xt}}=\frac{{u}_{1,i+1}{u}_{1,i}{u}_{0,i+1}+{u}_{0,i}}{kh},$
${u}_{x}=\frac{{v}_{1,i+1}{v}_{1,i}}{h}$


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 $\mathrm{O}\left({h}^{2}\,k\right)$ 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 $\mathrm{xord}$ is odd. For PDEs that are even order in space, stability requires a restriction of the form $k<a{h}^{\mathrm{xord}}$ for some $a$ depending upon the problem.

•

The scheme used to compute the value at the mesh point $\left[1\,i\right]$ is the result of applying central differencing to the PDE about the point $t,{x}_{i}$ using $1+2\u2308\frac{\mathrm{xord}}{2}\u2309$ points (that is, the mesh uses $\u2308\frac{\mathrm{xord}}{2}\u2309$ 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 $\mathrm{O}\left({h}^{2}\,{k}^{2}\right)$ 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 $\left[1\,i\right]$ is the result of applying central differencing to the PDE about the point $t+\frac{k}{2},{x}_{i}$ using $1+2\u2308\frac{\mathrm{xord}}{2}\u2309$ points (that is, the mesh uses $\u2308\frac{\mathrm{xord}}{2}\u2309$ 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 $\mathrm{O}\left({h}^{2}\,k\right)$ 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 $\left[1\,i\right]$ is the result of applying central differencing to the PDE about the point $t+k,{x}_{i}$ using $1+2\u2308\frac{\mathrm{xord}}{2}\u2309$ points (that is, the mesh uses $\u2308\frac{\mathrm{xord}}{2}\u2309$ 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 ${u}_{0,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 is $\mathrm{O}\left({h}^{2}\,{k}^{2}\right)$ 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 $\left[1\,i\right]$ 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+\frac{k}{2},{x}_{i}\frac{h}{2}$ using $1+\u230a\frac{\mathrm{xord}}{2}\u230b$ points to the left of $i$, and $\u230a\frac{\mathrm{xord}}{2}\u230b$ 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+\frac{k}{2},{x}_{i}+\frac{h}{2}$ using $\u230a\frac{\mathrm{xord}}{2}\u230b$ points to the left of $i$, and $1+\u230a\frac{\mathrm{xord}}{2}\u230b$ points to the right.



LaxFriedrichs


•

The LaxFriedrichs 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 $\mathrm{O}\left({h}^{2}\,k\,\frac{{h}^{2\u2308\frac{\mathrm{xord}}{2}\u2309}}{k}\right)$ 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 $\mathrm{O}\left(1\right)$ due to the $\mathrm{O}\left(\frac{{h}^{2\u2308\frac{\mathrm{xord}}{2}\u2309}}{k}\right)$ 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{h}^{\mathrm{xord}}$ for some $a$ depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be $\mathrm{O}\left({h}^{2},a\'{h}^{\mathrm{xord}},\frac{h}{a\'}\right)$, or simply $\mathrm{O}\left(h\right)$ when $k=a\'{h}^{\mathrm{xord}},a\'<a$.

•

The scheme used to compute the value at the mesh point $\left[1\,i\right]$ is identical to that of the Euler scheme with the exception that the value ${u}_{0,i}$ is replaced by the interpolation of the value at ${u}_{0,i}$ using all other points in the Euler stencil ${u}_{0,j}$ where $j\ne i$.



LaxWendroff


•

The LaxWendroff 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 $\mathrm{O}\left({h}^{2}\,kh\,{k}^{2}\right)$ accurate.

•

The LaxWendroff 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 $k<ah$ for some $a$ 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 $\mathrm{O}\left({h}^{2}\,{k}^{2}\right)$ 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 $\mathrm{xord}$ is even. For PDEs that are odd order in space, stability requires a restriction of the form $k<a{h}^{\mathrm{xord}}$ for some $a$ depending upon the problem.

•

The scheme used to compute the value at the mesh point $\left[1\,i\right]$ uses the formula

${u}_{t}=\frac{{u}_{1,i}{u}_{\mathrm{1},i}}{2k}$

for the time derivative, and uses central differencing over $1+2\u2308\frac{\mathrm{xord}}{2}\u2309$ points to compute all spatial derivatives.



DuFortFrankel


•

The DuFortFrankel 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 $\mathrm{O}\left({h}^{2}\,{k}^{2}\,\frac{{k}^{2}}{{h}^{2\u2308\frac{\mathrm{xord}}{2}\u2309}}\right)$ 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 $\mathrm{O}\left(1\right)$ due to the $\mathrm{O}\left(\frac{{k}^{2}}{{h}^{2\u2308\frac{\mathrm{xord}}{2}\u2309}}\right)$ 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{h}^{\mathrm{xord}}$ for some $a$ depending upon the problem. When this condition is combined with the accuracy of the method, the error is discovered to be $\mathrm{O}\left({h}^{2},a{\'}^{2}{h}^{\mathrm{xord}}\right)$, or simply $\mathrm{O}\left({h}^{2}\right)$ when $k=a\'{h}^{\mathrm{xord}},a\'<a$.

•

The scheme used to compute the value at the mesh point $\left[1\,i\right]$ is identical to that of the Leapfrog scheme with the exception that the value ${u}_{0,i}$ is replaced by the average of the values ${u}_{1,i}$ and ${u}_{\mathrm{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 $\left[1\,\mathrm{\xi}\right]$, 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 firstorder 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,ix1] + v[0,ix]v[0,ix1])/2/h,

diff(u,x,t)=(v[1,ix]v[1,ix1]v[0,ix]+v[0,ix1])/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 ${\mathrm{D}}_{1}\left(u\right)\left(x\,t\right)$ is present in the input PDE, this routine sees $\frac{\partial}{\partial x}\phantom{\rule[0.0ex]{0.4em}{0.0ex}}u\left(x\,t\right)$ 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 $\left[1\,\mathrm{ix}\right]$ should be denoted as ${v}_{1,\mathrm{ix}}$.


The returned expression is to be used to compute the discrete solution value at ${v}_{1,\mathrm{ix}}$, where $'\mathrm{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.


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, ${v}_{\mathrm{timeidx},\mathrm{spaceidx}}$, the step sizes $h,k$, the time value at the 0 time step $t$, and the space value on the mesh ${x}_{\mathrm{spaceidx}}$.


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=\mathrm{tv}+k$, the time value $t$ used in computing with the scheme would be $\mathrm{tv}$. This means that schemes that are derived as differences at half mesh points or backward schemes that use the time value at the $'\mathrm{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 $\mathrm{expand}$ or $\mathrm{normal}$ on the discretized PDE within the method procedure can degrade performance. It is best to experiment with this when writing a custom method.




