0% found this document useful (0 votes)
71 views

Pde Fem

The document provides an introduction to finite element methods. It discusses the main ingredients of FEM, including weak forms and weak solutions, test and shape functions, and assembling the system of equations. It also provides an example of the 1D Poisson problem, including developing the weak form and stiffness matrix using linear nodal basis functions. The document is intended to introduce students to finite element methods during a scientific computing course.

Uploaded by

Kartik Bali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Pde Fem

The document provides an introduction to finite element methods. It discusses the main ingredients of FEM, including weak forms and weak solutions, test and shape functions, and assembling the system of equations. It also provides an example of the 1D Poisson problem, including developing the weak form and stiffness matrix using linear nodal basis functions. The document is intended to introduce students to finite element methods during a scientific computing course.

Uploaded by

Kartik Bali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Scientific Computing I

Module 7: An Introduction to Finite Element Methods

Michael Bader
Lehrstuhl Informatik V
Winter 2021/2022
Part I: Introduction to Finite Element Methods

The Model Problem

FEM Main Ingredients


Weak Forms and Weak Solutions
Test and Shape Functions
Assembling the System of Equations

Example Problem: 1D Poisson


Example Problem, Weak Form and Nodal Basis
Stiffness Matrix for Linear Nodal Basis Functions

A Road to Theory

Time-Dependent Problems

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 2
The Model Problem: Poisson Equation

• 2D Poisson Equation on unit square:

∂2 ∂2
− 2
u(x, y ) − u(x, y) = f (x, y ) in Ω = (0, 1)2
∂x ∂y 2
• Dirichlet boundary conditions:

u(x, y) = g(x, y ) on ∂Ω

• for general operator L instead of ∆: similar concept


• new for FEM: compute a function to approximate u(x, y )
(instead of approximate values at certain grid points or in grid cells)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 3
Finite Elements – Main Ingredients
1. solve weak form of PDE to reduce regularity properties
Z Z
00 00
−u = f −→ − vu dx = vf dx for “all” v
Ω Ω

→ allows additional weak solutions (esp. after integration by parts)


2. compute a function as numerical solution
→ search in a function space Wh :
X
uh = uj ϕj (x), span{ϕ1 , . . . , ϕJ } = Wh
j

3. find weak solutions of simple form:


for example piecewise linear functions and choose basis functions with
local support (“hat functions”)
→ leads to system of linear equations

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 4
Weak Form and Weak Solutions
Motivation:
• an approximate solution (i.e., function) will likely not satisfy the PDE
• we thus need to “weaken” the requirements on the approximating function

The weak form is obtained via 3 steps: −u 00 = f


1. multiply with a test function v ↓
vu 00 dx
R R
(from a certain function space V ) − Ω
= Ω
vf dx for all v

2. integrate over the domain


⇒ integral over function product equiv. to scalar product on functions
3. (optional) perform “integration by parts”
⇒ “transfers” derivatives from solution u to test functions v
⇒ reduces smoothness requirements on u

⇒ “real solution” u also solves the weak form


however, additional, weak solutions are now allowed

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 5
Example: Weak Form of the Poisson Equation
• Poisson equation with Dirichlet conditions:

−∆u = f in Ω, u = 0 on δΩ

• weak form: Z Z
− ∆u · v dΩ = f · v dΩ ∀v ∈ V
Ω Ω

• apply divergence theorem:


Z Z Z
− ∆u · v dΩ = ∇u · ∇v dΩ − ∇u · v ds
Ω Ω ∂Ω

• choose functions v such that v = 0 on ∂Ω:


Z Z
∇u · ∇v dΩ = f · v dΩ ∀v ∈ V
Ω Ω

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 6
Example: Weak Form of the Poisson Equation (2)

• Poisson equation with Dirichlet conditions:

−∆u = f in Ω, u = 0 on δΩ

• transformed into weak form:


Z Z
∇u · ∇v dΩ = f · v dΩ ∀v ∈ V
Ω Ω

• weaker requirements for a solution u:


twice differentiabale → first derivative integrable
• h∇u, ∇v i a bilinear form (i.e. depends on 2 functions u and v );
often written as:
a (u, v ) = hf , v i ∀v ∈ V

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 7
A Bit More Motivation for the Weak Form
FEM and the Residual Equation
!
• for the PDE −∆u = f , the residual is defined as r (x) := ∆u(x) + f (x) = 0
• in the weak form (multiply with test function an integrate) we obtain
Z Z

v (x) r (x) = v (x) ∆u(x) + f (x) dx = 0 for all v
Z
• remember that f (x)g(x) dx is the standard scalar product on functions
• hence: the residual of the weak solution has to be orthogonal to all test functions
(and recall all connections between “orthogonal” and “shortest distance”)

FEM vs. Linear Algebra


• consider the system of linear equations Ax = b
• now imagine a “weak form” with scalar product: demand v T Ax = v T b for all v
• if v = eT = (0, . . . 0, 1, 0 . . . , 0), then eT Ax = eT b tests a single equation (i-th row)
i i i
• if you use all unit vectors ei as test functions, only an exact x is also a weak solution
• you may use fewer test functions (and maybe different ones) to allow “weak” solutions
• for the PDE weak form, you cannot use all test functions: these would be infinitely many

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 8
Test and Shape Functions
• search for solution functions uh of the form
X
uh = uj ϕj (x)
j

the ϕj (x) are typically called shape or ansatz functions


• the basis functions ϕj (x) build a vector space
(i.e., a function space) Wh

span{ϕ1 , . . . , ϕJ } = Wh

• insert into weak formulation


Z X  Z
∇ uj ϕj (x) · ∇v dx = f · v dx ∀v ∈ V
j

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 9
Test and Shape Functions (2)

• choose a basis {ψi } of a test space Vh ⊂ V


• then: if all basis functions ψi satisfy
Z X  Z
∇ uj ϕj (x) · ∇ψi dx = f · ψi dx ∀ψi
j
P
then all v = i vi ψi (x) ∈ Vh satisfy the equation
• the {ψi } are therefore often called test functions
• we obtain a system of equations for unknowns uj :
one equation for each test function ψi
• Vh is often chosen to be identical to Wh (Ritz-Galerkin method)
→ we then have as many equations as unknowns

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 10
Example: Nodal Basis
1

 1
h (x − xi−1 ) xi−1 < x < xi 0,8

 0,6
1
h (xi+1 − x)
ϕi (x) := xi < x < xi+1 0,4

0 otherwise
 0,2

0
0 0,2 0,4 0,6 0,8 1
x

f(x)
3 u(x) 3 u(x)=iii(x)

2 2

1 1

0 0
0 xi 1 0 1
h3=2-3

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 11
Assembling the System of Equations
• start from system of equations
Z X  Z
∇ uj ϕj (x) · ∇ψi dx = f · ψi dx ∀ψi
j

• ∇ and
R
are linear operators ⇒ rewrite into canonical form:
XZ  Z
∇ϕj (x) · ∇ψi (x) dx uj = f · ψi dx ∀ψi
j | {z } | {z }
=:Aij =:fi

• aim: make matrix A sparse → most Aij = 0


• approach: use local basis functions on a discretisation grid
• ψj , ϕj zero everywhere except in grid cells adjacent to grid point xj
• Aij = 0, if ψi and ϕj don’t overlap

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 12
Example Problem: 1D Poisson
• in 1D: −u 00 (x) = f (x) on Ω = (0, 1),
hom. Dirichlet boundary cond.: u(0) = u(1) = 0
• weak form:
Z 1 Z 1
0 0
u (x) · v (x) dx = f (x) · v (x) dx ∀v ∈ V
0 0

• computational grid:
xi = ih, (for i = 1, . . . , n − 1); mesh size h = 1/n
• Vh = Wh : piecewise linear functions (on intervals [xi , xi+1 ])
• insert uh = j uj ϕj (x) into weak form:
P

Z 1X Z 1
0 0
uj ϕj (x) · ϕi (x) dx = f (x) · ϕi (x) dx ∀i = 1, . . . , n − 1
0 j 0
| {z }
= j uj 01 ϕ0j (x)·ϕ0i (x) dx
P R

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 13
Nodal Basis
 1

 h (x − xi−1 ) xi−1 < x < xi
1
h (xi+1 − x)
ϕi (x) := xi < x < xi+1

0 otherwise

0,8

0,6

0,4

0,2

0
0 0,2 0,4 0,6 0,8 1
x
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 14
Nodal Basis – Derivatives and Integrals
Compute derivative of basis functions:
 1
 h
 xi−1 < x < xi
0
ϕi (x) := − h1 xi < x < xi+1

0 otherwise

Compute integrals of weak form:


Z Z xi Z xi+1   
1 1 1 1 2
• ϕ0i (x)ϕ0i (x) dx = · dx + − − dx =
xi−1 h h xi h h h
Z Z xi+1  
1 1 1
• ϕ0i (x)ϕ0i+1 (x) dx = − dx = −
xi h h h
Z
0 0 1
• ϕi (x)ϕi−1 (x) dx = − (same computation)
h
Z
• ϕ0i (x)ϕ0j (x) dx = 0 for all j 6= i, i ± 1
(supports of basis functions do not overlap!)
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 15
Resulting System of Equations
• resulting system matrix A (often called “stiffness” matrix):
 
2 −1
 .. 
1 −1 2 . 

h .. .. 
. . −1 
−1 2

• right hand sides (assume f (x) = α ∈ R):


Z 1 Z 1
f (x) · ϕi (x) dx = α · ϕi (x) dx = αh
0 0

• system of equations very similar to finite differences


• note: for other operators L: same approach!
• exercise: compute right-hand-side vector, if f (x) := fj φj (x)
P

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 16
Outlook: A Road to Theory

• requires concepts for convergence of a sequence of functions


(that better and better approximate the solution)
• weak formulation is equivalent to variational approach:
solution u minimises an energy functional
• best approximation property:

u − uhFE ≤ inf ku − v ka

a v ∈Vh

in terms of the norm induced by the bilinear form a (energy norm)


• thus: error bounded by interpolation error
(in energy norm)

(details in lecture Numerical Programming II, e.g.)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 17
Time-Dependent Problems

Example: 1D Heat Equation


• ut = uxx + f on domain Ω = [0, 1] for t ∈ [0, tend ]
• formulate weak form
Z Z Z
ut · v dx = uxx · v dx + f · v dx
Z  Z Z

∂t u · v dx = uxx · v dx + f · v dx

• apply discretisation in space using finite element method:



∂t (Mh uh ) = Ah uh + fh

Mh : mass matrix, Ah : stiffness matrix, uh = uh (t)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 18
Time-Dependent Problems (2)
Solve a system of ordinary differential equations:
• after spatial discretisation (Mh constant):

∂t Mh (uh ) = Ah uh + fh
• uh a vector of time-dependent coefficient functions:
T
uh = (u1 (t), . . . , ui (t), . . . , un (t))
 
• e.g., with forward Euler: Mh u(n+1)
h − uh
(n) (n)
= Ah uh + fh

Outlook: how to deal with inversion of mass matrix?


• approximate Mh by a simpler matrix (diagonal matrix, e.g.)
→ mass lumping
• choose orthogonal basis functions → mass matrix diagonal
• choose entirely element-local basis functions (“discontinuous
Galerkin”) → mass matrix block-diagonal
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 19
Part II: Implementation of Finite Element Methods

Element Stiffness Matrices


Element-Oriented Computation of Stiffness Matrices
Example: 1D Poisson
Example: 2D Poisson
Typical Workflow

Reference Elements and Stiffness Matrices


Element-Oriented Computation on Unstructured Meshes
Accumulation of Global Stiffness Matrix
Simple Example: 1D Poisson
Outlook: Extension to 2D and 3D
Outlook: Further Components and Aspects of FEM

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 20
Element Stiffness Matrices
Finite Element methods are often used for complicated meshes:

Questions:
• how to set up the system of equations efficiently?
• is it possible to use stencil notation??
⇒ Switch to element stiffness matrices!
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 21
Element Stiffness Matrices (2)
• for discretisation → domain Ω subdivided into finite elements Ω(k) :

Ω = Ω(1) ∪ Ω(2) ∪ · · · ∪ Ω(n)

• observation: basis functions are defined element-wisely


Zb Zc Zb
• for computation of integrals, use: f (x) dx = f (x) dx + f (x) dx
a a c
• element-wise evaluation of the integrals:
Z XZ
∇u · ∇v dx = ∇u · ∇v dx
Ω k Ω(k )
Z XZ
f · v dx = f · v dx
Ω k Ω(k )

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 22
Element Stiffness Matrices (3)
• leads to local stiffness matrices A(k ) for each element:
Z XZ
∇φj · ∇φi dx = ∇φj · ∇φi dx
Ω k
Ω(k )
| {z } | {z }
=:Aij =:Aij
(k)

• and respective element systems:


Z
(k)
A(k) x = b(k) with bi := f · φi dx
Ω(k )

• accumulate to obtain global system:


X X
A(k) x = b(k )
k k
| {z }
=:A

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 23
Element Stiffness Matrices (4)

Some comments on notation:


• assume: 1D problem, n elements (i.e. intervals), linear nodal basis
• in each element only two basis functions are non-zero!
• hence, almost all A(k)
ij are zero:
Z
(k)
Aij = ∇φj · ∇φi dx
Ω(k)

• only 2 × 2 elements of A(k ) are non-zero


• therefore convention to omit a-priori zero columns/rows
⇒ leaves only unknowns that are in Ω(k)
b (k ) (element stiffness matrix)
⇒ notation: write this matrix as A

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 24
Example: 1D Poisson
• Ω = [0, 1] splitted into Ω(k) = [xk , xk +1 ]
• nodal basis; leads to element stiffness matrix:
 
b (k) = 1 1 −1
A h −1 1

• consider case with only three unknowns (i.e., 3 basis functions):


   
1 −1 0 0 0 0
A(1) + A(2) = h1  −1 1 0  + h1  0 1 −1 
0 0 0 0 −1 1

• in stencil notation:
1 1 1
h [ −1 1 0] + h[0 1 − 1] → h [ −1 2 − 1]

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 25
Example: 2D Poisson
• −∆u = f on domain Ω = [0, 1]2
• splitted into Ω(i,j) = [xi , xi+1 ] × [xj , xj+1 ]
• bilinear basis functions
ϕij (x, y ) = ϕi (x)ϕj (y )
• “pagoda” functions

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 26
Example: 2D Poisson (2)
• leads to element stiffness matrix:

2 − 12 − 12 −1
 
 −1 2 −1 − 12 
Ab (k) = 
 21

− 12 

 −2 −1 2
−1 − 12 − 12 2

• accumulation leads to 9-point stencil


 
−1 −1 −1
 −1 8 −1 
 

−1 −1 −1

• exercise at home: compute Ab (k) and assemble global matrix


(and compare with stencil)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 27
Typical Workflow
1. choose grid (essentially the Ω(k) ):
• quadratic or cubic cells
• triangles (structured, unstructured)
• tetrahedra, etc.
2. set up basis functions for each element Ω(k) ;
for example, at all nodes xi ∈ Ω(k )

ϕi (xi ) = 1
ϕi (xj ) = 0 for all j 6= i

3. for element stiffness matrix, compute all


Z
b (k) =
A ∇ϕj · ∇ϕi dx
ij
Ω(k)

4. accumulate global stiffness matrix A (and rhs)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 28
Element-Oriented Computation on Unstructured
Meshes
Recall: FEM often used for complicated meshes:

(Re-)computation of element matrices required for each element?


• left grid: no (up to scaling with mesh size)
• right grid: yes?
⇒ requires a closer look at the computation of element matrices
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 29
Element Stiffness Matrices – Notation Revisited
• recall notation for local stiffness matrices A(k )
ij :
Z
(k)
Aij = ∇φj (x) · ∇φi (x) dx
Ω(k )

⇒ which basis functions φi , φj belong to element k?


• switch to element-local numbering of basis functions:
Z
(k)
Aµν =
b ∇φ(k) (k )
ν (x) · ∇φµ (x) dx
Ω(k)

(k) (k)
where φµ (x) = φi (x) and φν = φj (x) in Ω(k )
• requires a mapping φ(k) (k )
µ → φi (and φν → φj ),
i.e., a function ι(k) with i = ι(k) (µ) and j = ι(k) (ν)

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 30
Accumulation of Global Stiffness Matrix
• note the different dimensions of A(k) and A b (k) :
(k ) (k )
A omits zero rows and columns of A
b
• formulated via a projection matrix:

T (k ) 1 if i = ι(k) (µ)
A(k) = P (k) b (k ) P (k)
A with Pµ,i :=
0 otherwise
• recall computation of global stiffness matrix:
X X T (k ) (k )
A := A(k ) = P (k ) Ab P
k k

• hence, for each element:


b (k)
1. compute element stiffness matrix A
2. determine position of matrix elements Ab (k ) in A(k)
(k)
→ based on mapping ι (µ)
T (k ) (k)
3. add non-zero elements of A(k) = P (k) A b P to global matrix A

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 31
Element Stiffness Matrices and Meshes
Recall our initial question:

(Re-)computation of A b (k ) required for each element?


• left grid: no (up to scaling with mesh size)
• right grid: yes?
b (k) via reference elements
⇒ efficient computation of A
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 32
Simple Example: 1D Poisson
Consider FEM for 1D Poisson on an adaptive grid:
• grid points given as xk , not necessarily equidistant;
define elements Ω(k) = [xk , xk+1 ]
• piecewise linear basis functions (“hat functions”) φk (x);
φk (x) non-zero only on two elements: Ω(k−1) and Ω(k)
• mapping local to global indices: ι(k) (1) := k and ι(k) (2) := k + 1
• wanted: Ab (k) ∂ (k) (k)
φν (x) ∂ φµ (x) dx for every element k
R
µ,ν := (k) Ω ∂x ∂x

Introduce reference element Ωref with linear basis functions Φµ :

Φ1 (ξ) := ξ Φ2 (ξ) := 1 − ξ ξ ∈ Ωref := [0, 1]

and a mapping x = χ(k ) (ξ) for each Ω(k) defined as

χ(k ) (ξ) := xk + ξ(xk+1 − xk )


(k) (k ) 
such that φµ (x) = φµ χ(k) (ξ) := Φµ (ξ) for x ∈ Ω(k) .
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 33
Simple Example: 1D Poisson (2)
We need to compute
(k )
xk +1
Z χZ (1)
b (k) := ∂ (k) ∂ ∂ (k) ∂
A µ,ν φν (x) φ(k) (x) dx = φν (x) φ(k) (x) dx
∂x ∂x µ ∂x ∂x µ
xk χ(k ) (0)

g(b) Rb
f (g(t))g 0 (t) dt
R
Compare integration by substitution: f (x) dx =
g(a) a

Z1
b (k) = ∂ (k) (k)  ∂ (k ) (k) 
A µ,ν φ χ (ξ) φµ χ (ξ) (xk +1 − xk ) dξ.
∂x | ν {z } ∂x | {z }
0 =Φµ (ξ) =Φν (ξ)

Note that:

• ∂ξ χk (ξ) = (xk +1 − xk ) corresponds to the factor g 0 (t) in the substitution
rule
• we still have to deal with the partial derivatives in x
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 34
Simple Example: 1D Poisson (3)
∂f ∂f ∂g
We require the chain rule, ∂x = ∂g ∂x , to obtain:
∂ (k) (k)  ∂ ∂ ∂ξ
φµ χ (ξ) = Φµ (ξ) = Φµ (ξ)
∂x ∂x ∂ξ ∂x
x − x k
As x = χ(k) (ξ) := xk + ξ(xk+1 − xk ), we have ξ = and thus:
xk+1 − xk
∂ ∂ξ ∂ 1
Φµ (ξ) = Φµ (ξ)
∂ξ ∂x ∂ξ xk+1 − xk
Finally, we get:
Z1
b (k) = ∂ (k ) (k)  ∂ (k) (k ) 
A µ,ν φ χ (ξ) φ χ (ξ) (xk+1 − xk ) dξ
∂x ν ∂x µ
0
Z1
∂ ∂ 1
= Φν (ξ) Φµ (ξ) (xk+1 − xk ) dξ.
∂ξ ∂ξ (xk +1 − xk )2
0
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 35
Simple Example: 1D Poisson (4)
Altogether, element stiffness matrices are computed as:
Z1
b (k) = 1 ∂ ∂
A µ,ν Φν (ξ) Φµ (ξ) dξ
xk+1 − xk ∂ξ ∂ξ
0

With Φ1 (ξ) = ξ and Φ2 (ξ) = 1 − ξ, we obtain that


 
b (k) = 1 1 −1
A
xk+1 − xk −1 1
Observations:
• the integral values only depend on the reference element Ωref = [0, 1] and
the reference basis functions Φµ , Φν
• all other element matrices are obtained by simple scaling
• we did not use that Φµ , Φν are linear functions;
same computation for more complicated basis functions!
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 36
Outlook: Extension to 2D and 3D
For 2D, 3D, etc., we require the multidimensional substitution rule:
Z Z
f (x, y, z) dΩ = f (x(ξ, η, ζ), y (ξ, η, ζ), z(ξ, η, ζ)) |J | dξ dη dζ
Ω(k ) Ωref

where |J | is the determinant of the Jacobian:


∂x ∂x ∂x

∂ξ ∂η ∂ζ
|J | = ∂y ∂y ∂y


∂ξ ∂η ∂ζ
∂z ∂z ∂z

∂ξ ∂η ∂ζ

and also the multidimensional chain rule.


Result:
• similar, element-wise computation of stiffness matrices via reference
elements
• |J | instead of factor x 1−x ; more complicated, in general
k +1 k

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 37
Outlook: Automatised Finite Element Assembly
Example: FeniCS Project, https://fenicsproject.org/ Numerical Programming 2

Compute a FEM-Solution of the 2D Poisson Equation:

from fenics import *


# Create mesh and define function space
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, ’P’, 1)
# Define boundary condition (omitted)

# Define variational problem


u = TrialFunction(V)
v = TestFunction(V)
f = Constant(-6.0)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
# Compute solution Source: https://fenicsproject.org/pub/
u = Function(V) tutorial/html/._ftut1004.html#___sec19
solve(a == L, u, bc)
Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 38
Outlook: Further Components and Aspects of FEM
Additional components and “features” of Finite Element Methods:
• mesh generation:
structured/unstructured meshes consisting of triangles, tetrahedra,
rectangles, cuboids, quadrilaterals, hexahedrals, prisms, . . .
• higher-order basis functions:
polynomials of higher degree in various dimensions; “nodal” vs. “modal”
basis functions, “spectral” elements, . . .
• quadrature rules for integration:
Gaussian quadrature, e.g., to compute integrals of weak forms;
resp. choice of quadrature points for certain elements?
• solving the system of equations:
e.g., set up a global system of equations explicitly, or work directly on
element representation?
. . . and many more . . .

Michael Bader | Scientific Computing I | Introduction to Finite Element Methods | Winter 2021/2022 39

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy