Docsity

Iterative Linear Solvers - Lecture Notes | CS 4803, Study notes of Computer Science

Partial preview of the text

Download Iterative Linear Solvers - Lecture Notes | CS 4803 and more Study notes Computer Science in PDF only on Docsity!

Introduction toModeling andSimulation Iterative Linear Solvers

Review 

Accuracy and stability of solution of BVPs



Different from finite-difference solutions to IVPs, localtruncation errors in general do not accumulate



Types of boundary conditions



Dirichlet BC 

Newmann BC



Poisson equations



Special case: Laplace equation



How to solve linear systems resulted from finite-difference methods?

How to Solve Linear Systems? 

Boundary-value problems yields systems of linearalgebraic equations (similarly for implicit methods fortime-dependent PDEs as we will discuss later)



Linear systems are in general

sparse

, with relatively few

nonzeros in matrix



For

n

x

n

matrix, direct solvers such as Gaussian

elimination and Cholesky factorization require requires O

n

2

) storage and

O

n

3

) computation [Covered in detail

in numerical linear algebra]



Sparsity must be exploited to use much less storage andcomputation



Sparse

direct

solvers which are more sophisticated and more

accurate



Sparse

iterative

solvers are simpler and often suffice for solving

differential equations (and therefore are our focus)

Relaxation Methods 

Split sparse matrix and then successively approximatesolution



For Laplace’s equation, each point is set to average ofits neighbors



Jacobi method: update each point using old values ofneighbor points



Gauss-Seidel method: modify Jacobi method to use newvalues as soon as available



Warning: these methods are very simple but may notconverge (or converge very slowly)

1,

1,

,^

1

,^

1

,

2

2

,^

1,^

1,

,^

1

,^

1

1

(^

4

)^

(^

,^

)

1

(

)^

(^

,^

)

4

4

i^

j^

i^

j^

i j

i j

i j

i^

j

i j

i^

j^

i^

j^

i j

i j

i^

j

u

u

u

u

u

f^

x

y

h

h

u

u

u

u

u

f^

x

y

+^

−^

+^

−

+^

−^

+^

−

−

=

⇒

=

−

Gauss-Seidel Method 

Formula



Algorithm

for iter=0:maxiter

for j=2:(m+1)

for i=2:(m+1)

u(i,j) = 0.25*(u(i-1,j) + u(i+1,j) + u(i,j-1) + u(i,j+1) -

h^2 * f(i,j));

end end

end

,^

1,

1,

,^

1

,^

1

2

(^

(^

)^

(^

(^

)^

(^

1

(

)

(

,^

)

4

4

i j

i^

j^

i^

j^

i j

i j

k^

k^

k^

k^

k

i^

j

h

u

u

u

u

u

f^

x

y

+^

−^

+^

−

=

−

Matrix-Splitting 

Jacobi and Gauss-Seidel are examples of matrix-splittingmethods: Matrix

A

is split into



Then equation

Au

f

can be written as

and further,



Matrix

G
M
N

is

iteration matrix



Method converges if absolute values of eigenvalues of

G

are <1, i.e., its spectral radius

ρ



In particular,

=

−

A

M

N

Mu

Nu

f

Mu

Nu

f

(^

(^

)

(^

1

(^

)^

1

,

(

)

k

k

k

k

−

−

=

=

Mu

Nu

f

u

M

N u

M

f

(^

)^

(0)

2

2

k^

k

e

e

ρ ≤

More Efficient Method 

Successive over-relaxation (SOR)where

ω

1 is some scalar



If

ω

<1, then it is called under-relaxation



In matrix form



With a optimal choice of

ω

, spectral radius of

G
M
N

is

minimized to about 1-

π

h

, making it much more efficient

than Jacobi or G-S



However, determining optimal

ω

requires solving for

eigenvalues, which is too costly

,^

1,^

1,

,^

1

,^

1

,^

,^

,^

,

2

(^

)^

(^

(^

)^

(^

(^

(^

)^

(^

)

1

(

)

(

,^

)

4

4

(

)

i j

i^

j^

i^

j^

i j

i j

i j

i j

i j

i j

GS

k^

k^

k^

k

i^

j

k^

k^

GS

k

h

u

u

u

u

u

f^

x

y

u

u

u

u

ω +^

−^

+^

−

+^

=

−

=

−

1

(

)

,

ω

ω

− ω

=

−

=

−

M

D

L

N

D

U

Variance of Gauss-Seidel 

Red-black order



Color nodes interleavingly into red and black 

Update red nodes using black nodes in one iteration,and then update red nodes using black nodes next



Red-black order converges faster than Jacobiiterations and is amendable to parallelization



However it is still converge very slowly

Conjugate Gradient Method 

If

A

is

n

x

n

symmetric positive definite matrix, then

quadratic functionattains minimum precisely when

Ax

b



Optimization methods have formwhere

α

is search parameter chosen to minimize

objective function

φ

x

k

α

s

k

) along

s

k



For quadratic problem, negative gradient is residualvector



Line search parameter can be determined analytically

1 2

( )

T

T

φ

=

−

x

x Ax

x b

1 k

k

k

α

=

x

x

s

( )= -

=

φ

∇

x

b Ax r

/

k

T

T

k

k

k

α

=

r s

s As

Conjugate Gradient Method Cont’d 

Using above properties, we obtain CG method

More Advanced Topics forIterative Linear Solvers 

Preconditioning: can substantially acceleratedconvergence rate of CG



Apply CG algorithm to

M
A

, where

M

is chosen so

that

M
A

is better conditioned and systems of form

Mz

y

are easily solved



Example of preconditioner including Jacobi, SSOR,incomplete factorization, etc



Generalization of CG to unsymmetric matrics(GMRES, Bi-CGSTAB)



Multi-grid methods

Comput. Cost for

k

x

k

(x

k

) Grid



If problems are ill-conditioned, then iterativesolver may converge very slowly