Está en la página 1de 12

Today!

Lecture - Introduction

Ph.D. Course:
Nodal DG-FEM for solving partial differential equations

Allan P. Engsig-Karup
Scientific Computing Section
DTU Informatics
Technical University of Denmark ! Presentation and practical details
! Introduction to DG-FEM methods
August 6, 2012
! Getting setup for hands-on exercises

2 / 45

Course content Course content

This course is organized and taught by This course is an activity of GPUlab, DTU Informatics
! Assoc. Prof. Allan Peter Engsig-Karup
Building 321, r. 016
DTU Informatics, Scientific Computing Section, DTU,
D T U I n f o r m a t i c s
Denmark.
! Prof. Jan Hesthaven The course is sponsored by the PhD school at Technical University
Building 321, r. 009 of Denmark
Division of Applied Mathematics, Brown University, USA. ! DTU Informatics Graduate School ITMAN
Teaching assistance during afternoons
and organized with support from
! Post Doc Ole Lindberg ! The Danish Center for Applied Mathematics and Mechanics,
DTU Informatics, Scientific Computing Section, DTU,
DCAMM
Denmark.

3 / 45 4 / 45
Course content Course structure
Week 1:
The following topics are covered in the course Time Monday Thuesday Wednesday Thursday Friday
1 Introduction & DG-FEM in one spatial dimension 08.30-09.00 Breakfast
09.00-11.30 1 2 3 4 Project work
2 Implementation and numerical aspects (1D) 12.30-16.00 Hands-on Hands-on Hands-on Hands-on Project work
3 Insight through theory
Week 2:
4 Nonlinear problems
Time Monday Thuesday Wednesday Thursday Friday
5 Extensions to two spatial dimensions 08.30-09.00 Breakfast
6 Introduction to mesh generation 09.00-11.30 5 5+6 7 8 Project work
12.30-16.00 Hands-on Hands-on Hands-on Hands-on Project work
7 Higher-order operators
8 Problem with three spatial dimensions and other advanced ! Lectures: approx. 2.5 h/day, including 15 mins review + 15
topics mins break.
! Hand-on exercises: approx. 3.5 h/day.

5 / 45 6 / 45

Learning objectives Coursework and assessment


A student who has met the objectives of the course will be able to: This 2-week course has approx. 70 scheduled hours
! Apply the basic ideas underlying discontinuous Galerkin ! Breakfast and coffee/tee (0.5 hours/day)
methods. ! Lectures (approx. 2 hours/day)
! Apply the building blocks of DG-FEM methods for the ! Discussions (as needed)
simulation of phenomena described by partial differential ! Hands-on computer exercises (approx. 4 hours/day)
equations. ! Lunch (1 hours/day)
! Identify and exploit the properties and structure of the
To pass the course and get a diploma the requirements are
underlying problem.
! Completing a written report for assessment of work
! Be able to complete basic analysis to formulate a suitable
! Satisfactory completion of assignment problems
scheme for a new problem.
! Implement such methods and extensions in Matlab using the (approx. 40 hours)
! Short notes, produced codes and relevant results from
provided Matlab based toolbox.
! Skillfully perform numerical experiments. successfully completed exercises during afternoons sessions
! Analyse and explain the observed behavior of the methods The assignment is divided in two parts
based on a basic theoretical insight. ! Each part will be available tuesday morning of each week
! Apply important principles underlying the use of modern ! It is highly recommended that you Initiate your work on the
numerical methods in selected applications. assignments after completion of exercises
7 / 45 8 / 45
Practical details Practical details

! Background
! What is your background? Experiences?
! Why are you here?
! Access to the databar terminals, software and Internet
! Access to Matlab codes, http://www.nudg.org
! Access to hands-on exercises/slides/ect.,
http://www2.imm.dtu.dk/~apek/DGFEMCourse/
! General information
! Course material:
Nodal Discontinuous Galerkin Methods - Algorithms, Analysis,
and Applications
By J. S. Hesthaven & T. Warburton (2008), Springer.

9 / 45 10 / 45

Course work

The work in the course should be carried out in teams


! Two persons per team Introduction
! Hands-on exercises and assignment work is made by the team
Everyone is encouraged to take the opportunity to - discussion of numerical
! Interact! schemes and properties
! Get to know each other!
! Discuss the work!
! Share experiences!

11 / 45 12 / 45
Computational Science and Engineering Our goals

For the application of numerical methods we want


! Scientific computing has become indispensable for progress
! accuracy at minimal effort
and breakthroughs in science through (cost-efficient) ! flexibility to solve classes of problems with same code
numerical experiments and validation against real experiments. ! easy problem prototyping and code maintenance
! Numerical simulation using modern computers indispensable (avoid adhoc solutions)
today for engineering analysis and prediction of physical ! ensure that numerical results can be thrusted
events. (verification and validation)
! Interplay between experiments, simulation and theory.
13 / 45 14 / 45

Numerical solution of PDEs Conservation laws


Conservation laws appear in many brances of computational
To construct a numerical method for solving PDEs we need to science and engineering and are typically derived from physical
consider conservation principles, e.g. conservation of energy, momentum
! How to represent the solution u(x, t) by an approximate and mass.
solution uh (x, t)?
A general nonlinear conservation law (3D) can be stated in
! In which sense will the approximate solution uh (x, t) satisfy differential form as
the PDE?
∂t u + ∇ · F(u) = S(u)
The two choices separate and define the properties of different
numerical methods... or
∂t u + ∂x F (u) + ∂y G (u) + ∂z H(u) = S(u)
Bottom line is that we need ways to
where
! Generate a (coupled) system of algebraic equations from the
u1 f1 g1 h1 s1
         
well-posed PDE and incorporate boundary conditions  u2   f2   g2   h2   s2 
u= .  , F (u) = ..  , G (u) =  .  , H(u) =  .  , S(u) =  .
         
! Solve the system and equations while minimizing unavoidable  .. 

 .   ..   ..   ..


errors that are introduced in the process um fm gm hm sm

u(x, t) is a vector of conserved variables and F , G , H are flux


15 / 45
vectors. S is a source vector. 16 / 45
Conservation laws Conservation laws
Examples of conservation laws
! Euler equations of compressible gas dynamics (1D)
∂ρ ∂ρu For now, we restrict ourselves to consider the one-dimensional
∂t + ∂x = 0 (Mass)
scalar conservation law
∂ρu ∂(ρu 2 +p)
∂t + ∂x =0 (Momentum)
∂E ∂(E +p)u ∂u ∂f
∂t + ∂x ! = 0 (Energy) + = g, x ∈Ω
#
γp ∂t ∂x
p = (γ − 1) E − 12 ρu 2 , c
"
= ρ (Ideal gas low)
where f (u) is the flux function, g (x, t) is a source function.
! Nonlinear shallow water equations (1D)
Let’s discuss basic ideas, advantages and disadvantages of different
∂h
+ ∂hu classical numerical methods for solving this PDE...
∂t ∂x = 0 (Mass)
1
∂hu ∂(hu 2 + 2 gh2 )
∂t + ∂x = 0 (Momentum)

! and many many more...

17 / 45 18 / 45

Finite Difference Method Finite Difference Method


Main benefits
! Simple to understand
! Straightforward implementation on structured meshes
! High-order acurate approximations feasible
! Domain is represented by a set of collocation points ! Method is local and can be made explicit in time
! Solution is represented locally as a polynomial
! Simple techniques for local adaptivity (upwinding)
2 2
Extensive body of theoretical and practical work on these
' '
x ∈ [x k−1 , x k+1 ] : uh (x, t) = ai (t)(x − x k )i , fh (x, t) = bi (t)(x − x k )i !
i =0 i =0 methods since 1960’s
! PDE is satisfied in a point-wise manner Main problems
duh (x k , t) fh (x k+1 , t) − fh (x k−1 , t)
! Implementation complexity increases if geometric flexibility is
Rh (x k ) = + − g (x k , t) = 0 needed
dt hk + hk−1

! Local smoothness requirement pose a problem for resolving


! Less well-suited for problems with discontinuities
complex geometries, internal discontinuities and overall grid ! Grid smoothness requirements
structure.
19 / 45 20 / 45
Finite Volume Method Finite Volume Method

Main benefits
! Robust
! Support resolution of complex geometries
! Domain is represented by non-overlapping cells ! Well-suited for hyperbolic conservation laws (local upwinding)
! Solution is represented locally as a cell average ! Method is local and can be made explicit in time
1 Method is locally conservative (due to telescopic property)
(
!
ū k ≡ u k dx k
hk Ωk ! Extensive theoretical framework since 1970’s
! PDE is satisfied on conservation form Main problems
d ū k ! Inability to achieve high-order accuracy in a straightforward
hk + f (x k+1/2 , t) − f (x k−1/2 , t) = hk ḡ k
dt way on general grids due to requirement for extended stencils
! The flux function needs to be reconstructed on cell interfaces (flux reconstruction problem)
x k±1/2 ! Grid smoothness requirements
f (x k−1/2 , t) = F (ū k−1 , ū k ), f (x k+1/2 , t) = F (ū k , ū k+1 )

21 / 45 22 / 45

Finite Element Method Finite Element Method

Main benefits
! Robust
! Systematic implementation on unstructured meshes
! Domain is represented by non-overlapping elements
! Solution is represented globally using piecewise continuous
! High-order accuracy can be combined with complex
polynomials geometries
K
! Well-suited for elliptic problems (global statement)
'
uh (x) = u(xk , t)N k (x), N i (xj ) = δij ! Extensive theoretical framework since 1970’s
k=1
Main problems
! PDE is satisfied in a global manner
! Not well-suited for problems with direction (global statement)
) *
∂uh ∂fh duh
(
+ − gh j
N (x)dx = 0, j = 1, ..., K ⇒M + Sfh = Mgh ! Implicit in time reduces overall efficiency
Ωh ∂t ∂x dt

! The semi-discrete scheme is implicit by construction and


reduces overall efficiency for explicit time-integration
23 / 45 24 / 45
Properties of numerical methods General properties of the numerical methods
Numerical methods for solving PDEs can in general be
characterized by the properties Assesment of general properties of some classical numerical
methods
! Accuracy
Can we reduce the error? and how fast?
Complex High-order accuracy Explicit semi- Conservation Elliptic
! Flexibility FDM
geometries
×
and hp-adaptivity
"
discrete form
"
laws
"
problems
"
What is the range of problems that can be solved using the FVM
FEM
"
"
×
"
"
×
"
(")
(")
"
chosen method? DG-FEM " " " " (")

! Robustness We want a scheme which have the properties


Can we always expect a solution from our numerical model?
! The local high-order elements of FEM.
! Efficiency
! The geometric flexbility of FEM and FVM.
How long does it take to compute our solution?
! The local statement of the FVM.
Note: Very often it is difficult to achieve all properties at once!
These are exactly the components of the
⇒ Thus, we need to prioritize!
! Choice is often dictated by domain complexity and required Discontinuous Galerkin Method Finite Element Method
levels of accuracy.
25 / 45 26 / 45

Formulating a DG-FEM scheme

By subdividing the domain Ω ∈ [L, R] similar to FVM/FEM into a


union of non-overlapping elements D k
K
Ω∼
$
= Ωh = Dk
A first look at DGFEM k=1

D k−1 Dk D k+1
x
L = xl1 xrk−1 = xlk xrk = xlk+1 xrK = R

hk+1

we have the basis for geometric flexibility (any type of grid).

Generating the actual grid is a separate problem.

27 / 45 28 / 45
Formulating a DG-FEM scheme Formulating a DG-FEM scheme
We seek to represent the global solution using local high-order We want to find an approximation uh to the solution u of the
polynomial approximations similar to FEM general scalar conservation law
K
u(x, t) ∼ ∂t u + ∂x f (u) = g (x, t), x ∈Ω
%
= uh (x, t) = uhk (x, t),
k=1
Np Np
To do this, we form the local residual on the k = 1, .., K elements
& &
uhk (x, t) = ûjk (t)ψj (x) = uhk (xjk , t)lj (x) x ∈ D k : Rkh (x, t) = ∂t uhk + ∂x fhk − ghk
j=1 j=1
and require this to vanish locally in a Galerkin sense
using either a modal or nodal form.
'
This is the basis for arbitrary high-order accurate approximations. Rkh (x, t)lik (x)dx = 0, i = 1, ..., Np , k = 1, ..., K
Dk
Note: both low and high-order approximations then an option in
This is the basis for a nodal DG-FEM scheme.
the scheme.
However, we are not done yet... all elements are disconnected due
A high-order accurate method has asymptotic behavior O(hp ) of
to the local statement on the residual.
truncation error for h → 0 with p > 2.
29 / 45 30 / 45

Formulating a DG-FEM scheme Formulating a DG-FEM scheme


To connect elements, we apply Gauss’s Theorem
' ' ( Similar to FVM, we could introduce a numerical flux f ∗ which
approximate the physical flux, i.e.
)
k k
Rh (x, t)li (x)dx = ∂t uhk ljk + ∂x uhk ljk − ghk ljk dx = 0
Dk Dk
n̂ · f ∗ ∼
= n̂ · fhk
to convert the term with a spatial derivative such that
to address the lack of solution uniqueness at the interfaces. We
' ( ) *
∂t uhk ljk − uhk ∂x ljk − ghk ljk dx = − n̂ · fhk ljk dx
Dk ∂D k require that the numerical flux is somehow defined in terms of
interior (-) and exterior (+) interface states
where the boundary integral in 1D takes the form
)x k f ∗ = f ∗ (uh− , uh+ )
* (
l
n̂ · fhk ljk dx = fhk ljk k = fhk (xrk )δNp j − fhk (xlk )δ1j
∂D k xr
D k−1 urk−1,+ ulk+1,+ D k+1
The solution is not unique at interfaces between adjacent elements. ulk,− Dk urk,−
D k−1 D k+1
Dk
Clearly, the choice of the numerical flux must be important!

We have multiple solutions! How can we address this problem?


31 / 45 32 / 45
Formulating a DG-FEM scheme Formulating a DG-FEM scheme
From the weak form
' ( ) *
∂t uhk ljk − uhk ∂x ljk − ghk ljk dx = − n̂ · f ∗ ljk dx
So, after having applied Gauss’s Theorem we found Dk ∂D k
' ( ) * we can generate a local linear system by inserting the polynomial
k k k k k k
∂t uh lj − uh ∂x lj − gh lj dx = − n̂ · fhk ljk dx approximation uhk arriving at the compact scheme
Dk ∂D k

With the introduction of a numerical flux f ∗ , the local scheme in duhk


Mk − (S k )T fhk − Mk ghk = −f ∗ δ1j + f ∗ δNp j
the weak form then becomes dt
where δij is Kronecker’s delta and the element mass and stiffness1
' ( ) *
k k k k k k
∂t uh lj − uh ∂x lj − gh lj dx = − n̂ · f ∗ ljk dx
Dk ∂D k matrices have been introduced. These are defined from
dljk
' '
k k k k
Mij = li (x)lj (x)dx, Sij = lik (x) dx
Dk Dk dx

1
In classical finite element terminology, the discrete operator approximating
the first derivative is called a convection/advection matrix.
33 / 45 34 / 45

Formulating a DG-FEM scheme Formulating a DG-FEM scheme

It is also possible to derive yet another scheme from the weak form Consider the strong scheme
' ( ) *
∂t uhk ljk + ∂x uhk ljk − ghk ljk dx = n̂ · (fhk − f ∗ )ljk dx
' ( ) *
k k k k k k
∂t uh lj − uh ∂x lj − gh lj dx = − n̂ · f ∗ ljk dx Dk ∂D k
Dk ∂D k

by applying Gauss’s Theorem once more From this we can generate a local linear system of the form
' ( * duhk
Mk + S k fhk − Mk ghk = (fhk − f ∗ )δ1j − (fhk − f ∗ )δNp j
)
∂t uhk ljk + ∂x uhk ljk − ghk ljk dx = n̂ · (fhk − f ∗ )ljk dx dt
Dk ∂D k
which is clearly a semi-discrete system of the form
This is the so-called strong form.
duhk + ,
= −(Mk )−1 S k fhk − Mk ghk = (fhk − f ∗ )δ1j − (fhk − f ∗ )δNp j
We now have two basic DG-FEM schemes. How will they perform? dt
which can be solved by an appropriate explicit/implicit ODE solver.

35 / 45 36 / 45
Examples: error behavior
Consider the simple advection equation on a periodic domain

∂t u − 2π∂x u = 0, x ∈ [0, 2π], u(x, 0) = sin(lx), l= λ

Exact solution is then u(x, t) = sin(l (x − 2πt))).

The first examples... Errors at final time T = π.


N\ K 2 4 8 16 32 64 Convergence rate
1 - 4.0E-01 9.1E-02 2.3E-02 5.7E-03 1.4E-03 2.0
2 2.0E-01 4.3E-02 6.3E-03 8.0E-04 1.0E-04 1.3E-05 3.0
4 3.3E-03 3.1E-04 9.9E-06 3.2E-07 1.0E-08 3.3E-10 5.0
8 2.1E-07 2.5E-09 4.8E-12 2.2E-13 5.0E-13 6.6E-13 ∼
= 9.0

Error is seen to behave as

||u − uh ||Ω,h ≤ ChN+1

Clearly, paths to convergence are based on adjusting the size of


elements (h-convergence), the polynomial order (p-convergence) or
combinations hereof.
37 / 45 38 / 45

Examples: error behavior Example - High-order makes the difference


Consider the linear shallow water equations in one horizontal
50
dimension on a periodic domain h−version (P=2)
p−version (K=20)
40 p−version (K=10)
- . - . - .
∂ η 0 −h ∂ η
=
∂t u −g 0 ∂x u
30

CPU time
Tests of h− and p-refinement
20
−2
10
0
10
1
−4
10 3
10
−6
10 1
Error

Error

−5
5 10
−8
10 0
1 0 50 100 150 200 250
−10
7
Integration time [wave periods]
10 h−version (P=2)
h−version (P=4) −10 h−version (P=1)
h−version (P=6) 10 p−version (K=20)
−12
10
10
1
10
2

Number of degrees of freedom


3
10 0 50 100 150 200 250
Number of degrees of freedom
300 350 Figure: Optimized CPU-time vs. integration time for a fixed relative error
in amplitude of 5% (assume satisfactory engineering accuracy).
Again, the error behaves as
! Conclusion: a significant improvement in performance can be
||u − uh ||Ω,h ≤ ChN+1
achieved using high-order elements over long times of
39 / 45 integration. 40 / 45
Numerical solution of PDEs A brief history

Important reasons for the interest in DG-FEM methods are


! DG-FEM was first proposed by Reed & Hill in 1973 for a
! Need for numerical methods of high accuracy in space and neutron transport equation
time
! Support for locally adaptive numerical solutions σu + ∇ · (au) = f
hp-adaptivity, meshes can be both non-conforming and
unstructured. ! First analysis by Lesaint & Raviart (1974) showing in general
O(hN ) and optimal O(hN+1 ) for special meshes.
! General and very flexible framework for solving large classes of
PDEs ! Sharp analysis by Johnson (1986) showed O(hN+1/2 ) for
general meshes
! Conceptually no difference between 1-D, 2-D or N-D
! However, the schemes did not enjoy much use until further
! The method is local (to the elements) which makes it highly
developments...
suitable for parallel computations

41 / 45 42 / 45

A brief history A brief history

! Extension from scalar conservation laws to systems


1980s-late 1990s, Cockburn/Shu
! Development of limiters and RKDG for problems with The last decade has seen an explosion in activities
discontinuities ! Hamilton-Jacobi equations
Late 1980s, Shu/Cockburn ! Non-coercive problems and spectral accuracy
! Nodes, modes and large codes ! Adaptive solution techniques
from 1995, Warburton/Karniadakis ! Improved solvers
! Maxwell’s eqations, MHD, water waves, elasticity, etc. ! Advanced time-integration methods
- last decade has seen an explosion in development and
! Large-scale production codes
applications
! Higher order problems
! etc.
! Interior-Penalty (IP), Arnold (1982)
! Bassi-Rebay (BR), Bassi & Rebay (1997)
! Local Discontinuous Galerkin (LDG), Cockburn & Shu (1998)

43 / 45 44 / 45
Brief summary

We have established a basic understanding of DG-FEM


! How to formulate DG-FEM schemes
! Local expansions to achieve a high-order accurate basis
! Geometric flexibility in the spirit of FEM/FVM
! Explicit scheme and ’problem control’ in the spirit of FVM

However, many questions remains


! How do we choose the numerical flux?
! Is the scheme stable?
! How does the idea generalize to multi-dimensions?
! What is the price?
! etc...

45 / 45

También podría gustarte