You are on page 1of 49

FEM: basis functions

So far we have used piecewise-linear finite element approximations

On simplex meshes, local basis functions can be defined in terms of


barycentric coordinates (linear Lagrange basis polynomials)

A more general approach is the definition of local basis functions on


a reference element (unit interval/square/triangle/cube etc.)

We will consider both possibilities in this course


Barycentric coordinates in 1D

Let e = [x1 , x2 ] be an element of the computational mesh

The barycentric coordinates of a point x ∈ e are given by


x2 − x x − x1
λ1 (x) = , λ2 (x) =
x2 − x1 x2 − x1

These linear basis polynomials have the following properties:

1 2
1 λi ∈ P1 (e), i = 1, 2
2 λi (xj ) = δij , i, j = 1, 2
e
3 λ1 (x) + λ2 (x) = 1, x∈e
x1 x2
P1 elements in 1D

The barycentric coordinates {λ1 , λ2 } of x ∈ e are local basis


functions for the linear finite element approximation

ϕ1 (x) = λ1 (x), ϕ2 (x) = λ2 (x), x∈e

The shape function uh |e is a linear interpolation polynomial

uh (x) = u1 ϕ1 (x) + u2 ϕ2 (x), x∈e

u2
'1 '2
u1

e e

x1 x2 x1 x2
P2 elements in 1D

To construct a quadratic interpolation polynomial, we need to


provide function values at three points:

x1 7→ {1, 0}, x2 →
7 {0, 1}
 
x1 + x2 1 1
x12 = 7→ ,
2 2 2

The local basis functions are quadratic Lagrange polynomials

ϕ1 (x) = λ1 (x)(2λ1 (x) − 1)


ϕ2 (x) = λ2 (x)(2λ2 (x) − 1)
ϕ12 (x) = 4λ1 (x)λ2 (x)
P2 elements in 1D

Each Lagrange basis function equals 1 at one node and 0 at the


other nodes of the finite element

The shape function uh |e is a quadratic polynomial

uh (x) = u1 ϕ1 (x) + u2 ϕ2 (x) + u12 ϕ12 (x)

u2
'1 '12 '2
u1
u12

e
e
x1 x12 x2
x1 x12 x2
P3 elements in 1D

To construct a cubic interpolation polynomial, we need to provide


function values at four points:
 
2x1 + x2 2 1
x1 7→ {1, 0}, x12 = 7→ ,
3 3 3
 
x1 + 2x2 1 2
x2 7→ {0, 1}, x21 = 7→ ,
3 3 3

The local basis functions are cubic Lagrange polynomials

ϕ1 (x) = 12 λ1 (x)(3λ1 (x) − 2)(3λ1 (x) − 1)


ϕ2 (x) = 12 λ2 (x)(3λ2 (x) − 2)(3λ2 (x) − 1)
ϕ12 (x) = 92 λ1 (x)λ2 (x)(3λ1 (x) − 1)
ϕ21 (x) = 92 λ1 (x)λ2 (x)(3λ2 (x) − 1)
P3 elements in 1D

Each Lagrange basis function equals 1 at one node and 0 at the


other nodes of the finite element

The shape function uh |e is a cubic polynomial


u2

u12
u21
uh (x) = u1 ϕ1 (x) + u2 ϕ2 (x) u1

+ u12 ϕ12 (x) + u21 ϕ21 (x) e

x1 x12 x21 x2
Barycentric coordinates in 2D

Barycentric coordinates on a triangle

x = (x, y) 7→ {λ1 (x), λ2 (x), λ3 (x)}

Properties of the barycentric coordinates

x3
1 λi ∈ P1 (e), i = 1, 2, 3
e

2 λi (xj ) = δij , i, j = 1, 2, 3
x
3
P
3 λi (x) = 1 ∀x ∈ e
i=1 x1 x2
Barycentric coordinates in 2D

A linear polynomial in 2D has three degrees of freedom

λi ∈ P1 (e) ⇒ λi (x) = c1i + c2i x + c3i y

At the vertices we have λi (xj ) = δij . It follows that



 λi (x1 ) = c1i + c2i x1 + c3i y1 = δ1i
λi (x2 ) = c1i + c2i x2 + c3i y2 = δ2i
λi (x3 ) = c1i + c2i x3 + c3i y3 = δ3i

This is a system of 3 equations for 3 unknowns

The solution of this system are the coefficients of λi


Barycentric coordinates in 2D

The matrix form of the linear systems for cij reads


    
1 x1 y1 c11 c12 c13 1 0 0
 1 x2 y2   c21 c22 c23 = 0 1 0 
1 x3 y3 c31 c32 c33 0 0 1
| {z }| {z } | {z }
A C E

The determinant of A is proportional to the area of e


1
|e| = | det A| > 0
2
The matrix of coefficients cij is given by C = A−1
Barycentric coordinates in 2D

x3
Barycentric splitting e

3
[ 1 e2 e1
e= ei , |ei (x)| = | det Ai (x)| e3
i=1
2
x1 x2

1 x y 1 x1 y1 1 x1 y1
! ! !
A1 = 1 x2 y2 , A2 = 1 x y , A3 = 1 x2 y2
1 x3 y3 1 x3 y3 1 x y

|ei (x)| | det Ai (x)|


λi (x) = = , i = 1, 2, 3
|e| | det A|
Barycentric coordinates in 2D

The geometric interpretation confirms the properties

λi ∈ P1 (e), λi (xj ) = δij , i, j = 1, 2, 3

The area of e is the sum of subtriangle areas

|e1 (x)| + |e2 (x)| + |e3 (x)| = |e|, x∈e

It follows that
λ1 (x) + λ2 (x) + λ3 (x) ≡ 1

The barycentric coordinates λi (x) are invariant w.r.t. the optional


transformation of e onto a reference triangle ê
Nodal points in 2D

Vertices
x1 7→ {1, 0, 0}, x2 7→ {0, 1, 0}, x3 7→ {0, 0, 1}

Edge midpoints
     
1 1 1 1 1 1
x12 7→ , ,0 , x13 7→ , 0, , x23 7→ 0, ,
2 2 2 2 2 2

x3

Centroid

1 1 1
 x13 x123 x23
x123 7→ , ,
3 3 3

x1 x12 x2
P1 elements in 2D

Linear approximation uh |e ∈ P1 (e)


uh (x, y) = c1 + c2 x + c3 y

Vertex-based basis functions


ϕ1 = λ1 , ϕ2 = λ2 , ϕ3 = λ3

Edge-based basis functions


ϕ12 = 1 − 2λ3 , ϕ13 = 1 − 2λ2 , ϕ23 = 1 − 2λ1

The vertex-based version is continuous along the boundary of e

The edge-based version is continuous only at the midpoints xij


P2 elements in 2D

Quadratic approximation uh |e ∈ P2 (e)


uh (x, y) = c1 + c2 x + c3 y + c4 x2 + c5 xy + c6 y 2

Standard P2 basis
ϕi = λi (2λi − 1), i = 1, 2, 3
ϕij = 4λi λj , i, j = 1, 2, 3

Extended P2 basis
ϕi = λi (2λi − 1) + 3λ1 λ2 λ3 , i = 1, 2, 3
ϕij = 4λi λj − 12λ1 λ2 λ3 , i, j = 1, 2, 3
ϕ123 = 27λ1 λ2 λ3
Barycentric coordinates in 3D

Barycentric coordinates on a tetrahedron

x = (x, y, z) 7→ {λ1 (x), λ2 (x), λ3 (x), λ4 (x)}

Properties of the barycentric coordinates

1 λi ∈ P1 (e), i = 1, 2, 3, 4

2 λi (xj ) = δij , i, j = 1, 2, 3, 4
4
P
3 λi (x) = 1 ∀x ∈ e
i=1
Barycentric coordinates in 3D

A linear polynomial in 3D has four degrees of freedom

λi ∈ P1 (e) ⇒ λi (x) = c1i + c2i x + c3i y + c4i z

At the vertices we have λi (xj ) = δij . It follows that


    
1 x1 y1 z1 c1i δ1i
 1
 x2 y2 z2  
 c2i   δ2i
=


 1 x3 y3 z3   c3i   δ3i 
1 x4 y4 z4 c4i δ4i

This is a system of 4 equations for 4 unknowns

The solution of this system are the coefficients of λi


Barycentric coordinates in 3D

Barycentric splitting
4
[ 1
e= ei , |ei (x)| = | det Ai (x)|
i=1
2

Volume fractions
|ei (x)| | det Ai (x)|
λi (x) = = , i = 1, 2, 3, 4
|e| | det A|

4
X 4
X
|ei (x)| = |e| ⇒ λi (x) = 1, x∈e
i=1 i=1
Nodal points in 3D

Vertices

x1 7→ {1, 0, 0, 0}, x2 7→ {0, 1, 0, 0}


x3 7→ {0, 0, 1, 0}, x4 7→ {0, 0, 0, 1}

Barycenters x4
e
xi + xj xi + xj + xk x134
xij = , xijk = x234
2 3 x124
x3
x1 + x2 + x3 + x4 x123
x1234 = x1
4
x2
P1 elements in 3D

Linear approximation uh |e ∈ P1 (e)


uh (x, y, z) = c1 + c2 x + c3 y + c4 z

Vertex-based basis functions


ϕ1 = λ1 , ϕ2 = λ2 , ϕ3 = λ3 , ϕ4 = λ4

Face-based basis functions


ϕ123 = 1 − 3λ4 , ϕ124 = 1 − 3λ3
ϕ134 = 1 − 3λ2 , ϕ234 = 1 − 3λ1
Local transformations

Finite difference approximations for nonuniform grids can be derived


using a global transformation to a unit interval/square/cube

In finite element methods, local basis functions are commonly


defined on a geometrically simple reference element ê

A one-to-one mapping from ê to a given mesh cell e is conveniently


defined in terms of these local basis functions

Numerical integration is performed on the reference element

Partial derivatives are transformed using the chain rule


Local transformations
n=1 n=1 n = n2 = 2 nn =
= 33
y^ y^ z^ z^
Mappingn = 1 n= n=3 x
x^ 2 1 x^ 3
3
1 ^ 4x^ 41 1
Fe : ê 7→ e y^ z^
x^ 3 1
e^ x^ 4 1
e^
0 e^ 1 e^ 0 1 e^ 1
0 e^ 1 1
0 x
0
x^1 2 x^
x^1 e^ x^2 x0^ x^ 1 x^ 2 e^x^ ^1
0 e^x^1 1 x^02 x^ x^1 1 x^ 2 0x^ 11
x^ 1 x^ 2 x^
x^1 x^2 x^ x^ 1 x^ 2 x^ x^ 1 x^ ^ x^
1y^ 2x3
1 x^ 3 Fe
y Fx^ 3e y^ z x4Fe
y^ x3 Fe
Fe y
y Fe xF
1
e z x4
z x4 e
x3
Fe Fe x3 ex3
x1 x1
x1 e x3 e x3
e e e x2
x1
x2
x1
e x1 x2 xx2 x x2 x
e x2 x2
x1 x2 x x x
x1 x2 x x y x
y
y
1D example

The barycentric coordinates defined on ê = (0, 1) are given by

ϕ̂1 (x̂) = 1 − x̂, ϕ̂2 (x̂) = x̂, x̂ ∈ ê

The linear transformation to e = (x1 , x2 ) = Fe (ê) is defined by

x = Fe (x̂) := ϕ̂1 (x̂)x1 + ϕ̂2 (x̂)x2 = x1 + x̂(x2 − x1 )

The local basis functions and derivatives are defined on ê thus:


∂ ϕ̂i ∂ϕi ∂x ∂ϕi 1 ∂ ϕ̂i
ϕi (x) = ϕ̂i (x̂), = ⇒ =
∂ x̂ ∂x ∂ x̂ ∂x x2 − x1 ∂ x̂
Generalization

A general mapping Fe : ê 7→ e is defined by


X
x = Fe (x̂) = xi ϕ̂i (x̂), x∈e
i

For linear basis functions ϕ̂i we have

Fe (x̂) = Be x̂ + be

1D : Be = x2 − x1 , be = x1
x −x x −x x1
   
2D : Be = y 2 − y 1 y 3 − y 1 , be = y1
2 1 3 1

x2 − x1 x3 − x1 x4 − x1
! !
x1
3D : Be = y2 − y1 y3 − y1 y4 − y1 , be = y1
z2 − z1 z3 − z1 z4 − z1 z1
Affine transformation

Properties of Fe (x̂) = Be x̂ + be

A node/barycenter is mapped to a node/barycenter


 
xi + xj x̂i + x̂j
xi = Fe (x̂i ), xij = = Fe = Fe (x̂ij )
2 2
 
xi + xj + xk x̂i + x̂j + x̂k
xijk = = Fe = Fe (x̂ijk )
3 3

The edges of the element e = Fe (ê) are straight


Basis functions

Definition of the basis functions


ϕi (x) = ϕ̂i (Fe−1 (x)) = ϕ̂i (x̂)
x = Fe (x̂) ∈ e, x̂ ∈ ê

Affine transformation preserves the order of ϕ̂i . We have

ϕi (xj ) = ϕ̂i (x̂j ) = δij


!
∂x ∂y
ˆ ϕ̂i = J∇ϕi ,
∇ J= ∂ x̂
∂x
∂ x̂
∂y
∂ ŷ ∂ ŷ

The Jacobian matrix J must be nonsingular for Fe−1 to exist


Calculation of gradients

ˆ ϕ̂i , where
The linear system J∇ϕi = ∇
 T  T
∂ϕi ∂ϕi ˆ ϕ̂i = ∂ ϕ̂i ∂ ϕ̂i
∇ϕi = , , ∇ ,
∂x ∂y ∂ x̂ ∂ ŷ

can be solved using Cramer’s rule


 
∂ϕi 1 ∂ ϕ̂i ∂y ∂ ϕ̂i ∂y
= −
∂x det J ∂ x̂ ∂ ŷ ∂ ŷ ∂ x̂
 
∂ϕi 1 ∂ ϕ̂i ∂x ∂ ϕ̂i ∂x
= −
∂y det J ∂ ŷ ∂ x̂ ∂ x̂ ∂ ŷ

In contrast to finite differences, there no need to transform second


derivatives in finite element methods for 2nd order PDEs
Mappings and elements

Let p be the polynomial degree for the solution uh ∈ Vh

Let q be the polynomial degree for the mapping Fe

The finite element approximation is called

subparametric if p > q

isoparametric if p = q

superparametric if p < q

Accurate approximation of curvilinear boundaries can be


easily achieved using mappings of degree q > 1
Isoparametric elements

Desired properties

e = Fe (ê), x̂i 7→ xi , x̂ij 7→ xij , x̂123 7→ x123

Extended P2 mapping
3
X X
x = Fe (x̂) = xi ϕ̂i (x̂) + xij ϕ̂ij (x̂) + x123 ϕ̂123 (x̂)
i=1 ij

y^ y
Fe e
1
e^
1
2

0 1
2
1 x^ 0 x
Bilinear elements

The space Qk (e) consists of functions which are polynomials of


degree k w.r.t. each independent variable

Qk (e) = span{xk11 xk22 . . . xknn }

0 ≤ ki ≤ k, i = 1, . . . , n

A bilinear shape function uh |e ∈ Q1 (e) is defined by

uh (x, y) = c1 + c2 x + c3 y + c4 xy, (x, y) ∈ e

Bilinear basis functions are defined as tensor products of

λ1 (t) = 1 − t, λ2 (t) = t, t ∈ [0, 1]


Bilinear elements

Q1 basis functions ϕi (x) = ϕ̂i (Fe−1 (x)), x∈e

ϕ̂1 (x̂) = λ1 (x̂)λ1 (ŷ), ϕ̂3 (x̂) = λ2 (x̂)λ2 (ŷ)


ϕ̂2 (x̂) = λ2 (x̂)λ1 (ŷ), ϕ̂4 (x̂) = λ1 (x̂)λ2 (ŷ)

4
X
x = Fe (x̂) = xi ϕ̂i (x̂), ϕi (x) = ϕ̂i (Fe−1 (x))
i=1

y^ y x3
x4
1
x^ 4 x^ 3 e
Fe
e^ x2
x^ 1 x^ 2 x1
0 1 x^ 0 x
Biquadratic elements

A biquadratic shape function uh |e ∈ Q2 (e) is a polynomial of


degree 2 w.r.t. the independent variables x and y

uh (x, y) = c1 + c2 x + c3 y + c4 xy + c5 x2 + c6 y 2

+ c7 x2 y + c8 xy 2 + c9 x2 y 2 , (x, y) ∈ e

Biquadratic basis functions are defined as tensor products of

θ1 (t) = (1 − t)(1 − 2t), θ2 (t) = t(1 − 2t)

θ3 (t) = 4t(1 − t), t ∈ [0, 1]


Biquadratic elements

Q2 basis functions ϕi (x) = ϕ̂i (Fe−1 (x)), x∈e

ϕ̂1 (x̂) = θ1 (x̂)θ1 (ŷ), ϕ̂4 (x̂) = θ1 (x̂)θ2 (ŷ), ϕ̂7 (x̂) = θ3 (x̂)θ2 (ŷ)
ϕ̂2 (x̂) = θ2 (x̂)θ1 (ŷ), ϕ̂5 (x̂) = θ3 (x̂)θ1 (ŷ), ϕ̂8 (x̂) = θ1 (x̂)θ3 (ŷ)
ϕ̂3 (x̂) = θ2 (x̂)θ2 (ŷ), ϕ̂6 (x̂) = θ2 (x̂)θ3 (ŷ), ϕ̂9 (x̂) = θ3 (x̂)θ3 (ŷ)

Transformation: subparametric (bilinear) or isoparametric

e Fe1 e^ Fe2 e
y x7 x3 y^ y
x4 x4 x7 x3
1
x6 x^ 4 x^ 7 x^ 3 x6
x8 x9 x8 x9
x^ 8 x^ x^ 6
x1 x5 x2 9
x^ 1 x^ 5 x^ 2 x1 x5
x2

0 x 0 1 x^ 0 x
Trilinear elements

Q1 basis functions ϕi (x) = ϕ̂i (Fe−1 (x)), x∈e

ϕ̂1 (x̂) = λ1 (x̂)λ1 (ŷ)λ1 (ẑ), ϕ̂5 (x̂) = λ1 (x̂)λ1 (ŷ)λ2 (ẑ)
ϕ̂2 (x̂) = λ2 (x̂)λ1 (ŷ)λ1 (ẑ), ϕ̂6 (x̂) = λ2 (x̂)λ1 (ŷ)λ2 (ẑ)
ϕ̂3 (x̂) = λ2 (x̂)λ2 (ŷ)λ1 (ẑ), ϕ̂7 (x̂) = λ2 (x̂)λ2 (ŷ)λ2 (ẑ)
ϕ̂4 (x̂) = λ1 (x̂)λ2 (ŷ)λ1 (ẑ), ϕ̂8 (x̂) = λ1 (x̂)λ2 (ŷ)λ2 (ẑ)

z^ e^ z e
x^ 4 x^ 3 x4 x3
1 x8
x = Fe (x̂) Fe x7
x^ 8 x^ 7 x1 x2
8
X x^ 1 x^ 2 x5 x6
= xi ϕ̂i (x̂)
0 1 x^ 0 x
i=1
x^ 5 x^ 6
1
y^ y
Implementation of FEM

Volume and surface integrals are calculated element-by-element


using numerical quadrature of sufficiently high order

Computations are commonly performed on the reference element


using the necessary transformations of variables

The matrix and right-hand side of the global linear system are
assembled from element matrices and vectors

Nonzero entries of sparse matrices are stored in one-dimensional


arrays to reduce memory requirements
Poisson equation in 1D

Dirichlet-Neumann problem
 ∂2u
− ∂x2 = f in (0, 1)
u(0) = 0, ∂u
∂x (1) = 0

Variational formulation 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

N
X N
X
FEM discretization uh = uj ϕj ∈ Vh , vh = vj ϕj ∈ Vh
j=1 j=1
Poisson equation in 1D

Element contributions
N
X N
X
aij = a(ϕj , ϕi ) = akij , bi = b(ϕi ) = bki
k=1 k=1

Z Z
∂ϕj ∂ϕi
akij = dx, bki = f ϕi dx
ek ∂x ∂x ek

Local basis functions ek = [xk−1 , xk ], i, j ∈ {k − 1, k}


xk − x x − xk−1
ϕk−1 = , ϕk = , ∆xk = xk − xk−1
∆xk ∆xk
Poisson equation in 1D

Element contribution to the stiffness matrix A


Z ∂ϕk−1 ∂ϕk−1 ∂ϕk−1 ∂ϕk
!
Ake = ∂x ∂x
∂ϕk ∂ϕk−1
∂x ∂x
∂ϕk ∂ϕk
dx
ek ∂x ∂x ∂x ∂x

 
∂ϕk−1 1 ∂ϕk 1 1 −1
=− =− ⇒ Ake =
∂x ∆xk ∂x ∆xk −1 1

Element contribution to the load vector b


Z  
ϕk−1
bke = f dx
ek ϕk
Poisson equation in 1D

Insertion of element contributions


   
· · · · ·
· a k−1 k−1 a k−1 k ·   bk−1 
PkT Ake Pk =  Pk bke = 

, 
 · ak k−1 ak k ·   bk 
· · · · ·

 
0 ... 0 1 0 0 ... 0
Pk =
0 ... 0 0 1 0 ... 0

Assembly of the global system


X X
Au = b, A= PkT Ake Pk , b= PkT bke
k k
Poisson equation in 1D

Example N = 3, ∆x = 31 , f ≡ 1
   
k 1 1 −1 ∆x 1
Ae = , bke =
∆x −1 1 2 1

'0 '1 '2 '3

e1 e2 e3
0 1
x0 x1 x2 x3
Poisson equation in 1D

   
1 −1 0 0 0 0 0 0
1  −1 + 1 
1 0 0   0 1 −1 0 
A =  
∆x  0 0 0 0  ∆x  0 −1 1 0 
0 0 0 0 0 0 0 0
   
0 0 0 0 1 −1 0 0
1 
 0 0 0 0  1  −1 2 −1 0 
+ =  
∆x  0 0 1 −1  ∆x  0 −1 2 −1 
0 0 −1 1 0 0 −1 1
       
1 0 0 1
∆x 
 1  + ∆x 
 
 + ∆x 
1  
 = ∆x 
0   2 
b= 
2  0  2  1  2  1  2  2 
0 0 1 1
Poisson equation in 1D

Replacing the first equation by the Dirichlet boundary condition


u0 = 0, we obtain the reduced system
    
2 −1 0 u1 1
1 
−1 2 −1   u2  =  1 
(∆x)2 1
0 −1 1 u3 2

The unique solution of the discrete problem is

u1 = 52 (∆x)2 , u2 = 4(∆x)2

u3 = 92 (∆x)2 , ∆x = 1
3
P2 discretization

Linear system i = 1, . . . , 2N
2N N Z N Z
X X ∂ϕi ∂ϕj X
uj dx = f ϕi dx
j=1 k=1 ek ∂x ∂x k=1ek

P2 basis functions ek = [x2k−2 , x2k ], x 7→ {λ1 (x), λ2 (x)}

ϕ2k−2 = λ1 (2λ1 − 1), ϕ2k−1 = 4λ1 λ2 , ϕ2k = λ2 (2λ2 − 1)

∂ϕ2k−2 1 −1 ∂ϕ2k−1 −λ2 ∂ϕ2k 4λ2 −1


∂x = − 4λ∆x , ∂x = 4 λ1∆x , ∂x = ∆x
P2 discretization

 ∂ϕ2k−2 ∂ϕ2k−2 ∂ϕ2k−2 ∂ϕ2k−1 ∂ϕ2k−2 ∂ϕ2k 


Z ∂x ∂x ∂x ∂x ∂x ∂x
∂ϕ2k−1 ∂ϕ2k−2 ∂ϕ2k−1 ∂ϕ2k−1 ∂ϕ2k−1 ∂ϕ2k
Ake
 
=   dx
 ∂x ∂x ∂x ∂x ∂x ∂x 
ek
∂ϕ2k ∂ϕ2k−2 ∂ϕ2k ∂ϕ2k−1 ∂ϕ2k ∂ϕ2k
∂x ∂x ∂x ∂x ∂x ∂x

 
7 −8 1 N
1  X
= −8 16 −8  , A= PkT Ake Pk
3∆x
1 −8 7 k=1

 
Z f ϕ2k−2 N
X
bke =  f ϕ2k−1  dx, be = Pk bke
ek f ϕ2k k=1
Dirichlet boundary conditions

In practice, the linear system is assembled for the pure Neumann


problem (using ϕi for Dirichlet boundary nodes as well)
    
a00 a01 . . . a0N u0 b0
 a10 a11 . . . a1N   u1   b1 
 ·  =  · 
    
 ...
aN 0 aN 1 . . . aN N uN bN

Then the matrix and right-hand side of this extended system are
modified to take the boundary condition u0 = g into account

The straightforward approach is elimination of the first equation


and insertion of u0 = g in the remaining equations
Dirichlet boundary conditions

The reduced linear system consists of N − 1 equations


      
a11 . . . a1N u1 b1 a10
 ...  ·  =  ·  −  · g
aN 1 . . . a N N uN bN aN 0

A symmetric stiffness matrix remains symmetric

Elimination of rows and columns changes the size of the


matrix and requires significant programming effort

Alternative: solution of an extended linear system


Dirichlet boundary conditions

Replacing the first equation of the linear system by the Dirichlet


boundary condition u0 = g, we solve
   
1 0 ... 0 u0 g
 a10 a11 . . . a1N   u1
   b1 
 = 
 ...  ·   · 
aN 0 aN 1 . . . aN N uN bN

The resulting stiffness matrix is nonsymmetric

The dimensions are the same as for Neumann BC


Dirichlet boundary conditions

A third possibility is to add γ(u0 − g) where γ  1 is a large penalty


parameter, to the first equation of the extended system
    
a00 + γ a01 . . . a0N u0 b1 + γg
 a10 a11 . . . a1N    u1  =  b1
   
 
 ...  ·   · 
aN 0 aN 1 . . . aN N uN bN

A symmetric stiffness matrix remains symmetric

The dimensions are the same as for Neumann BC


Other boundary conditions

Neumann boundary conditions


Z
∂u
(1) = g2 ⇒ bN = f ϕN dx + g2
∂x eN

Robin boundary conditions


Z
∂u
αu(1) + (1) = g3 ⇒ bN = f ϕN dx + g3
∂x eN
Z
∂ϕj ∂ϕi
aN N = dx + α
eN ∂x ∂x

You might also like