Vous êtes sur la page 1sur 27

Finite element discretization of

Laplace and Poisson equations

Yashwanth Tummala
Tutor: Prof S.Mittal

2/12/2008

Outline
z
z
z
z
z
z
z
z
z

Finite Element Method for 1D


Introduction to Poissons and Laplaces Equations
Finite Element Method for 2D-Discretization etc
Weak formulation
Interpolation functions
Boundary Conditions
Assembly of element equations
Examples
Summary

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Finite Element Method For 1D


z
z
z

z
z
z
z
z

Domain represented by simple domain/finite elements


Approximation functions constructed over elements
1D equation looks like: d a du + cu f = 0, 0<x<L
dx

dx

Construct Finite Element Mesh


Derive the element equations
Assemble the equations
Impose the Boundary conditions
Find the solutions

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Introduction

What are Poissons and Laplaces Equations?


(k u ) = f ( x, y ) in domain ,
where is the gradient operator
In Cartesian coordinate system
r r
=i
+j
x
y
and the Poisson's Equation takes the form:

u u
k

k
= f ( x, y )

x x y y

When f ( x, y ) is zero it becomes a Laplace's Equation!

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Introduction
Some examples:

Heat Transfer-Conduction, Convection (Temp. distribution)


Electrostatics- Scalar potential
Magnetostatics- Magnetic potential
Fluid mechanics, Stress Distribution etc.

Problem Statement:
-Find the solution u(x,y) of the second order partial differential
equation namely the Poissons Equation
-Given k, f(x,y) and specified boundary conditions in a domain

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Finite Element Discretization


Discretization/Mesh Generation:
2D geometric shapes- triangle, rectangle, quadrilateral etc.

General rules:
Elements should characterize governing equations
Number, shape, type, are as
required (accuracy)
Large gradients are adequately
modeled ( density of elements)
Mesh refinements should vary gradually

Finite Element Discretization of Laplace and Poisson Equations

n$
e

2/12/2008

Weak Form
For a typical element e, Finite element model over e,
u u
w
x k x y k x f dxdy = 0
e
We also have the following,
w

u w u
u
k
k
=
wk

x x x x x
x

u
u w u
k

wk

k
=
y
y y y y y

From gradient (or divergence theorem) in component form:


x wk x dxdy = w k x n ds
x

u

u
=
wk
dxdy
w

y y
k y ny ds
e
e

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Weak Form
Where n$ = n x $i + n y $j and n$ = unit normal vector
Thus we get the weak form of Poisson's Equation:
w
x
e

u
u
u w u
k
k
wf
dxdy
w
n
k
n
+

x
y k
ds = 0
x y y

x
y

u
u
We say qn = n x k
+
n
y k

x
y

Finite Element Model: u is approximated


u ( x, y ) u ( x, y ) = u ( x, y )
n

e
h

j =1

e
j

e
j

u he ( x , y ) = value of u he at jth node ( x j , y j )


n = no. of nodes of the element.

ej = Lagrange interpolation function/shape function.


Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Finite Element Model


{

Chose linearly independent functions w= 1e , e2 ,... ne

The weak form becomes:


e ej e ej

e
e
i
i

k
+
k
dxdy u j f i dxdy i qn ds = 0

x y y

j=1 e x
e
e

Or this ith equation can be rewritten as:
n

k u
e
ij

e
j

= fi e + Qie (i = 1,2,..., n )

j=1

Unknowns : u1e ,ue2 ,....,une


In the matrix form the set of Equations is:

{K } {u }
e

nxn

e
j nx 1

{ }

= fe

nx 1

{ }

+ Qe

nx 1

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Interpolation Functions
For a triangular element:

uhe ( x, y ) = c1e + c2e x + c3e y = u1e 1e + u2e 2e + u3e 3e

uhe ( x1, y1 ) = u1e = c1e + c2e x1 + c3e y1,


uhe ( x2 , y 2 ) = u2e = c1e + c2e x2 + c3e y 2 ,

or

uhe ( x3 , y 3 ) = u3e = c1e + c2e x3 + c3e y 3 ,

or

{u} = {A}{c}
1
{c} = {A} {u}

After a bit of math we get :


i = x j y k xk y j , i = y j y k , i = ( x j xk )
1
(1u1 + 2u2 + 3u3 ) ,... A=area of the triangle
2A
From the first Equation above we get:
1
ie =
ie + ie x + ie y , ( i = 1,2,3 )
2 Ae
Finite Element Discretization of Laplace and Poisson Equations
c1 =

10

2/12/2008

Interpolation Functions
We calculate K e and {f e } for linear triangular element.
The associated element coefficient matrix is:
ke
ie je + ie ej
K =
4 Ae
e
ij

1
fe Ae
3
An example :

fi e =

a2 + b2
ke
2
[K e ] = 2ab
b
a 2

11

b 2
b2
0

a 2
1
f ab

0 , f e = e 1
6
2
a
1

{ }

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Interpolation Functions
For a rectangular element:
u he ( x , y ) = c 1e + c 2e x + c 3e y + c 4e xy
u h ( x ,y ) = c 1 + c 2 x + c 3 y + c 4 x y
u 1 = u h (0, 0 ) = c 1, u 2 = u h ( a , 0 ) = c 1 + c 2 a
u 3 = u h ( a , b ) = c 1 + c 2 a + c 3 b + c 4 a b , u 4 = u h (0, b ) = c 1 + c 3 b
T h u s w e g e t the interpo la tion fun ctio n s a s:

x
y
x
y
1e = 1 1 , e2 = 1 ,
a
b
a
b

x y
x
, e4 = 1
a b
a

i +1
x , y = ( 1) 1

3e =
1e

12

y
or

xi + x
yi + y
1

a
b

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Interpolation Functions
The element coefficient matrix for linear rectangular element:

2 a2 + b2

a 2 2b 2
k
K e = e
6ab a 2 + b 2

b 2 2a 2

2 a2 + b2

a 2 2b 2

a2 + b2

a2 + b2

b 2 2a 2

b 2 2a 2

2 a2 + b2

a 2 2b 2

b 2 2a 2

a2 + b2

2
2
a 2b

2
2
2 a +b

When a=b, we further simplify to get :


4 1 2 1

ke 1 4 1 2
e
K =
6 2 1 4 1

1
4

13

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Assembly of Element Equations


Based on two principles:
Continuity of primary variables
Equilibrium or balance of secondary variables (like flux)

Inferences:
Continuity of u at nodes continuity along interelement
boundary.
At the interface, flux should be equal in magnitude and opposite
in sign.
Relation/Coefficients of the stiffness matrix are thus derived,
taking global and local node numbering into consideration.

14

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Assembly of Element Equations


For better understanding: With two elements we have
u11 = U1, u21 = u12 = U2, u31 = u42 = U3, u22 = U4, u32 = U5 continuity of u

(q )

1
n 23

( )

= qn2

14

Equilibrium of secondary variables

So, the assembled equations are given by:


K

K
K

1
11
1
21
1
31

15

1
12

1
13

1
2
1
2
K22
K23
+ K11
+ K14
1
2
1
2
+ K41
+ K44
K32
K33
2
2
K21
K24
2
2
K31
K34

0
2
K12
2
K42
2
K22
2
K32

F
U
1

0 1
F1 + F 2
2
K13 U2 2 1

2
U3 = F31 + F42
K43

2

K23 U4 F22

2
K33 U5 F

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Boundary Conditions
The boundary integral is of the form: Q
When is it not necessary to compute???
Equilibrium of internal flux

e
i

q ne

e
i

( s )d s

In general the integral over the boundary is:


Q ie =

i ( s )q n ( s )ds +

1 2

23

i ( s )q n ( s )ds +

i ( s )q n ( s )ds

3 1

Q ie = Q i1e + Q i2e + Q i3e


e

What is the contribution of side 2-3 to Q1


What about the rectangular elements?
How many non-zero terms will they have?

16

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Example
2u
2u
u = f0 i.e
+
= f0
2
2
x
y

Consider the problem


in a
square region. Using FEM find u(x,y), u=0 on the entire boundary,
f0 is uniformly distributed source.
2

Along the diagonal :


u
u
=
=0
n
x

u
1 u u
=

=0
n
2 y x
u
u
=
= 0
n
y

On the lines of symmetry, normal derivative of u(x,y)=0

17

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Example
Solution by Linear Triangular Elements:
Symmetry along diagonal-model as shown
Mesh as 4 linear triangles - local and global nodes
Element 1 = Typical Element
We get the element coeff matrix and source vector:

b2
1
K 1 =
b2

2a b
0

b2

a2 + b2
a 2

a 2
a 2

{f }
1

1
f ab
1
= 0
6
1

w h e re a = b = A /2 = 0 .5
Thus w e have :
K 1 = K 2 = K 3 = K 4 ,

18

{f } = { f } = { f } = { f }
1

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Example
So, finally :
1 1 0
1
K e = 1 2 1 ,
2

0 1 1

{f }
e

1
f0
=
1
24
1

The assembled system of equations look like:1


1

1
1 0

2 0
0

1
4

2
1
0
0

2
4

1
0

2
1

2
0

1
0

4
1

0 U1

0 U2
0 U3

0 U4
1 U 5

1 U 6

f 3
= 0 +
24 1

Q1
1

2
3
Q
Q
Q
+
+
2
3
1
1
3
4
Q 3 + Q 2 + Q1

Q 23

2
3
4
Q1 + Q 3 + Q 2

4
Q
3

F ro m the b o u n d a ry co n d itio n s w e g e t;
U4 = U5 = U6 = 0

19

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Example
By boundary condition and balancing of internal Flux :
Q1 = Q11 = 0, Q2 = Q21 + Q32 + Q13 = 0

Q3 = Q31 + Q22 + Q14 = 0


The above set of equations can be written as:
1
1
1

f11
K 11
U1
K 12
K 13

1

1
2
3
1
2
1
2
3
K
K
+
K
+
K
K
+
K
U
=
f
+
f
+
f
22
33
11
23
32
1
21
2 2 3
1
1
2
1
2
4
1
2
4
K 31
+ K 23
+ K 22
+ K 11
K 32
K 33

U 3 f3 + f2 + f1
Us in g numerical values for K ije and f11(with f0 = 1), We get :

0.5

0.5
0.0

20

0.5
2.0
1.0

0.0 U1
1
1

1.0 U 2 =
3
24
3
2.0 U 3

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Example
Solution by Linear Rectangular Elements:
4

1
1
K e =
6 2

1
Observe that

1 2 1
1

2
4 1 2
f
a
1
, f1 = 0
1 4 1
4 1

1
2 1 4
U3 = U6 = U7 = U8 = U9 = 0

u=0

{ }

u
=0
x

u=0

Boundary conditions on secondary variables are:


Q11 = 0, Q12 + Q12 = 0, Q14 + Q13 = 0
Balancing at global node 5 gives:

u
=0
y

Q13 + Q 24 + Q 32 + Q14 = 0
By taking f0 = 1, a=0.5, we can solve for Ui

21

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Conduction
Conduction in 1D is given by: x k Tx = f ( x , y )
Conduction in 2D is given by: x k Tx y k Ty = f ( x , y )

u(x,y)= T = Temperature
qn = negative of heat flux
k x , k y = thermal conductivities along x and y
f = internal heat generation
Consider heat transfer in two-dimensional plane.
Find Temperature distribution in the plane.
x

22

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Convection
For a convection boundary:
E q u a tio n fo r e n e rg y tra n fs fe r:
T
T
kx
nx + ky
n y + (T T ) = q n
x
y
= c o n v e c tiv e c o n d u c ta n c e , T = A m b ie n t te m p e ra tu re
q n = s p e c ifie d h e a t flu x
T h e W e a k F o rm :

w T
w T
k
k
+
x x x y y y w f
e
F in ite E le m e n t M o d e l:
n

T = T je ej ( x , y

d x d y

q n (T T ) d s = 0

j= 1

23

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Conduction/Convection
So, we finally get :

(K
n

j =1

e
ij

+ H

e
ij

Fie =

e
ij

e
j

=Fi e + Pi e , w h e re ,

f ei d x d y +

d x d y

q ne ei d s = f i e + Q ie

e
e

24

)T

e
e

ei j
ei j
+ ky
k x

x
y
y

e
ij

ei ej d s , P i e =

ei T d s

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Summary

25

Finite Element Model for 1D problems


Poissons and Laplaces Equations (Model Equation)
Finite Element Discretization
Weak Form
Finite Element Model and Algebraic equations
Interpolation Functions for Triangular elements
Interpolation Functions for Rectangular elements
Examples For the Interpolation/Shape functions

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

Summary

Associated Element Coefficient Matrix


Boundary Conditions and Integrals
Assembly of element Equations and the principles
Example with a square domain and triangular
elements
Example with a square domain and rectangular
elements
Application of FEM to Conduction, Conduction &
Convection etc.

26

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008

References
http://en.wikipedia.org
An Introduction to the Finite Element Method- 3rd
Edition by J.N.REDDY
The Finite Element Method- 4th Edition
by Zienkiewicz

- THANK YOU

27

Finite Element Discretization of Laplace and Poisson Equations

2/12/2008