MATLAB Function Reference Previous page   Next Page
pdepe

Solve initial-boundary value problems for systems of parabolic and elliptic partial differential equations (PDEs) in one space variable and time

Syntax

Arguments

m

A parameter corresponding to the symmetry of the problem. m can be slab = 0, cylindrical = 1, or spherical = 2.

pdefun

A handle to a function that defines the components of the PDE.

icfun

A handle to a function that defines the initial conditions.

bcfun

A handle to a function that defines the boundary conditions.

xmesh
A vector [x0, x1, ..., xn] specifying the points at which a numerical solution is requested for every value in tspan. The elements of xmesh must satisfy x0 < x1 < ... < xn. The length of xmesh must be >= 3.
tspan

A vector [t0, t1, ..., tf] specifying the points at which a solution is requested for every value in xmesh. The elements of tspan must satisfy t0 < t1 < ... < tf. The length of tspan must be >= 3.

options

Some options of the underlying ODE solver are available in pdepe: RelTol, AbsTol, NormControl, InitialStep, and MaxStep. In most cases, default values for these options provide satisfactory solutions. See odeset for details.

Description

sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan) solves initial-boundary value problems for systems of parabolic and elliptic PDEs in the one space variable and time . pdefun, icfun, and bcfun are function handles. See Function Handles in the MATLAB Programming documentation for more information. The ordinary differential equations (ODEs) resulting from discretization in space are integrated to obtain approximate solutions at times specified in tspan. The pdepe function returns values of the solution on a mesh provided in xmesh.

Parameterizing Functions Called by Function Functions, in the MATLAB mathematics documentation, explains how to provide additional parameters to the functions pdefun, icfun, or bcfun, if necessary.

pdepe solves PDEs of the form:

     (2-2)  

The PDEs hold for and . The interval must be finite. can be 0, 1, or 2, corresponding to slab, cylindrical, or spherical symmetry, respectively. If , then must be >= 0.

In Equation 2-2, is a flux term and is a source term. The coupling of the partial derivatives with respect to time is restricted to multiplication by a diagonal matrix . The diagonal elements of this matrix are either identically zero or positive. An element that is identically zero corresponds to an elliptic equation and otherwise to a parabolic equation. There must be at least one parabolic equation. An element of that corresponds to a parabolic equation can vanish at isolated values of if those values of are mesh points. Discontinuities in and/or due to material interfaces are permitted provided that a mesh point is placed at each interface.

For and all , the solution components satisfy initial conditions of the form

     (2-3)  

For all and either or , the solution components satisfy a boundary condition of the form

     (2-4)  

Elements of are either identically zero or never zero. Note that the boundary conditions are expressed in terms of the flux rather than . Also, of the two coefficients, only can depend on .

In the call sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan):

pdepe returns the solution as a multidimensional array sol.  = ui = sol(:,:,i) is an approximation to the ith component of the solution vector . The element ui(j,k) = sol(j,k,i) approximates at  = (tspan(j),xmesh(k)).

ui = sol(j,:,i) approximates component i of the solution at time tspan(j) and mesh points xmesh(:). Use pdeval to compute the approximation and its partial derivative at points not included in xmesh. See pdeval for details.

sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan,options) solves as above with default integration parameters replaced by values in options, an argument created with the odeset function. Only some of the options of the underlying ODE solver are available in pdepe: RelTol, AbsTol, NormControl, InitialStep, and MaxStep. The defaults obtained by leaving off the input argument options will generally be satisfactory. See odeset for details.

Remarks

Examples

Example 1. This example illustrates the straightforward formulation, computation, and plotting of the solution of a single PDE.

This equation holds on an interval for times .

The PDE satisfies the initial condition

and boundary conditions

It is convenient to use subfunctions to place all the functions required by pdepe in a single M-file.

In this example, the PDE, initial condition, and boundary conditions are coded in subfunctions pdex1pde, pdex1ic, and pdex1bc.

The surface plot shows the behavior of the solution.

The following plot shows the solution profile at the final value of t (i.e., t = 2).

Example 2. This example illustrates the solution of a system of PDEs. The problem has boundary layers at both ends of the interval. The solution changes rapidly for small .

The PDEs are

where .

This equation holds on an interval for times .

The PDE satisfies the initial conditions

and boundary conditions

In the form expected by pdepe, the equations are

The boundary conditions on the partial derivatives of have to be written in terms of the flux. In the form expected by pdepe, the left boundary condition is

and the right boundary condition is

The solution changes rapidly for small . The program selects the step size in time to resolve this sharp change, but to see this behavior in the plots, the example must select the output times accordingly. There are boundary layers in the solution at both ends of [0,1], so the example places mesh points near 0 and 1 to resolve these sharp changes. Often some experimentation is needed to select a mesh that reveals the behavior of the solution.

In this example, the PDEs, initial conditions, and boundary conditions are coded in subfunctions pdex4pde, pdex4ic, and pdex4bc.

The surface plots show the behavior of the solution components.

See Also

function_handle (@), pdeval, ode15s, odeset, odeget

References

[1]  Skeel, R. D. and M. Berzins, "A Method for the Spatial Discretization of Parabolic Equations in One Space Variable," SIAM Journal on Scientific and Statistical Computing, Vol. 11, 1990, pp.1-32.


Previous page  pcolor pdeval Next page

© 1994-2005 The MathWorks, Inc.