Towards Multigrid Methods - TUM · The Multigrid V-Cycle Crucial idea: recursive call of...
Transcript of Towards Multigrid Methods - TUM · The Multigrid V-Cycle Crucial idea: recursive call of...
Scientific Computing II
Towards Multigrid Methods
Michael BaderTechnical University of Munich
Summer 2018
Part I
Multigrid Methods
Fundamental Multigrid IdeasNested IterationCoarse-Grid Correction – A Two-Grid Method
Multigrid SchemesMultigrid V-CycleMultigrid W-CycleFull Multigrid V-Cycle
Computational EffortCosts per IterationSpeed of Convergence
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 2
Multigrid Idea No. 1
Observation and convergence analysis show:• “high-frequency error” is relative to mesh size• on a sufficiently coarse grid, even very low frequencies can be
“high-frequency”(if the mesh size is big)
“Multigrid” idea:• use multiple grids to solve the system of equations• hope that on each grid, a certain range of error frequencies will be
reduced efficiently
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 3
Nested Iteration
Solve the problem on a coarser grid:• will be comparably (very) fast• can give us a good initial guess:• leads to “poor man’s multigrid”: nested iteration
Algorithm:1. Start on a very coarse grid with mesh size h = h0;
guess an initial solution xh
2. Iterate over Ahxh = bh using relaxation method⇒ approximate solution xh
3. interpolate the solution xh to a finer grid Ωh/2
4. proceed with step 2 (now with mesh size h := h/2) using interpolatedxh/2 as initial solution
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 4
Multigrid Idea No. 2
Observation for nested iteration:• error in interpolated initial guess also includes low frequencies• relaxation therefore still slow• can we go “back” to a coarser grid later in the algorithm?
Idea No. 2: use the residual equation⇒ coarse-grid correction:
• solve Ae = r on a coarser grid• leads to an approximation of the error e• add this approximation to the fine-grid solution
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 5
A Two-Grid Method
Algorithm:1. relaxation/smoothing on the fine level system⇒ solution xh
2. compute the residual rh = bh − Ahxh
3. restriction of rh to the coarse grid ΩH
4. compute a solution to AHeH = rH
5. interpolate the coarse grid solution eH to the fine grid Ωh
6. add the resulting correction to xh
7. again, relaxation/smoothing on the fine grid
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 6
Correction Scheme – Components
• smoother:reduce the high-frequency error components, and get a smooth error
• restriction:transfer residual from fine grid to coarse grid, for example by
– injection– (full) weighting
• coarse grid equation:(acts as) discretisation of the PDE on the coarse grid
• interpolation:transfer coarse grid solution/correction from coarse grid to fine grid
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 7
The Multigrid V-Cycle
Crucial idea: recursive call of Two-/Multigrid solver on coarse grids
Algorithm:1. pre-smoothing on the fine level system⇒ solution xl
2. compute the residual rl = bl − Alxl
3. restriction of rl to the coarse grid Ωl−1
4. solve coarse grid system Al−1el−1 = rl−1by a recursive call to the V-cycle algorithm
5. interpolate the coarse grid solution el−1 to the fine grid Ωl
6. add the resulting correction to xl
7. post-smoothing on the fine grid
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 8
The W-Cycle
• perform two coarse grid correction steps instead of one
Ω8h
Ω4h Ω4h
Ω2h Ω2h
Ωh Ωh
AAU
AAU
AAU
Ω8h Ω8h
Ω4h Ω4h Ω4h
Ω8h Ω8h
Ω4h Ω4h Ω4h
Ω2h Ω2h Ω2h
Ωh Ωh
AAU
AAU
AAU
AAU AAU AAU
AAU
(V-cycle and W-cycle)
• more expensive• useful in situations where the coarse grid correction is not very accurate
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 9
The Full Multigrid V-Cycle (FMV- or F-Cycle)
Recursive algorithm:• combines nested iteration and V-cycle• (recursively!) perform an FMV-cycle on the next coarser grid to get a
good initial solution• interpolate this initial guess to the current grid• perform a V-cycle to improve the solution
Ω8h Ω8h
Ω4hΩ4h
Ω8h
Ω4h Ω4h
Ω2h Ω2h
Ω8h
Ω4h Ω4h
Ω2h Ω2h
Ωh Ωh
AAU
AAU
AAU
AAU
AAU
AAU
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 10
V-Cycle – Computational Costs
Further algorithmic details:• on the coarsest grid: direct solution;
but: number of unknowns small, ideally O(1)
• number of smoothing steps is typically very small (1 or 2)and must not depend on problem size
Computational Costs (storage and computing time):• 1D: c · n + c · n/2 + c · n/4 + . . . ≤ 2c · n• 2D: c · n + c · n/4 + c · n/16 + . . . ≤ 4/3c · n• 3D: c · n + c · n/8 + c · n/64 + . . . ≤ 8/7c · n• overall costs are dominated by the costs of the finest grid
(n the number of grid points on the finest grid: typicall n = h−D)
Thus: runtime O(n) per iteration, but how many iterations necessary?
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 11
Speed of Convergence
• fastest method around (if all components are chosen carefully), but:best-possible convergence often hard to obtain
• “textbook multigrid efficiency”:∥∥∥e(m+1)∥∥∥ ≤ γ ∥∥∥e(m)
∥∥∥ ,where convergence rate γ < 1 (esp. γ 1) is independent of the numberof unknowns⇒ constant number of multigrid steps to obtain a given number of digits⇒ overall computational work increases only linearly with the number of
unknowns• see exercises: analysis of two-grid convergence
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 12
Speed of Convergence (2)For the “Model Problem” (i.e., Poisson Problem):
• O(n) to solve up to “reduce error by a factor of . . . ” (10−8, e.g.)• wanted: solve to the “level of truncation”→ depending on discretisation error; for example O(h2)
• O(n) up to “level of truncation” achieved by FMV-Cycle;ideal case: 1 cycle; after each V-cycle, the “level of truncation” error isachieved on that grid on that grid
For Other Problems:• OK for strongly elliptic problems• multigrid variants for non-linear problems, parabolic/hyperbolic, . . .• every component may fail, leading to slow or no convergence:
smoother, interpolation/restriction, coarse-grid operator• achieving “textbook efficiency” usually a demanding task
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 13
Part II
Components of Multigrid Methods
InterpolationRestrictionCoarse Grid OperatorSmoothers
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 14
Interpolation (aka “Prolongation”)
For Poisson problem:• (bi-)linear interpolation:
in 1D: resembles homogeneous (f = 0) solution• constant (in general too small approximation order):
sometimes used for cell-based coarsening (unknowns located in cellcenters)
• quadratic, cubic, etc.:often too costly, more smoothing steps are cheaper and can eliminate thedisadvantage of a lower-order interpolation
• but: in FMV-cycle interpolation to finer grid (after a completed V-cycle)should be higher-order (to limit the introduced error)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 15
Interpolation – Matrix Notation
For linear interpolation (1D):
12 0 01 0 012
12 0
0 1 00 1
212
0 0 10 0 1
2
x1
x2x3
=
12 (0 + x1)
x112 (x1 + x2)
x212 (x2 + x3)
x312 (x3 + 0)
Notation: Ih2hx2h = xh or Ph
2hx2h = xh
Note: disregards boundary values (here: 0-Dirichlet condition assumed)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 16
Interpolation – Convection-DiffusionExample problem: 1D convection-diffusion equation
−εuxx + cux = f , 0 < ε c
Operator-dependent Interpolation:• consider homogeneous problem (f = 0)
with Dirichlet boundaries: u(0) = 1, u(1) = 0• exact solution for this case:
u(x) =1
1− ec/ε
(ecx/ε − ec/ε
)= 1− 1− ecx/ε
1− ec/ε
• interpolate at x = 12 : u
( 12
)= 1− 1−ec/2ε
1−ec/ε =: 1− 1−z1−z2 ;
for large z = ec
2ε , we have u( 1
2
)≈ 1− 1
z ≈ 1• thus: linear interpolation inappropriate (and leads to slow convergence)→ interpolation should be operator-dependent
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 17
RestrictionFor Poisson problem:
• “injection”: pick values at corresp. coarse grid points• “full weighting” = transpose of bilinear interpolation (safer, more robust
convergence), see illustration below for the 1D case
1/2 1/21/2 1/2
linear interpolation
11 1
linear interpolation
1/21/2
f ll i hti
11/2 full weighting
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 18
Restriction – Matrix Notation
For full weighting (1D):
12 1 1
2 0 0 0 00 0 1
2 1 12 0 0
0 0 0 0 12 1 1
2
x1x2x3x4x5x6x7
=
12 (x1 + 2x2 + x3)12 (x3 + 2x4 + x5)12 (x5 + 2x6 + x7)
Notation: I2hh xh = x2h or R2h
h xh = x2h
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 19
Coarse Grid Operator
Two main options:1. discretise PDE on grid Ωh to obtain Ah
2. “Galerkin approach”: A2h := R2hh AhPh
2h→ compare effect on vector x2h:
A2hx2h := R2hh AhPh
2hx2h
→ evaluate from right to left:• interpolate x2h to xh := Ph
2hx2h• apply fine-grid operator Ah to interpolated xh• restrict resulting matrix-vector product to Ω2h
Exercise:• Compute A2h := R2h
h AhPh2h for Ah := 1
h2 tridiag(−1,2,−1)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 20
A Matrix-Oriented View of Coarse-Grid Correction
1. given a system of equations Ahxh = bh
2. pre-smoothing leads to approximate solution x (i)h
and resp. error xh = x (i)h + e(i)
h
3. compute residual r (i)h = bh − Ahx (i)h ;
respective residual equation: Ahe(i)h = r (i)h
4. restriction of residual equation: R2hh Ahe(i)
h = R2hh r (i)h
5. approximate error on coarse grid: e(i)h ≈ Ph
2he(i)2h
→ leads to Galerkin coarsening R2hh AhPh
2he(i)2h = R2h
h r (i)h
6. compute error e(i)2h from (R2h
h AhPh2h)e(i)
2h = A2he(i)2h = b2h := R2h
h r (i)h
7. interpolate coarse-grid error, e(i)h ≈ Ph
2he(i)2h ,
and apply as coarse-grid correction: x (i+1)h = x (i)
h + Ph2he(i)
2h
8. post-smoothing on approximate solution x (i+1)h
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 21
Galerkin Coarse Grid Operator: A2h := R2hh AhPh
2h
• assume linear Interpolation and full weighting restriction:
R2hh =
12 1 1
2 0 0 0 00 0 1
2 1 12 0 0
0 0 0 0 12 1 1
2
Ph2h = (R2h
h )T
• for Poisson equation with stencil 1h2 [−1 2 − 1] (see exercises)
→ coarse-grid stencil reproduces: 1(2h)2 [−1 2 − 1]
• for pure convection and central differencing, stencil 1h [1 0 − 1],
→ coarse-grid stencil reproduces: 12h [1 0 − 1] (check!)
→ but leads to unstable discretisation• question: result for upwind discretisation: stencil 1
h [−1 1 0]?
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 22
Galerkin Coarsening and Convection
• coarsening with linear Interpolation, full weighting restriction,and upwind stencil 1
h [−1 1 0]
• leads to coarse-grid stencil 1h
[− 3
412
14
]→ not a diagonal-dominant matrix→ unstable discretisation
• remedy: use “downwind” interpolation and “upwind” restriction:
R2hh =
1 1 0 0 0 0 00 0 1 1 0 0 00 0 0 0 1 1 0
Ph2h =
0 0 01 0 01 0 00 1 00 1 00 0 10 0 1
• result: upwind discretisation stencil reproduced: 1
2h [−1 1 0]!
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 23
Matrix-Dependent Interpolation/Restriction• assume general 1D 3-point discretisation stencil: [sl sc sr ]
where sc = −(sl + sr ) > 0• use the following 3-point interpolation stencil:
]− sl
sc1 − sr
sc
[and
Ph2h = (R2h
h )T , thus:
R2hh =
−slsc
1 − srsc
0 0 0 00 0 − sl
sc1 − sr
sc0 0
0 0 0 0 − slsc
1 − srsc
• Galerkin coarsening A2h := R2h
h AhPh2h leads to stencil
1sc
[−s2
l s2l + s2
r − s2r]
→ check this!
• remains diagonal dominant→ stable coarse-grid discretisation• try as exercise:
compute coarse-grid operator for convection-diffusion equation;compare operator- and matrix-dependent interpolation/restriction
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 24
Matrix-Dependent Interpolation/Restriction (2)• take a closer look at the matrix multiplication R2h
h Ah:
. . .
. . .. . . 0 0 0 0
· · · 0 − slsc
1 − srsc
0 · · ·
0 0 0 0. . .
. . .. . .
. . .. . .
. . .
0 sl sc sr 0 · · ·· · · 0 sl sc sr 0 · · ·
· · · 0 sl sc sr 0
. . .. . .
. . .
• equivalent to performing row operations as in Gaussian elimination:
. . .. . .
. . .
0 sl sc sr 0 · · ·· · · 0 sl sc sr 0 · · ·
· · · 0 sl sc sr 0
. . .. . .
. . .
·(− sl
sc)
·1·(− sr
sc)
• red entries become 0⇒ coarse-grid unknown no longer depends on fine-grid unknowns• similar for multiplication AhPh
2h, but with column operations
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 25
Smoothers
Efficient smoothers for the Poisson problem (see tutorials):• Gauss-Seidel• red-black Gauss-Seidel• damped (ω = 2
3 ) Jacobi→ why ω = 2
3 ?→ examine smoothing factors (dependent on wave number k )
How about . . .• Jacobi (non-weighted)?→ does not work (zig-zag pattern prevents smoothing)
• SOR?→ typically does not work well for Poisson model problem
(does not smooth high frequencies efficiently)→ can help for other problems using a tailored ω
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 26
Smoothers – Anisotropic ProblemsModel problems and observation:
• anisotropic Poisson equation: uxx + εuyy = f with ε 1(or similar: ε 1)
• Poisson equation on stretched grids:
1h2
x(ui+1,j − 2ui,j + ui−1,j ) +
1h2
y(ui,j+1 − 2ui,j + ui,j−1) = fij
with hx hy (or similar: hx hy )• Strong dependency in x-direction, weak dependency in y -direction
(or vice versa)• Good smoothing of the error only in x-direction
(or in y -direction):
ui,j =1
2h2x + 2h2
y
(−h2
xh2y fij + h2
y (ui+1,j + ui−1,j )− h2x (ui,j+1 + ui,j−1)
)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 27
Smoothers – Anisotropic Problems (2)
Semi-Coarsening:• situation on coarser grid for example Hx = 2hx , Hy = hy :
14h2
x(ui+1,j − 2ui,j + ui−1,j ) +
1h2
y(ui,j+1 − 2ui,j + ui,j−1) = fij
• thus: anisotropy has weakened on the semi-coarsened grid
Line Smoothers:• perform a column-wise (or row-wise) Jacobi/Gauss-Seidel relaxation→ solve each column (or row) simultaneously:
u(n+1)i−1,j − (2 + 2ε)u(n+1)
ij + u(n+1)i+1,j = h2fij − ε(u(n)
i,j−1 + u(n)i,j+1)
• use direct, tridiagonal solver for each “line” (i.e., row or column)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 28
Smoothers – Convection-Diffusion
• example: 1D Convection-Diffusion equation
−εuxx + ux = f , ε 1
• “upwind discretisaton”:
− ε
h2 (un−1 − 2un + un+1) +1h
(un − un−1) = fn
• (weighted) Jacobi and red-black Gauss-Seidel?→ no smoothing, basically updates one grid point per iteration
• Gauss-Seidel (relaxation from “left to right”)?→ almost an exact solver
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 29
Smoothers – More Complicated Situations
Problems:• anisotropic Poisson with space-dependent ε = ε(x , y),
or more general:−∇
(D(x , y)∇u(x , y)
)= f (x , y)
• convection-diffusion with variable convection:
−εuxx + v(x)ux = f − ε∆u + v(x , y)∇u(x , y) = f (x , y)
Approaches for Smoothing:• alternating line smoothers, “plane smoothers” in 3D• “Zebra” line smoothers (similar to red-black-GS)• Gauss-Seidel smoothing in “downwind” order→ difficult to do for complicated flows in 2D and 3D
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 30
Part III
Finite Elements, Hierarchical Bases,and Multilevel Methods
FEM Main IngredientsTest and Shape Functions1D Poisson Equation and Nodal Basis
Hierarchical Bases and Generating SystemsHierarchical BasisFEM with Hierarchical vs. Nodal BasesHierarchical Basis TransformationFEM and Hierarchical Basis Transform
Generating Systems and MultigridHierarchical Generating System and FEM
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 31
Remember: Finite Elements – Main Ingredients
1. solve weak form of PDE to reduce regularity properties
u′′ = f −→∫
v ′u′ dx =
∫vf dx
→ allows additional weak solutions2. compute a function as numerical solution→ search in a function space Wh:
uh =∑
j
ujϕj (x), spanϕ1, . . . , ϕJ = Wh
3. find weak solutions of simple form:for example piecewise linear functions and choose basis functions withlocal support (“hat functions”)→ leads to system of linear equations
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 32
Test and Shape Functions
• consider a general PDE Lu = f on some domain Ω
• search for solution functions uh of the form
uh =∑
j
ujϕj (x)
the ϕj (x) are typically called shape or ansatz functions• the basis functions ϕj (x) build a vector space
(i.e., a function space) Wh
spanϕ1, . . . , ϕJ = Wh
• insert into weak formulation∫vL(∑
j
ujϕj (x)
)dx =
∫vf dx ∀v ∈ V
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 33
Test and Shape Functions (2)• choose a basis ψi of the test space Vh
typically defined on some discretisation grid Ωh• then: if all basis functions ψi satisfy∫
ψi (x)L(∑
j
ujϕj (x)
)dx =
∫ψi (x)f (x) dx ∀ψi
then all v ∈ Vh satisfy the equation• the ψi are therefore often called test functions• we obtain a system of equations for unknowns uj :
one equation for each test function ψi• Vh is often chosen to be identical to Wh (Ritz-Galerkin method)→ we then have as many equations as unknowns
• leads to system of linear equations Au = b where
(Au)i :=∑
j
uj
∫ψi (x)Lϕj (x) dx︸ ︷︷ ︸
= Aij
=
∫ψi (x)f (x) dx =: bi
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 34
Example: Nodal Basis
ϕi (x) :=
1h (x − xi−1) xi−1 < x < xi1h (xi+1 − x) xi < x < xi+1
0 otherwise
0,60,4 0,80,20
1
1
0,4
0,2
x
0
0,8
0,6
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 35
Example Problem: 1D Poisson
• in 1D: −u′′(x) = f (x) on Ω = (0,1),hom. Dirichlet boundary cond.: u(0) = u(1) = 0
• weak form: ∫ 1
0v ′(x) · u′(x) dx =
∫ 1
0v(x)f (x) dx ∀v
• grid points xi = ih, (for i = 1, . . . ,n − 1); mesh size h = 1/n• Vh = Wh: piecewise linear functions (on intervals [xi , xi+1])• leads to stiffness matrix:
1h
2 −1
−1 2. . .
. . . . . . −1−1 2
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 36
Hierarchical Basis
• hat functions with multi-level resolution
0,60,4 0,80,20
1
1
0,4
0,2
x
0
0,8
0,6
• FEM solution identical for hierarchical and nodal basis(same function space!)
• known from Scientific Computig I:diagonal stiffness matrix for 1D Poisson!
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 37
Hierarchical vs. Nodal Basis
h3=2-3xi
f(x)u(x)=iii(x)u(x)
0 10
1
2
3
0 10
1
2
3
h3=2-3xi
ii(x)
0 10
1
2
3
0 10
1
2
3u(x)=iii(x)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 38
Hierarchical Basis and Multigrid
• What happens, if we use FEM on hat function bases with differentresolutions?
• Define “mother of all hat functions”
φ(x) := max1− |x |,0
• consider mesh size hn = 2−n and grid points xn,i = i · hn
• nodal basis then Φn := φn,i ,0 ≤ i ≤ 2n with
φn,i (x) := φ
(x − xn,i
hn
)• hierarchical basis combines Φn := φn,i , i = 1,3, . . . ,2n − 1 (only odd
indices) and defines basis as
Ψn :=n⋃
l=1
Φl
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 39
Hierarchical Basis Transformation(or: How to represent functions on a coarser grid?)
0,60,4 0,80,20
1
1
0,4
0,2
x
0
0,8
0,6
−→
0,60,4 0,80,20
1
1
0,4
0,2
x
0
0,8
0,6
• represent hat functions φn−1,i (x) via fine-level functions φn,j (x)
φn−1,i (x) = 12φn,2i−1(x) + φn,2i (x) + 1
2φn,2i+1(x)
• hierarchical-basis transformation as matrix-vector product:ψn,i−1(x)ψn,i (x)ψn,i+1(x)
:=
φn,2i−1(x)φn−1,i (x)φn,2i+1(x)
=
1 0 012 1 1
20 0 1
φn,2i−1(x)φn,2i (x)φn,2i+1(x)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 40
Hierarchical Basis Transformation (2)
Level-by-level algorithm for hierarchical transform:
.x2x1 x3 x5 x7
Φ4Φ2 Φ6Φ1 Φ3 Φ5 Φ7
x6x4
−→
.x2x1 x3 x5 x7
Ψ2 Ψ6Ψ1 Ψ3 Ψ5 Ψ7
x6x4
.x2x1 x3 x5 x7
Ψ2 Ψ6Ψ1 Ψ3 Ψ5 Ψ7
x6x4
−→
.x2x1 x3 x5 x7
Ψ2 Ψ6Ψ1 Ψ3 Ψ5 Ψ7
x6x4
Ψ4
Remark: allows to implement transform in O(N)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 41
Hierarchical Basis Transformation (3)
• hierarchical basis transformation: ψn,i (x) =∑
jHi,jφn,j (x)
• transform can be written as matrix-vector product: ~ψn = Hn~φn
• step-wise transform from each grid level to the next similar to
H(2)3 =
1 0 0 0 0 0 012 1 1
2 0 0 0 00 0 1 0 0 0 00 0 1
2 1 12 0 0
0 0 0 0 1 0 00 0 0 0 1
2 1 12
0 0 0 0 0 0 1
cmp. restriction operator!
• Hn then a sequence of level-to-next-level transforms:
Hn = H(1)n H(2)
n . . . H(n−2)n H(n−1)
n
.x2x1 x3 x5 x7
Φ4Φ2 Φ6Φ1 Φ3 Φ5 Φ7
x6x4
−→
.x2x1 x3 x5 x7
Ψ2 Ψ6Ψ1 Ψ3 Ψ5 Ψ7
x6x4
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 42
Hierarchical Coordinate Transformation
• consider function f (x) ≈∑
iaiψn,i (x) represented via hier. basis
• wanted: corresponding representation in nodal basis∑k
bkφn,k (x) =∑
i
aiψn,i (x) ≈ f (x)
• with ψn,i (x) =∑
jHi,jφn,j (x) we obtain
∑k
bkφn,k (x) =∑
i
ai
∑j
Hi,jφn,j (x) =∑
j
∑i
aiHi,jφn,j (x)
• compare coordinates (identify indices j and k ) and get
bj =∑
i
Hi,jai =∑
i
(HT )
j,i ai
• written in vector notation: b = HT a
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 43
FEM and Hierarchical Basis Transform
• FEM discretisation with hierarchical test and shape functions:∫ψi (x)L
(∑j
ujψj (x)
)dx =
∫ψi (x)f (x) dx ∀ψi
• leads to respective stiffness matrix AHBi,j :∫
ψi (x)L(∑
j
ujψj (x)
)dx =
∑j
uj
∫ψi (x)Lψj (x) dx =
∑j
ujAHBi,j
• vs. stiffness matrix with nodal basis as shape functions:∫ψi (x)L
(∑j
vjφj (x)
)dx =
∑j
vj
∫ψi (x)Lφj (x) dx =
∑j
vjA∗i,j
• Note:∑
j ujAHBi,j and
∑j vjA∗i,j are both equal to
∫ψi (x)f (x) dx
• Therefore: (AHBu)i =∑
j ujAHBi,j =
∑j vjA∗i,j = (A∗v)i and v = HT u
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 44
FEM and Hierarchical Basis Transform (2)
• status: FEM with hierarchical test and nodal shape functions∫ψi (x)L
(∑j
vjφj (x)
)dx =
∫ψi (x)f (x) dx
• represent test functions via nodal basis:∫ ∑k
Hi,kφk (x)L(∑
j
vjφj (x)
)dx =
∫ ∑k
Hi,kφk (x)f (x) dx
∑k
Hi,k
∫φk (x)L
(∑j
vjφj (x)
)dx =
∑k
Hi,k
∫φk (x)f (x) dx
• leads to new system of equations: HANB v = H bNB
where ANB and bNB stem from nodal-basis FEM discretisation!• with v = HT u we obtain H ANB HT u = H b as system of equations, thus:
AHB = H ANB HT ( Galerkin coarsening)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 45
FEM and Hierarchical Basis Transform – Summary
• in general: FEM with nodal test and shape functions∫φi (x)L
(∑j
vjφj (x)
)dx =
∫φi (x)f (x) dx ANBuNB = bNB
changed to different test and shape functions:∫ψi (x)L
(∑j
vjψj (x)
)dx =
∫ψi (x)f (x) dx A??u?? = b??
• change from nodal to hierarchical basis:AHBuHB = H ANB HT uHB = H bNB = bHB
• change from nodal to coarser-level nodal basis:ACuC = R ANB RT uC = R bNB = RC
• Note: R,RT as in Galerkin coarsening; strongly related to H,HT
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 46
Hierarchical Generating System
.x1,1
.
.
x2,1 x2,3
x3,1 x3,3 x3,5 x3,7
Φ1,1
Φ2,1 Φ2,3
Φ3,1 Φ3,3 Φ3,5 Φ3,7
l =1
l =3
l =2
W1
W3
V3W2
.x1,1
.
.
x2,1 x2,3
x3,1 x3,3 x3,5 x3,7
x2,2
x3,2 x3,6x3,4
V1
V2
V3
• hierarchical basis combines Φn := φn,i , i = 1,3, . . . ,2n − 1 (only oddindices)
• generating system combines nodal bases of all levels:n⋃
l=1Φl
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 47
FEM and Hierarchical Generating Systems• solution function uh represented as
uh =n∑
l=1
2l−1∑j=1
vl,jφl,j (x)
→ non-unique “multi-grid” representation!• FEM discretisation with test and shape functions from hierarchical
generating system:∫φk,i (x)L
(∑l
∑j
vl,jφl,j (x)
)dx =
∫φk,i (x)f (x) dx ∀φk,i ∈
n⋃k=1
Φk
• assume order of test/shape functions:
φn,1, . . . , φn,2n−1, φn−1,1, . . . , φn−1,2n−1−1, . . . , φ2,1, φ2,2, φ2,3, φ1,1
• leads to (linearly dependent!) system of linear equations:
AGSuh = bGS
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 48
Multi-Level System of Equations• system matrix AGS given as (for example)Ah A2h
h A4hh
Ah2h A2h A4h
2h
Ah4h A2h
4h A4h
• Ah, A2h, and A4h are the nodal-basis stiffness matrices for resolution h,
2h, and 4h• consider submatrix Ah
2h → computed as∫φ2h,i (x)L
(∑j
vh,jφh,j (x)
)dx =
∫φ2h,i (x)f (x) dx ∀φ2h,i ∈ Φ2h
• test functions φ2h,i (x) = 12φh,2i−1(x) + φh,2i (x) + 1
2φh,2i+1(x)
• not a hierarchical transform, but a restriction operation R2hh :
~φ2h = R2hh~φh thus: Ah
2h = R2hh Ah
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 49
Multi-Level System of Equations (2)
• system of linear equations AGSvGS = bGS thus given as Ah AhPh2h AhPh
4h
R2hh Ah A2h A2hP2h
4h
R4hh Ah R4h
2hA2h A4h
vh
v2hv4h
=
bhR2h
h bhR4h
h bh
with restriction and prolongation operators: R = PT
• matrix is singular(!) due to obviously linearly dependent rows• however: all solutions lead to same piecewise linear function• result of a relaxation method on this system of equations?
symmetric Gauss-Seidel sweep corresponds to one multigridV-Cycle! (Griebel, 1994)
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 50
Symmetric Gauss-Seidel on AGSvGS = bGS
• pick out second block row of the system AGSvGS = bGS:
R2hh Ahvh + A2hv2h + A2hP2h
4h v4h = R2hh bh
• Gauss-Seidel→ thus solve for unknowns in v2h:
A2hv2h + A2hP2h4h v (old)
4h = R2hh bh − R2h
h Ahv (new)h = R2h
h
(bh − Ahv (new)
h
)• observation #1: relaxation works on restricted fine-grid residual
R2hh
(bh − Ahv (new)
h
)• observation #2: relaxation considers prolongated coarse-grid correction
from previous iteration: A2hP2h4h v (old)
4h
⇒ FEM on hierarchical generating systems matches V-Cycle Multigridwith Galerkin coarsening
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 51
Literature/References – Multigrid
• Briggs, Henson, McCormick: A Multigrid Tutorial (2nd ed.), SIAM, 2000.• Trottenberg, Oosterlee, Schuller: Multigrid, Elsevier, 2001.• Shapira: Matrix-Based Multigrid: Theory and Applications, Springer,
2008.• Hackbusch: Iterative Solution of Large Sparse Systems of Equations,
Springer 1993.• Brandt, Livne: Multigrid Techniques: 1984 Guide with Applications to
Fluid Dynamics, Revised Edition, SIAM• M. Griebel: Multilevelmethoden als Iterationsverfahren uber
Erzeugendensystemen, Teubner Skripten zur Numerik, 1994M. Griebel: Multilevel algorithms considered as iterative methods onsemidefinite systems, SIAM Int. J. Sci. Stat. Comput. 15(3), 1994.
Michael Bader | Scientific Computing II | Towards Multigrid Methods | Summer 2018 52