pdsolve/numeric - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Differential Equations : pdsolve : pdsolve/numeric

pdsolve/numeric

find numerical solution of time-based partial differential equations

 

Calling Sequence

Parameters

Description

Time-based Solver

Options

Details

Returned Module

Examples

References

Calling Sequence

pdsolve(PDEsys, conditions, numeric, vars, options)

Parameters

PDEsys

-

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

vars

-

(optional) dependent variable or a set or list of dependent variables for PDEsys

options

-

(optional) equations of the form keyword = value where keyword is one of 'indepvars', 'time', 'range', 'spacestep', 'timestep', 'bcopts', 'optimize', 'errorest', 'errortype', 'abstol', 'mintimestep' or 'maxtimestep'; specify options for the problem and its solution

Description

• 

The pdsolve(PDEsys,conditions,numeric,vars,options) command returns a module that can be used to compute numerical solutions for time-based PDE systems over a fixed finite 1-space interval.

• 

The pdsolve/numeric routine uses finite difference methods to obtain these numerical solutions.

• 

The PDE system PDEsys must be specified in diff notation.

• 

Derivatives in the initial/boundary conditions conditions must be specified in indexed D notation (for example, for u(x,y), D[1]u0,y describes the normal derivative on the line x=0).

• 

The vars parameter specifies the dependent variable(s) of the problem. For the solvers that can compute solutions of systems of PDEs, it provides an order for the dependent variables in the output.

• 

For information on specifying the independent variables of the problem, see the Options section of this help page.

Time-based Solver

• 

The solver has two modes of operation.

  

- The first mode of operation uses the default method, which is a centered implicit scheme, and is capable of finding solutions for higher order PDE or PDE systems. The PDE systems must be sufficiently close to a standard form for the method to find the numerical solution.

  

- The second mode of operation is strictly educational, and allows specification of a particular method to solve a PDE. This mode is restricted to a single PDE.

• 

Note: This page describes only the default method. For information on the specified method approach, see Finding a Numerical Solution of a PDE Using a Specified Method. Both modes accept Dirichlet, Neumann, Robin, or periodic boundary conditions.

Options

  

The optional equations for the default method are as follows.

  

'indepvars'=list

  

Specifies the independent variables of the problem, and provides an order to the independent variables for returned procedures that compute the solution given the values of the independent variables.

  

'time'=name, 'range'=l..r

  

The time argument specifies the name of the time variable for the problem, while the range argument specifies the spatial domain of the problem. Note: The values of both options are determined automatically if the boundary conditions are specified for both end points of the domain. These options are typically needed only for first order non-periodic problems where only one of the end points appears in the condition.

  

'spacestep'=numeric

  

Specifies the spacing of the spatial points on the discrete mesh on which the solution is computed, and defaults to 1/20th of the spatial range of the problem, rl, where l is the left boundary, and r is the right. Note: The spacing must be small enough that a sufficient number of points are in the spatial domain for the given method, boundary conditions, and spatial interpolation (see below). If the given value of spacestep does not fit into the input domain an integral number of times, the closest smaller step size that does is used. For problems using error estimates, or an adaptive approach, the total number of spatial points must be odd, so again, if this is not the case for the specified spacestep, then it is reduced to satisfy this requirement.

  

'timestep'=numeric

  

Provides the size of the time step used when integrating the PDE in the time direction, and defaults to the value of the spatial step spacestep before adjustments are made for fitting the interval.

  

'bcpts'=integer

  

Specifies the number of points used in discretization of the boundary conditions of the problem. It defaults to one greater than the differential order of the PDE in the space variable. This provides a first order accurate approximation to the boundary condition. Additional information is available below in Details.

  

'optimize'=boolean/symbol

  

Specifies the level of optimization to use in generating the method. Three types of optimization are available, true, partial, and false. The default partial optimization gives fairly good performance for a low time penalty in generating the method. A setting of false disables optimization altogether (not recommended). A setting of true causes pdsolve to call codegen[optimize] when constructing the numerical method. Because the additional time efficiency from the use of the fully optimized method is often offset by the time taken to perform the optimization, partial is the default setting.

  

'errorest'=boolean,'errortype'=keyword,'abstol'=numeric,'mintimestep'=numeric, 'maxtimestep'=numeric

  

These are all options related to error estimation, and error control, and are discussed in the pdsolve,numeric,errorcontrol page.

  

'compile'=boolean

  

This option specifies that the underlying procedures used to evaluate the PDE should be compiled. By default this is false, as not all PDE can be compiled, and this option can only be used for the default PDE solution method. Problems typically run significantly faster when compiled. Note that in the event the compile fails, the problem will be silently run with compile=false.

Details

  

The default method uses a second order (in space and time) centered, implicit finite difference scheme to obtain the computed solution. The number of points in the stencil of the finite difference scheme is one greater than the order of each equation.

  

Note: A first order accurate accurate boundary condition (the default) can be used for second order accurate method, and still provide a solution of second order accuracy. Use of boundary conditions with an order of accuracy that is too low degrades the accuracy of the solution, while use of boundary conditions with an order of accuracy that is too high may negatively impact the stability of the problem. For first and second order accurate methods, it is generally recommended to use one or two more boundary points than the differential order of the PDE in the space variable. For third and fourth order accurate methods it is generally recommended to use two or three more boundary points than the differential order of the PDE in the space variable.

  

PDE that are greater than first order in time are solved by converting to an equivalent first order system. Note: The conversion to first order is the expected one, namely that for any dependent variables that are higher than first order, variables representing all lower order time derivatives, and corresponding equations, are appended to the system. This choice of additional variables may not always be desirable, particularly when error control is in use, so often better performance can be obtained by choosing the first order system yourself. For more information on this topic, see pdsolve/numeric/firstorder.

  

Requested values that do not lie on a mesh point are computed using a Lagrange interpolation that uses 4 space points and 3 time points. The time points are chosen (whenever possible) so that only one time value is larger than the requested time.

Returned Module

  

The module returned by pdsolve/numeric has a number of methods that can be used to compute or view the solution of the input PDE: plot, plot3d, animate, and value. In addition, the settings method is available to query/set certain parameters of the solution process.

  

If the method returned by pdsolve/numeric is assigned to a name, say pde_module, the calling sequences that use the methods have the form pde_module:-method(arguments), where method is one of plot, plot3d, animate, value, and settings.

• 

depspec

  

All methods involving the computation of solution values allow specification of multiple functions of the dependent and independent variables along with options specific to each function. This allows multiple plots to be displayed with the same command using different options for each. The full description of this argument is here. In the methods below, it is only referenced by name.

  

The default value of depspec is the first dependent variable of the problem with no additional options.

  

In the single function case, depspec can be a function of the dependent and independent variables, or a list consisting of a function of the dependent and independent variables followed by options. For example, ux,tsinx, or ux,t,color=blue.

  

If specifying multiple functions, depspec can be given as a list of functions or function/option combinations as described in the single function case. For example, ux,t,wx,t, or ux,t+t,color=blue,wx,t.

• 

plot

  

The plot method supports the following calling sequences.

  

plot(v1=numeric, options)

  

plot(depspec, v1=numeric, options)

  

plot(v1=numeric, v2=range, options)

  

plot(depspec, v1=numeric, v2=range, options)

  

In the above calling sequences, the values/ranges specified by v1=numeric and v2=range, where v1,v2 are the names of the independent variables of the problem, specify the domain of the plot.

  

If only the value of v1 is specified (as is the case in the first two calling sequences), the functions are plotted with the value of that independent variable fixed as specified, and the domain of the plot ranging between the boundaries for the other independent variable. For example, specification of t=1 for a problem in ux,t defined for x in the range 0,1 plots ux,1 for x=0..1.

  

Note: If the spatial value is fixed, a time range must also be specified as in the third and fourth calling sequences.

  

If both a value and range are specified, v1 is fixed at the specified value and the plot is displayed over the range described by v2. The range for v2 must be contained in the boundaries for v2 (that is, the domain of the problem).

  

The options input specifies plot options to apply to all displayed plots that do not have a conflicting plot-specific option in the depspec.

  

Unlike plot, the plot method defaults to using the discrete points used on the computational domain, as controlled by timestep and/or spacestep. This can be changed by using the numpoints=npt plot option, in which case npt equally spaced points are computed by interpolation to obtain the plot.

• 

animate

  

The animate method supports the following calling sequences.

  

animate(v1=numeric, range, list, options)

  

animate(depspec, v1=numeric, range, list, options)

  

animate(v1=numeric, range, list, v2=range, options)

  

animate(depspec, v1=numeric, range, list, v2=range, options)

  

In the above calling sequences, the values/ranges specified for v1 give the animation, and the range specified by v2=range specifies the domain of each frame of the animation where v1,v2 are the names of the independent variables of the problem.

  

The specification of the values for v1 determines which values of v1 correspond to each frame of the animation. If specified as a range, the default of 16 frames is used to generate the animation, which can be changed using the option frames=integer. If specified as a list, the v1 values in the list are sorted, and correspond to the v1 values for each frame of the animation. Note: The v1=numeric specification, where v1 is the time variable, corresponds to the specification t&equals;t0..numeric for t0<numeric and t&equals;numeric..t0 for numeric<t0, where t0 is the initial time for the problem.

  

The v2=range argument (if provided) gives the range of the plot. If not present, this defaults to the interval between the boundaries of the problem.

  

Note: If v1 corresponds to the spatial variable, then v2=range must be provided.

  

The options input specifies plot options to apply to all displayed animations that do not have a conflicting plot-specific option in the depspec.

  

In addition, the title option has an additional feature. Using a floating point printf format code, you can display the time or space value for the current frame of the animation. For example, in a time-based animation, specifying title="t=%f" displays the specified title with the current time in place of %f in the animation. For more information, see the section on floating point formats on the printf help page.

  

Unlike plots[animate], the animate method defaults to using the discrete points used on the computational domain, as controlled by timestep or spacestep. This can be changed by using the numpoints=npt plot option, in which case npt equally spaced points are computed by interpolation to obtain the plot for each frame.

• 

plot3d

  

The plot3d method supports the following calling sequences.

  

plot3d(v1=numeric, range, options)

  

plot3d(depspec, v1=numeric, range, options)

  

plot3d(v1=numeric, range, v2=range, options)

  

plot3d(depspec, v1=numeric, range, v2=range, options)

  

In the above calling sequences, the values/ranges specified for v1 and v2 specify the rectangular area over which the 3-d plot is produced where v1,v2 are the names of the independent variables of the problem.

  

The specifications of v1,v2 define the domain for the plot. Like animate, the specification v1=numeric defines the interval from the initial point of the problem for the time variable.

  

The options input specifies plot3d options to apply to all displayed plots that do not have a conflicting plot-specific option in the depspec.

  

Unlike plot3d, the plot3d method supports explicit functions of the dependent and independent variables in the color specification for both the RGB and HUE types. For example, for a PDE problem in ux&comma;t, the RGB values can be specified by color&equals;ux&comma;t&comma;xux&comma;t2&comma;xtux&comma;t.

• 

value

  

The value method provides a mechanism to obtain the numerical values for the solution of the PDE or PDE system directly. The value method supports the following calling sequences.

  

value(options)

  

value(depspec, options)

  

value(v1=numeric, options)

  

value(depspec, v1=numeric, options)

  

value(v1=numeric, v2=range, options)

  

value(depspec, v1=numeric, v2=range, options)

  

In all cases, the value method returns a procedure or procedures that can be used to evaluate the solution at a point.

  

There are two distinct forms of output, bivariate functions (that is, the solution over the domain), or univariate functions (that is, solution profiles with one independent variable value fixed).

  

The first two calling sequences provide bivariate function output, so the returned function or functions are procedures that, given the values of both independent variables, return solution value(s). For these calling sequences, the solution is computed as each point is requested.

  

The remaining four calling sequences provide solution profiles with v1 fixed to the specified numeric function value. For these calling sequences, the solution is computed prior to output, and the returned procedure essentially provides an interpolation of that output. For the 5th and 6th calling sequences, v1 corresponds to the spatial variable. In this case, the returned procedures can only compute values for the time range specified by v2=range.

  

The only allowable option is used to specify the output type for the returned procedure(s), and like dsolve[numeric], it can be either output=procedurelist (the default) or output=listprocedure. The procedurelist output returns a single procedure that, if called with valid independent variable values, returns a list of equations for the independent variable values, and the dependent variable values as specified by the depspec if provided. The listprocedure output returns a list of equations, where the right-hand sides of these equations correspond to procedures that can be called to compute the numerical value indicated by the left-hand sides of the equations.

• 

settings

  

The settings command allows querying or setting of parameters for the computation of the solution. It supports the following calling sequences.

  

settings()

  

settings(options)

  

The first calling sequence is query-only, and reports settings that can be changed for the computation.

  

The second calling sequence changes settings based on the specified options. Valid options include timestep, and spacestep, which can be set in the same way as for the original call to pdsolve/numeric, with the exception that changing the spacestep value after creation of the solution module does not change the timestep. Adaptive modules have additional options for the settings method, see pdsolve,numeric,errorcontrol.

Examples

Simple wave equation:

PDEtux&comma;t&equals;xux&comma;t

PDE:=tux&comma;t&equals;xux&comma;t

(1)

IBCux&comma;0&equals;sin2&pi;x&comma;u0&comma;t&equals;sin2&pi;t

IBC:=u0&comma;t&equals;sin2&pi;t&comma;ux&comma;0&equals;sin2&pi;x

(2)

pdspdsolvePDE&comma;IBC&comma;numeric&comma;time&equals;t&comma;range&equals;0..1

pds:=moduleexportplot&comma;plot3d&comma;animate&comma;value&comma;settings&semi;...end module

(3)

p1pds:-plott&equals;0&comma;numpoints&equals;50&colon;p2pds:-plott&equals;18&comma;numpoints&equals;50&comma;color&equals;blue&colon;p3pds:-plott&equals;14&comma;numpoints&equals;50&comma;color&equals;green&colon;plots&lsqb;display&rsqb;p1&comma;p2&comma;p3

Plot of errors (exact solution is known):

esolsin2&pi;xt

esol:=sin2&pi;xt

(4)

p2pds:-plotuesol&comma;t&equals;18&comma;numpoints&equals;50&comma;color&equals;blue&colon;p3pds:-plotuesol&comma;t&equals;38&comma;numpoints&equals;50&comma;color&equals;green&colon;plots&lsqb;display&rsqb;p2&comma;p3

Heat equation with left end fixed at constant temperature and right end insulated:

PDEtux&comma;t&equals;12x2ux&comma;t10

PDE:=tux&comma;t&equals;1102x2ux&comma;t

(5)

IBCux&comma;0&equals;1&comma;u0&comma;t&equals;0&comma;D&lsqb;1&rsqb;u1&comma;t&equals;0

IBC:=u0&comma;t&equals;0&comma;ux&comma;0&equals;1&comma;D1u1&comma;t&equals;0

(6)

pdspdsolvePDE&comma;IBC&comma;numeric

pds:=moduleexportplot&comma;plot3d&comma;animate&comma;value&comma;settings&semi;...end module

(7)

p1pds:-plott&equals;0&colon;p2pds:-plott&equals;110&colon;p3pds:-plott&equals;12&colon;p4pds:-plott&equals;1&colon;p5pds:-plott&equals;2&colon;plots&lsqb;display&rsqb;p1&comma;p2&comma;p3&comma;p4&comma;p5&comma;title&equals;`Heat profile at t=0,0.1,0.5,1,2`

pds:-valuet&equals;1&comma;output&equals;listprocedure

x&equals;procx...end proc&comma;t&equals;1.&comma;ux&comma;t&equals;procx...end proc

(8)

uvalrhsop3&comma;

uval:=procx...end proc

(9)

fsolveuvalx&equals;12&comma;x&equals;0..1

0.2978753742

(10)

pds:-plot3dt&equals;0..1&comma;x&equals;0..1&comma;axes&equals;boxed&comma;orientation&equals;120&comma;40&comma;color&equals;0&comma;0&comma;u

Biharmonic: Bar with fixed ends and fixed angles:

PDE2t2ux&comma;t&equals;14x4ux&comma;t10

PDE:=2t2ux&comma;t&equals;1104x4ux&comma;t

(11)

IBCux&comma;0&equals;sin&pi;x2&comma;D&lsqb;2&rsqb;ux&comma;0&equals;0&comma;u1&comma;t&equals;0&comma;D&lsqb;1&rsqb;u1&comma;t&equals;0&comma;u1&comma;t&equals;0&comma;D&lsqb;1&rsqb;u1&comma;t&equals;0

IBC:=u1&comma;t&equals;0&comma;u1&comma;t&equals;0&comma;ux&comma;0&equals;sin&pi;x2&comma;D1u1&comma;t&equals;0&comma;D1u1&comma;t&equals;0&comma;D2ux&comma;0&equals;0

(12)

pdspdsolvePDE&comma;IBC&comma;numeric&comma;spacestep&equals;140

pds:=moduleexportplot&comma;plot3d&comma;animate&comma;value&comma;settings&semi;...end module

(13)

Animated (displaying the time in the title) with the following command:

pds:-animatet&equals;2&comma;frames&equals;50&comma;title&equals;time = %f

Solution just prior to formation of a shock for a nonlinear PDE:

PDEtux&comma;t&equals;xux&comma;tux&comma;t

PDE:=tux&comma;t&equals;xux&comma;tux&comma;t

(14)

IBCux&comma;0&equals;&ExponentialE;16x1222&comma;u0&comma;t&equals;&ExponentialE;42

IBC:=u0&comma;t&equals;12&ExponentialE;4&comma;ux&comma;0&equals;12&ExponentialE;16x122

(15)

pdspdsolvePDE&comma;IBC&comma;numeric&comma;time&equals;t&comma;range&equals;0..2&comma;spacestep&equals;1256&comma;timestep&equals;160

pds:=moduleexportplot&comma;plot3d&comma;animate&comma;value&comma;settings&semi;...end module

(16)

Animated with the following command:

pds:-animatet&equals;0.60&comma;frames&equals;31

An example of a system (also biharmonic)

PDEtux&comma;t&equals;12x2vx&comma;t20&comma;tvx&comma;t&equals;2x2ux&comma;t&colon;

IBCux&comma;0&equals;sin&pi;x&comma;u0&comma;t&equals;0&comma;u1&comma;t&equals;0&comma;vx&comma;0&equals;1x&comma;v0&comma;t&equals;1&comma;v1&comma;t&equals;0&colon;

pdspdsolvePDE&comma;IBC&comma;numeric&comma;spacestep&equals;150

pds:=moduleexportplot&comma;plot3d&comma;animate&comma;value&comma;settings&semi;...end module

(17)

And plots of the solution v at t=0,0.1,...,0.5 can be obtained via

plots&lsqb;display&rsqb;seqpds:-plotv&comma;t&equals;i10&comma;i&equals;0..5

References

  

Boyce, W.E. and DiPrima, R.C. Elementary Differential Equations and Boundary Value Problems. New York: John Wiley & Sons, 1997.

  

Carrier, G.F. and Pearson, C.E. Partial Differential Equations: Theory and Technique. 2nd ed. Academic Press, 1988.

  

Strikwerda, J. C. Finite Difference Schemes and Partial Differential Equations. Wadsworth and Brooks/Cole, 1989.

See Also

codegen[optimize]

dsolve[numeric]

fsolve

pdsolve

pdsolve/numeric/education

pdsolve/numeric/errorcontrol

pdsolve/numeric/firstorder

pdsolve/numeric/method

plot

plot options

plot3d

plots[animate]

plots[display]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam