introduction to scientific computing ii from gaussian elimination to multigrid – a recapitulation...

83
Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Upload: dulcie-dennis

Post on 01-Jan-2016

226 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Introduction to Scientific

Computing II

From Gaussian Elimination to Multigrid – A Recapitulation

Dr. Miriam Mehl

Page 2: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Tasks – SLE

fu

nn

nn

nn

nn

r

r

r

r

u

u

u

u

,

,1

1,2

1,1

,

,1

1,2

1,1

411

1411

11411

1141

114

???

Page 3: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Tasks – Molecular Dynamics

Page 4: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Prerequisites

• discretisation of PDEs

• linear algebra

• Gaussian elimination

• basics on iterative solvers

• Jacobi, Gauss-Seidel, SOR, MG

• matlab

Page 5: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Organization

• lecture (90 min/week)

– theory

– methods

– simple examples

• tutorials (45 min/week)

– more examples

– make your own experiences

Page 6: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

What Determines the Grading?

• written exam at the end of the semester

• no weighting of tutorials

!!!! solving tutorials is essential !!!!

- for understanding and remembering subjects

- for your success in the exam

Page 7: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Materials

• slides (short, only headwords)

• exercise sheets

make your own lecture notes!

find your own solutions!

solutions presented in the tutorials

Page 8: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Rules

• for questions ask or fix a date per email

Dr. Miriam Mehl:

[email protected]

Martin Buchholz:

[email protected]

Page 9: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Introduction to Scientific

Computing IIFrom Gaussian Elimination to Multigrid

– A Recapitulation

Dr. Miriam Mehl

Page 10: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

What’s the Problem to be Solved?

0

)(Re1

u

puuuu

T

t

Finite Elements

Finite Differences

(Finite Volumes)

Scientific Computing I

Numerical Programming II

Systems of linear equations

Application

ScenarioModelling

Scientific

Computing I

Partial Differential Equations

bAuh LU, Richardson, Jacobi, Gauss-Seidel,

SOR, MG

Scientific Computing I, Scientific Computing Lab,

Numerical Programming IMore on this!!!

Page 11: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

two-dimensional Poisson equation

heat equation diffusion membranes …

Example Equation

21;0 in fu

vvvvvvvvvvvvvvv

grid +

finite differences

bAuh

Page 12: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Typical SLE

sparse

band structure

411

1411

11411

1141

114

Page 13: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Example

]9[

]8[

]7[

]6[

]5[

]4[

]3[

]2[

]1[

]9[

]8[

]7[

]6[

]5[

]4[

]3[

]2[

]1[

410100000

141010000

014001000

100410100

010141010

001014001

000100410

000010141

000001014

f

f

f

f

f

f

f

f

f

u

u

u

u

u

u

u

u

u

Page 14: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

1411

141

1411

11411

1141

141

1141

114

1

1

1

1

1

1

1

1

1

Page 15: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

1411

141

1411

11411

****

141

****

114

1

1

1

1

1

1*

1

1*

1

Page 16: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

1411

141

1411

*****

****

****

****

114

1

1

1

1

1*

1**

1*

1*

1

Page 17: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

1411

141

****

****

****

****

****

114

1

1

1

1*

1**

1***

1*

1*

1

Page 18: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

1411

****

****

****

****

****

****

114

1

1

1*

1**

1***

1***

1*

1*

1

Page 19: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

411

****

***

****

****

****

****

****

114

1

1*

1**

1***

1***

1***

1*

1*

1

Page 20: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

***

***

***

****

****

****

****

****

114

1*

1**

1***

1***

1***

1***

1*

1*

1

Page 21: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

**

**

***

****

****

****

****

****

114

1**

1***

1***

1***

1***

1***

1*

1*

1

Page 22: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination (LU)

*

**

***

****

****

****

****

****

114

1***

1***

1***

1***

1***

1***

1*

1*

1

Page 23: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination – Costs

2D: O(N4)

3D: O(N7)

Page 24: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination – Costs 2D

halloh runtime (HLRB2, 62 TFlop/s)

2-7 0.02 sec

2-8 0.27 sec

2-9 4.4 sec

2-10 1 min 16 sec

2-11 18 min 55 sec

2-12 5 h 02 min 40 sec

2-13 3 d 8 h 37 min 15 sec

Page 25: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Gaussian Elimination – Costs 3D

hallo

h runtime (HLRB2, 62 TFlop/s)

2-6 4 min 44 sec

2-7 10 h 05 min 24 sec

2-8 53 d 19 h 21 min 17 sec

2-9 18 a 313 d 21 h 54 min 22 sec

Page 26: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Iterative Solvers – Principle

series of approximations

costs per iteration? convergence? stopping criterion?

hMh

Mhhh uuuuu with10

Page 27: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods

problem: order an amount of peas on a straight line

(corresponds to solving uxx=0)

Page 28: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Gauss-Seidel

sequentially place peas on the line between two neighbours

Page 29: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 30: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 31: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 32: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 33: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 34: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 35: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 36: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 37: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 38: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 39: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 40: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 41: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 42: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 43: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 44: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 45: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 46: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 47: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 48: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

Relaxation Methods – Gauss-Seidel

Page 49: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

sequentially place peas on the line between two neighbours

we get a smooth curve instead of a straight line global error is locally (almost) invisible

Relaxation Methods – Gauss-Seidel

Page 50: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods

problem: order an amount of peas on a straight line

(corresponds to solving uxx=0)

Page 51: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Jacobi

place peas on the line between two neighbours in parallel

Page 52: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Jacobi

place peas on the line between two neighbours in parallel

Page 53: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Jacobi

place peas on the line between two neighbours in parallel

Page 54: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Jacobi

place peas on the line between two neighbours in parallel

we get a high plus a low frequency oscillation these fequencies are locally (almost) invisible

Page 55: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods

problem: order an amount of peas on a straight line

(corresponds to solving uxx=0)

Page 56: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 57: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 58: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 59: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 60: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 61: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

Page 62: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 63: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 64: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 65: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 66: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 67: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 68: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 69: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 70: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 71: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 72: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 73: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 74: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 75: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 76: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 77: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

Page 78: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – SOR

sequentially correct location of peas a little more than

to the line between two neighbours

better than GS and J, but still not optimal

Page 79: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods

problem: order an amount of peas on a straight line

(corresponds to solving uxx=0)

Page 80: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Hierarchical

place peas on the line between two neighbours in parallel,

but in a hierarchical way from coarse to smooth

Page 81: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Hierarchical

place peas on the line between two neighbours in parallel,

but in a hierarchical way from coarse to smooth

Page 82: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Hierarchical

place peas on the line between two neighbours in parallel,

but in a hierarchical way from coarse to smooth

Page 83: Introduction to Scientific Computing II From Gaussian Elimination to Multigrid – A Recapitulation Dr. Miriam Mehl

Relaxation Methods – Hierarchical

place peas on the line between two neighbours in parallel,

but in a hierarchical way from coarse to smooth

exact solution in one step unfortunately only in 1D, 2D and 3D: multigrid