You are on page 1of 40

Poisson equation

Strong form of the boundary-value problem (BVP)




 −∆u = f in Ω Poisson equation

 u=g 1 on Γ 1 Dirichlet BC

 n · ∇u = g2 on Γ2 Neumann BC

αu + n · ∇u = g3

on Γ3 Robin BC

Variational form: Find u ∈ V = {v ∈ H 1 (Ω) : v|Γ1 = g1 } s.t.


Z Z Z
(∇u · ∇v − f v) dx − g2 v ds + (αu − g3 )v ds = 0
Ω Γ2 Γ3

for each test function v ∈ W = {w ∈ H 1 (Ω) : w|Γ1 = 0}


Poisson equation

Variational form of the boundary value problem

a(u, v) = b(v) ∀v ∈ W

Equivalence to the minimization problem

J(u) ≤ J(w) ∀w ∈ V

where
Z Z Z
1
J(w) = |∇w|2 dx − f w dx − g2 w ds
2 Ω Ω Γ2
Z Z
α
− g3 w ds + w2 ds
Γ3 2 Γ3
Minimization problems

Let u ∈ V be a weak solution of the Dirichlet problem

Lu = f in Ω, u = 0 on Γ

Conditions for existence of an equivalent minimization problem


1 Linearity
L(αu + βv) = αLu + βLv, α, β ∈ R
2 Symmetry Z Z
vLu dx = uLv dx, u, v ∈ V
Ω Ω

R
3 Positive definiteness Ω
uLu dx ≥ 0 ∀u ∈ V
Z
uLu dx = 0 ⇔ u≡0

1D example

2

The operator L = − ∂x 2 is linear and symmetric:
1 1 1 1
∂2u
Z Z Z 
∂u ∂v ∂u
vLu dx = − v dx = dx − v
0 0 ∂x2 0 ∂x ∂x ∂x 0
Z 1 2
 1 Z 1
∂ v ∂v
= − u 2 dx + u = uLv dx
0 ∂x ∂x 0 0

Positive-definiteness can be shown as follows:


Z 1 Z 1 2 Z 1  2
∂ u ∂u
uLu dx = − u 2 dx = dx ≥ 0
0 0 ∂x 0 ∂x

∂u 2
R1  ∂u
0 ∂x dx = 0 ⇒ ∂x ≡0 ⇒ u≡0 since u(0) = 0
Minimization problems

Dirichlet boundary conditions are built into the definition of

V := {w : Ω 7→ R | J(w) is well-defined, w|Γ1 = g1 }

Neumann and Robin boundary conditions are built into


Z Z
1
J(w) = wLw dx − f w dx
2
Z Ω Z Ω Z
α
− g2 w ds − g3 w ds + w2 ds
Γ2 Γ3 2 Γ3
Basis functions

Express u ∈ V as a linear combination of basis functions



X
u=g+ cj ϕj , ϕj ∈ W
j=1

The boundary condition u = g1 on Γ1 ⊂ Γ is satisfied if

g|Γ1 = g1 , ϕi |Γ1 = 0, i∈N

Numerical methods for minimization problems approximate u


in terms of a finite number of basis functions ϕj
Discrete problem

Let {ϕi } be basis functions spanning a finite-dimensional space Wh


N
X
uh ∈ Vh ⊂ V ⇒ uh = gh + cj ϕj , ϕj ∈ Wh
j=1

Restrict the search for the minimizer of J to the subspace Vh

Continuous MP: u ∈ V Discrete MP: uh ∈ Vh


J(u) ≤ J(w) ∀w ∈ V J(uh ) ≤ J(wh ) ∀wh ∈ Vh

The unknowns of the discrete problem are c1 , . . . , cN


Rayleigh-Ritz method

Substitution of uh ∈ Vh into the functional J transforms it into


a scalar function of the coefficients c1 , . . . , cN . We have
∂J
J(uh ) = min J(wh ) ⇒ = 0, i = 1, . . . , N
wh ∈Vh ∂ci

This is a system of N equations for N unknowns

Ac = b, A ∈ RN ×N , b ∈ RN , c = (c1 , . . . , cN )T

A unique solution exists under certain assumptions


Poisson equation in 1D

Minimization problem: Find uh ∈ Vh such that


Z 1"  2 #
1 ∂wh
J(uh ) ≤ J(wh ) = − f wh dx ∀wh ∈ Vh
0 2 ∂x

N
X N
X
gh = 0, uh = cj ϕj , wh = c̃j ϕj
j=1 j=1

Necessary conditions for a minimum


  2   
Z 1 X N Z 1 N
∂J ∂ 1 ∂ϕj  X
= cj dx − f cj ϕj  dx = 0
 
∂ci ∂ci 2 0 ∂x

j=1 0 j=1
Poisson equation in 1D

Linear algebraic system


 
Z 1 N Z 1
∂ϕi X ∂ϕj 
cj dx = f ϕi dx, i = 1, . . . , N
0 ∂x j=1
∂x 0

Matrix form Ac = b, c = (c1 , . . . , cN )T


Z 1 Z 1
∂ϕi ∂ϕj
aij = dx, bi = f ϕi dx
0 ∂x ∂x 0

Matrix properties depend on the choice of the basis functions ϕi


Monomial basis

A possible definition of the 1D basis functions is

ϕj = xj , j = 0, 1, . . . , N

The numerical solution uh is a polynomial of degree N


N
X
uh (x) = cj xj , uh (0) = 0
j=1

The coefficients of the matrix and of the right-hand side are


Z 1 Z 1
i+j−2 ij
aij = ij x dx = , bi = f xi dx
0 i + j − 1 0
Bad choice of ϕi

The so-defined A is a Hilbert matrix

 
1 1 1 1 · 1

 1 4/3 6/4 8/5 · 2N/(N + 1) 

 1 6/4 9/5 12/6 · 3N/(N + 2) 
A= 

 1 8/5 12/6 16/7 · 4N/(N + 3) 

 · · · · · · 
1 · · · · N 2 /(2N − 1)

It is non-singular but full and very ill-conditioned

Numerical solutions become unstable for large N


Good choice of ϕi

For efficiency reasons, it is worthwhile to use bases that lead to


linear systems with sparse/banded matrices

This will be the case if the basis functions ϕj have compact support,
i.e., vanish outside a small patch of mesh elements

The finite element method (FEM) provides a very general framework


for construction of such basis functions

The restriction of the numerical solution uh to each mesh element is


a polynomial defined by a small number of local degrees of freedom
FE approximations

In the process of mesh generation, the computational domain Ωh is


decomposed into small disjoint subdomains/elements ek such that
[
Ω̄h = ek
k

In 1D ek is a closed interval. Triangles and quadrilaterals are used in


2D. A 3D mesh may consist of tetrahedra, hexahedra, prisms etc.

The mesh (also called triangulation) is called conforming if ei ∩ ej ,


j 6= i is an empty set or a common vertex/edge/face

The shape function uh |ek is a polynomial of certain degree


FE basis functions

A local interpolation polynomial is uniquely defined by function


values (or derivatives) at the nodal points

A basis function ϕi is associated with each node xi . Lagrange


finite element approximations satisfy

1 if i = j
ϕj (xi ) = δij =
0 if i 6= j

The coefficients of the piecewise-polynomial numerical solution


X
uh (x) = uj ϕj (x)
j

can be determined, e.g., using the Rayleigh-Ritz method


Basis functions in 1D

Local basis functions ei = [xi−1 , xi ]


xi − x x − xi−1
ϕi−1 (x) = , ϕi (x) = , x ∈ ei
xi − xi−1 xi − xi−1

Linear shape functions ' i 1 ' i

N
P
uh (x) = uj ϕj = ui−1 ϕi−1 + ui ϕi
j=1
x−xi−1
= ui−1 + xi −xi−1 (ui − ui−1 ), x ∈ ei xi 1 xi

Interpolation property: uh (xi−1 ) = ui−1 , uh (xi ) = ui


Basis functions in 1D

Global basis functions


x−xi−1


 xi −xi−1 , if xi−1 ≤ x ≤ xi

xi+1 −x
ϕi (x) = xi+1 −xi , if xi ≤ x ≤ xi+1


0, otherwise

N u1 ui 1
X uN 1 uN
uh (x) = uj ϕj (x)
j=1
0 1
uh (xi ) = ui ≈ u(xi ) x0 x1 xi 1 xi xi+1 xN 1 xN
ui+1
Poisson equation in 1D

Coefficients of the finite element scheme for Poisson’s equation


Z 1 Z 1
∂ϕi ∂ϕj
aij = dx, bi = f ϕi dx
0 ∂x ∂x 0

Decomposition of integrals into element contributions


Z 1 Z Z Z
= + +··· +
0 e1 e2 eN

Exact or numerical integration on ek , assembly of the global linear


system from element contributions
Poisson equation in 1D

Global matrix A for a uniform mesh


 
2 −1
 −1 2 −1 
1   1
A=  · · · , ∆x =
∆x   N
 −1 2 −1 
−1 1

In the case f = const the resulting linear system is equivalent to


the second-order central difference discretization

The finite element approach is better suited for discretization of


multidimensional problems (on unstructured meshes)
Galerkin method

The variational form of a linear PDE can be written as

a(u, v) = b(v) ∀v ∈ V0

where a(·, ·) is a bilinear form and b(·) is a linear form

a(α1 u1 + α2 u2 , v) = α1 a(u1 , v) + α2 a(u2 , v)

a(u, α1 v1 + α2 v2 ) = α1 a(u, v1 ) + α2 a(u, v2 )

b(α1 v1 + α2 v2 ) = α1 b(v1 ) + α2 b(v2 )

The bilinear form a(·, ·) is symmetric if a(u, v) = a(v, u)


Galerkin method

Let uh ∈ Vh be a finite element approximation to u ∈ V


N
X
uh (x) = gh + uj ϕj (x) ∈ Vh
j=1

In general, we cannot have a(uh , v) = b(v) for all v ∈ V0 . Therefore,


we consider the finite-dimensional discrete problem

a(uh , vh ) = b(vh ) ∀vh ∈ V0,h

Each test function vh is a linear combination of ϕi


N
X
vh (x) = vi ϕi (x) ∈ V0,h
i=1
Galerkin method

The variational form (VF) is satisfied for all test functions vh ∈ {ϕi }

a(uh , ϕi ) = b(ϕi ), ∀i = 1, . . . , N

The converse is also true: Suppose that VF is satisfied for all ϕi .


Then for any test function vh ∈ V0,h we have
N
! N
X X
a(uh , vh ) = a uh , vi ϕi = vi a (uh , ϕi )
i=1 i=1
N N
!
X X
= vi b(ϕi ) = b vi ϕi = b(vh )
i=1 i=1

due to the properties of bilinear and linear forms


Summary

Variational formulation
a(u, v) = b(v) ∀v ∈ V0

Galerkin discretization

a(uh , vh ) = b(vh ) ∀vh ∈ V0,h

Linear algebraic system

a(uh , ϕi ) = b(ϕi ), i = 1, . . . , N
Linear algebraic system

N
P
Substitution of uh = uj ϕj into the bilinear form yields
j=1
 
N
X N
X
a(uh , ϕi ) = a  uj ϕj , ϕi  = a (ϕj , ϕi ) uj
j=1 j=1

The result is the linear algebraic system


X
aij uj = bi , ∀i = 1, . . . , N
j

aij = a(ϕj , ϕi ), bi = b(ϕi )

We have N equations for N unknowns u1 , . . . , uN


Poisson equation in 1D

Boundary value problem


 2
− ∂∂xu2 = f in (0, 1)
u(0) = 0, ∂u ∂x (1) = 0

Variational formulation
Z 1 2 
∂ u
− 2 − f v dx = 0, v(0) = 0
0 ∂x

1 1 1
∂2u
Z Z 
∂u ∂v ∂u
Integration by parts − v dx = dx − v
0 ∂x2 0 ∂x ∂x ∂x 0
Poisson equation in 1D

Continuous problem a(u, v) = b(v) ∀v ∈ V0


Z 1 Z 1
∂u ∂v
a(u, v) = dx, b(v) = f v dx
0 ∂x ∂x 0

Discrete problem a(uh , vh ) = b(vh ) ∀vh ∈ V0,h


N
X
a(uh , ϕi ) = b(ϕi ), uh = uj ϕj , i = 1, . . . , N
j=1

Z 1 Z 1
∂ϕi ∂ϕj
Au = b, aij = dx, bi = f ϕi dx
0 ∂x ∂x 0
Poisson equation in 2D

Boundary value problem




 −∆u = f in Ω

 u = g1 on Γ1

 n · ∇u = g2 on Γ2

αu + n · ∇u = g3

on Γ3

Variational formulation u ∈ Vg
Z
[−∆u − f ]v dx = 0 ∀v ∈ V0

Vg = {v ∈ V : v|Γ1 = g1 }, V0 = {v ∈ V : v|Γ1 = 0}
Poisson equation in 2D

Integration by parts
Z Z Z
∇u · ∇v dx − (n · ∇u)v ds = f v dx
Ω Γ Ω

Substitution of boundary conditions


R
Dirichlet Γ1
(n · ∇u)v ds = 0 since v|Γ1 = 0
R R
Neumann Γ2
(n · ∇u)v ds = Γ2 g2 v ds
R R R
Robin Γ3
(n · ∇u)v ds = Γ3 g3 v ds − α Γ3 uv ds

Z Z Z Z
(n · ∇u)v ds = g2 v ds + g3 v ds − α uv ds
Γ Γ2 Γ3 Γ3
Poisson equation in 2D

Continuous problem a(u, v) = b(v) ∀v ∈ V0


Z Z
a(u, v) = ∇u · ∇v dx + α uv ds
Z Ω Z ZΓ3
b(v) = f v dx + g2 v ds + g3 v ds
Ω Γ2 Γ3

Discrete problem a(uh , vh ) = b(vh ) ∀vh ∈ V0,h


N
X
a(uh , ϕi ) = b(ϕi ), uh = uj ϕj , i = 1, . . . , N
j=1

Au = b, aij = a(ϕj , ϕi ), bi = b(ϕi )


Finite elements in 2D

ϕi
Piecewise-linear approximation
ϕi (x, y) = ci1 + ci2 x + ci3 y
(x, y) ∈ ek , i = 1, 2, 3
xi

1 if i = j
ϕj (xi , yi ) = δij =
0 6 j
if i =

The matrix of the linear system is sparse and has a band structure
which depends on the numbering of nodes

The matrix is symmetric and positive-definite, i.e., it inherits the


properties of the elliptic differential operator L = ∆
Positive definiteness

An N × N matrix A = {aij } is positive-semidefinite if


N
X
uT Au = ui aij uj ≥ 0, ∀u = (u1 , . . . , uN )T
i,j=1

The FEM approximation of Poisson’s equation satisfies


N R 
uT Au =
P R
ui Ω ∇ϕj · ∇ϕi dx + α Γ3 ϕj ϕi ds uj
i,j=1

R N
|∇uh |2 dx + α
R
u2h ds,
P
= Ω Γ3
uh = uj ϕj
j=1

Sufficient condition of positive-definiteness: α > 0


Error analysis

Let u ∈ V0 be the solution of the continuous problem


Z Z
∇u · ∇v dx = f v dx ∀v ∈ V0
Ω Ω

Let uh ∈ Vh ⊂ V be the solution of the discrete problem


Z Z
∇uh · ∇vh dx = f vh dx ∀vh ∈ V0,h
Ω Ω

Let ũh ∈ Vh be the interpolant of the exact solution


N
X
ũh (x) = u(xj )ϕj (x), x∈Ω
j=1
Error analysis

Which approximation of u is better: uh or ũh ?

Although ũ is nodally exact, it turns out that the global error


in ∇u can be estimated as follows:
Z Z
2
|∇(u − uh )| dx ≤ |∇(u − ũh )|2 dx
Ω Ω

Proof. Using the test function v = vh , we find that


Z
∇(u − uh ) · ∇vh dx = 0 ∀vh ∈ V0,h

In particular, this Galerkin orthogonality condition holds for

vh = ũh − uh = (ũh − u) + (u − uh )
Error analysis

It follows that the global error can be written as


Z Z
|∇(u − uh )|2 dx = ∇(u − uh ) · ∇(u − ũh )dx
Ω Ω

Using the inequality pq ≤ 12 (p2 + q 2 ) we obtain


Z Z Z
2 1 2 1
|∇(u − uh )| dx = |∇(u − uh )| dx + |∇(u − ũh )|2 dx
Ω 2 Ω 2 Ω
Z Z
2
That is, |∇(u − uh )| dx ≤ |∇(u − ũh )|2 dx 
Ω Ω
| {z } | {z }
approximation error interpolation error
Convection-diffusion in 1D

Boundary value problem


∂2u

P e ∂u
∂x − ∂x2 = 0 in (0, 1)
u(0) = 0, u(1) = 1

Variational formulation
Z 1
∂u ∂ 2 u

Pe − v dx = 0, v(0) = v(1) = 0
0 ∂x ∂x2

1 1 1
∂2u
Z Z 
∂u ∂v ∂u
Integration by parts − v dx = dx − v
0 ∂x2 0 ∂x ∂x ∂x 0
Convection-diffusion in 1D

Continuous problem a(u, v) = b(v) ∀v ∈ V0


1 
Z 
∂u ∂v
a(u, v) = Pev + dx, b(v) = 0
0 ∂x ∂x

Discrete problem a(uh , vh ) = b(vh ) ∀vh ∈ V0,h


N
X
a(uh , ϕi ) = b(ϕi ), uh = uj ϕj , i = 1, . . . , N − 1
j=1

Z 1  
∂ϕj ∂ϕi
aij = P e ϕi + dx, bN −1 = −aN −1,N
0 ∂x ∂x
Convection-diffusion in 1D

Linear algebraic system


P e ui+1 −u
2
i−1
− ui−1 −2ui +ui+1
∆x = 0, i = 1, . . . , N − 1

The piecewise-linear Galerkin discretization on a uniform mesh


corresponds to the central difference approximation

This approximation is second-order accurate, tends to produce


nonphysical oscillations in the case P e∆x > 2

Stabilization is necessary for larger values of P e


Stabilization in 1D

The Galerkin scheme can be stabilized by adding artificial diffusion


which vanishes as we refine the mesh

The standard Galerkin discretization of the modified equation

∂u ∂2u P e ∆x
Pe − (1 + τ ) 2 = 0, τ =α
∂x ∂x 2
is given by
 1+α 1−α
 ui−1 −2ui +ui+1
Pe 2 (ui − ui−1 ) + 2 (ui+1 − ui ) − ∆x =0

The parameter values α = ±1 correspond to the first-order accurate


forward and backward difference approximations
Convection-diffusion in 2D

Boundary value problem


(
∇ · (vu − d∇u) = 0 in Ω
u=g on Γ

Stabilization: add streamline diffusion ∇ · (D∇u)

v⊗v vi vj |v|h
D=τ , dij = τ = dji , τ =α
|v|2 |v|2 2

Variational formulation u ∈ Vg
Z
− (vu − d∇u − D∇u) · ∇w dx = 0 ∀w ∈ V0

Stabilization in 2D

Stabilization term
(v · ∇u)(v · ∇w) |v|h
Z Z
(D∇u) · ∇w dx = τ dx, τ =α
Ω Ω |v|2 2

symmetric, positive-semidefinite (also at the discrete level)

no smearing in directions orthogonal to the velocity v

optimal value of the parameter α is problem-dependent

nonphysical oscillations may occur if α is too small

high levels of numerical diffusion if α is too large

You might also like