5636 - Parallel Numerical Algorithms Mike Peardon — Hilary Term 2016

advertisement
5636 - Parallel Numerical Algorithms
Mike Peardon — mjp@maths.tcd.ie
http://www.maths.tcd.ie/~mjp/5636
School of Mathematics
Trinity College Dublin
Hilary Term 2016
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
1/7
Solving sparse linear systems
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
2/7
Example problem: Poisson’s equation
Example of elliptic partial differential equation, which leads
to a sparse linear system that can be solved numerically.
Poisson’s equation (in two dimensions)
−∇2 φ = η
which in two dimensions is:
2
∂
∂2
−
+
φ(x, y ) = η(x, y )
∂x 2 ∂y 2
Approximate numerical solution built on discrete grid of
points in xy-plane, defining φ to take values only at grid
points: finite difference scheme.
Boundary data can be Dirichlet or Von Neumann
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
3/7
Poisson’s equation
(2)
Need to represent ∇2 on this grid. Use the Taylor series and
data from nearest neighbouring grid points:
φ(x + a, y ) = φ(x, y ) + a
∂φ
a2 ∂ 2 φ
(x, y ) + O(a3 )
(x, y ) +
∂x
2 ∂x 2
Poisson’s equation: finite difference
1 1
φ(x, y ) =
η(x, y ) + φ(x + a, y ) + φ(x − a, y )
4 a2
+ φ(x, y + a) + φ(x, y − a)
Result is a sparse linear system, where each entry in the
vector of unknowns, φ is directly dependent on just four
other entries (the nearest neighbours in the stencil).
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
4/7
Poisson’s equation
(3)
φ(x,y+a)
φ(x−a,y) φ(x,y)
Stencil is nearest-neighbours.
Dirichlet: boundary points are
given
Von Neumann: boundary
points are defined via other
linear equations.
φ(x+a,y)
φ(x,y−a)
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
5/7
Jacobi iteration
Jacobi iteration is a simple iterative scheme for solving a
linear system (to a given accuracy). Not used much in
practise, since better schemes known.
Jacobi iteration
To solve
Mx = y ,
can write for any matrix P
(M − P)x = y − Px.
Defining a sequence x (0) , x (1) , x (2) , . . . gives the iteration
Px (k+1) = y + (P − M)x (k)
x (k+1) = P −1 y + (I − P −1 M)x (k)
Mike Peardon — mjp@maths.tcd.ie (TCD)
5636
Hilary Term 2016
6/7
Jacobi iteration for Poisson’s equation
Jacobi for Poisson’s equation
1 1
φ(k+1) (x, y ) =
η(x, y ) + φ(k) (x + a, y ) + φ(k) (x − a, y )
4 a2
(k)
(k)
+ φ (x, y + a) + φ (x, y − a)
P0
Mike Peardon — mjp@maths.tcd.ie (TCD)
Break 2d domain into rectangular
blocks, assign each to parallel
process.
Data dependency: locally, looks
like Dirichlet problem.
Update boundary data between
each iteration.
5636
Hilary Term 2016
7/7
Download