MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of MATLAB Mathematics - SERC - Index of

serc.iisc.ernet.in
from serc.iisc.ernet.in More from this publisher
15.11.2014 Views

5 Differential Equations The example pdex3 uses pdeval to evaluate the derivative of the solution at xout = 0. See pdeval for details. Changing PDE Integration Properties The default integration properties in the MATLAB PDE solver are selected to handle common problems. In some cases, you can improve solver performance by overriding these defaults. You do this by supplying pdepe with one or more property values in an options structure. sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan,options) Use odeset to create the options structure. Only those options of the underlying ODE solver shown in the following table are available for pdepe. The defaults obtained by leaving off the input argument options are generally satisfactory. “Changing ODE Integration Properties” on page 5-17 tells you how to create the structure and describes the properties. PDE Property Categories Properties Category Error control Step-size Property Name RelTol, AbsTol, NormControl InitialStep, MaxStep Example: Electrodynamics Problem This example illustrates the solution of a system of partial differential equations. The problem is taken from electrodynamics. It has boundary layers at both ends of the interval, and the solution changes rapidly for small t . The PDEs are ∂u --------- 1 0.024 ∂2 u 1 = ----------- ∂t ∂x 2 – Fu ( 1 – u 2 ) ∂u --------- 2 0.170 ∂2 u 2 = ----------- ∂t ∂x 2 + Fu ( 1 – u 2 ) where Fy ( ) = exp( 5.73y) – exp( – 11.46y) . The equations hold on an interval 0 ≤ x ≤ 1 for times t ≥ 0 . 5-100

Partial Differential Equations The solution u satisfies the initial conditions u 1 ( x, 0) ≡ 1 u 2 ( x, 0) ≡ 0 and boundary conditions ∂u --------- 1 ( 0, t) ≡ 0 ∂x u 2 ( 0, t) ≡ 0 u 1 ( 1, t) ≡ 1 ∂u --------- 2 ( 1, t) ≡ 0 ∂x Note The demo pdex4 contains the complete code for this example. The demo uses subfunctions to place all required functions in a single M-file. To run this example type pdex4 at the command line. See “PDE Solver Basic Syntax” on page 5-92 and “Solving PDE Problems” on page 5-94 for more information. 1 Rewrite the PDE. In the form expected by pdepe, the equations are 1 1 .∗ ∂ ---- u 1 ∂t u 2 = ∂ ----- 0.024( ∂u 1 ⁄ ∂x) ∂x 0.170( ∂u 2 ⁄ ∂x) + – Fu ( 1 – u 2 ) Fu ( 1 – u 2 ) The boundary conditions on the partial derivatives of u have to be written in terms of the flux. In the form expected by pdepe, the left boundary condition is 0 1 + u 2 0 .∗ 0.024( ∂u 1 ⁄ ∂x) 0.170( ∂u 2 ⁄ ∂x) = 0 0 5-101

5 Differential Equations<br />

The example pdex3 uses pdeval to evaluate the derivative <strong>of</strong> the solution at<br />

xout = 0. See pdeval for details.<br />

Changing PDE Integration Properties<br />

The default integration properties in the <strong>MATLAB</strong> PDE solver are selected to<br />

handle common problems. In some cases, you can improve solver performance<br />

by overriding these defaults. You do this by supplying pdepe with one or more<br />

property values in an options structure.<br />

sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan,options)<br />

Use odeset to create the options structure. Only those options <strong>of</strong> the<br />

underlying ODE solver shown in the following table are available for pdepe.<br />

The defaults obtained by leaving <strong>of</strong>f the input argument options are generally<br />

satisfactory. “Changing ODE Integration Properties” on page 5-17 tells you<br />

how to create the structure and describes the properties.<br />

PDE Property Categories<br />

Properties Category<br />

Error control<br />

Step-size<br />

Property Name<br />

RelTol, AbsTol, NormControl<br />

InitialStep, MaxStep<br />

Example: Electrodynamics Problem<br />

This example illustrates the solution <strong>of</strong> a system <strong>of</strong> partial differential<br />

equations. The problem is taken from electrodynamics. It has boundary layers<br />

at both ends <strong>of</strong> the interval, and the solution changes rapidly for small t .<br />

The PDEs are<br />

∂u<br />

--------- 1<br />

0.024 ∂2 u 1<br />

= -----------<br />

∂t<br />

∂x 2 – Fu ( 1 – u 2 )<br />

∂u<br />

--------- 2<br />

0.170 ∂2 u 2<br />

= -----------<br />

∂t<br />

∂x 2 + Fu ( 1 – u 2 )<br />

where Fy ( ) = exp( 5.73y)<br />

– exp( – 11.46y)<br />

. The equations hold on an interval<br />

0 ≤ x ≤ 1 for times t ≥ 0 .<br />

5-100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!