You are on page 1of 49

Introduction to Finite Element Method

1D Steady State Conservation Laws

Dr. Aamer Haque


http://math.iit.edu/~ahaque6
ahaque7@iit.edu

Illinois Institute of Technology


July 14, 2009
Outline
1D Steady State Conservation Laws
1D Elliptic Equations
Variational/Weak Form
Minimization of Functionals
Galerkin Finite Element Method
Formulation
Basis/shape functions
Element assembly
Solution
Post-processing
Application
Higher order
1D Steady State Conservation Laws

To derive 1D steady state conservation laws, we need only the following:

Flux Conservation

b
b a=a f s x dx

Constitutive Law

d
x=k x u x
dx
Physics & Engineering Examples
Physical Conservation State Flux Material Source Constitutive
Problem Law Variable u Modulus k f s
Law

Deformation Equilibrium Displacement Stress Young's Body Hooke's


of elastic of forces modulus forces law
bar

Heat Conservation Temperature Heat flux Thermal Heat Fourier's


conduction of energy conductivity sources law
in a rod

Fluid flow Conservation Velocity Shear stress Viscosity Body Stoke's


of linear forces law
momentum

Electrostatics Conservation Electric Electric Dialectric Charge Coulomb's


of electric flux potential flux permittivity law

Flow through Conservation Hydraulic Flow Permeability Fluid Darcy's


porous media of mass head rate source Law

Table found on page 44 of Finite Elements, An Introduction, Vol 1, Becker, Carey & Oden, 1981
1D Model
f xx

f s x

k 1 x k 2 x

1 2 3 4
x 0=0 x 1= x k x 2 =x x 3= x f x 4 =L

Discontinuities in data:
Material modulus

Point source

= i i =[0, L] Source function


Continuous Regions Flux Relation

f s

a k b

a x b

b
b a=a f s d
b
lim b x blim a x a=lim a x , b x a f s d =0
+ - - +

x =0
Continuous Regions
Differential Relation
f s

a k b

a x b

Mean b
Value b a=a f s d = f s ba a , b
Theorem
b a
lim a x , b x
- + =lim a x , b x f s
- +
ba

d
x= f s x
dx
Discontinuous Material Modulus

f s x

a k 1 x k 2 x b

a xk b

b
b a=a f s x dx
b
lim b x blim a x a=lim a x
+
k
-
k
-
k , b x +k a f s x dx=0

x k =0
Dirac Delta Function

Is NOT a function of x!

Many physics texts list mathematically erroneous definitions and


properties of the Dirac delta function. They even perform operations
on this function as if it was an ordinary real-valued function.


x dx=1

x=
{if x=0
0 if x0 }
Distributions
A distribution or functional maps a function to a real number

: C 0
A functional can be defined in a many different ways
A class of functionals can be defined by the inner product

f = f x xdx
:

y
A particular sequence of functionals is given by 3

n f = f x n x dx
2

{ }
1
n if x
2n 1
n x=
1
0 if x
2n
x
Definition of the Dirac Delta Function
The Dirac delta function is a distribution, functional, or generalized function
: C 0
It maps functions to their value at the origin f = f 0
It is the limit of the sequence of functionals on the previous slide n

f =lim n f xn x dx

These mathematical properties justify the notation (ONLY a notation!)


f x x dx= f 0

f x xx 0 dx= f x0
Point Source
f xx
f s x

a k x b

a x b

b b
b a=a f s x dxa f xx dx
b
lim b x blim a x a=lim a x
+

-

-
, b x + a f s x dx f = f

x = f
Discontinuous Source
f s x

a k x b

a xf b

b
b a=a f s x dx
xf b
lim b x blim a x a =lim a x
+
f
-
f
-
f
a f s x dxlim b x +
f
x f
f s x dx=0

x f =0
1D Elliptic Differential Equation

Source Function f s x= f xb x u x

Differential Equation (Valid for continuous regions i )


d
dx [ d
]
k x u x b xu x= f x
dx

Material Interfaces
& Discontinuities in Source Function k x
d
dx
u x =0

Point Sources

k x
d
dx
u x = f
Boundary Conditions

Essential, Prescribed, Dirichlet u0=u 0


u L=u L
Natural, Flux

Neumann d
k x u x= 0, at x=0
dx
d
k x u x= L at x= L
dx

Robin d
k x u x p 0 u x= p0 u0 at x=0
dx
d
k x u x p L u x= p L u L at x= L
dx
Integrate with a test function

Differential Equation [ k u ' ]' b u= f


Multiply by a test function and integrate over each subdomain i

[k u ' ]' v dx b u v dx= f v dx


i i i

Integrate by parts

xi xi xi xi
[k u ' v ] x k u ' v ' dxx b u v dx=x f v dx
xi1
i1 i1 i1

Observations
xi xi1
[k u ' v ] x [k u ' v ] x =k xi1 u ' x i1 v xi1 k xi u ' x i v xi k x i1 u ' x i1 v xi1
i1 i

k xi u ' xi v x i =0 if xi { x k , x f }

k xi u ' xi v x i = f v xi if x i { x }
Sum over whole domain

Sum up the subdomains to obtain the entire domain = i i =[0, L]

i [k u ' ] ' v dxi b u v dx=i


i i i
f v dx

xi xi xi xi
i [k u ' v ] x i1 i x k u ' v ' dxi x b u v dx=i x
i1 i1 i1
f v dx

Observe that we have the following expression for the first sum
xi
i [k u ' v ] x =k 0 u ' 0v 0i k xi u ' x i v xi k L u ' L v L
i1

Jumps are zero at every interface not having a point source


xi
i [k u ' v ] x =k 0u ' 0v 0 f v x k Lu ' L v L
i1
Variational/Weak Form

L L
0 [ k u ' v ' b u v ] dx=0 f v dx f v x
k 0 u ' 0 v 0k L u ' L v L

Trial Functions: u
Test Functions: v
The goal is to find a solution that satisfies this expression for all
possible test functions

We still need to specify the space of trial and test functions and
also incorporate the boundary conditions
Function Spaces

A classical solution to the differential equation requires


2
uC [0, L]

A weak solution only requires that the solution and its


derivative be integrable

The trial functions (i.e. solutions) and test functions


are members of particular function spaces

v :[0, L ]

{ ] dx }
L
1
H = v : 0 [ v ' 2
v 2

H 10= {v H 1 : v 0=v L=0 }


Essential Boundary Conditions

u0=u 0 u L=u L

Find u H ={v H : v 0=u 0 , v L=u L } v H 0


1 1 1

L L
0 [ k u ' v ' b u v ] dx=0 f v dx f v x

The test functions cannot be varied at the boundaries in


order for there to be a unique solution for the trial function
Natural Boundary Conditions
0 u ' 00 u 0=0

L u ' L L u L= L

1 1
Find u H v H
L L
0 [ k u ' v ' b u v ] dx=0 f v dx f v x

k 0

0 [ 0 0 u 0 ] v 0

k L

L [ L L u L ] v L
Essential & Natural BCs

u0=u 0

L u ' L L u L= L

1= {v H 1 : v 0=0 }
1={v H 1 : v 0=u 0 } v H
Find u H
L L
0 [ k u ' v ' b u v ] dx=0 f v dx f v x

k L

L [ L L u L ] v L
Minimization Problem
Differential Equation
(DE) [ k u ' ]' b u= f

Boundary Conditions u0=0 u L=0


(BC)

Variational
Find u H 10 v H 10
Problem L L
(V) 0 [ k u ' v ' b u v ] dx=0 f v dx

Minimization Find u H 10 such that J u J v v H 10


Problem 1 L
(M) J v= 0 [ k v ' b v 2 f v ] dx
2 2
2
Equivalence of Forms

DE solution V solution M solution

2
V/M solutionuC [0, L ] DE solution

The Galerkin FEM solves the V problem

The Ritz Method solves the M problem

A minimization problem cannot be formulated for


every differential equation or variational problem
The Galerkin FEM Method

The Galerkin method finds a solution from a finite dimensional


subspace of the space of trial functions

H h H 1
Since the space is finite dimensional, every function in it can
be written as a linear combination of basis functions
N
u h x= j=1 j j x

We will formulate the Galerkin FEM for the natural BCs


Other BCs will be enforced in the solution process
Galerkin FEM - Variational Problem
0 u h ' 00 u h 0=0

L u h ' L L u h L= L

h h
Find u h H v h H
L L
0 [ k u h ' v h ' b uh v h ] dx=0 f v h dx f v h x

k 0

0 [ 0 0 u h 0 ] v h 0

k L

L [ L L u h L ] v h L
Galerkin FEM - System of Equations
N
u h x= j=1 j j x

v h x=i x , i=1, , N

K = F
Stiffness Matrix Nodal Variables Load Vector

[ ] [] []
K 11 K 1 N 1 F1
K= = F=
K N 1 K NN N FN

L k 0 k L
K ij =0 [ k i ' j ' b i j ] dx 0 i 0 j 0 L j 0
0 L L i

L k 0 k L
F i =0 f i dx f i x 0 i 0 L
0 L L i
Galerkin FEM Basis Functions

The basis functions are usually chosen to be piecewise polynomials


The lowest order polynomials which are in H 1 are piecewise linear
N
h
H H 1
u h x= j=1 j j x

The basis functions are constructed to match the spatial discretization


The spacial domain consists of discrete elements
The corners (or boundaries in 1D) of these elements are called nodes

A nodal basis satisfies the following property

{
i x j =ij = 1 : i= j
0 : i j }
Linear Basis Functions

1 2 3 N 1 N
1

x 1=0 e=1 x2 e=2 x3 e=3 x 4 x N 2e=N 2 x N 1e=N 1 x N = L

{ }
x xi1
if x[ x i1 , xi ]
xi xi1
i x=
xi1 x
if x[ x i , x i1 ]
xi1 x i
Basis Functions to Shape Functions
i i1
i = 2 1

i
2 i1
1

x i1 e=i xi e=i1 x
i1 x i1 e=i xi e=i1 x
i1

{ } { }
x xi1 0 if x[ xi , xi1 ]
i if x[ x i1 , xi ] i1
2 x= xi xi1 1 x= xi1 x
if x[ xi , xi1 ]
0 if x[ x i1 , xi ] x i1 xi
Transition to Elemental
Stiffness Matrices and Load Vectors

L N 1 xk N 1
K ij =0 [ k i ' j ' b i j ] dx=k =1 x [ k i ' j ' b i j ] dx=e=1 K ij
e
k 1

L i1 xk N 1
F i =0 f i dx=k =i x f i dx=e=1 F i
e
k1

k 0 k L
K ij = K ij 0 j 0 L j 0
0 0 i L L i

k 0 k L
F i = F i f i x 0 L
0 0 i L L i
Local Element Stiffness Matrix
and Load Vector
Components of Local Element Stiffness Matrix and Load Vector

x

K ij =x
e i

[ k i ' j ' b i j ] dx i , j=1,2


i1

x

F i =x
e i
f i dx
i1

Matrix Notation (used extensively in engineering!)


x x

K =x k B B dxx b N T N dx
e Ti i
N = [ 1 2 ]
i1 i1

xi
B=[ 1 ' 2 ' ]

F =x
e T
f N dx
i1
Linear Shape Functions
i
1 i
2
1 2

x i1 e=i xi 1 0 1

Original Element Master Element

{ }
xi x 1
i if x[ x i1 , xi ] 1 = 1
1 x= xi xi1 2
0 if x[ x i1 , xi ]
1
2 = 1
2

{ }
x xi1
i if x[ x i1 , xi ]
2 x= xi xi1
0 if x[ x i1 , xi ] 2 x x x i1 xi
= x = h= xi xi1
h 2
Numerical Integration
Gauss Quadrature is usually used for numerical integration

1 n
1 f d =i=1 f i wi

n 1 2 3 w1 w 2 w 3
1 0 - - 2 - -
2 1/ 3 1/ 3 - 1 1 -
3 3/ 5 0 3/5 5/ 9 8/ 9 5/ 9

Element Stiffness Matrix and Load Vector using Master Element

h 1 h 1
K = 1 k B B d 1 b N T N d
e T
N = [ 1 2 ]
2 2
B=[ 1 ' 2 ' ]
h 1
F = 1 f N d
e T
2
Element Assembly
Change from local indexing system to global system

i1 i
K = L K L
e e T e e

F = L F
e e T e
[
Le = 0 1 0 0
0 0 1 0 ]
Assemble the global system

N 1
=
K e
K
e=1

N 1
F =e=1 F
e
Global System Natural BCs

[ ][ ]
K 111 K 11 2 0 0 0 F 11
121
K 12 2 K
K 12 1 K 21 2 0 0
1
F 2 F 1
2

0 K 221 22 2 K
K 31 1 0 0 F 22 F 31
K= F=

0 0 0 2N22 K
K
N 1
11 1N21
K
N 2
F 2 F 1
N 1

0 0 0 K 2N11 N 1
K 22 F2
N 1

1
1 1 k 0
F = F 1 f 1 x
111 k 0 0
K 11 1= K
1
0 0
0
F 2F 1 = F 2 F 1 f 2 x f 1 x
e e1 e e1 e e1

2N21 k L L
K 2N21= K
L k L
F 2N 1= F 2N 1 f 2N 1 x L
L
Global System Essential BCs

[ ] [ ]
1 0 0 0 0 u0
12 2 K
0 K 12 1 K 21 2 0 0 1 2
F 2 F 1
0 K 22 1 22 2 K
K 31 1 0 0 F
2
F
3
K= F= 2 1

0 0 0 2N22 K
K 1N11 0 N 2
F 2 F 1
N 1

0 0 0 0 1 uL

F 12F 12= F 12 F 21 f 1
2 x
f 2
1 x
K 1
21 u0

F 2F 1 = F 2 F 1 f 2 x f 1 x
e e1 e e1 e e1

F 2N 2 F 1N 1= F 2N 2 F 1N 1 f 2N 2 x f 1N 1 x K
1N21 u L
Global System Essential+Natural BCs

[ ] [ ]
1 0 0 0 0 u0
12 2 K
0 K 12 1 K 21 2 0 0 F 12 F 21
0 K 22 1 22 2 K
K 31 1 0 0 F 2
F 3
K= F= 2 1

0 0 0 2N22 K
K 1N11 1N21
K F 2N 2 F 1N 1
0 0 0 K 2N11 K
N 1
22 F 2N 1

F 12F 12= F 12 F 21 f 1
2 x
f 2
1 x
K 1
21 u0

F 2F 1 = F 2 F 1 f 2 x f 1 x
e e1 e e1 e e1

2N21 k L L
K 2N21= K F 2N 1= F 2N 1 f 2N 1 x
k L
L
L L
Observations on the Global System

K = F

Global stiffness matrix properties


Singular unless boundary conditions are applied
(SPD) Symmetric Positive Definite
Sparse/Banded (Tridiagonal for 1D linear basis)

Global system numerical solution methods


Banded LU factorization

Does not require SPD


Not efficient in 2D/3D
Banded Cholesky factorization
Requires SPD
More efficient than LU
Not efficient in 2D/3D
Preconditioned Conjugate-Gradient
Requires SPD
Efficient in 2D/3D
Post-Processing

When a nodal basis is used in the FEM approximation, we observe that


the nodal variables are the solutions of the state variable at the nodes

N
u h x= j=1 j j x {
i x j =ij = 1 : i= j
0 : i j }
ui =u h x i =i

The flux can be computed using the FEM approximation

N
h x= j=1 j k x j ' x

The flux will not be as accurate as the state variable


FEM Procedure
Formulate the problem
Variational or Minimization
Formulate the approximation method
Galerkin or Ritz
Create spatial discretization
Elements and nodes
Choose basis/shape functions
Polynomial
Form local element matrices and vectors
Gauss quadrature
Assemble global system
Apply boundary conditions
Solve global system
Linear matrix solver
Post-process the solution
Compute fluxes
FEM Application

Hanging steel cable (e.g. elevator cable) u0=0 in


Differential Equation
x


d
dx
k [
d
dx
u x = g ]
Data u x

L=1,000 ft A=1 in 2
k =29,000 ksi
4
g=2.835610 kip/in L=10 kip
FEM Application - Matrices
Since the data is constant, the local element matrices
can be integrated exactly

K [
e= k 1 1
h 1 1 ] F e= []
g h 1
2 1

The element force vector assigns the distributed load


as two statically equivalent nodal loads

=
Solution for Displacement
Solution for Stress
How do we increase accuracy?
The h method
Increase spatial resolution
Increases size of global matrix
The p method
Increase polynomial order of basis
Increases global matrix bandwidth
The h-p method
Hybrid technique of h and p methods
Increases efficiency
Increases complexity
Quadratic Shape Functions

1 3
2

x i1 xi x i1
1 2 1
1 = 1 2 =1 3 = 1
2 2
Quadratic Basis Functions

2 2 3 4 5
Error Estimates

dsu 2 d s1
u 2
s
L , s1
L
dx dx
u h p k =polynomials of order k
=min k , s h=const.
1 1
vH =[ v ' 2v 2 dx ]
1
2
vL =[ v 2 dx ]
2
2


uu hH C1
1 h
1
uu hL C 2 h
2

You might also like