<<

(Galerkin) Finite element approximations

The finite element method (FEM): special choice for the shape functions φ. ˜

Ne = 5 Subdivide Ω into elements Ωe:

Ne Ω = Ωe e=1 [ Ω1 Ω2 Ω3 Ω4 Ω5 Ωe1 Ωe2 = x = a x = b ∩ ∅ Approximate u on each element separately by a 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 n T 1 uh(x) = uiφi(x) = φ (x)u φ3(x) i=1 ˜ ˜ X

Ω1 Ω2 Ω3 Ω4 Ω5 n: number of global nodal points.

x1 = ax2 x3 x4 x5 x6 = b Local element shape functions:

e e e T e u (x) = u φ1(x)+u φ2(x) = φ (x)u h 1 2 ˜ φ1(x) φ2(x) ˜ 1 1 T with φ = [φ1(x), φ2(x)] and ˜ e e x x2 x x1 e e e e φ1(x) = − , φ2(x) = − x1 x2 x1 x2 xe xe xe xe 1 − 2 2 − 1 Example: quadratic elements

Local element shape functions:

φ1(x) φ2(x) φ3(x) 1 1 1

e e e e e e e e e x1 x2 x3 x1 x2 x3 x1 x2 x3

e e e T e uh(x) = u1φ1(x) + u2φ2(x) = φ (x)u ˜ ˜ T with φ = [φ1(x), φ2(x), φ3(x)] and ˜ (x xe)(x xe) (x xe)(x xe) φ (x) = − 2 − 3 , φ (x) = − 1 − 3 , 1 (xe xe)(xe xe) 2 (xe xe)(xe xe) 1 − 2 1 − 3 2 − 1 2 − 3 (x xe)(x xe) φ (x) = − 1 − 2 3 (xe xe)(xe xe) 3 − 1 3 − 2 Example: higher-order elements

General of order p:

p+1 e e T e uh(x) = ui φi(x) = φ (x)u i=1 ˜ ˜ X T with φ = [φ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

4 N =3 e uh(x) T uh(x) = uiφi(x) = φ (x)u i=1 ˜ ˜ X u 2 u3 u1 u4 u1 φ1(x) u φ (x) Ω1 Ω2 Ω3 u = 2 , φ(x) = 2 u  φ (x) x1 = ax2 x3 x4 = b ˜ 3 ˜ 3 u  φ (x) 1  4  4  φ (x) Ne = 3 3    

Ω1 Ω2 Ω3

x1 = ax2 x3 x4 = b Local numbering in elements

Weak form: Find uh in Sh such that

dv du ( h,A h) + v (b)h = (v , f) for all v V dx dx h b h h ∈ h

Split: N N e dv du e ( h,A h) + v (b)h = (v , f) for all v V dx dx h b h h ∈ h e=1 e=1 X X Write in each element e:

2 2 e e T e e T uh(x) = ui φi(x) = φ (x)ue, vh(x) = vi φi(x) = φ (x)ve i=1 ˜ ˜ i=1 ˜ ˜ X X

T e e T where ue = (u1, u2) and φ (x) = (φ1(x), φ2(x)). ˜ ˜ Element and vector

We get: Ne Ne T T (ve Keue) + vnhb = ve f e e=1 ˜ ¯ ˜ e=1 ˜ ˜ X X where

dφ dφT dφ dφT Ke = ˜,A ˜ = ˜A ˜ dx ¯ dx dx e Ω dx dx   Z e f e = (φ, f)e = φf dx ˜ ˜ ZΩe ˜ are the element matrix Ke and element vector f e. ¯ ˜ Local global (assembling) →

The local vectors ue and ve are part of the global vectors: ˜ ˜

ue = P eu, ve = P ev, ˜ ¯ ˜ ˜ ¯ ˜ So we get

Ne Ne Ne T T T T ˜ v Keue = v P KeP e u = v Ke u ˜e ¯ ˜ ˜ ¯ e ¯ ¯ ˜ ˜ ¯ ˜ e=1 e=1 ˜ e=1 X X Ke  X  ¯ Ne Ne | {z } Ne vT f = vT P T f = vT f˜ e e e e e e=1 ˜ ˜ e=1 ˜ ¯ ˜ ˜ e=1 ˜ X X f˜  X  e | ˜{z } Weak form

Substitution into the weak form:

vT Ku = vT f for all v ˜ ¯ ˜ ˜ ˜ ˜ or Ku = f ¯ ˜ with ˜

Ne ˜ K = Ke ¯ e=1 ¯ X 0 Ne 0   f = f˜ + . e ˜ e=1 ˜  0  X    h  − b   Example (1)

For example: u1 u2 0 1 0 0 u2 u2 = =   = P 2u u3 0 0 1 0 u3 ¯ ˜     ˜ u4 P 2   ¯   0| 0 {z } 2 2 ˜ T 1 0 K11 K12 0 1 0 0 K2 = P 2 K2P 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 K11 K12 0 0 0 0 0 0 0 0 0 0 1 1 2 2 K21 K22 0 0 0 K11 K12 0 0 0 0 0 K =   +  2 2  +  3 3  ¯ 0 0 0 0 0 K21 K22 0 0 0 K11 K12  0 0 0 0 0 0 0 0 0 0 K3 K3       21 22  1 1      K11 K12 0 0 1 1 2 2 K21 K22 + K11 K12 0 =  2 2 3 3  0 K21 K22 + K11 K12  0 0 K3 K3   21 22   Similar for assembly of f. ˜ 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)

uu vu Kuu Kup f u u = ˜ , v = ˜ ,K = ¯ ¯ , f = ˜ ˜ up ˜ vp ¯ Kpu Kpp ˜ f p ˜  ˜   ¯ ¯  ˜ 

Note: up prescribed values, vp = 0. Weak form ˜ ˜ ˜ vT Ku = vT f for all v ˜ ¯ ˜ ˜ ˜ ˜ with vp = 0 leads to ˜ ˜ T T vu (Kuuuu + Kupup) = vu f u for all vu ˜ ¯ ˜ ¯ ˜ ˜ ˜ ˜ or Kuuuu = f u Kupup ¯ ˜ ˜ − ¯ ˜ 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), at x = a, t > 0 (ΓD) du A = h (t) at x = b, t > 0 (Γ ) − dx b N Notes:

B Strong form; Classical (strong) solution u(x, t) 0 2 B f(x, t) C (a, b) (continuous) then u C (a, b) (twice continuously differentiable)∈ ∈ Oldroyd-B/UCM viscoelastic model

λ τ5 +τ = 2ηD where τ5= τ˙ L τ τ LT − · − · or ∂τ τ η + ~u τ L τ τ LT + = 2 D ∂t · ∇ − · − · λ λ ∂u ∂u bu f ∂t a∂x |{z} | {z } | {z } | {z } Diffusion is missing (A = 0). Dimensionless form (1)

Scaling:

t = tct∗ tc : characteristic time

u = Uu∗ U : characteristic value solution

x = Lx∗ L : characteristic length scale

Dimensionless variables: (1). O 2 U ∂u∗ aU ∂u∗ AU ∂ u∗ + 2 2 + bUu∗ = f tc ∂t∗ L ∂x∗ − L ∂x∗ Relative to convection:

2 L ∂u∗ ∂u∗ 1 ∂ u∗ bL L + 2 + u∗ = f atc ∂t∗ ∂x∗ − Pe∂x∗ a aU aL Pe = : P´eclet number, convection/diffusion. A Dimensionless form (2)

Time scales:

L convection: B a L2 diffusion: B A 1 source: (’relaxation time’) B b B time scales in b.c. B externally or internally generated frequencies (’von Karman vortex’)

We choose tc = L/a (convection) and get

2 ∂u∗ ∂u∗ 1 ∂ u∗ + 2 + b∗u∗ = f ∗ ∂t∗ ∂x∗ − Pe∂x∗ bL L with b = and f = f. Pe > 1 : convection dominated ∗ a ∗ aU Exercise 6

L2 Assume b = 0 and f = 0. We take for the typical time scale t = (diffusion c A time scale). Show that we now have the non-dimensional form

2 ∂u∗ ∂u∗ ∂ u∗ + 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

du d du (u) = a (A ) + bu = f L dx − dx dx

: linear operator, with b.c. L

u = ua, at x = a (ΓD) du A = h at x = b (Γ ) − dx b N Weak form

Multiply with test function v and integrate:

(v, u f) = 0 for all v L − Partial integration of the diffusion term and inserting b.c. we get: Find u S such that ∈

dv du du ( ,A ) + (v, a ) + (v, bu) + v(b)h = (v, f) for all v V dx dx dx b ∈ where S and V are appropriate spaces. Galerkin FEM approximations (1)

Approximation spaces Sh and Vh:

n T uh(x) = uiφi(x) = φ (x)u i=1 ˜ ˜ X n T vh(x) = viφi(x) = φ (x)v i=1 ˜ ˜ X where φ(x) are global shape functions. Substituting this into the weak form gives: Find u˜ S such that h ∈ h dv du du ( h,A h) + (v , a h) + (v , bu ) + v (b)h = (v , f) for all v V dx dx h dx h h h b h h ∈ h or vT Ku = vT f for all v ˜ ¯ ˜ ˜ ˜ ˜ Galerkin FEM approximations (2)

and thus Ku = f ¯ ˜ ˜ with

T dφ dφ dφi dφj K = ( ˜,A ˜ ) or Kij = ( ,A ) ¯ dx dx dx dx T dφ dφj + (φ, a ˜ ) + (φi, a ) ˜ dx dx T + (φ, bφ ) + (φi, bφj) ˜ ˜

f = (φ, f) hbφ(b) 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” dx˜ dx˜ h 1 1 −  dφT 1 1 1 (φ, )e = − “convection matrix” dx˜ 2 1 1 ˜ −  h 2 1 (φ, φT ) = “mass matrix” e 6 1 2 ˜ ˜   where h is the element length. Global stiffness matrix

Global stiffness matrix (uniform element size):

1 1 0 ...... 0 1− 2 1 0 ...... 0 −0 1− 2 1 0 ... 0  − −  . .  1    . .  h    . .     0 ... 0 1 2 1 0   − −   0 ...... 0 1 2 1  − −   0 ...... 0 1 1   −    Finite difference scheme: (divide by h)

2 ui 1 + 2ui ui+1 d u 2 − − − = (x ) + (h ) h2 −dx2 i O Global convection matrix

Global convection matrix (uniform element size):

1 1 0 ...... 0 −1 0 1 0 ...... 0 −0 1 0 1 0 ... 0 −  . . 1    . . 2    . .    0 ... 0 1 0 1 0  −   0 ...... 0 1 0 1  −   0 ...... 0 1 1  −    Finite difference scheme: (divide by h)

ui 1 + ui+1 du 2 − − = (x ) + (h ) 2h dx i O Global mass matrix

Global mass matrix (uniform element size):

2 1 0 ...... 0 1 4 1 0 ...... 0 0 1 4 1 0 ... 0 . . h   . . 6   . .   0 ... 0 1 4 1 0   0 ...... 0 1 4 1   0 ...... 0 1 2     Finite difference scheme: (divide by h)

ui 1 + 4ui + ui+1 2 − = u(x ) + (h ) 6 i O Global right-hand side

Sometimes the following approximation is applied:

f(x) fˆ φ (x) fˆ : nodal point values of f ≈ k k k Xk In that case: fi = (φi, f) = (φi, φk)fˆk Xk with (φi, φk) the mass matrix. Finite difference scheme: (divide by h)

fi 1 + 4fi + fi+1 2 − = f(x ) + (h ) 6 i O

Note that the usual approach is to use . 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: du 1 d2u = 0 on (0, 1) dx − Pedx2 with b.c. u(0) = 0, u(1) = 1 Exact solution: 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 0.8 Pe=10 exact Pe=10 GFEM 0.6 Pe=100 exact Pe=100 GFEM 0.4

0.2

u(x) 0

-0.2

-0.4

-0.6

-0.8 0 0.2 0.4 0.6 0.8 1 x 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

0.6

0.4 u(x)

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x Observations (1)

1 Boundary layer of width . B Pe B Global upstream “wiggles” appear when the boundary layer is not resolved by the mesh. B Governed by the mesh P´eclet number Peh: ah 1 h Pe = = Pe h 2A 2L where wiggles appear when

h 2 Pe > 1 or > h L Pe or wiggle-free when h 2 < L Pe Observations (2)

The problem is twofold:

1. Rapid change in the solution over small lengths (large )

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 ): → ∞ du = f on (0, 1) dx with 1 (x 1)2 u(0) = 0, f = exp[ − 2 ] √πσ − σ2 Exact solution: 1 x 1 1 u(x) = erf( − 2 ) + erf( ) 2 σ 2σ Notes: h i

B length scale σ for σ 0 B 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.8 σ=0.15 GFEM σ=0.05 exact σ=0.05 GFEM 0.6

0.4 u(x)

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x 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.8 σ=0.05 Ne=21

0.6

0.4 u(x)

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x 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 and would require too much computer resources.

B In viscoelastic flow problems the GFEM method often performs very poorly.

Stabilization necessary ⇒ of the discrete equations

Equidistant mesh (mesh size h), inner node i:

ui+1 ui 1 ui+1 2ui + ui 1 fi 1 + 4fi + fi+1 a − − A − − = − 2h − h2 6 Notes:

B central differencing

B consistent averaging of source term

B for f = 0: 1 ui+1 ui 1 (ui+1 2ui + ui 1) = 0 − − − Peh − − or 1 + Peh ui+1 ui = (ui ui 1) − 1 Peh − − or −

sign(ui+1 ui) = sign(ui ui 1) for Peh > 1 Wiggles! − − − − for Pe (no diffusion): Simpson rule for integration, which is (h4). B h → ∞ O for Pe (no diffusion), matrix: B h → ∞ 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)

ah For Pe = = 1 we have a diffusivity of: h 2A ah A = A¯ = 2

d2u Adding A¯ to the equations, or − dx2 du d2u a (A + A¯) = f dx − dx2 removes wiggles, but we solve a modified equation. New mesh P´eclet:

ah Pe Pe¯ = = h < 1 h ah 1 + Pe 2(A + 2 ) h Artificial diffusion (2)

Discretized equations with equidistant mesh (mesh size h), inner node i:

ui+1 ui 1 ah ui+1 2ui + ui 1 fi 1 + 4fi + fi+1 a − − (A + ) − − = − 2h − 2 h2 6 or ui ui 1 ui+1 2ui + ui 1 fi 1 + 4fi + fi+1 a − − A − − = − h − h2 6 upwind differencing

u | {z } ui i+1 ui 1 −

xi 1 xi xi+1 − h h

ui ui 1 du − − = (x ) + (h) h dx i O Artificial diffusion (2) In general artificial diffusivity: ah A¯ = β 2 with examples:

B β = 1, upwind differencing ¯ B Peh = 1 for Peh > 1:

0 for Peh 1 β = 1 ≤ 1 for Peh > 1 ( − Peh B Exact nodal point values (’optimal’ value) for du d2u a A = constant dx − dx2 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 β = 0 the first-order derivative can be interpreted as being discretized by the following6 finite difference scheme

1 ui+1 ui 1 ui ui 1 du (1 β) − + (1 + β) − − = (x ) + (h) 2 − h 2 h dx i O 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 0.8 β=1 β ≤ =0 for Peh 1, 1-1/Peh for Peh>1 β =coth(Peh)-1/Peh 0.6

0.4 u(x)

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x 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 N =20 1 e GFEM Ne=40 β AD =1 Ne=20 β 0.8 AD =1 Ne=40

0.6 u(x) 0.4

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x Example: 1D steady convection with source term

Error in solution. Ne = 100 (Galerkin), 3000 (β = 1); σ = 0.05

0.002 β AD =1 Ne=3000 0.0015 GFEM Ne=100

0.001

| 0.0005 exact -u

k 0 |u k -0.0005 max

-0.001

-0.0015

-0.002 0 0.2 0.4 0.6 0.8 1 x 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η D) + p τ = ρ~b, in Ω ∂t · ∇ − ∇ · s ∇ − ∇ · ~u = 0, in Ω ∇ · ∂τ λ( + ~u τ L τ τ LT ) + τ = 2ηD, in Ω ∂t · ∇ − · − · Weak form of modified equation by AD

Artificial diffusion solves the modified equation:

du d du ah a (A + A¯) + bu = f, with A¯ = β dx − dx dx 2   where we assume also the modified boundary condition:

u = ua, at x = a (ΓD) du (A + A¯) = h at x = b (Γ ) − dx b N For the weak form we get: Find u S such that ∈ dv du du ( , (A + A¯) ) + (v, a ) + (v, bu) + v(b)h = (v, f) for all v V dx dx dx b ∈ Streamline upwinding (SU) (1)

Compared to standard weak form we have added the term dv du dv ahdu βh dv du ( , A¯ ) = ( , β ) = ( , 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)h = (v, f) for all v V dx dx 2 dx dx b ∈ 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: dφ βhdvh T ˆ ˆ βh vˆh = vh + = v φ with φ = (φ + ˜) 2 dx ˜ ˜ ˜ ˜ 2 dx where h may vary from element to element.

φˆi

φi

β 2 x xi 1 xi i+1 β − 2

hi hi+1 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, u f) = 0 for all v L − to βh dv (v + , u f) = 0 for all v 2 dx L − where du d du (u) = a (A ) + bu L 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 ( Petrov-Galerkin). → Interpretation of second-derivatives

Interpretation of Hughes & Brooks (1982). Split:

βh dv βh dv (v + , u f) = (v, u f) + ( , u f) = 0 for all v 2 dx L − L − 2 dx L − I II | {z } | {z } B Term I: partial integration of diffusion terms with fluxes on the boundary (standard procedure)

B Term II: interprete element wise:

βh dv βh dv ( , u f) = ( , u f) = 2 dx L − 2 dx L − e e X 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)h dx dx dx b βh dv du d du + , a (A ) + bu f 2 dx dx − dx dx − e e X  τa  = (v, f) for all v V |{z} ∈ Notes:

B A = 0 (no diffusion): e can be removed (viscoelastic CE) P B consistency βh usual definition: τa = with time scale τ B 2

h 1 ah 1 1 τ = β = β = A¯ 2 a 2 a2 a2

d du constant A, linear elements: (A ) = 0 in the interior of the element. If B 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 1 β AD =1 Ne=20 β SUPG =1 Ne=20 0.8

0.6 u(x) 0.4

0.2

0

-0.2 0 0.2 0.4 0.6 0.8 1 x Example: 1D steady convection with source term (2)

σ = 0.05; maximum nodal error as a function of number of elements Ne.

1 AD SUPG GFEM

| 0.1 exact -u k |u k

max 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.

1 AD SUPG GFEM 7/x 10/x2

| 0.1 exact -u k |u k

max 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 on Ω ∂t · ∇ − ∇ · ∇ u L with boundary and| initial {z } conditions

ΓD u(~x,t = 0) = u0(~x) in Ω ΓN u = uD on ΓD ∂u ~n Ω A = A~n u = h on Γ − ∂n − · ∇ N N ~n: outside normal Weak form (1)

Multiply by testfunction v:

∂u (v, + u f) = 0 for all v ∂t L − where the standard inner product on L2(Ω) is

(a, b) = ab dx ZΩ With A u v = A( u)v) A u v ∇ · ∇ ∇ · ∇ − ∇ · ∇ and the divergence theorem (Gauss):  

~a dx = ~n ~a dΓ ∇ · · ZΩ ZΓ Weak form (2)

we get the weak form: Find u S such that ∈ ∂u (v, ) + (v,~a u) + ( v, A u) + (v, bu) + (v, h ) = (v, f) ∂t · ∇ ∇ ∇ N ΓN for all v V . Notes: ∈

B v = 0 on ΓD, u = uD on ΓD B we have silently introduced:

(~a,~b) = ~a ~b dΩ · ZΩ

(a, b)Γ = ab dΓ ZΓ GFEM (1)

Ω = Ω , Ω Ω = for e = f ∪e e e ∩ f ∅ 6

φ1(~x) φ3(~x) φ2(~x) 3

  1 2

3 3 3

   1 1 1

   2 2 2 GFEM (2)

Approximation spaces Sh and Vh:

n T uh(~x,t) = ui(t)φi(~x) = φ (~x)u(t) i=1 ˜ ˜ X n T vh(~x,t) = vi(t)φi(~x) = φ (~x)v(t) i=1 ˜ ˜ X where φ(~x) are global shape functions. Substituting into the weak form: ˜ vT Mu˙ + vT Ku = vT f for all v ˜ ¯ ˜ ˜ ¯ ˜ ˜ ˜ ˜ or Mu˙ + Ku = f ¯ ˜ ¯ ˜ ˜ GFEM (2)

The ‘mass matrix’ M is given by ¯ T M = (φ, φ ),Mij = (φi, φj) ¯ ˜ ˜ and the ‘stiffnes matrix’ by

T K = ( φ,A φ ) or Kij = ( φi,A φj) ¯ ∇˜ ∇˜ ∇ ∇ + (φ,~a φT ) + (φ ,~a φ ) · ∇ i · ∇ j ˜ T ˜ + (φ, bφ ) + (φi, bφj) ˜ ˜

f = (φ, f) (φ, hN )ΓN fi = (φi, f) (φi, hN )ΓN ˜ ˜ − ˜ − Example: 2D steady convection with source term (1)

~a =1 | |

u =0

u =0 ∂u ∂u a + a = f on (0, 1) (0, 1) x∂x y ∂y × 1√ 1√ with (ax, ay) = (2 2, 2 2) and

1 (x + y 1)2 u(x, 0) = 0, u(0, y) = 0, 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)

N = 15 15; σ = 0.05; GFEM e ×

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)

N = 30 30; σ = 0.05; GFEM e ×

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)

N = 45 45; σ = 0.05; GFEM e ×

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)

N = 100 100; σ = 0.05 e ×

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)

~a =1 | | u =1

u =0 ∂u ∂u a + a = 0 on (0, 1) (0, 1) x∂x y ∂y × 1√ 1√ with (ax, ay) = (2 2, 2 2) and

u(x, 0) = 0, u(0, y) = 1

Exact solution is: 1 for y > x (0 for y < x Example: 2D steady convection with discontinuous inflow (2)

N = 15 15; GFEM e ×

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)

N = 30 30; GFEM e ×

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: d2u ah A¯ with A¯ = β − dx2 2 which stabilizes du a dx 3D added diffusion: a h (A¯ u) with A¯ = β| | −∇ ∇ 2 which stabilizes ~a u · ∇ however, in all directions. This is too much added diffusion. Only diffusion in the direction of ~a is needed since ∂u ~a ~a u = ~a ~e u = ~a with ~e = · ∇ | | · ∇ | |∂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:

(A~e~e¯ u) −∇ · ∇ or ~a~a (A¯ u) with A¯ = A~e~e¯ = A¯ −∇ · ∇ ~a 2 | | In the weak form we get an extra term:

( v, A¯ u) ∇ · ∇ SU (1)

Diffusion added in AD method: ~a~a ( v, A¯ u) = ( v, A¯ u) ∇ · ∇ ∇ ~a 2 · ∇ | | ~a~a = v A¯ u) dΩ ∇ · ~a 2 · ∇ ZΩ | | A¯ = (~a v)(~a u) dΩ ~a 2 · ∇ · ∇ ZΩ | | A¯ = ( ~a v,~a u) ~a 2 · ∇ · ∇ | | = (τ~a v,~a u) · ∇ · ∇ with A¯ h τ = = β ~a 2 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, + u f = 0 · ∇ ∂t L −   or (with elementwise interpretation):

∂u ∂u v, + u f + τ~a v, + u f = 0 ∂t L − · ∇ ∂t L − Ωe e   X   First term: partial integrate to standard weak form. Notes on SUPG (1)

A¯ τ = , with A¯ “the amount of streamline diffusion”. When the real diffusion B ~a 2 | | ah A = 0, we need to generalize A¯ = β(Pe ) to more dimensions. There are 6 h 2 various ways to do this. For example for a bilinear quadrilateral:

~h1 = h1~e1 ~a0 ~h2 = h2~e2 ~a ~h ~a ~h A¯ = β(Pe )| · 1| + β(Pe )| · 2| ~e2 h1 2 h2 2

h2

~e1 with

~a ~h1 ~a ~h2 Peh1 = | · |, Peh2 = | · | h1 2A 2A

B For higher-order elements a constant τ is non-optimal. Notes on SUPG (2)

B The choice of τ is somewhat arbitrary, in particular when diffusion is absent (A = 0). Note, that A¯ h τ = = β ~a 2 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 a + a = f on (0, 1) (0, 1) x∂x y ∂y × 1√ 1√ with (ax, ay) = (2 2, 2 2) and

1 (x + y 1)2 u(x, 0) = 0, u(0, y) = 0, 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)

N = 15 15; σ = 0.05; SUPG e ×

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)

N = 30 30; σ = 0.05; SUPG e ×

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)

~a =1 | | u =1

u =0 ∂u ∂u a + a = 0 on (0, 1) (0, 1) x∂x y ∂y × 1√ 1√ with (ax, ay) = (2 2, 2 2) and

u(x, 0) = 0, u(0, y) = 1

Exact solution is: 1 for y > x (0 for y < x Example: 2D steady convection with discontinuous inflow (2)

N = 15 15; SUPG e ×

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)

N = 30 30; SUPG e ×

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)

N = 30 30; AD method with isotropic diffusion of a h/2 e × | |

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)

N = 100 100; AD method with isotropic diffusion of a h/2 e × | |

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 non- smooth 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).