multi-dimensional parallel discontinuous galerkin โ€ฆ...sample 2d mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข...

37
Multi-dimensional Parallel Discontinuous Galerkin Method Mentors: Dr. Ohannes Karakashian, Dr. Kwai Wong, Michael Wise Zhe Zhu The Chinese University of Hong Kong 7/29/2016

Upload: others

Post on 24-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Multi-dimensional Parallel Discontinuous Galerkin Method

Mentors: Dr. Ohannes Karakashian, Dr. Kwai Wong, Michael Wise

Zhe Zhu

The Chinese University of Hong Kong

7/29/2016

Page 2: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Agenda

1. Background

2. How DG works

3. Solve 2D equation

4. Solve 3D Equation

5. Parallelization

6. Future work

Page 3: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Background

Goal:

Implement DG-FEM to solve Poissonโ€™s equation in parallel on HPC platform

โˆ’ฮ”๐‘ข = ๐‘“ ๐‘–๐‘› ฮฉ๐‘ข = ๐‘”๐‘‘ ๐‘œ๐‘› ฮ“๐ท๐œ•๐‘ข

๐œ•๐‘›= ๐‘”๐‘› ๐‘œ๐‘› ฮ“๐‘

Ax=b Approximate solution of u

Problem Setting:

Page 4: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

How DG works

Element term

Interior edge term

Boundary edge term

Penalty term

Jump term

Diagonal local block

Local block Local block

Global matrix A

Solve Ax=b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ)Given

equation

Weak form

LHS: Ax RHS: b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ) F(v)

Divided into three parts

Computed in parallel

Combine all local blocks

Use Trilinos to finish parallel solving

Test function v

Page 5: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

How DG works

Given equation

Weak form

LHS: Ax RHS: b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ) F(v)

Test function v

โˆ’ฮ”๐‘ข = ๐‘“ ๐‘–๐‘› ฮฉ๐‘ข = ๐‘”๐‘‘ ๐‘œ๐‘› ฮ“๐ท

๐œ•๐‘ข

๐œ•๐‘›= ๐‘”๐‘› ๐‘œ๐‘› ฮ“๐‘

Page 6: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

How DG works

Given equation

Weak form

LHS: Ax RHS: b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ) F(v)

Test function v

โˆ’ฮ”๐‘ข = ๐‘“ ๐‘–๐‘› ฮฉ๐‘ข = ๐‘”๐‘‘ ๐‘œ๐‘› ฮ“๐ท

๐œ•๐‘ข

๐œ•๐‘›= ๐‘”๐‘› ๐‘œ๐‘› ฮ“๐‘

Bilinear Function for Stiffness Matrix:

:element term : jump term :penalty term

Solving Linear System:

Page 7: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

How DG works

Element term

Interior edge term

Boundary edge term

Penalty term

Jump term

Diagonal local block

Local block Local block

Global matrix A

Solve Ax=b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ)Given

equation

Weak form

LHS: Ax RHS: b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ) F(v)

Divided into three parts

Computed in parallel

Combine all local blocks

Use Trilinos to finish parallel solving

Test function v

Page 8: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

How DG works

Element term

Interior edge term

Boundary edge term

Penalty term

Jump term

Diagonal local block

Local block Local block

Global matrix A

Solve Ax=b

๐‘Žโ„Ž(๐‘ข, ๐‘ฃ)

Divided into three parts

Computed in parallel

Combine all local blocks

Use Trilinos to finish parallel solving

Bilinear Function for Stiffness Matrix:

:element term : jump term :penalty term

Solving Linear System:

Page 9: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Sample 2D Mesh

โˆ’ฮ”๐‘ข = ๐‘“ ๐‘–๐‘› ฮฉ๐‘ข = ๐‘”๐‘‘ ๐‘œ๐‘› ฮ“๐ท๐œ•๐‘ข

๐œ•๐‘›= ๐‘”๐‘› ๐‘œ๐‘› ฮ“๐‘

โ€ข We want to solve ๐‘ข through numerical method

โ€ข We want to get an approximation of ๐‘ข on the domain.

ฮฉฮ“๐ท

Where ๐‘“, ๐‘”๐‘‘, ๐‘”๐‘› is known

Page 10: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

ฮฉฮ“๐ท

Choose nodal points

โ€ข By calculating the value of u on these nodal points, we can get the approximation of u on ฮฉโ€ข In general, the more nodal points you choose, the higher accuracy of the approximation you get

Page 11: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

1. Find a set of independent basic functions { ๐‘ฃ๐‘—}

2. Try to use the linear combination to get the approximate

value on nodal points which can fit into the exact value.

3. Represent u as a linear combination of those basic

functions

Solve 2D Equation

๐‘ข =

๐‘—

๐‘ข๐‘— ๐‘ฃ๐‘—

How to get the approximation of u on these nodal points ?

Page 12: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

The two problem we need to solve:

1. How to choose the basic functions?

2. How to represent u as a linear combination of basic functions?

Solve 2D Equation

Page 13: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Master cell

lagrange interpolation

๐œ‘๐ด = x

๐œ‘๐ต = y

๐œ‘๐ถ = 1-x-y

Page 14: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

๐œ‘๐ด = x

๐œ‘๐ต = y

๐œ‘๐ถ = 1-x-y

๐œ‘๐ด0

๐œ‘๐ต0

๐œ‘๐‘0

๐œ‘๐ด1

๐œ‘๐ต1

๐œ‘๐‘1

โ€ฆ

๐œ‘๐ด7

๐œ‘๐ต7

๐œ‘๐‘7

Divide the mesh into several elements

Page 15: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Use map to do integration in the master cell

a

b c

(x,y)

( ๐‘ฅ, ๐‘ฆ)

Page 16: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Bilinear Function for Stiffness Matrix:

:element term : jump term :penalty term

Solving Linear System:

Page 17: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

๐œ™0(๐ผ0)

๐œ™1(๐ผ0)

๐œ™0(๐ผ1)

๐œ™2(๐ผ0)

๐œ™2(๐ผ1)

๐‘ข0

(๐ผ0)

๐‘ข1

(๐ผ0)

๐‘ข2

(๐ผ0)

๐‘ข0

(๐ผ1)

๐‘ข1

(๐ผ1)

๐‘ข2

(๐ผ0)

= โ‹ฏ

๐œ™1(๐ผ1)

๐œ™0(๐ผ0) ๐œ™1

(๐ผ0) ๐œ™2(๐ผ0) ๐œ™0

(๐ผ1)๐œ™1

(๐ผ1)๐œ™2

(๐ผ1)

โ€ฆ

Page 18: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Triangles

Interior Edges

Boundary Edges

++

--

+-

-+

8*

8*

8*

Page 19: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Page 20: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

For triangles:

Element-element matrix:

Page 21: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Page 22: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Page 23: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

We use Gaussian quadrature to do the integration

โ€ข In this example, the function is linear, so we only need one quadrature point to get the answer.

โ€ข When calculate penalty term, we will need at least two quadrature point.

โ€ข The match of the more than one pair of quadrature points is a problem.

Solve 2D Equation

Page 24: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

Get the right number for each blocks and combine those blocks into the global matrix

For edge (++ case)

Page 25: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 2D Equation

The RHS: Global matrixThe LHS: vector

Page 26: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 3D Equation

Nodal point *8

Tetrahedron *6

Inter face *6

Boundary face *12

Page 27: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 3D Equation

lagrange interpolation

๐œ‘๐ด = x

๐œ‘๐ต = y

๐œ‘๐ถ = z

๐œ‘๐ท = 1-x-y-z

Page 28: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 3D Equation

2D 3D

Element term Integration on surface Integration of 3 dimension

Number of quadrature points 0 0

Jump term Integration on line Integration on face

Number of quadrature points 1 1

Penalty term Integration on line Integration on face

Number of quadrature points 2 3

When our basic function is linear, the number of quadrature points needed for each term:

To calculate the penalty term of 3D case, we need to figure out how the three pairs of nodal points are matched.

Page 29: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 3D Equation

1. Find the way of mapping between the two cell and the

master cell respectively

2. Find out the relation between the two cell

3. Find the way of matching

4. Get the right answerIndex match

0 0, 1, 2

1 0, 2, 1

2 1, 0, 2

3 1, 2, 0

4 2, 0, 1

5 2, 1, 0

Page 30: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Solve 3D Equation

Index match

0 0, 1, 2

1 0, 2, 1

2 1, 0, 2

3 1, 2, 0

4 2, 0, 1

5 2, 1, 0

Cell1: [1, 2, 3, 4] Cell2: [3, 1, 5, 4]

1. [1, 2, 3, 4] and [3, 1, 5, 4] are all map to [A, B, C, D]

2. The common face is [1, 3, 4] and [3, 1, 4]

3. The match way is [1, 0, 2]

4. Face [1, 3, 4] maps to [A, C, D] of the master cell

5. Face [3, 1, 4] maps to [A, B, D] of the master cell

6. Get the value of given functions at quadrature points

on [A, C, D] and [A, B, D]

7. Multiply those value according to the match way

Page 31: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Parallelization

1. Divide the global matrix into the combination of several blocks

2. Calculate the right number for each blocks in parallel

3. Combine those blocks into the global matrix

4. Use conjugate gradient method to solve the equation in parallel

Page 32: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Parallelization

After Global Matrix Construction: Solve linear system

โ€ข C programming: dgesv on LAPACK

โ€ข LU factorization: dense matrix solver

โ€ฆ

Cell Matrices

MPI Assembly

Global Matrix

LAPACK dgesvdense matrix solver

Solution

Page 33: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Parallelization

Parallelize the linear system solving process

โ€ข AztecOO on Trilinos

โ€ข Each processor has access to global rows

โ€ฆ

Cell Matrices

MPI Assembly

Global Rows

AztecOO on Trilinos

Solution

Page 34: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Parallelization

Page 35: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Future works

โ€’ Extend the partial differential equation to some time-dependent

equations

โ€’ Finish the parallel code, which can be scaled on existing

supercomputers.

Page 36: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Acknowledgement

This project is sponsored by

Oak Ridge National Laboratory

Joint Institute for Computational Sciences

University of Tennessee, Knoxville

The Chinese University of Hong Kong

Most sincere gratitude to my mentors

Dr. Ohannes Karakashian, Dr. Kwai Wong and Michael Wise

Page 37: Multi-dimensional Parallel Discontinuous Galerkin โ€ฆ...Sample 2D Mesh โˆ’ฮ” = ๐‘– ฮฉ = ฮ“ ๐œ•๐‘ข ๐œ•๐‘› = ๐‘› ฮ“๐‘ โ€ข We want to solve through numerical method ... Dr. Ohannes

Q & A