Discontinuous Galerkin Finite Element Method for the ...apek/ScientificComputing... ·...

1
Discontinuous Galerkin Finite Element Method for the Diffusion-Advection Equation Florian Pöppl 02689 Advanced Numerical Methods for Differential Equations Introduction DG-FEM is a variaধon of classical FEM Methods where elements are only weakly coupled. The test funcধons are polynomial funcধons on their respecধve element and vanish everwhere else. The global soluধon is therefore not necessarily conধnu- ous. Coupling is achieved using a numerical flux between element borders. This poster aims to present the results of an exploraধon into the implementaধon and properধes of DG-FEM methods. A DG-FEM method for the 1D advecধon equa- ধon was implemented and tested. Higher dimensional and more general diffusion- advecধon problems were solved with the help of the Netgen/NGSolve sođware. Advection Equation in 1D Consider the linear advecধon equaধon in 1D with periodic boundary condiধons u t + f (u)=0, x [0, 1], u(-1,t)= u(1,t), u(x, 0) = sin(πx), where f = au x the exact soluধon is given by u(x, t)= sin(πx - aπt). The domain [ -1, 1] is divided into K consecuধve sub-intervals (elements) of size h := 2 K . On each element k , we discreধze the differenধal equaধon using a nodal spectral galerkin method with N +1 Gauss-Lobaħo nodes. The elements are coupled by introducing a numerical flux f * , resulধng in a discrete operator L h u k t = - 2 h D x (a k )+ 2 h M -1 [(au k - (au) * )L k i ] x k r x k l =: L h (u), where L k i are the Lagrange polynomials of element k and M, D x are the correspond- ing mass and differenধaধon matrices. With the average operator {u} := u - +u + 2 and the jump operator [ u] := u - + u + we can define the numerical flux f * =(au) * := {au} + |a| 1 - α 2 [ nu] with a parameter α> 0. Here, + refers to the exterior of an element, - to the interior and n ± to the corresponding normal vector. This is called upwind flux for α =0 and central flux for α =1. In order to solve this semi-discrete problem, we have to decide on a ধme-stepping method. Figure 1 shows the eigenvalues of L h for N = 16. For a central flux, the eigenvalues are purely imaginary (which also means there is no dissipaধon). For an upwind flux, the eigenvalues also have a real part. It can also be shown that the magnitude of the largest eigenvalue behaves asymptoধcally like O(N 2 ) meaning that heurisধcally, the ধme-step Δt has to be chosen so that Δt C N 2 , where the constant C depends on the ধme-integraধon method used. Here, a RK 4 method with a suitably small ধme-step is chosen. Figure 2 shows that this method converges with order h N +1 . Figure: Eigenvalues of L h for N = 16. Figure: Errors for different N over h. Netgen/NGSolve NGSolve is a high performance mulphysics finite element sođware. It is widely used to analyze models from solid mechanics, fluid dynamics and electromagnecs. Due to its flexible Python interface new physical equaons and soluon algorithms can be implemented easily. NGSolve takes care of meshing, building the finite element space and the discrete operators and can efficiently solve the resulধng linear systems. Users have to Define the problem geometry and boundary condiধons. Specify a suitable variaধonal formulaধon of the PDE. Time-integrate the resulধng discreধzaধons. In the case of DG methods, NGSolve works with an L 2 finite element space V h con- sisধng of L 2 -orthogonal element-wise polynomial funcধons of arbitrary order. Stationary Diffusion-Advection Equation Consider now the more general case, D R, b C , R d ) and f L 2 (Ω): -DΔu + ∇· (bu)= f, x Ω R d , u =0, x Ω. For u, v H 1 0 , this can be wriħen in variaধonal formulaধon as A(u, v ) := Z Duv - Z b · uv = Z fv =: l (v ). The element-wise DG formulaধon A DG (u, v )= l (v ) for u, v L 2 is then given by A DG (u, v )= A dif (u, v )+ A adv (u, v ), A dif (u, v ) := X K Z K uv - X F Z F {nu}[ v ] - X F Z F {nv }[ u]+ β h X F Z F [ u][ v ], A adv (u, v ) := - X K Z K buv + X F Z F b · nu * v. with A dif and A adv corresponding to the diffusion and advecধon term respecধvely and a user-definable parameter β> 0. Here, K denotes the elements of the mesh (e.g. triangle, tetrahedon) and F the faces of those elements. As in the 1D case we choose an upwind numerical flux u * := b · n{u} + 1 2 |b · n|[ u]. Given A DG NGSolve constructs a discrete operator A h and right-hand side l h such that the modal coefficients u h of the soluধon are given by A h u h = l h . Instationary Diffusion-Advection Equation Consider the (bi)linear forms A DG and l from above and the ধme-dependent problem t u = DΔu + ∇· (bu)+ f, x Ω, u =0, x Ω, with starধng condiধon u(x, 0) = u 0 (x). It's disconধnuous Galerkin formulaধon is t Z uv | {z } =:M (u,v ) = A DG (u, v )+ l (v ) NGSolve provides the discreধzaধon of M , the mass matrix M h , so that the soluধon u h is given by the ODE M h t u h = A DG h u h + l h . Solving the Poisson Equation Using the formulaধons from before, solving the Poisson equaধon with NGSolve -Δu =2y (1 - y )+ x(1 - x), (x, y ) [0, 1] 2 , u(x, y )=0, (x, y ) [0, 1] 2 requires specifying a mesh, the linear forms A DG and l and then solving the resulধng linear system. The exact soluধon is u = x(1 - x)y (1 - y )). The choice of the parameter β is important because if it is chosen too small, A DG is not coercive and the system therefore not solvable. A larger β also results in a smoother soluধon (Figures 3 and 4). Figure: Plot of u h with β =2.5, N =1, h max =0.3. Figure: Plot of u h with β = 25, N =1, h max =0.3. For polygonal geometries the method converges with O(h N +1 max ). For other geome- tries, e.g. circles/spheres a geometric error of magnitude O(h) is introduced. Solving the Time-Dependent Diffusion Advection Equation Given an iniধal condiধon u 0 we have to advance the semi-discrete system M h t u h = A DG h u h + l h in ধme by choosing an appropriate ধme-stepping method. For D> 0 and β >> 0 the ODE is sধff, meaning implicit methods must be used. One implicit Euler step for this problem is given by (M h tA DG h )u n+1 h = M h u n h + l n h , which can be solved efficiently since both M h and A h are sparse matrices. In a similar fashion, higher-order ধme-integraধon methods can be constructed from singly diagonally implicit Runge-Kuħa methods. Figures 5a-5d show the ধme-evoluধon of the diffusion-advecধon equaধon for D = 0.05 and b(x, y ) = (1 - x, 1 - y ) with u 0 = e -32((x-0.1) 2 +(y -0.1) 2 . (a) t =0 (b) t =0.1 (c) t =0.5 (d) t =1 Figure: Time evoluধon with Δt =0.01, N =3, h max =0.1.

Transcript of Discontinuous Galerkin Finite Element Method for the ...apek/ScientificComputing... ·...

Page 1: Discontinuous Galerkin Finite Element Method for the ...apek/ScientificComputing... · DiscontinuousGalerkinFiniteElementMethodfortheDiffusion-AdvectionEquation FlorianPöppl 02689AdvancedNumericalMethodsforDifferentialEquations

Discontinuous Galerkin Finite Element Method for the Diffusion-Advection EquationFlorian Pöppl

02689 Advanced Numerical Methods for Differential Equations

Introduction

DG-FEM is a varia on of classical FEM Methods where elements are only weakly

coupled. The test func ons are polynomial func ons on their respec ve element

and vanish everwhere else. The global solu on is therefore not necessarily con nu-

ous. Coupling is achieved using a numerical flux between element borders.

This poster aims to present the results of an explora on into the implementa on and

proper es of DG-FEM methods. A DG-FEM method for the 1D advec on equa-

on was implemented and tested. Higher dimensional and more general diffusion-

advec on problems were solved with the help of the Netgen/NGSolve so ware.

Advection Equation in 1D

Consider the linear advec on equa on in 1D with periodic boundary condi ons

ut + f (u) = 0, x ∈ [0, 1],u(−1, t) = u(1, t),

u(x, 0) = sin(πx),

where f = aux the exact solu on is given by u(x, t) = sin(πx − aπt). The domain

[−1, 1] is divided into K consecu ve sub-intervals (elements) of size h := 2K . On

each element k, we discre ze the differen al equa on using a nodal spectral galerkin

method with N + 1 Gauss-Loba o nodes. The elements are coupled by introducing

a numerical flux f ∗, resul ng in a discrete operator Lh

ukt = −2

hDx(ak) + 2

hM−1[(auk − (au)∗)Lk

i ]xkr

xkl

=: Lh(u),

where Lki are the Lagrange polynomials of element k and M, Dx are the correspond-

ing mass and differen a on matrices.

With the average operator u := u−+u+

2 and the jump operator [u] := u− + u+ we

can define the numerical flux

f ∗ = (au)∗ := au + |a|1 − α

2[nu]

with a parameter α > 0. Here, + refers to the exterior of an element, − to the

interior and n± to the corresponding normal vector. This is called upwind flux for

α = 0 and central flux for α = 1.In order to solve this semi-discrete problem, we have to decide on a me-stepping

method. Figure 1 shows the eigenvalues of Lh for N = 16. For a central flux, the

eigenvalues are purely imaginary (which also means there is no dissipa on). For

an upwind flux, the eigenvalues also have a real part. It can also be shown that

the magnitude of the largest eigenvalue behaves asympto cally like O(N 2) meaning

that heuris cally, the me-step ∆t has to be chosen so that ∆t ≤ CN2 , where the

constant C depends on the me-integra on method used. Here, a RK4 method

with a suitably small me-step is chosen.

Figure 2 shows that this method converges with order hN+1.

Figure: Eigenvalues of Lh for N = 16. Figure: Errors for different N over h.

Netgen/NGSolve

NGSolve is a high performance mul physics finite element so ware. It is widely used to analyze

models from solid mechanics, fluid dynamics and electromagne cs. Due to its flexible Python

interface new physical equa ons and solu on algorithms can be implemented easily.

NGSolve takes care of meshing, building the finite element space and the discrete

operators and can efficiently solve the resul ng linear systems. Users have to

Define the problem geometry and boundary condi ons.

Specify a suitable varia onal formula on of the PDE.

Time-integrate the resul ng discre za ons.

In the case of DG methods, NGSolve works with an L2 finite element space Vh con-

sis ng of L2-orthogonal element-wise polynomial func ons of arbitrary order.

Stationary Diffusion-Advection Equation

Consider now the more general case, D ∈ R, b ∈ C(Ω,Rd) and f ∈ L2(Ω):

−D∆u + ∇ · (bu) = f, x ∈ Ω ⊂ Rd,

u = 0, x ∈ ∂Ω.

For u, v ∈ H10 , this can be wri en in varia onal formula on as

A(u, v) :=∫

D∇u∇v −∫

b · u∇v =∫

fv =: l(v).

The element-wise DG formula on ADG(u, v) = l(v) for u, v ∈ L2 is then given by

ADG(u, v) = Adif(u, v) + Aadv(u, v),

Adif(u, v) :=∑

K

∫K

∇u∇v −∑

F

∫F

n∇u[v] −∑

F

∫F

n∇v[u] + β

h

∑F

∫F

[u][v],

Aadv(u, v) := −∑

K

∫K

bu∇v +∑

F

∫F

b · n u∗v.

with Adif and Aadv corresponding to the diffusion and advec on term respec vely

and a user-definable parameter β > 0. Here, K denotes the elements of the mesh

(e.g. triangle, tetrahedon) and F the faces of those elements.

As in the 1D case we choose an upwind numerical flux u∗ := b · nu + 12|b · n|[u].

Given ADG NGSolve constructs a discrete operator Ah and right-hand side lh such

that the modal coefficients uh of the solu on are given by Ahuh = lh.

Instationary Diffusion-Advection Equation

Consider the (bi)linear formsADG and l from above and the me-dependent problem

∂tu = D∆u + ∇ · (bu) + f, x ∈ Ω,

u = 0, x ∈ ∂Ω,

with star ng condi on u(x, 0) = u0(x). It's discon nuous Galerkin formula on is

∂t

∫uv︸ ︷︷ ︸

=:M(u,v)

= ADG(u, v) + l(v)

NGSolve provides the discre za on of M , the mass matrix Mh, so that the solu on

uh is given by the ODE Mh∂tuh = ADGh uh + lh.

Solving the Poisson Equation

Using the formula ons from before, solving the Poisson equa on with NGSolve

−∆u = 2y(1 − y) + x(1 − x), (x, y) ∈ [0, 1]2,u(x, y) = 0, (x, y) ∈ ∂[0, 1]2

requires specifying a mesh, the linear forms ADG and l and then solving the resul ng

linear system. The exact solu on is u = x(1 − x)y(1 − y)).The choice of the parameter β is important because if it is chosen too small, ADG

is not coercive and the system therefore not solvable. A larger β also results in a

smoother solu on (Figures 3 and 4).

Figure: Plot of uh with β = 2.5, N = 1, hmax = 0.3. Figure: Plot of uh with β = 25, N = 1, hmax = 0.3.

For polygonal geometries the method converges with O(hN+1max ). For other geome-

tries, e.g. circles/spheres a geometric error of magnitude O(h) is introduced.

Solving the Time-Dependent Diffusion Advection Equation

Given an ini al condi on u0 we have to advance the semi-discrete system

Mh∂tuh = ADGh uh + lh

in me by choosing an appropriate me-stepping method.

For D > 0 and β >> 0 the ODE is s ff, meaning implicit methods must be used.

One implicit Euler step for this problem is given by

(Mh + ∆tADGh )un+1

h = Mhunh + lnh,

which can be solved efficiently since both Mh and Ah are sparse matrices.

In a similar fashion, higher-order me-integra on methods can be constructed from

singly diagonally implicit Runge-Ku a methods.

Figures 5a-5d show the me-evolu on of the diffusion-advec on equa on for D =0.05 and b(x, y) = (1 − x, 1 − y) with u0 = e−32((x−0.1)2+(y−0.1)2

.

(a) t = 0 (b) t = 0.1 (c) t = 0.5 (d) t = 1

Figure: Time evolu on with ∆t = 0.01, N = 3, hmax = 0.1.