You are on page 1of 20

FEniCS Course

Lecture 10: Discontinuous Galerkin


methods for elliptic equations
Contributors
Andre Massing
1 / 10
The discontinuous Galerkin (DG) method uses
discontinuous basis functions
u
u
h
t
V
h
= P
k
(T
h
) = {v
h
L
2
() : v
h
|
T
P
k
(T) T T
h
}
2 / 10
The discontinuous Galerkin (DG) method uses
discontinuous basis functions
u
u
h
t
V
h
= P
k
(T
h
) = {v
h
L
2
() : v
h
|
T
P
k
(T) T T
h
}
2 / 10
The discontinuous Galerkin (DG) method uses
discontinuous basis functions
u
u
h
t
V
h
= P
k
(T
h
) = {v
h
L
2
() : v
h
|
T
P
k
(T) T T
h
}
2 / 10
The DG method eases mesh adaptivity
u
u
h
t
3 / 10
The DG method eases mesh adaptivity
u
u
h
t
3 / 10
The DG method eases mesh adaptivity
u
u
h
t
3 / 10
The DG method eases space adaptivity
u
u
h
t
4 / 10
The DG method eases space adaptivity
u
u
h
t
4 / 10
The DG method eases space adaptivity
u
u
h
t
4 / 10
DG-FEM Notation
Interface facets
Average v =
1
2
(v
+
+ v

)
Jump [v] = (v
+
v

)
Boundary facet
v = [v] = v
Jump identity
[(
h
v)w
h
] = [
h
v]w
h
+
h
v[w
h
]
5 / 10
The symmetric interior penalty method (SIP)
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF

F
u
h
n[v
h
] dS

Consistency

FF

F
v
h
n[u
h
] dS

Symmetry
+

FF

h
F

F
[u
h
][v
h
] dS

Penalty
6 / 10
The symmetric interior penalty method (SIP)
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF

F
u
h
n[v
h
] dS

Consistency

FF

F
v
h
n[u
h
] dS

Symmetry
+

FF

h
F

F
[u
h
][v
h
] dS

Penalty
6 / 10
The symmetric interior penalty method (SIP)
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF

F
u
h
n[v
h
] dS

Consistency

FF

F
v
h
n[u
h
] dS

Symmetry
+

FF

h
F

F
[u
h
][v
h
] dS

Penalty
6 / 10
The symmetric interior penalty method (SIP)
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF

F
u
h
n[v
h
] dS

Consistency

FF

F
v
h
n[u
h
] dS

Symmetry
+

FF

h
F

F
[u
h
][v
h
] dS

Penalty
l
h
(v
h
) =

fv
h
dx

FF
b

F
v
h
ng dS +

FF
b

h
F

F
gv
h
dS
6 / 10
The symmetric interior penalty method (SIP)
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF

F
u
h
n[v
h
] dS

Consistency

FF

F
v
h
n[u
h
] dS

Symmetry
+

FF

h
F

F
[u
h
][v
h
] dS

Penalty
l
h
(v
h
) =

fv
h
dx

FF
b

F
v
h
ng dS +

FF
b

h
F

F
gv
h
dS
6 / 10
Split of SIP form into interior and boundary
contribution
a
h
(u
h
, v
h
) =

TT

T
u
h
v
h
dx

FF
i

F
u
h
n[v
h
] dS

Consistency

FF
i

F
v
h
n[u
h
] dS

Symmetry
+

FF
i

h
F

F
[u
h
][v
h
] dS

Penalty

FF
b

F
u
h
nv
h
ds

Consistency

FF
b

F
v
h
nu
h
ds

Symmetry
+

FF
b

h
F

F
u
h
v
h
ds

Penalty
7 / 10
Useful FEniCS tools (I)
Access facet normals and local mesh size:
n = FacetNormal(mesh)
h = CellSize(mesh)
Restriction:
f = Function(V)
f(+)
grad(f)(+)
8 / 10
Useful FEniCS tools (II)
Average and jump:
# define it yourself
h_avg = (h(+) + h(-))/2
# or use built -in expression
avg(h)
jump(v)
jump(v, n)
Integration on interior facets:
... *dS
alpha/h_avg*dot(jump(v, n), jump(u, n))*dS
9 / 10
Exercise
Solve our favorite Poisson problem given
Domain:
= [0, 1] [0, 1],
D
=
Source and boundary values:
f(x, y) = 200 cos(10x) cos(10y)
g
D
(x, y) = cos(10x) cos(10y)
Mission: Solve this PDE numerically by using the SIP method.
Print the errornorm for both the L
2
and the H
1
norm for various
mesh sizes. For a UnitSquareMesh(128,128) the error should be
0.0009166 and 0.1962, respectively.
Extra mission: Implement the NIP variant, solve the same
problem and compare the H
1
and L
2
error for a range of
meshes UnitSquareMesh(N,N), N = 2
j
, j = 2, , 7. Can you
determine the order of convergence?
10 / 10

You might also like