#
MCS 571 S97 --- Numerical Methods for PDEs --- Hanson

##
PPDE Computer Problem

Problem program with output due Wednesday 05 March 1997 in class.
Write a single, efficient program, in double precision (64 bit),
that compares the performance of the three numerical methods:

1) the Euler's Explicit Method (EEM),

2) the Crank-Nicolson Implicit Method (CNIM), and

3) the Runge-Kutta Explicit Method (RKEM) modified for PPDEs. Apply
these methods to the inhomogeneous, linear Parabolic Partial
Differential Equation:

where
,

Consider the special test example with spatially variable coefficients,

on
, with initial conditions:

on
and boundary conditions:

for *t > 0*
with
,
, *m = 11*,
*n= 101* and mesh requirements,

,

,

where
,
for *i=0* to *m*,
for *j=0* to *n*.
Use an
high order Forward Finite Difference
approximation for
.
If your method needs corner values, i.e.,
and
, use the
average values of the boundary and initial conditions.
*Warning: Do not write your code only for numerical values
given here, but write it more generally and not just for this
test case.*

**Method Specifications:**
The *Euler's Explicit Method (EEM)* can be written as

where here
and
are the
Central Finite Difference (CFD) approximations using
corresponding
to the derivatives
and
, respectively.

The *Crank-Nicolson Implicit Method (CNIM)* is

where
and the corresponding
CFD derivatives are
and
,
all using
as discrete
values. Use the Thomas Tridiagonal Solver Algorithm to solve.

The *4th order Runge-Kutta Explicit method (RKEM)*
(modified PPDE for this Computer Problem from the 4th order RKEM ODE
method) is written,

for interior points, where

with
with corresponding
derivatives
and
(all indexed at *(i,j)*),

with
and
corresponding derivatives
and
,

with
and
corresponding derivatives
and
, and

with
and
corresponding
derivatives
and
,
using
as discrete values.
Each
should satisfy derivative boundary
conditions
where they are specified, for *[p] = 1, 2, 3,* and *4*.

**Output Specifications:**
Tabulate for *j = 0* to *5* step *1*
and *j=11* to *n* step *10*
(i.e., variable sample)
*j
*
while for *i = 0,2,5,9,m,*
*
i EEM[U]
CNIM[U] RKEM[U] RELDIF[EEM]
RELDIF[CNIM]
*
in 4 significant digit exponential format for the above floating point
headings, where *EEM[U]*, *CNIM[U]* &
*RKEM[U]* are the respective Euler's
Explicit, Crank-Nicolson Implicit & Runge-Kutta Explicit Methods
results for
, while *RELDIF[EEM]* &
*RELDIF[CNIM]* are the relative difference of
the first two methods compared to *RKEM*, i.e.,
*RELDIF[EEM] = EEM[U]/RKEM[U]-1,*
*RELDIF[CNIM] = CNIM[U]/RKEM[U]-1,*
provided
. Also print out the outputted
locations,
, at least once at the beginning of the
tabulated numerical output. In
addition, report the timings in seconds for each method, counting
common initializations of terms like coefficient arrays
for *{a, b, c, d}* and output.

**Some Proper Efficiency Suggestions:**
1) Compute once and store the spatially dependent coefficients
in an array to use in all time steps.

2) Avoid calculating items like constant expressions in loops, but keep
code general.

Added Note: These methods can also be used for nonlinear PPDEs,
directly for EEM and RKEM, but with a predictor-corrector modification
for CNIM.

`Web Source: http://www.math.uic.edu/~hanson/pcp571s97.html`
`Email Comments or Questions to
hanson@uic.edu
`