MCS 571 Computer Project 2 -- Numerical EPDE -- Spring 2004

Comparison of Numerical Methods for Linear Elliptic PDEs:
MATLAB or C/Fortran Programming Computation


MATLAB or C/Fortran Programming Output are Due Wednesday 28 April 2004 in Class


General Method Specifications:

Write a single, efficient, general program, in MATLAB, Fortran, C that compares the performance of the three numerical methods:

  1. Successive Overrelaxation (SOR),

  2. Alternating Directions Implicit (ADI),

  3. Conjugate Gradient Method (CGM)
for Elliptic PDEs. (See Prof. Hanson for any instruction variations.)

Apply these methods to the inhomogeneous, linear Elliptic PDE (LEPDE):

where a1 < x < b1;    a2 < y < b2.

Caveat Usor: You are responsible for checking the correctness of the formulas, given here and for any modifications needed to transform them to useful code.


Detailed Method Specifications:

The SOR and CGM methods are all derived from the Euler's explicit method which in the linear algebra formulation (with arrays marked with an M for matrix to avoid confusion with the model) is

where m1 and m2 are the total number of interior points for x and y, respectively. Let kmax=75 be the maximum number of iterations and tol = 0.5e-5. Caution: UM here means upper triangular part of AM, while Ui,j(k) denotes the kth iteration of a grid algebra component at node (i,j). (Remark: If you use MATLAB, then there may be three sets of indices to keep track of:


1. Successive Over Relaxation (SOR) Method:

Let XM0 = -w*DM-1*BM to start.

For k = 0 : kmax While (||RMk||2 > tol*||BM||2) Do:

where the SOR residual is which is not the same as the standard residual, and w=1.25 is the starting SOR acceleration parameter. Hence, in linear algebra iteration form. The grid algebra form can also be used for SOR, where the coefficients cp,q,i,j for (p, q) = (-1:+1, -1:+1) and c0,i,j depend on the PDE model and the FD scheme.


2. Alternating Directions Implicit (ADI) Method:

The ADI method is based on operator splitting by dimension for a higher order approximation to replace the Crank-Nicolson Implicit Method CNIM in higher dimension to preserve the tridiagonal advantage in using the Thomas algorithm (See your class notes or Morton and Mayer, the second opinion text). The method specified here is a modification of the PRADI variant of ADI for the variable coefficients and extra drift-source terms here. Use the same initial condition X0 as for the SOR method. Let the ADI acceleration parameter be symbolically given by

where Delta_t is an artificial time step from the CNI PPDE derivation, the relative diffusion coefficient is deltai2 is the CFD operator for a 2nd order derivative and Deltai is the CFD operator for a first order derivative, for i = 1:2. Let p = padi = w/Adh2max; to starting. The PRADI variant algorithm for our LEPDE here would be, These must be converted to a suitable form for the Thomas algorithm.


3. Conjugate Gradient Method (CGM):

The CGM method is best modified to account for non-symmetric matrices A and for program efficiency.

For this method, use one of the following professional codes given in MATLAB from the NeTLib software archive (the class pseudo-code only gives the major ideas):

  1. Conjugate Gradiant Squared Method (CGSM), see "help cgs" in MATLAB or use a text editor for the lead comments specifying the meaning of the input and output arguments,

    function [x, error, iter, flag] = cgs(A, x, b, M, max_it, tol)

  2. Bi-Conjugate Gradiant Method (BCGM), see "help cgs" in MATLAB or use a text editor for the lead comments specifying the meaning of the input and output arguments,

    function [x, error, iter, flag] = bicg(A, x, b, M, max_it, tol)

For each of these method M is the preconditioner or starting approximate for A = AM which can be taken as M = -DM.


Test Case Specifications:

Your program should be fairly general and not made just for the particular values or functions here, but you can use the following values as a test case as long as your program is not specifically tailored to it. where a1 < x < b1, a2 < y < b2. On

where PI = 4*atan(1), and the spatially variable coefficients are with boundary conditions, The mesh requirements are that m1 = 6 and m2 = 5. Let tol = 0.5e-6 and kmax = 10 iterates.


Output Specifications:

  1. In a well-labeled rectangular table, tabulate the SOR, ADI and CGM

      Ui,j(k)
    for (i,j) = (0,0) : (m1+1,m2+1) at the starting iterate, for the first two new iterates (for SOR and ADI only) and the last full iterate, to 5 significant digits in Ui,j(k). Also make a plot of the final iterate. Print out the final value (successful or not) of the stopping criterion and the total number of iterations. For CGM methods also print out the estimated error. Note that you have to convert XM to U, including boundary conditions for CGM and other methods where the linear algebra form was used.

  2. Report the timings for each method of solution. You can use clock with etime or btter timer in MATLAB or C or Fortran. Specify what you are actually timing and make sure it is a fair comparison, being sure to mention if you have excluded a common setup of the problem prior to solving.

  3. Comment on the nature of the difference among SOR, ADI and CGM and say why. State what computer and what compiler were used.


Efficiency Hints:

  1. Compute once and store the spatially dependent coefficients in an array to use in all iteration steps.
  2. Avoid calculating items like constant expressions in loops.


Web Source: http://www.math.uic.edu/~hanson/mcs571/ecp571s04:.html

MCS 571 HomePage: http://www.math.uic.edu/~hanson/mcs571/

Email Comments or Questions to hanson A T uic edu