(Galerkin) Finite element approximations

(Galerkin) Finite element approximations
The finite element method (FEM): special choice for the shape functions φ.
˜
Subdivide Ω into elements Ωe:
Ne = 5
Ω=
Ne
[
Ωe
e=1
Ω1
x=a
Ω2
Ω3
Ω4
Ω5
x=b
Ω e1 ∩ Ω e2 = ∅
Approximate u on each element separately by a polynomial of some degree p, for
example by Lagrangian interpolation (using p + 1 nodal points per element). The
end points of an element must be nodal points.
Example: linear elements
Global shape functions:
Ne = 5
1
uh(x) =
φ3(x)
Ω1
Ω2
Ω3
Ω5
Ω4
x1 = a x2
x3
x4
x5
x6 = b
n
X
uiφi(x) = φT (x)u
˜
˜
i=1
n: number of global nodal points.
Local element shape functions:
φ1(x)
1
xe1
ueh(x) = ue1φ1(x)+ue2φ2(x) = φT (x)ue
˜
˜
φ2(x)
xe2 xe1
1
xe2
with φT = [φ1(x), φ2(x)] and
˜
x − xe1
x − xe2
φ1(x) = e
, φ2(x) = e
x1 − xe2
x2 − xe1
Example: quadratic elements
Local element shape functions:
φ1(x)
φ2 (x)
1
xe1
φ3(x)
1
1
xe2
xe3 xe1
xe2
xe3 xe1
xe2
xe3
ueh(x) = ue1φ1(x) + ue2φ2(x) = φT (x)ue
˜
˜
with φT = [φ1(x), φ2(x), φ3(x)] and
˜
(x − xe2)(x − xe3)
(x − xe1)(x − xe3)
φ1(x) = e
,
φ2(x) = e
,
(x1 − xe2)(xe1 − xe3)
(x2 − xe1)(xe2 − xe3)
(x − xe1)(x − xe2)
φ3(x) = e
(x3 − xe1)(xe3 − xe2)
Example: higher-order elements
General polynomials of order p:
ueh(x) =
p+1
X
ueiφi(x) = φT (x)ue
˜
˜
i=1
with φT = [φ1, φ2, . . . , φp+1].
˜
Various expansions possible:
B Gauss-Lobatto integration points (includes end points) and Lagrangian
interpolation (Spectral elements).
B Hierarchical base functions: end points are nodes but internal shape functions
have no nodes (similar to Legrende polynomials). (hp-FEM).
B Legrendre polynomials in discontinuous Galerkin methods.
Global numbering
Ne = 3
uh(x)
u2
u1
Ω1
x1 = a
uh(x) =
u3
Ω2
x2
Ω3
x3
1
Ω2
x2
x4 = b
φ3(x)
Ne = 3
Ω1
x1 = a
u4
Ω3
x3
x4 = b
4
X
uiφi(x) = φT (x)u
˜
˜
i=1
 
u1
u2
,
u=

u3
˜
u4

φ1(x)
φ2(x)

φ(x) = 
φ3(x)
˜
φ4(x)

Local numbering in elements
Weak form: Find uh in Sh such that
(
Split:
dvh duh
,A
) + vh(b)hb = (vh, f ) for all vh ∈ Vh
dx
dx
Ne
Ne
X
X
dvh duh
,A
) + vh(b)hb =
(vh, f ) for all vh ∈ Vh
(
dx
dx
e=1
e=1
Write in each element e:
ueh(x) =
2
X
ueiφi(x) = φT (x)ue,
˜
˜
i=1
vhe (x) =
where uTe = (ue1, ue2) and φT (x) = (φ1(x), φ2(x)).
˜
˜
2
X
vieφi(x) = φT (x)v e
˜
˜
i=1
Element matrix and vector
We get:
Ne
X
(v Te K eue) + vnhb =
˜ ¯ ˜
e=1
where
Ke
¯
fe
˜
Ne
X
v Te f e
˜ ˜
e=1
Z
dφ dφT dφ dφT
,A ˜
=
A ˜ dx
=
˜
˜
dx
dx e
dx
Ωe dx
Z
φf dx
= (φ, f )e =
Ωe ˜
˜
are the element matrix K e and element vector f e.
¯
˜
Local → global (assembling)
The local vectors ue and v e are part of the global vectors:
˜
˜
ue = P eu,
¯ ˜
˜
v e = P ev ,
¯ ˜
˜
So we get
Ne
X
v Te K eue
Ne
X
T
P Te K eP e u
| {z }
T
Ne
X
=v
K̃ e u
v
˜ ¯ ˜
˜ ¯ ¯ ¯ ˜ ˜ e=1 ¯ ˜
e=1
e=1
K̃ e
¯
Ne
N
N
e
e
X
X
X
f̃ e
v Te f e =
v T P Te f e = v T
{z
}
|
˜ e=1 ˜
˜ ˜
˜ ¯ ˜
e=1
e=1
f̃ e
˜
=
Weak form
Substitution into the weak form:
vT K u = vT f
˜ ¯˜ ˜ ˜
or
for all v
˜
Ku = f
¯˜ ˜
with
K=
¯
Ne
X
K̃ e
¯
e=1


0
 0 
Ne
X
 . 

f̃ e + 
f=
 . 
 0 
˜ e=1 ˜
−hb
Example (1)
For example:
 
u1
u2
0 1 0 0 
u2

 = P 2u
u2 =
=
u3
0 0 1 0 u3 ¯ ˜
˜
|
{z
}
u4
P2

¯
0 0 2
2


1 0 K11 K12
0 1 0 0
K̃ 2 = P T2 K 2P 2 = 
2
2
0 1 K21
K22
0 0 1 0
¯
¯ ¯ ¯
0 0


0
0
0
0
2
2
0 K11
K12
0


=
2
2
0 K21 K22 0
0
0
0
0
Example (2)
Assembly of K :
¯
 
 1
1
0
0
K11 K12 0 0
2
1
1
 0 K11
K21
K
0
0
22
+
K=
2

0
0
0 0 0 K21
¯
0
0
0
0
0 0
 1
1
K11
K12
0
1
1
2
2
K21
K22
+ K11
K12

=
2
2
3
0
K21
K22
+ K11
3
0
0
K21
Similar for assembly of f .
˜
0
2
K12
2
K22
0

0
0 

3 
K12
3
K22


0
0

0
 + 0
0 0
0
0

0
0
0
0
0
0 

3
3 
0 K11 K12
3
3
0 K21
K22
Exercise 5
The ‘bandwidth’ of K for linear shape functions is 3. How large is the bandwidth
¯
for K when using polynomial
shape functions of order k, k ≥ 1?
¯
Dirichlet conditions
Renumber and split vector and matrix (‘u’ unknown, ‘p’ prescribed)
u=
˜
uu
˜ ,
u
p
˜
v=
˜
vu
˜v ,
p
˜
K=
¯
K uu K up
,
¯
¯
K
K
pu
pp
¯
¯
Note: up prescribed values, v p = 0. Weak form
˜
˜
˜
vT K u = vT f
˜ ¯˜ ˜ ˜
for all v
˜
with v p = 0 leads to
˜
˜
v Tu (K uuuu + K upup) = v Tu f u
¯ ˜
˜ ¯ ˜
˜ ˜
or
K uuuu = f u − K upup
¯ ˜
¯ ˜
˜
for all v u
˜
f=
˜
fu
f˜ p
˜
1D convection-diffusion-reaction equation
1D convection-diffusion-reaction Eq.: find u(x) such that for x ∈ (a, b)
∂u
∂u
∂
∂u
+ a − (A ) + bu = f
∂t
∂x ∂x ∂x
and
u = ua(t),
du
−A = hb(t)
dx
at x = a, t > 0
(ΓD )
at x = b, t > 0
(ΓN )
Notes:
B Strong form; Classical (strong) solution u(x, t)
B f (x, t) ∈ C 0(a, b) (continuous) then u ∈ C 2(a, b) (twice continuously
differentiable)
Oldroyd-B/UCM viscoelastic model
5
λ τ +τ = 2ηD
where
or
5
τ = τ̇ − L · τ − τ · LT
∂τ
τ
η
+ ~u · ∇τ −L · τ − τ · LT + = 2 D
∂t
λ} | λ
|{z}
| {z } |
{z
{z }
∂u
∂t
a ∂u
∂x
Diffusion is missing (A = 0).
bu
f
Dimensionless form (1)
Scaling:
t = tct∗
tc : characteristic time
u = U u∗
U : characteristic value solution
x = Lx∗
L : characteristic length scale
Dimensionless variables: O(1).
U ∂u∗ aU ∂u∗ AU ∂ 2u∗
∗
+
−
+
bU
u
=f
∗
∗
2
∗2
tc ∂t
L ∂x
L ∂x
Relative to convection:
L ∂u∗ ∂u∗
1 ∂ 2u∗ bL ∗
L
+
−
+ u =
f
atc ∂t∗ ∂x∗ Pe ∂x∗2
a
aU
aL
Pe =
: Péclet number, convection/diffusion.
A
Dimensionless form (2)
Time scales:
B
B
B
B
B
L
convection:
a
2
L
diffusion:
A
1
source: (’relaxation time’)
b
time scales in b.c.
externally or internally generated frequencies (’von Karman vortex’)
We choose tc = L/a (convection) and get
∂u∗ ∂u∗
1 ∂ 2u∗
∗ ∗
∗
+
−
+
b
u
=
f
∂t∗ ∂x∗ Pe ∂x∗2
bL
L
∗
with b =
and f =
f . Pe > 1 : convection dominated
a
aU
∗
Exercise 6
L2
(diffusion
Assume b = 0 and f = 0. We take for the typical time scale tc =
A
time scale). Show that we now have the non-dimensional form
∂u∗
∂u∗ ∂ 2u∗
+ Pe ∗ − ∗2 = 0
∗
∂t
∂x
∂x
When will this non-dimensional form be preferable over the one on the previous
slide?
Steady state 1D convection-diffusion-reaction equation
steady state: ∂u/∂t = 0
L(u) = a
du
d
du
− (A ) + bu = f
dx dx dx
L: linear operator, with b.c.
u = ua,
du
−A = hb
dx
at x = a
(ΓD )
at x = b (ΓN )
Weak form
Multiply with test function v and integrate:
(v, Lu − f ) = 0
for all v
Partial integration of the diffusion term and inserting b.c. we get: Find u ∈ S
such that
du
dv du
( , A ) + (v, a ) + (v, bu) + v(b)hb = (v, f )
dx dx
dx
where S and V are appropriate spaces.
for all v ∈ V
Galerkin FEM approximations (1)
Approximation spaces Sh and Vh:
uh(x) =
vh(x) =
n
X
uiφi(x) = φT (x)u
˜
˜
i=1
n
X
viφi(x) = φT (x)v
˜
˜
i=1
where φ(x) are global shape functions. Substituting this into the weak form gives:
Find uh˜ ∈ Sh such that
dvh duh
duh
(
,A
) + (vh, a
) + (vh, buh) + vh(b)hb = (vh, f )
dx
dx
dx
or
vT K u = vT f
˜ ¯˜ ˜ ˜
for all v
˜
for all vh ∈ Vh
Galerkin FEM approximations (2)
and thus
Ku = f
¯˜ ˜
with
dφ dφT
K = ( ˜, A ˜ )
dx
dx
¯
dφT
+ (φ, a ˜ )
˜ dx
+ (φ, bφT )
˜ ˜
f = (φ, f ) − hbφ(b)
˜
˜
˜
or
Kij = (
dφi dφj
,A
)
dx
dx
dφj
+ (φi, a
)
dx
+ (φi, bφj )
fi = (φi, f ) − hbφi(b)
Galerkin FEM approximations (3)
Build from element matrices. For example with constant coefficients and linear
element shape functions:
dφ dφT
1 1 −1
( ˜ , ˜ )e =
“stiffness matrix”
−1
1
dx dx
h
dφT
1 −1 1
(φ, ˜ )e =
“convection matrix”
−1
1
2
˜ dx
h 2 1
(φ, φT )e =
“mass matrix”
1
2
6
˜ ˜
where h is the element length.
Global stiffness matrix
Global stiffness matrix (uniform element size):

1
−1

0
 .
 .
1
 ..
h
 ..

0

0
0
−1 0 . . . . . . . . . . . . .
2 −1 0 . . . . . . . .
−1 2 −1 0 . . .

0
0

0
.. 

.. 

.. 


...
0 −1 2 −1 0 

. . . . . . . . 0 −1 2 −1
. . . . . . . . . . . . . 0 −1 1
Finite difference scheme: (divide by h)
d2u
−ui−1 + 2ui − ui+1
2
=
−
(x
)
+
O(h
)
i
h2
dx2
Global convection matrix
Global convection matrix (uniform element size):

−1 1 0 . . . . . . . . . . . . .
−1 0 1 0 . . . . . . . .

 0 −1 0 1
0 ...
 .
 .
1
 ..
2
 ..

 0 . . . 0 −1 0
1

 0 . . . . . . 0 −1 0
0 . . . . . . . . . . . 0 −1

0
0

0
.. 

.. 

.. 


0

1
1
Finite difference scheme: (divide by h)
−ui−1 + ui+1 du
= (xi) + O(h2)
2h
dx
Global mass matrix
Global mass matrix (uniform element size):

2 1 0 .........
1 4 1 0 . . . . . .

0 1 4 1 0 . . .
.
.
h
 ..
6
 ..

0 . . . 0 1 4 1

0 . . . . . . 0 1 4
0 ......... 0 1

0
0

0
.. 

.. 

.. 


0

1
2
Finite difference scheme: (divide by h)
ui−1 + 4ui + ui+1
= u(xi) + O(h2)
6
Global right-hand side
Sometimes the following approximation is applied:
f (x) ≈
X
fˆk φk (x)
fˆk : nodal point values of f
k
In that case:
fi = (φi, f ) =
X
(φi, φk )fˆk
k
with (φi, φk ) the mass matrix.
Finite difference scheme: (divide by h)
fi−1 + 4fi + fi+1
= f (xi) + O(h2)
6
Note that the usual approach is to use numerical integration.
Exercise 7
a. Verify the element stiffness, convection and mass matrix by performing the
integrations.
b. Assume a non-equidistant grid and denote the element sizes by h1, h2,. . . ,hNe .
How does the global stiffness matrix now look like? Has the global convection
matrix still a zero on the diagonal?
Example: 1D steady convection-diffusion (1)
Equation:
with b.c.
Exact solution:
du
1 d2u
=0
−
dx Pe dx2
u(0) = 0,
on (0, 1)
u(1) = 1
1 − exp(Pex)
u(x) =
1 − exp(Pe)
Example: 1D steady convection-diffusion (2)
Ne = 10; Pe = 1, 10, 100.
1
Pe=1 exact
Pe=1 GFEM
Pe=10 exact
Pe=10 GFEM
Pe=100 exact
Pe=100 GFEM
0.8
0.6
u(x)
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
0
0.2
0.4
0.6
x
0.8
1
Example: 1D steady convection-diffusion (2)
Ne = 10, 20; Pe = 25
1
Pe=25 exact
Pe=25 Ne=10
Pe=25 Ne=20
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Observations (1)
1
.
Pe
B Global upstream “wiggles” appear when the boundary layer is not resolved by
the mesh.
B Governed by the mesh Péclet number Peh:
B Boundary layer of width
ah
1h
Peh =
=
Pe
2A 2 L
where wiggles appear when
Peh > 1
or wiggle-free when
or
2
h
>
L Pe
h
2
<
L Pe
Observations (2)
The problem is twofold:
1. Rapid change in the solution over small lengths (large gradients)
2. Mesh size h is too large to resolve the length scale
As long as the length scale is resolved GFEM works well for convection-diffusion
problems.
Example: 1D steady convection with source term (1)
Equation (Pe → ∞):
with
du
=f
dx
u(0) = 0,
Exact solution:
Notes:
B length scale σ
B for σ → 0
on (0, 1)
(x − 12 )2
1
f = √ exp[−
]
σ2
πσ
x − 21
1 i
1h
erf(
) + erf( )
u(x) =
2
σ
2σ
1
u(x) = H(x − ) (Heaviside)
2
du
1
= f (x) = δ(x − )
dx
2
Example: 1D steady convection with source term (2)
Ne = 20; σ = 0.45, 0.15, 0.05.
1
σ=0.45 exact
σ=0.45 GFEM
σ=0.15 exact
σ=0.15 GFEM
σ=0.05 exact
σ=0.05 GFEM
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Example: 1D steady convection with source term (3)
Ne = 11, 20, 21; σ = 0.05
1
σ=0.05 exact
σ=0.05 Ne=11
σ=0.05 Ne=20
σ=0.05 Ne=21
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Observations
B Inaccurate solutions and upstream wiggles when layer with small length scale
σ is not resolved by the mesh.
B By experimentation we find that
h 1
<
σ 2
to get good smooth solutions with GFEM.
B Strong mesh dependence when solution is underresolved.
Problem is again lack of resolution for rapidly changing solutions (large gradients).
Summary of the examples
B GFEM works well for smooth solutions and the mesh resolves rapidly changing
solutions.
B For non-smooth solutions and/or a too coarse mesh wiggles can easily appear.
B The GFEM is not robust and local errors can easily be amplified throughout
the domain.
Some might consider the latter a good thing (“Don’t suppress wiggles they tell
you something”). However:
B In many practical problems resolving all large gradients is not an option and
would require too much computer resources.
B In viscoelastic flow problems the GFEM method often performs very poorly.
⇒ Stabilization necessary
Analysis of the discrete equations
Equidistant mesh (mesh size h), inner node i:
a
ui+1 − ui−1
ui+1 − 2ui + ui−1 fi−1 + 4fi + fi+1
−A
=
2
2h
h
6
Notes:
B central differencing
B consistent averaging of source term
B for f = 0:
ui+1 − ui−1 −
or
or
1
(ui+1 − 2ui + ui−1) = 0
Peh
1 + Peh
(ui − ui−1)
ui+1 − ui =
1 − Peh
sign(ui+1 − ui) = − sign(ui − ui−1)
for Peh > 1
Wiggles!
B for Peh → ∞ (no diffusion): Simpson rule for integration, which is O(h4).
B for Peh → ∞ (no diffusion), matrix:


−1 1 0 . . . . . . . . . . . . . 0
−1 0 1 0 . . . . . . . . 0


 0 −1 0 1
0 . . . 0
 .
.. 
 .



a  .
.
.
.
= ...


2h  .
.. 
.


 0 . . . 0 −1 0
1 0


 0 . . . . . . 0 −1 0 1
0 . . . . . . . . . . . 0 −1 1
zeros on the diagonal, “leap frogging”.
Artificial diffusion (1)
For Peh =
ah
= 1 we have a diffusivity of:
2A
A = Ā =
ah
2
d2 u
Adding −Ā 2 to the equations, or
dx
du
d2u
a − (A + Ā) 2 = f
dx
dx
removes wiggles, but we solve a modified equation. New mesh Péclet:
¯h=
Pe
ah
Peh
=
<1
ah
1
+
Pe
2(A + 2 )
h
Artificial diffusion (2)
Discretized equations with equidistant mesh (mesh size h), inner node i:
a
or
ui+1 − ui−1
ah ui+1 − 2ui + ui−1 fi−1 + 4fi + fi+1
− (A + )
=
2
2h
2
h
6
ui − ui−1
ui+1 − 2ui + ui−1 fi−1 + 4fi + fi+1
a
−A
=
2
h
h
6
| {z }
upwind differencing
ui−1
xi−1
h
ui
ui+1
xi
xi+1
h
ui − ui−1 du
= (xi) + O(h)
h
dx
Artificial diffusion (2)
In general artificial diffusivity:
Ā = β
with examples:
ah
2
B β = 1, upwind differencing
¯ h = 1 for Peh > 1:
B Pe
(
0
β=
1 − Pe1
h
for Peh ≤ 1
for Peh > 1
B Exact nodal point values (’optimal’ value) for
du
d2u
a − A 2 = constant
dx
dx
gives:
1
β = coth(Peh) −
Peh
β(Peh)
1
coth(x)-1/x
1-1/x
x/3
0.8
0.6
0.4
0.2
0
0
2
4
6
8
10
Exercise 8
Show that for β 6= 0 the first-order derivative can be interpreted as being
discretized by the following finite difference scheme
1
2 (1
− β)
ui+1 − ui 1
ui − ui−1 du
+ 2 (1 + β)
= (xi) + O(h)
h
h
dx
i.e. a linear combination of ‘downwind’ and ‘upwind’ differencing.
Example: 1D steady convection-diffusion
Ne = 10; Pe = 25 (Peh = 1.25)
1
Pe=25 exact
GFEM
β=1
β=0 for Peh≤1, 1-1/Peh for Peh>1
β=coth(Peh)-1/Peh
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Observations
B Upwind differencing rather inaccurate (first-order) near large gradients.
B Wiggles are gone. As expected the boundary layer is not resolved.
B ‘Optimal’ β(Peh) can reduce error significantly (weighted upwind/downwind).
B Away from the boundary layer the solution seems accurate.
Example: 1D steady convection with source term
Ne = 20, 40; σ = 0.05; β = 1
1.2
σ=0.05 exact
GFEM Ne=20
GFEM Ne=40
AD β=1 Ne=20
AD β=1 Ne=40
1
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Example: 1D steady convection with source term
Error in solution. Ne = 100 (Galerkin), 3000 (β = 1); σ = 0.05
0.002
AD β=1 Ne=3000
GFEM Ne=100
0.0015
maxk|uk-uexact|
0.001
0.0005
0
-0.0005
-0.001
-0.0015
-0.002
0
0.2
0.4
0.6
x
0.8
1
Observations
B GFEM: global wiggles and inaccuracy for Ne = 20 but very accurate for
Ne = 40 (fast convergence)
B Upwind: no wiggles (robust) but convergence is very slow near large gradients.
Seems to be accurate outside the layer with large gradients.
Question: Can we combine the accuracy (fast convergence) of GFEM with the
robustness of upwind?
Set of equations (flow of a visco-elastic fluid)
Rewrite: Find (~u, p, τ ) such that,
∂~u
ρ( + ~u · ∇~u) − ∇ · (2ηsD) + ∇p − ∇ · τ = ρ~b,
∂t
∇ · ~u
= 0,
λ(
∂τ
+ ~u · ∇τ − L · τ − τ · LT ) + τ = 2ηD,
∂t
in Ω
in Ω
in Ω
Weak form of modified equation by AD
Artificial diffusion solves the modified equation:
du
d
du a −
(A + Ā)
+ bu = f,
dx dx
dx
ah
with Ā = β
2
where we assume also the modified boundary condition:
u = ua,
du
−(A + Ā) = hb
dx
at x = a
(ΓD )
at x = b (ΓN )
For the weak form we get: Find u ∈ S such that
(
dv
du
du
, (A + Ā) ) + (v, a ) + (v, bu) + v(b)hb = (v, f )
dx
dx
dx
for all v ∈ V
Streamline upwinding (SU) (1)
Compared to standard weak form we have added the term
(
dv du
dv ah du
βh dv du
, Ā ) = ( , β
)=(
,a )
dx dx
dx 2 dx
2 dx dx
This suggest another form of the modified weak form:
(
dv du
βh dv du
, A ) + (v +
, a ) + (v, bu) + v(b)hb = (v, f )
dx dx
2 dx dx
for all v ∈ V
the convection term has been weighted with a modified test function
βh dv
v̂ = v +
2 dx
⇒ streamline upwinding (SU). For constant a, uniform size h, 1D → equivalent to
AD (artificial diffusion). Very inaccurate (overly diffusive) with time-dependent,
reaction and source terms (similar to AD).
Streamline upwinding (SU) (2)
For the Galerkin FEM:
βh dvh
βh dφ
T
v̂h = vh +
= v φ̂
with φ̂ = (φ +
)
˜
2 dx
2 dx
˜ ˜
˜
˜
where h may vary from element to element.
φ̂i
φi
β
2
xi+1
xi
xi−1
hi
hi+1
β
2
Consistent weighting
Hughes & Brooks (1982): problem with SU in inconsistency : The exact solution
does not satisfy the weak form. Their solution is to modify the weighting of the
differential equation from the standard form
(v, Lu − f ) = 0
to
(v +
where
βh dv
, Lu − f ) = 0
2 dx
for all v
for all v
du
d
du
L(u) = a − (A ) + bu
dx dx dx
The space of the weight functions (not V !) is in effect different from the space
of shape functions when applying “Vh = Uh” like in the Galerkin method (→
Petrov-Galerkin).
Interpretation of second-derivatives
Interpretation of Hughes & Brooks (1982). Split:
(v +
βh dv
βh dv
, Lu − f ) = (v, Lu − f ) + (
, Lu − f ) = 0
2 dx
{z
} | 2 dx {z
|
}
I
for all v
II
B Term I: partial integration of diffusion terms with fluxes on the boundary
(standard procedure)
B Term II: interprete element wise:
X βh dv
βh dv
(
, Lu − f ) =
(
, Lu − f )e =
2 dx
2
dx
e
Streamline upwind Petrov-Galerkin (SUPG)
This leads to the SUPG method for the 1D steady convection-diffusion-reaction
equation: Find u ∈ S such that
dv du
du
( , A ) + (v, a ) + (v, bu) + v(b)hb
dx dx
dx
X βh dv du
d
du
+
, a − (A ) + bu − f
2 dx dx dx dx
e
e
|{z}
τa
= (v, f )
Notes:
B A = 0 (no diffusion):
B consistency
P
e
can be removed (viscoelastic CE)
for all v ∈ V
B usual definition: τ a =
βh
with time scale τ
2
τ =β
h1
ah 1
1
=β
=
Ā
2a
2 a2
a2
d
du
B constant A, linear elements:
(A ) = 0 in the interior of the element. If
dx dx
reaction term bu and source term f are also absent (convection-diffusion only)
SU=SUPG!
B optimal values of β(Peh) neccessary to improve accuracy of diffusion terms.
Example: 1D steady convection with source term (1)
Ne = 20; σ = 0.05
1.2
σ=0.05 exact
GFEM Ne=20
AD β=1 Ne=20
SUPG β=1 Ne=20
1
0.8
u(x)
0.6
0.4
0.2
0
-0.2
0
0.2
0.4
0.6
x
0.8
1
Example: 1D steady convection with source term (2)
σ = 0.05; maximum nodal error as a function of number of elements Ne.
maxk|uk-uexact|
1
AD
SUPG
GFEM
0.1
0.01
0.001
10
100
Ne
Example: 1D steady convection with source term (3)
σ = 0.05; maximum nodal error as a function of number of elements Ne.
maxk|uk-uexact|
1
AD
SUPG
GFEM
7/x
10/x2
0.1
0.01
0.001
10
100
Ne
Observations
B Compared to GFEM: SUPG greatly enhances the stability/robustness for coarse
grids in convection(-dominated) problems where solutions are non-smooth or
underresolved (no global wiggles).
B Compared to SU: SUPG is much more accurate because convergence is faster
than linear.
Extension to 3D: convection-diffusion-reaction equation
Strong solution u(~x, t):
∂u
+ ~a · ∇u − ∇ · (A∇u) + bu = f
{z
}
∂t |
on Ω
Lu
with boundary
conditions
and
initial
u(~x, t = 0) = u0(~x) in Ω
u = uD on ΓD
∂u
−A
= −A~n · ∇u = hN on ΓN
∂n
ΓD
ΓN
~n
~n: outside normal
Ω
Weak form (1)
Multiply by testfunction v:
∂u
(v,
+ Lu − f ) = 0
∂t
for all v
where the standard inner product on L2(Ω) is
Z
(a, b) =
ab dx
Ω
With
∇ · A∇u v = ∇ · A(∇u)v) − A∇u · ∇v
and the divergence theorem (Gauss):
Z
Z
∇ · ~a dx = ~n · ~a dΓ
Ω
Γ
Weak form (2)
we get the weak form: Find u ∈ S such that
(v,
∂u
) + (v, ~a · ∇u) + (∇v, A∇u) + (v, bu) + (v, hN )ΓN = (v, f )
∂t
for all v ∈ V . Notes:
B v = 0 on ΓD , u = uD on ΓD
B we have silently introduced:
(~a, ~b) =
Z
Ω
~a · ~b dΩ
Z
(a, b)Γ =
Γ
ab dΓ
GFEM (1)
Ω = ∪eΩe,
Ωe ∩ Ωf = ∅
30
1
φ2(~x)
φ1(~x)
1
1
0
φ3(~x)
1
0
2
03
1
1
for e 6= f
03
1
1
0
1
1
0
2
03
1
1
0
1
1
0
2
1
0
1
0
2
GFEM (2)
Approximation spaces Sh and Vh:
uh(~x, t) =
vh(~x, t) =
n
X
ui(t)φi(~x) = φT (~x)u(t)
˜
˜
i=1
n
X
vi(t)φi(~x) = φT (~x)v (t)
˜
˜
i=1
where φ(~x) are global shape functions. Substituting into the weak form:
˜
v T M u̇ + v T K u = v T f
˜ ¯ ˜ ˜ ¯˜ ˜ ˜
or
M u̇ + K u = f
¯ ˜ ¯˜ ˜
for all v
˜
GFEM (2)
The ‘mass matrix’ M is given by
¯
M = (φ, φT ),
¯
˜ ˜
Mij = (φi, φj )
and the ‘stiffnes matrix’ by
K = (∇φ, A∇φT )
¯
˜
˜ T
+ (φ, ~a · ∇φ )
˜
˜
T
+ (φ, bφ )
˜ ˜
or
f = (φ, f ) − (φ, hN )ΓN
˜
˜
˜
Kij = (∇φi, A∇φj )
+ (φi, ~a · ∇φj )
+ (φi, bφj )
fi = (φi, f ) − (φi, hN )ΓN
Example: 2D steady convection with source term (1)
|~a| = 1
u=0
u=0
∂u
∂u
ax
+ ay
=f
∂x
∂y
√ 1√
1
with (ax, ay ) = ( 2 2, 2 2) and
u(x, 0) = 0,
u(0, y) = 0,
on (0, 1) × (0, 1)
1
(x + y − 1)2
f = √ exp[−
]
2
2σ
πσ
Exact solution goes from 0 for x + y < 1 to 1 for x + y > 1 over a length scale
of σ.
Example: 2D steady convection with source term (2)
Ne = 15 × 15; σ = 0.05; GFEM
1.03E+00
7.61E−01
4.92E−01
2.23E−01
−4.57E−02
−3.15E−01
max: 1.03E+00
min:−3.15E−01
Example: 2D steady convection with source term (3)
Ne = 30 × 30; σ = 0.05; GFEM
1.02E+00
8.08E−01
5.99E−01
3.89E−01
1.79E−01
−3.08E−02
max: 1.02E+00
min:−3.08E−02
Example: 2D steady convection with source term (4)
Ne = 45 × 45; σ = 0.05; GFEM
1.00E+00
7.99E−01
5.95E−01
3.91E−01
1.88E−01
−1.61E−02
max: 1.00E+00
min:−1.61E−02
Example: 2D steady convection with source term (5)
Ne = 100 × 100; σ = 0.05
1.00E+00
8.01E−01
6.00E−01
3.99E−01
1.98E−01
−3.47E−03
max: 1.00E+00
min:−3.47E−03
Example: 2D steady convection with discontinuous inflow (1)
u=1
|~a| = 1
u=0
∂u
∂u
+ ay
=0
∂x
∂y
√
√
with (ax, ay ) = ( 12 2, 12 2) and
ax
u(x, 0) = 0,
Exact solution is:
(
1
0
on (0, 1) × (0, 1)
u(0, y) = 1
for y > x
for y < x
Example: 2D steady convection with discontinuous inflow (2)
Ne = 15 × 15; GFEM
1.06E+00
8.38E−01
6.13E−01
3.88E−01
1.63E−01
−6.22E−02
max: 1.06E+00
min:−6.22E−02
Example: 2D steady convection with discontinuous inflow (3)
Ne = 30 × 30; GFEM
1.06E+00
8.38E−01
6.13E−01
3.88E−01
1.63E−01
−6.22E−02
max: 1.06E+00
min:−6.22E−02
Observations for GFEM in 2D
B Inaccurate solutions and global upstream wiggles when layer with small length
scale σ is not resolved by the mesh.
B Almost wiggle free, very localized cross-stream jumps possible even for coarse
meshes.
B Strong mesh dependence when solution is underresolved.
Artificial diffusion (1)
1D added diffusion:
which stabilizes
d2 u
−Ā 2
dx
ah
2
du
a
dx
3D added diffusion:
−∇(Ā∇u)
which stabilizes
with Ā = β
|a|h
with Ā = β
2
~a · ∇u
however, in all directions. This is too much added diffusion. Only diffusion in the
direction of ~a is needed since
∂u
~a · ∇u = |~a|~e · ∇u = |~a|
∂e
~a
with ~e =
|~a|
Artificial diffusion (2)
Add anisotropic diffusion using a tensorial diffusion coefficient, with a component
in the direction of ~e (i.e. the “streamline” direction) only:
−∇(Ā~e~e · ∇u)
or
~a~a
−∇(Ā · ∇u)
with Ā = Ā~e~e = Ā 2
|~a|
In the weak form we get an extra term:
(∇v, Ā · ∇u)
SU (1)
Diffusion added in AD method:
~a~a
(∇v, Ā · ∇u) = (∇v, Ā 2 · ∇u)
|~a|
Z
~a~a
=
∇v · Ā 2 · ∇u) dΩ
|~a|
Ω
Z
Ā
=
(~a · ∇v)(~a · ∇u) dΩ
2
a|
Ω |~
=(
Ā
~a · ∇v, ~a · ∇u)
2
|~a|
= (τ~a · ∇v, ~a · ∇u)
with
Ā
h
τ = 2=β
|~a|
2|~a|
SU (2)
The weak form now becomes
· · · + v + τ~a · ∇v, ~a · ∇u + · · ·
i.e. the convection term is multiplied by a modified weighting function
v̂ = v + τ~a · ∇v
SUPG
SU → SUPG: consistent weighting and interpret extra terms elementwise:
∂u
v + τ~a · ∇v,
+ Lu − f = 0
∂t
or (with elementwise interpretation):
X
∂u
∂u
τ~a · ∇v,
=0
v,
+ Lu − f +
+ Lu − f
∂t
∂t
Ωe
e
First term: partial integrate to standard weak form.
Notes on SUPG (1)
Ā
B τ = 2 , with Ā “the amount of streamline diffusion”. When the real diffusion
|~a|
ah
to more dimensions. There are
A 6= 0, we need to generalize Ā = β(Peh)
2
various ways to do this. For example for a bilinear quadrilateral:
~h1 = h1~e1
~h2 = h2~e2
~a0
|~a · ~h1|
|~a · ~h2|
Ā = β(Peh1)
+ β(Peh2)
2
2
~e2
h2
~e1
h1
with
Peh1
|~a · ~h1|
,
=
2A
B For higher-order elements a constant τ is non-optimal.
Peh2
|~a · ~h2|
=
2A
Notes on SUPG (2)
B The choice of τ is somewhat arbitrary, in particular when diffusion is absent
(A = 0). Note, that
Ā
h
τ = 2=β
|~a|
2|~a|
In viscoelastic flow it is common to use:
h
τ=
2U
where h is a characteristic element size and U is a characteristic velocity.
There are various possible choices for h and U (see separate notes).
A bit of experimentation with the 1D “Gaussian distribution in the right-hand
side” example (source term, no diffusion) seems to suggest that the solution
is rather insensitive to the exact value of β in this case, as long as the scaling
with h is there.
Example: 2D steady convection with source term (1)
|~a| = 1
u=0
u=0
∂u
∂u
ax
+ ay
=f
∂x
∂y
√ 1√
1
with (ax, ay ) = ( 2 2, 2 2) and
u(x, 0) = 0,
u(0, y) = 0,
on (0, 1) × (0, 1)
1
(x + y − 1)2
f = √ exp[−
]
2
2σ
πσ
Exact solution goes from 0 for x + y < 1 to 1 for x + y > 1 over a length scale
of σ.
Example: 2D steady convection with source term (2)
Ne = 15 × 15; σ = 0.05; SUPG
1.02E+00
8.14E−01
6.08E−01
4.03E−01
1.98E−01
−7.67E−03
max: 1.02E+00
min:−7.67E−03
Example: 2D steady convection with source term (3)
Ne = 30 × 30; σ = 0.05; SUPG
1.00E+00
8.03E−01
6.02E−01
4.01E−01
2.00E−01
−4.83E−04
max: 1.00E+00
min:−4.83E−04
Example: 2D steady convection with discontinuous inflow (1)
u=1
|~a| = 1
u=0
∂u
∂u
+ ay
=0
∂x
∂y
√
√
with (ax, ay ) = ( 12 2, 12 2) and
ax
u(x, 0) = 0,
Exact solution is:
(
1
0
on (0, 1) × (0, 1)
u(0, y) = 1
for y > x
for y < x
Example: 2D steady convection with discontinuous inflow (2)
Ne = 15 × 15; SUPG
1.05E+00
8.27E−01
6.09E−01
3.91E−01
1.73E−01
−4.47E−02
max: 1.05E+00
min:−4.47E−02
Example: 2D steady convection with discontinuous inflow (3)
Ne = 30 × 30; SUPG
1.05E+00
8.30E−01
6.11E−01
3.91E−01
1.72E−01
−4.70E−02
max: 1.05E+00
min:−4.70E−02
Example: 2D steady convection with discontinuous inflow (4)
Ne = 30 × 30; AD method with isotropic diffusion of |a|h/2
1.00E+00
8.00E−01
6.00E−01
4.00E−01
2.00E−01
0.00E+00
max: 1.00E+00
min: 0.00E+00
Example: 2D steady convection with discontinuous inflow (5)
Ne = 100 × 100; AD method with isotropic diffusion of |a|h/2
1.00E+00
8.00E−01
6.00E−01
4.00E−01
2.00E−01
0.00E+00
max: 1.00E+00
min: 0.00E+00
Observations for SUPG in 2D
B In streamline direction: SUPG greatly enhances the stability/robustness for
coarse grids in convection(-dominated) problems where solutions are nonsmooth or underresolved (no global wiggles).
B Normal to the streamline direction: SUPG shows a small ‘diffusion-like’
smoothing that decreases with mesh size. The diffusion is much less than the
diffusion in the AD method (when added isotropically).