Given by Geoffrey C. Fox at CPS615 Basic Simulation Track for Computational Science on Fall Semester 95. Foils prepared 8 November 1995
Outside Index
Summary of Material
This Introduces the three fundamental types of PDE's -- Elliptic, Parabolic and Hyperbolic and studies the numerical solution of Elliptic Equations |
The sparse matrix formulation is used and iterative approachs -- Jacobi, Gauss Seidel and SOR are defined |
These are motivated by analogies between equilibrium of diffusive equations and elliptic systems |
Eigenvalue analysis is used to discuss convergence of methods |
Outside Index Summary of Material
Geoffrey Fox |
NPAC |
Syracuse University |
111 College Place |
Syracuse NY 13244-4100 |
This Introduces the three fundamental types of PDE's -- Elliptic, Parabolic and Hyperbolic and studies the numerical solution of Elliptic Equations |
The sparse matrix formulation is used and iterative approachs -- Jacobi, Gauss Seidel and SOR are defined |
These are motivated by analogies between equilibrium of diffusive equations and elliptic systems |
Eigenvalue analysis is used to discuss convergence of methods |
Physical systems which behave as continuous systems at a macroscopic level, in a fluid fashion |
Examples:
|
Partial Differential Equations (PDE's) are characterized by rate of changes in 2 or more independent variables |
Wave equation (hyperbolic): One dimensional equation is: |
The natural generalization is Maxwell's Equations describing computational Electromagnetics for radar cross-sections of aircraft and antenna patterns |
Numerical Relativity has interesting complex wave equation in three dimensions. |
This is a heat or other type of diffusion equation lying intermediate between elliptic and hyperbolic equations |
where y is temperature
|
Laplace's equation (elliptic): steady state in systems of electric or magnetic fields in a vacuum or the steady flow of incompressible non-viscous fluids |
Poisson's equation (elliptic): a variation of Laplace when an outside force, given by the function f, is applied to the system |
Cauchy conditions |
y and ¶y/¶n are given |
on a curve |
Solution given by Taylor series for each point near curve if these are sufficient to determine higher derivatives
|
Can be solved as linear system with deterministic equations for derivatives of boundary conditions if coefficients have certain characteristics -- Gives rise to three types:
|
Another problem with Cauchy conditions on closed boundary |
Two other types of boundary conditions
|
Boundary conditions to give solutions for types of equations |
Equation Type -- Boundary Curve -- Boundary Data -- Example |
Hyperbolic Open Cauchy Wave Equation |
Parabolic Open Dirichilet or Neumann Diffusion Equation |
Elliptic Closed Dirichilet or Neumann Laplace's Equation |
Example of 2nd order diffusion equation with open boundary curve |
Example of Laplace's equation with closed boundary curve |
Discretize region by imposing grid points with spacing h |
Represent two adjacent neighbors of the point (x,y) in the x direction by Taylor series |
Add the two equations |
Solve previous equation for 2nd derivative |
Combine with similar equation in y direction |
Backward difference operator and forward difference operator are O(h) |
Higher order operators use more points on the grid (larger stencil) and are more accurate |
Use difference operator |
to solve for every |
interior point of grid |
Nx*Ny linear |
equations |
of the form |
Example equations |
to solve Laplace on |
a 5x6 grid with b |
labelling boundary |
and y internal points |
System of 12 equations - block tridiagonal |
A sparse matrix |
with two bands -- |
one next to diagonal |
and the other a |
"distance" Nx |
away |
Note original grid shown here is Nx by Ny but matrix is Nx Ny by Nx Nywithzeros outside a band of total width 2Nx +1 |
Note no "compact labelling" where points near each other in two dimensions remain near each in one dimension after mapping onto vector (one dimension) |
We must use Iterative methods to solve the linear equations coming from solution of large elliptic equations (Laplace's equation in example we will study) |
We can motivate iteration by studying an "artificial" diffusion equation |
subject to y having same boundary conditions (in x for all "artificial time" t ) as original equation |
that we needed to solve |
Consider ANY trial function y = y(0) at t = 0 |
Then we solve (*) and look at converged solution as t |
As |
The iteration of (*) in t gives a solution of (**) in limit of infinite t |
If we solve the diffusion equation (*) by finite difference in space (which is as for Laplace's equation) and time |
Here "t" could be t,t+dt or an average such as: |
t0 is Initial value which we can take as t=0 |
t1 = t0+ dt ..... |
tk+1=tk+dt |
The iteration gives yk(x)=y(x,tk) in terms of y(k-1)(x) |
This give Iterative equation if we use k to label time steps |
c1 yk+1(x,y) = ( y"k"(x+h,y) + y"k"(x-h,y)+y"k"(x,y+h)+y"k"(x,y-h))/4 |
- c2 y"k"(x,y) |
where c1 + c2 = 1 |
and the value of c1,c2 depend on K,h and dt. |
as dt is arbitary, we can choose c1 |
(and hence c2 = 1 - c1 ) to optimize convergence. |
We use cryptic notaation "k" to repreprent various possible choices for evaluating time on right hand side. Simplest is "k" = k but choices are k, k+1 or linear combinations which can vary for different x values. |
Different Choices of c1, c2, "k" give |
Either Jacobi Iterative Method
|
or Gauss Seidel
|
Over relaxation
|
There are many iterative methods - our diffusion equation analogy suggested the three simplest or stationary methods - so called because iteration equation is the same at each iteration |
Jacobi Method The Jacobi method is based on solving for every variable locally with respect to the other variables; one iteration of the method corresponds to solving for every variable once. The resulting method is easy to understand and implement, but convergence is slow. |
Gauss-Seidel The Gauss-Seidel method is like the Jacobi method, except that it uses updated values as soon as they are available. In general, it will converge faster than the Jacobi method, though still relatively slowly. |
Successive Overrelaxation (SOR) Successive Overrelaxation (SOR) can be derived from the Gauss-Seidel method by introducing an extrapolation parameter w. For the optimal choice of w, SOR converges faster than Gauss-Seidel by an order of magnitude. |
Superfix k denotes iteration |
Write A = D-L-U D = Diagonal L = Lower Triangle U = Upper Triangle |
Generic Iteration
|
Choose an Initial Guess x(0) to the solution x. |
for k = 1,2, ......
|
Check Convergence -- continue loop over k if required (e.g. maximum (over i) change |xi(k) -xi(k-1) | is too large) |
end |
Method converges if and only if all |li| < 1 |
We can calculate l i in simple cases. What counts is largest value of |l i| as this term will dominate in limit of large k where k counts iterations. |
The Jacobi Iteration Matrix G=M-1N is given by |
What does "difficult" eigenfunction mean? |
Pictures illustrate that "diffucult" eigenfunction sinpx is "long" wave length - "local" iteration algorithm converges slowly whereas local iteration converges very fast for short wavelength |
There is a minor confusion as shortest wavelength eigensolutions with n = (N-1) has a large eigenvalue whose modulus |lN-1| = l1 (lN-1 = -l1) is equal to that of "difficult" long wavelength case |
One would expect it to be damped strongly. This is an artifact of this iteration scheme as even (l = 0, 2, 4 ....) and odd grid points are decoupled |
Update of even l points only involves odd l |
Update of odd l points only involves even l |
We will return to this when we discuss relaxation |
Smallest (in modulus) eigenvalue corresponds to most rapidly varying eigenfunction - these are x dependences to which local iteration most sensitive |
Consider Ax = b solved "directly" which is Gaussian elimination where one succesively removes
|
Then this has memory requirement of order N2 and computational complexity of order N3 |
This is modified somewhat when you consider matrices A with a lot of zeroes and try hard to exploit these zeros i.e. avoid doing calculations which are irrelevant as adding or multiplying by zero |
Of course this cannot be done by testing on matrix element being zero as modern computers do floating point arithmetic faster than or at least as fast as test! |
Rather one arranges loops to not include zero elements -- if possible! |
One can show that in a general sparse matrix, it is straightforward to preserver the "end" zeros |
000...000X000...000XXX000...000X000...000 shows structure of a row of A in 2D Laplace example |
The first and last zeros can be explicitly taken into account by setting range of for loops properly |
The inside zeros "fill" i.e. become nonzero during process of Gaussian elimination |
Thus if bandwidth B i.e. |
000...000X000...000XXX000...000X000...000 |
Then computational complexity is not N3 as for a full (no zeros accounted) but NB2 |
Note G here is size of number of grid points in each dimension |
One dimension Nx = G Direct time a G (as tridiagonal matrix) Sparse time a G.G2 = G3 |
Two dimensions Nx = Ny = G Direct time a G2.G2 = G4 (G2xG2 banded matrix - band size G) Sparse time a G2 (one iteration) .G2 (# iterations) = G4 |
Three dimensions Nx = Ny = Nz = G Direct time a G3.(G2)2 = G7 (G3xG3 banded matrix - band size G2) Sparse time a G3 (one iteration) .G2 (# iterations) =G5 |
SOR and conjugate gradient will make iterative methods "look better" as number of iterations proportional to G and not G2 |
One Dimension: Both Sparse and Direct Methods use memory of order G -- the matrix size |
In two dimensions,
|
In three dimensions,
|
Jacobi and Gauss Seidel give a formula for x(k+1) in terms of x(k) call this x(k+1) |
Overrelaxation forms x(k+1) = w x(k+1) + (1-w)x(k) |
Typically only 0 < w < 2 is sensible w < 1 is relaxation 1 < w < 2 is over relaxation |
First consider relaxation for Jacobi x(k+1) = wx(k+1) + (1-w)x(k) |
There is an iteration matrix
|
The iteration matrices are related by |
GJOR(w) = wGJ + (1-w )I |
where I is the identity matrix and subscript JOR stands for Jacobi Over Relaxation |
This relation is still true after diagonalization and is preserved for eigenvalues |
lJOR(w) = wlJ + (1-w) |
We need to look at those values of lJOR which are largest and smallest |
These are: |
lJOR|max = 1- p2/2N2 = 1- e |
lJOR|min = -1+ p2/2N2 = -1+ e |
lJOR|max(w) = 1 - ew
|
lJOR|min(w) = 1+ we - 2w
|
The best value of w is w = 1 i.e. Best is Original Jacobi iteration as one must minimize the maximum over all values of eigenvalue moduli |l| and for Jacobi one canNOT use overrelaxation |
For w=1/2, one has |
x(k+1) =1/2[x(k) + x(k+1 ) ] where J denotes Pure Jacobi |
and subscript JOR stands for Jacobi Over Relaxation again |
This has "update" matrix in two dimensions |
xpoint = 1/2 xpoint + 1/8 times x of four neighbors |
We now "couple" even and odd grid points which were decoupled in original Jacobi |
Corresponding eigenvalue of most rapidly varying eigenfunction is |
now lJOR|min ~ 0 |
not lJOR|min ~ -1 as before |
Jacobi has a set x(k-1) and then replaces it bodily by x(k) |
After we find x(k), we know all of x(k-1) and x1(k). |
In Gauss Seidel use x1(k), x2(k-1) .... xn(k-1) to find x2(k). |
In Jacobi, one uses x1(k-1), x2(k-1) .... xn(k-1) to find x2(k) |
Gauss Seidel - general prescription - always use latest values of xj |
There are many possible, Gauss Seidel's - one for each ordering of variables |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |