introduction to multigrid and its...
TRANSCRIPT
Introduction to Multigrid and its ParallelizationCME 342: Parallel Methods in Numerical Analysis
!Thomas D. Economon
Lecture 14a May 28, 2014
CME 342: Parallel Methods in Numerical Analysis
�����������������HW 1 & 2 have been returned. Any questions?
�����������������Final projects are due June 11, 5 pm. If you are not doing a research project, please complete the assigned project.
�����������������Poll: would you like to have 10 min. project presentations during the exam period (starting at 9 am on Wednesday, June 11)? This would be for folks completing a research project.
�����������������Tom’s office hours are now Fridays from 1:00-2:45 pm in the conference room inside of Durand 464.
Announcements 2
CME 342: Parallel Methods in Numerical Analysis
Outline 3
Motivation for Multigrid
Geometric Multigrid (linear)
Parallelization
Nonlinear Multigrid (SUmb)
CME 342: Parallel Methods in Numerical Analysis
�����������������Multigrid is a very powerful and elegant algorithm for convergence acceleration.
�����������������Often used for solving elliptic PDEs, hyperbolic PDEs (computational fluid dynamics!), purely algebraic problems.
�����������������We’ll focus on geometric multigrid for problems with physical grids.
�����������������At first, the Poisson equation will be used as a model problem (your project).
�����������������Main ideas behind multigrid:
�����������������Due to local stencils, typical iterative methods damp local (high frequency) errors effectively, but global (low frequency) errors are reduced more slowly.
�����������������Multigrid generates effective convergence at all length scales by using a sequence of grids at various resolutions.
Multigrid Introduction 4
CME 342: Parallel Methods in Numerical Analysis
Some very useful references (that also list many others):
�����������������Briggs, “A Multigrid Tutorial,” SIAM, 1987.
�����������������Brandt, “1984 Guide to Multigrid Development, with applications to computational fluid dynamics.”
�����������������Chow et al., “A Survey of Parallelization Techniques for Multigrid Solvers,” on class website.
�����������������Mavriplis, D., “On Convergence Acceleration Techniques for Unstructured Meshes,” NASA/CR-1998-208732 (ICASE Report No. 98-44).
Multigrid References 5
CME 342: Parallel Methods in Numerical Analysis
Poisson Example 6
⌦
@⌦
⇢�ar2� = f in ⌦
� = g on @⌦
{i, j} {i+1, j}{i�1, j}
{i, j�1}
{i, j+1} h
} }h
⇢� a
h2 (�i,j�1 + �i�1,j � 4�i,j + �i+1,j + �i,j+1) = fi,j in ⌦
initialize �i,j = gi,j and do not update on @⌦
⇡
After applying 2nd-order finite differencing on a 2D, uniform grid to the Poisson equation…
CME 342: Parallel Methods in Numerical Analysis
Poisson Example 7
⌦ = [0, 1]⇥ [0, 1]
a = 1
f(x, y) = �5.0 exp(x) exp(�2.0 y)
�(x, y) = exp(x) exp(�2.0 y)
Set known solution values on boundaries, set initial guess
to zero, and solve using Gauss-Seidel smoothing:
Test Problem with Analytic Solution:
�n+1i,j =
1
4
✓�n+1i,j�1 + �n+1
i�1,j + �ni+1,j + �n
i,j+1 +h2
afi,j
◆
CME 342: Parallel Methods in Numerical Analysis
Poisson Example 8
We might reduce cell size to improve accuracy or to include more physics.
CME 342: Parallel Methods in Numerical Analysis
Poisson Example 9
But decreasing the cell size makes the problem more stiff.
CME 342: Parallel Methods in Numerical Analysis
�����������������As we decrease the cell size on our mesh, the low frequency errors are difficult to eliminate and cause slow solver convergence.
�����������������These are global errors spanning the larger solution domain that are not well treated by our stencil’s local influence.
�����������������Key idea: use a coarse mesh representation to provide a better initial solution guess or to correct the solution on the fine mesh.
�����������������Low frequency (smooth) errors on the fine mesh appear as high frequency (oscillatory) errors on the coarse mesh.
�����������������Cells on coarsest level may span the majority of the solution domain.
�����������������Smoothing iterations are cheaper on the smaller coarse mesh.
�����������������Apply these ideas recursively to cover all length scales (frequencies).
Geometric Multigrid 10
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 11
Linear multigrid for our model Poisson problem (1/2).
Starting with our linear system (discrete Poisson)
A� = f , (1)
define the error in the solution to be the di↵erence between the solution � and
the approximation to the solution
˜
�, or
e = �� ˜
�, (2)
where e is the error vector (one value per node in the computational mesh). We
can also define a residual vector r, which is a measure of how well the discretized
governing equations are being satisfied by our numerical solution procedure, as
r = f �A ˜
�. (3)
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 12
Linear multigrid for our model Poisson problem (2/2).
Introducing the error into our original system gives
A⇣˜
�+ e⌘= f , (1)
and by then introducing our definition of the residual, we recover the following
expression:
A e = r, (2)
which relates the error in the solution to the residual. We can now compute a
measure of the error on coarser mesh levels after transferring the values of the
residual from the fine mesh level onto the coarse level. After calculating e on a
coarse level, we can form a correction to the solution on the fine mesh as
� =
˜
�+ e, (3)
CME 342: Parallel Methods in Numerical Analysis
�����������������So then, how do we coarsen the mesh and move information up and down between levels?
�����������������Coarsening with structured meshes is straightforward: remove every other node in each direction of the grid with each level (vertex-based) or combine 2 cells in each direction (cell-centered).
�����������������Some definitions:
�����������������Smoother: solution relaxation method that is applied on each grid level for a number of iterations (or sweeps). Gauss-Seidel in our Poisson example.
�����������������Restriction operator: an operator that transfers information from a fine grid “down” to a coarse grid.
�����������������Prolongation operator: an operator that transfers information from a coarse grid “up” to a fine grid.
Geometric Multigrid 13
CME 342: Parallel Methods in Numerical Analysis
�����������������Typical restriction operators…
�����������������Injection: copy information at coincident nodes from fine to coarse mesh.
�����������������Weighted: surrounding & coincident fine mesh nodes contribute information to the coarse mesh node.
�����������������Typical prolongation operators…
�����������������Bilinear/Trilinear interpolation: information from coincident nodes is transferred coarse to fine mesh and remaining fine nodes are interpolated.
�����������������Weighted: surrounding & coincident coarse mesh nodes contribute information to the fine mesh node.
Geometric Multigrid 14
CME 342: Parallel Methods in Numerical Analysis
SMOOTHSMOOTH
SMOOTH
RESTRICT
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT PROLONGATE
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT
PROLONGATE
PROLONGATE
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT
PROLONGATE
PROLONGATE
PROLONGATE
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT
PROLONGATE
PROLONGATE
PROLONGATE
PROLONGATE
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
SMOOTH
RESTRICT
RESTRICT
RESTRICT
RESTRICT
PROLONGATE
PROLONGATE
PROLONGATE
PROLONGATE
SMOOTH
Geometric Multigrid 15
Downstroke and upstroke of a multigrid V-cycle.
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 16
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 17
With full coarsening, solutions on any evenly divisible grid (n = 2m+1) can be converged to machine precision in O(10) multigrid cycles.
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 18
CME 342: Parallel Methods in Numerical Analysis
�����������������Often use variable number of smoothing iterations on the different levels (coarser levels are cheaper).
�����������������Other cycles are possible, another typical choice is a multigrid W-cycle (see SUmb slides).
�����������������Full Multigrid: use the multigrid V-cycle to converge the solution on each mesh level, starting from the coarsest moving to the finest.
Geometric Multigrid 19
CME 342: Parallel Methods in Numerical Analysis
Geometric Multigrid 20What about unstructured meshes? Could create your own sequence of coarse
meshes or use an agglomeration approach for automatic generation.
From Mavriplis D., “On Convergence Acceleration Techniques for Unstructured Meshes”
CME 342: Parallel Methods in Numerical Analysis
For mesh-based PDE problems, a common approach to parallelization of multigrid is similar to the single grid procedure:
1. Partition fine mesh using a typical decomposition approach while first ignoring coarse levels (one partition per processor).
�����������������For example, divide into blocks for simple structured meshes or use METIS for unstructured grids.
�����������������Construct appropriate halo layers and communication schedules.
2. Each processor constructs their own coarse mesh levels.
3. Traverse the multigrid cycle in the same manner, one level at a time.
Parallel Multigrid 21
CME 342: Parallel Methods in Numerical Analysis
�����������������Two issues in particular to consider in parallel: coarsening and smoothers.
�����������������Coarsening
�����������������Can inherit coarse mesh partitions directly from fine mesh partitions, i.e., nodes/cells on partition boundaries remain on boundaries on lower levels.
�����������������Usually straightforward for structured meshes. See Chow et al. for more discussion on unstructured grids.
�����������������Communications required after restriction/prolongation.
�����������������Smoothers
�����������������Classical iterative smoothers are sequential, except for Jacobi.
�����������������Recall multi-coloring concepts from previous lectures on iterative solvers.
�����������������A very popular choice is red-black Gauss-Seidel (SOR) for 5-point stencils.
�����������������Communications required after updating each color for the smoother.
Parallel Multigrid 22
CME 342: Parallel Methods in Numerical Analysis
Parallel Multigrid 23
{i, j} {i+1, j}{i�1, j}
{i, j�1}
{i, j+1}
Red-black ordering for Gauss-Seidel allows for the partitioning of the domain. Alternate colors and communicate between.
CME 342: Parallel Methods in Numerical Analysis
Other issues to consider when parallelizing multigrid:
�����������������Load-balancing on all levels… relatively easy on structured meshes, but what about unstructured?
�����������������Communication costs vs. compute time on coarse levels.
�����������������On coarsest level, operator may be small and communication cost high.
�����������������Operator may be dense on coarsest level. Use a direct solve?
�����������������Based on this, the time spent on coarse levels in parallel MG solvers is often minimized…
�����������������W-cycles and full MG are often avoided.
�����������������Voluntarily communicate less on the coarse/coarsest mesh levels?
Parallel Multigrid 24