30

Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Fast solvers for Eulerian convection schemesSemester Thesis FS 2010

Andreas HiltebrandSupervisor: Holger HeumannProfessor: Ralf Hiptmair

Seminar for Applied Mathematics

ETH Zürich

23.12.10

Page 2: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Goal and discretization

Goal:solve quickly pure advection and advection dominatedproblems

Discretization:�nite elementsdiscontinuous Galerkinupwind formulation

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 3: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Permuted block triangular systems

0 2 4 6 8 10 12

0

2

4

6

8

10

12

nz = 90

Au = b

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 4: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Block triangular systems

0 2 4 6 8 10 12

0

2

4

6

8

10

12

nz = 90(PAP

T)Pu = Pb

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 5: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Block triangular systems

0 2 4 6 8 10 12

0

2

4

6

8

10

12

nz = 36(PAP

T)Pu = Pb

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 6: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Solution of lower block triangular systems

lower block triangular systems=⇒ easily solvableby block-wise forward substitution

for i = 1, . . . , nB

uBi =

(D

Bi

)−1(bBi −

∑i−1j=1 L

Bi ,ju

Bj

)

DB1 0 · · · · · · 0

LB2,1 D

B2

. . ....

.... . .

. . .. . .

......

. . . DBnB−1 0

LBnB ,1 · · · · · · L

BnB ,nB−1 D

BnB

uB1

uB2...

uBnB−1uBnB

=

bB1

bB2...

bBnB−1bBnB

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 7: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Advection problems ↔ block triangular systems

pure advection problem

�nite elements

discontinuous Galerkin

upwind formulation

=⇒ permutation of block triangular system

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.8

10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 8: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Advection problems ↔ block triangular systems

pure advection problem

�nite elements

discontinuous Galerkin

upwind formulation

=⇒ permutation of block triangular system

00.2

0.40.6

0.81

0

0.2

0.4

0.6

0.8

10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 9: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Advection problems ↔ block triangular systems

pure advection problem

�nite elements

discontinuous Galerkin

upwind formulation

=⇒ permutation of block triangular system

advection dominated problem=⇒ permutation of almost block triangular system,use block Gauss-Seidel method

construction of permutation?

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 10: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Outline

1 IntroductionGoal and discretizationSolution of lower block triangular systemsRelationship between advection problems and block triangularsystems

2 Construction of permutationMatrix graphConsistent orderingCycles and strongly connected componentsTarjan's algorithm

3 Problems and resultsAdvection-di�usion equation

4 Conclusions

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 11: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Matrix graph

capturing the dependencies =⇒ matrix graph

0 1 2 3 4 5 6 7 8

0

1

2

3

4

5

6

7

8

nz = 13

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 12: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Matrix graph

capturing the dependencies =⇒ matrix graph

0 1 2 3 4 5 6 7 8

0

1

2

3

4

5

6

7

8

nz = 13

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 13: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Consistent ordering

Find an ordering π such that

(i , j) ∈ E ⇒ π(i) < π(j) ∀i , j ∈ V

0 1 2 3 4 5 6 7 8

0

1

2

3

4

5

6

7

8

nz = 13

5

2

4

3

7

6

1

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 14: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Cycles and strongly connected components

No cycles =⇒ no problem (Topological sorting)

Cycles =⇒ no consistent ordering

1 2 3

456 7 8

Condensate strongly connected components

7, 5, 1 3, 4, 26 8

=⇒ consistent ordering possibleFast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 15: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

Determination of strongly connected components:Tarjan's algorithm

depth �rst search

Θ( |V | + |E | )here: Θ(n)

=⇒ construction of ordering: Θ(n)

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 16: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Steady state advection-di�usion equation in 2D/3D

−ε∆u + b ·∇u = f

on the unit square [0, 1]2/ unit cube [0, 1]3

Dirichlet boundary conditions

b velocity �eld

f source term

ε di�usivity coe�cient

u unknown scalar function

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 17: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 18: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Compared methods

Krylov solver:Biconjugate gradient stabilized method (BiCGSTAB)

Preconditioner:

SOR: SSOR

SORTSOR: sorting the system and then SSOR

BLOCKGS: implicitly sorting the system and then blockGauss-Seidel method

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 19: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

0 0.5 1 1.5 2

x 106

0

50

100

150

200

n

tota

l tim

e / s

ε=0

SORSORTSORBLOCKGS

0 0.5 1 1.5 2

x 106

0

50

100

150

200ε=1e−006

n

tota

l tim

e / s

0 0.5 1 1.5 2

x 106

0

50

100

150

200ε=0.001

n

tota

l tim

e / s

0 0.5 1 1.5 2

x 106

0

50

100

150

200

250

300

350ε=0.1

n

tota

l tim

e / s

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 20: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

0 0.5 1 1.5 2

x 106

0

20

40

60

80

100

n

num

ber

of it

erat

ions

ε=0

0 0.5 1 1.5 2

x 106

0

20

40

60

80

100ε=1e−006

n

num

ber

of it

erat

ions

0 0.5 1 1.5 2

x 106

0

20

40

60

80

100ε=0.001

n

num

ber

of it

erat

ions

0 0.5 1 1.5 2

x 106

0

20

40

60

80

100

120ε=0.1

n

num

ber

of it

erat

ions

SORSORTSORBLOCKGS

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 21: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Comparison of di�erent parts

0 5 10 15

x 105

0

2

4

6

8

10

n

time

/ s

Construct orderingSort systemSolve systemTotal time

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 22: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Conclusions

pure advection problems (with this discretization):permuted lower block triangular system

permutation can be found in Θ(n)using Topological sorting and Tarjan's Algorithm

advection dominated problems (with this discretization):permuted almost lower block triangular system

solve system with block Gauss-Seidel preconditioner:only few iterations

the more dominating the advection the more e�cient

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 23: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Appendix

Topological sorting

Tarjan's algorithm

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 24: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Topological sorting

Algorithm 1: Topological sorting

input : graph G = (V ,E )output: ordering πfor v ∈ V do attr(v) = C

for v ∈ V do SetAttr(v)for v ∈ V do

if attr(v) = C then π(�rst) = v

end

Procedure SetAttr(v)

if attr(v) = C then SetF(v);if attr(v) = C then SetL(v);

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 25: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Topological sorting

Procedure SetF(v)

if ∀w ∈ pred(v) : attr(w) = F then

attr(v) = F ;π(�rst) = v ;for w ∈ succ(v) do if attr(w) = C then SetF(w)

end

Procedure SetL(v)

if ∀w ∈ succ(v) : attr(w) = L then

attr(v) = L;π(last) = v ;for w ∈ pred(v) do if attr(w) = C then SetL(w)

end

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 26: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

Algorithm 2: Tarjan's Algorithm

input : graph G = (V ,E )output: strongly connected components components

index = 1S = {}components = {}for v ∈ V do

if index(v) is unde�ned then tarjan(v)end

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 27: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

Procedure tarjan(v)

index(v) = index

lowlink(v) = index

index = index + 1S .push(v)for (v , v ′) ∈ E do

if index(v ′) is unde�ned then

tarjan(v ′)lowlink(v) = min(lowlink(v), lowlink(v ′))

end

else if v ′ ∈ S then

lowlink(v) = min(lowlink(v), index(v ′))end

end

...

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 28: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

Procedure tarjan(v)

...if lowlink(v) = index(v) then

c = {}repeat

v ′ = S .pop()c = c ∪ {v ′}

until v ′ = v

components = components ∪ {c}end

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 29: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

1 2 3

456 7 8

v index(v) lowlink(v) S c

1 1 1 {1}5 2 2 {1, 5}7 3 3 {1, 5, 7}7 3 1 {1, 5, 7}5 2 1 {1, 5, 7}1 1 1 {1, 5, 7}

{} {7, 5, 1}2 4 4 {2}4 5 5 {2, 4}3 6 6 {2, 4, 3}3 6 4 {2, 4, 3}8 7 7 {2, 4, 3, 8}

{2, 4, 3} {8}

Fast solvers for Eulerian convection schemes Andreas Hiltebrand

Page 30: Fast solvers for Eulerian convection schemeshiptmair/StudentProjects/...Fast solvers for Eulerian convection schemes Semester Thesis FS 2010 Andreas Hiltebrand Supervisor: Holger Heumann

Introduction Construction of permutation Problems and results Conclusions Appendix

Tarjan's algorithm

1 2 3

456 7 8

v index(v) lowlink(v) S c

4 5 4 {2, 4, 3}2 4 4 {2, 4, 3}

{} {3, 4, 2}6 8 8 {6}

{} {6}

7, 5, 1 3, 4, 26 8

Fast solvers for Eulerian convection schemes Andreas Hiltebrand