+ All Categories
Home > Documents > Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Date post: 19-Jan-2018
Category:
Upload: johnathan-newman
View: 217 times
Download: 0 times
Share this document with a friend
Description:
Content Introduction Algorithm Results & Performance A Failing Example Conclusion
31
Multigrid Methods The Implementation Wei E CSE@Technische Universität München. Ferien Akademie 19 th Sep. 2005
Transcript
Page 1: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Multigrid MethodsThe Implementation

Wei ECSE@Technische Universität München.

Ferien Akademie 19th Sep. 2005

Page 2: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 3: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 4: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Introduction

Fluid DynamicsSolving PDEsComputational Fluid DynamicsNumerical Solution

Page 5: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

The Navier-Stokes Equations (1)

Non-stationary incompressible viscous fluids

2D Cartesian coordinates system of partial differential equations two momentum equations + continuity

equation

Page 6: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

The Navier-Stokes Equations (2)

xgyuv

xu

yu

xu

xp

tu

)()()(

Re1 2

2

2

2

2

ygxuv

yv

yv

xv

xp

tv

)()()(

Re1 2

2

2

2

2

0

yv

xu

Page 7: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Poisson Equation

Where f(x,y) is the right-hand side calculated by the quantities in the previous time step;

the unknown u is to be solved in the current time step.

0,10,10),,( yxyxfuuu yyxx

Page 8: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Discretization (1)

11,11,0

,22

00

,,21,,1,

2,1,,1

njmivvvv

fvh

vvvh

vvv

mjjini

jijiy

jijiji

x

jijiji

Finite Difference Scheme:

Page 9: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Discretization (2)

The corresponding matrix representation is:

where fAv

1

1

1

1

2

.

.

.,

.

.

.,

..

...1

mm f

f

f

v

v

v

BaIaI

aIBaIaIB

hA ,

211..

...121

12

1

2

2

2

2

h

hh

hB

Page 10: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 11: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Multigrid Implementation

The two classical schemes:

V-Cycle

Full Multigrid (FMG)

Page 12: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

V-Cycle: The Algorithm

grid = { double Ddim_array f // the right hand side double Ddim_array v // the current approximation }Grid = array of structure grid.

for j = 0 to coarsest - 1 Grid[j].v <- relax(Grid[j].v, Grid[j].f, num_sweeps_down); Grid[j+1].f <- restrict(Grid[j].f- calculate_rhs(Grid[j].v));

endfor

Grid[coarsest].v = direct_solve(Grid[coarsest].v, Grid[coarsest].f);

for j = coarsest – 1 to 0 Grid[j].v <- Grid[j].v + interpolate(Grid[j+1].v); Grid[j].v <- relax(Grid[j].v, Grid[j].f, num_sweeps_up);

endfor

Page 13: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

V-Cycle: Comments (1)

a) Non-recursive structure; b) Gauss-Seidel is used as the relaxation met

hod;c) calculate_rhs() is a function to calculate th

e right-hand side based on current approximation;

d) Several methods can be used to solve the small-size problem, we choose SOR (successive over relaxation);

Page 14: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

V-Cycle: Comments (2)

e) For restriction, we take the mean value of the four neighbors as the result

f) For interpolation, we use the similar method as restriction: spreading the value into it’s four neighbors.

restriction interpolation

Page 15: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

FMG: The Algorithm

Once we have the V-cycle, FMG would be rather easy to implement:

for j = 0 to coarsest - 1 Grid[coarsest-j+1].v <- Grid[coarsest-j+1].v + interpolate_fine(Grid[coarsest-j].v); Grid[coarsest-j+1].v <- V-cycle(Grid[coarsest-j+1].v, Grid[coarsest-j+1].f);

endfor

Page 16: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

FMG: Comments

a) Initialization for all the approximations and right-hand sides should be made before executing the FMG main loop;

b) interpolate_fine() stands for a higher order interpolator. In practice, we use the interpolation matrix:

1331399339931331

161

Page 17: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 18: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Model Problem (1): Hidden Step

Fluid flows with a constant velocity through a channel with a hidden obstacle on one side. No-slip conditions are imposed at the upper and lower walls.

Page 19: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Simulation result (1)

The Hidden Step:

Page 20: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Model Problem (2): Karman Vortex

The flow in a channel can meet a tilted plate. At the left boundary, the fluid inflow has a constant velocity profile, while at the upper and lower boundaries no-slip conditions are imposed.

Page 21: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Simulation result (2)

Von Karman Vortex

Page 22: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Performance (1)

Size

Method

128*32 256*64 128*128 256*128

SOR 18 sec 289 sec 700 sec 1635 sec

V-Cycle 10 sec 76 sec 80 sec 172 sec

FMG 7 sec 33 sec 35 sec 75 sec

Testing platform: P4 2.4GHz, 1GB Memory, SUSE Linux 9.3

Page 23: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Performance (2)

Performance Chart

0

500

1000

1500

2000

128*32 256*64 128*128 256*128Probl em Si ze

Time

(se

c) SORV-cycl eFMG

Page 24: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 25: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

A Failing Example

Throttle :

Page 26: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Simulation Result

Page 27: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

The Reason

Page 28: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Content

IntroductionAlgorithmResults & PerformanceA Failing ExampleConclusion

Page 29: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Conclusion

An Optimal (i.e., O(N)) Solver.Highly Modular Program StructureAdvanced Debugging Technique

Page 30: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Reference

[1] Practical Course – Scientific Computing and Visualization Worksheet, Lehrstuhl für Informatik mit Schwerpunkt Wissenschaftliches Rechnen, TU-Muenchen, 2005.

[2] Krzysztof J. Fidkowski, A High-Order Discontinuous Galerkin Multigrid Solver for Aerodynamic Applications, Master Thesis in Aerospace Engineering at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY

[3] S. McCormick, B. Briggs, and V. Henson, "A Multigrid Tutorial”, second edition, SIAM,Philadelphia, June 2000.

Page 31: Multigrid Methods The Implementation Wei E Universitt Mnchen. Ferien Akademie 19 th Sep. 2005.

Thank You!


Recommended