You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/228448411

Finite Element Solution for Two Dimensional Laplace Equation with Dirichlet
Boundary Conditions

Article · February 2012

CITATIONS READS

8 10,138

5 authors, including:

Muhammad Shabbir Muhammad Rafiq Malik


University of Engineering and Technology, Lahore University of Central Punjab
1 PUBLICATION 8 CITATIONS 172 PUBLICATIONS 1,902 CITATIONS

SEE PROFILE SEE PROFILE

Muhammad Ozair Ahmad Anjum Pervaiz


University of Lahore University of Engineering and Technology, Lahore
116 PUBLICATIONS 991 CITATIONS 29 PUBLICATIONS 126 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Anjum Pervaiz on 05 January 2015.

The user has requested enhancement of the downloaded file.


Pak. J. Engg. & Appl. Sci. Vol. 10, Jan., 2012 (p. 97-102)

Finite Element Solution for Two Dimensional Laplace Equation with


Dirichlet Boundary Conditions
M. Shabbir1*, M. Rafiq2 and M.O.Ahmed1, A.Pervaiz1, R.Siddique1
1. Department of Mathematics, University of Engineering & Technology Lahore, Pakistan
2. Faculty of Engineering, Univ. of Central Punjab, Lahore, Pakistan
* Corresponding author: E. mail: schabir@hotmail.com

Abstract
The steady state heat distribution in a plane region is modeled by two dimensional Laplace
equation. In this paper Galerkin technique has been used to construct Finite Element model for two
dimensional steady heat flow problem with Dirichlet boundary conditions in a rectangular domain.
Results are then compared with analytic solution to check the accuracy of the developed scheme.

Key Words: Dirichlet Conditions, Finite Element Model, Galerkin Method, Laplace Equation

1. Introduction 2.1 Domain Discretization


It is conventional to solve Laplace Equation [1] Divide the region R into finite number of
in two dimension with Dirichlet conditions. In many rectangular elements. Every node and every side of
advanced courses on electromagnetism , it is the rectangle must be common with adjacent
fundamental to study the solution of Laplace equation elements except for sides on the boundaries. The
with various boundary conditions. Particularly, the nodes and elements are both numbered.
Dirichlet and Neumann boundary value problems of
Laplace equation are included in advanced courses 2.2 Interpolating Functions
[2]. Two dimensional Laplace equation with Dirichlet Consider a rectangular element (e ) with sides
boundary conditions is a model equation for steady ‘a’ and ‘b’ as shown in figure 1 in which the nodes
state distribution of heat in a plane region [3]. In this are numbered in the counterclockwise direction and
paper Galerkin technique has been used to develop derive the interpolation function [4] for it. Assume
Finite Element model for two dimensional Laplace the interpolating polynomial in such a way that the
equation with Dirichlet boundary conditions in a number of terms and the number of nodes are equal
rectangular domain. in the element. Accordingly, assume

2. Finite Element Model u (e) ( x, y) c1 c2 x c3 y c4 xy (3)


A simple case of steady state heat conduction in where c1. i 1, 2, 3, 4 are constants.
a rectangular domain is defined by two dimensional
Laplace equation

2 2
u u
( x, y ) ( x, y ) 0 in R (1)
2 2
x y

with Dirichlet conditions

u ( x, c ) f1 ( x), u ( x, d ) f 2 ( x), a x b
(2)
u ( a, y ) g1 ( y ), u (b, y ) g 2 ( y ), c y d Fig.1 Rectangular element with nodes

97
Pak. J. Engg. & Appl. Sci. Vol.10, Jan., 2012

We choose local coordinate system ( x, y) to x y


N1(e) 1 1
derive the interpolation functions. a b

The value u ( x, y ) at each node of rectangular x y


N 2(e) 1
element is given by a b
xy
u1 u (e) (0, 0) c1 (4a) N 3(e)
ab
u2 u (e) (a, 0) c1 c2 a
x y
u2 u (e) (a, 0) c1 c2 a (4b) N 4( e) 1
a b
u3 u (e) (a, b) c1 c2 a c3b c4 ab (4c)
2.3 Element Equations
u4 u (e) (a, b) c1 c3b (4d)
The Galerkin [5] approach is applied to
Solving equations (4) for ci .i 1, 2, 3, 4 , we construct Finite Element model of the equation (1)
obtain over the element (e ) . Substituting u (e) ( x, y) into the
equation (1) gives the residual
c1 u1
2 (e) 2 (e)
u u
c2
u2 u1 E ( e ) ( x, y ) 2
a x y2

u4 u1 Then equating the weighted residual integral to


c3 zero gives
b
u3 u4 u1 u2 2 (e) 2 (e)
c4 u u
ab W 2
dxdy 0 (6)
R
x y2
Substituting the values of ci .i 1, 2, 3, 4 in
equation (3) where W x, y is the general weighting function.

u2 u1 u4 u1
u (e) ( x, y) u1 x y 2 (e)
u 2 (e)
u
a b W 2
dxdy W dxdy 0 (7)
R
x R
y2
u3 u1 u 2 u4
xy Since
ab
u (e) W u (e) 2 (e)
u
Collecting the coefficients of u1 , u2 , u3 and u4 W W
in the above equation, we have
x x x x x2
Therefore
(e) x y x y 2 (e)
u ( x, y ) 1 1 u1 1 u2 u u (e) W u (e)
a b a b W W
x2 x x x x
xy x y
u3 1 u4 Similarly
ab a b 2 (e)
u u (e) W u (e)
W W
4 y2 y y y y
u ( e)
( x, y) N i(e) ui(e)
i 1
Substituting in equation (7)

where

98
Finite Element Solution for Two Dimensional Laplace Equation with Dirichlet Boundary Conditions

u ( e) u (e) u ( e)
W dxdy W n y ds W ds
y y y n
R R R (e)

u (e) u (e) is neglected. So equation (9) becomes


W dxdy W n y ds
R
y y R
y
W u (e) W u (e)
0
u (e) u (e) ( e)
x x y y
W dxdy W n x ds R (10)
( e) x x ( e) x
R R
The evaluation of equation (10) requires the
Using gradient theorem [4]to 1st and 2nd integrals in
equation (8) to transform into line integrals function u (e) ( x, y) and its both partial derivatives.
Differentiating equation (5) gives
W u (e) W u (e)
dxdy 0
( e) x x y y u ( e) y 1 1 y
R (8) u1 u2
x ab a a ab
where R (e ) is the border of the element (e ) , s is
y y
the curvilinear coordinate on the boundary and u3 u4 (11a)
ab ab
n y cos( nˆ , ˆj ) and n y cos( nˆ , ˆj ) are direction
cosines of the outward unit normal of the boundary. u (e) x 1 x
u1 u2
y ab b ab
Substituting in equation (8)
x 1 y
u3 u4 (11b)
(e) (e) ab b ab
u u
W n y ds W n y ds
x y
R R Substituting equation (11) into equation (10)
(e) (e)
W u W u
dxdy 0 W y 1
( e) x x y y u1
R ( e)
x ab a
R
u (e)
W ds 1 y y y
n u2 u3 u4 dxdy
R a ab ab ab
W u (e) W u (e) W y 1 1 y
dxdy u1 u2
( e) x x y y x ab a a ab
R ( e)
R
Wfdxdy 0 (9)
(e) y y
R u3 u4 dxdy
where ab ab
u (e) u (e) u (e) W x 1 x x
nx ny u1 u2 u3
n x y x ab b ab ab
( e)
R
and n is the unit outward normal.
1 x
For Dirichlet boundary conditions, u ( x, y ) is u 4 dxdy (12)
b ab
specified on the boundary, and the line integral

99
Pak. J. Engg. & Appl. Sci. Vol.10, Jan., 2012

In Galerkin weighted residual approach, the b b b b


u1 u2 u3 u4
weighting factors are chosen to be shape functions 3a 3a 6a 3a
i.e.
a a a a
u1 u2 u3 u4 0
Wi N i(e) , i 1, 2, 3, 4 3b 6b 6b 3b
b a a b
Let‘s evaluate equation (12) for u1 u2
3a 3b 6b 3a

x y b a b a
Wi ( x, y ) N i(e) ( x, y ) 1 1 u3 u4 0
a b (13) 6a 6b 6a 3b
Differentiating equation (13) with respect to x 1 1
2 (a 2 b 2 )u1 (a 2 2b 2 )u 2
and y 6ab 6ab
1 1
w1 y 1
(14a) (a 2 b 2 )u3 (b 2 2a 2 )u 4 0 (16a)
x ab a 6ab 6ab
Similarly for
w1 x 1
(14b) W2 N 2 , W3 N3 and W4 N4
y ab b
1 1
Substituting equation (14) into equation (12) (a 2 2b 2 )u1 2(a 2 b 2 )u 2
6ab 6ab
ba
y 1 y 1 1 y 1 1
u1 u2 (b 2 2a 2 )u3 (a 2 b 2 )u 4 0 (16b)
ab a ab a a ab 6ab 6ab
00
1 1
y y (a 2 b 2 )u1 (b 2 2a 2 )u 2
u3 u 4 dxdy 6ab 6ab
ab ab
1 1
ba 2(a 2 b 2 )u3 (a 2 2b 2 )u 4 0 (16c)
x 1 x 1 x 6ab 6ab
u1 u2
ab b ab b ab 1 1
00
(b 2 2a 2 )u1 (a 2 b 2 )u 2
6ab 6ab
x 1 x
u3 u 4 dxdy 1 1
ab b ab (a 2 2b 2 )u3 2 (a 2 b 2 )u 4 0 (16d)
6ab 6ab
ba
y 1 y 1 The above equations (16a) to (16d) can be
u1
ab a ab a written in matrix form
00
1 y y y
u2 u3 u 4 dxdy K ( e) u ( e) F (e)
a ab ab ab
where
ba
x 1 2(a 2 b2 ) a2 2b 2 (a 2 b2 ) b2 2a 2
ab b 1 a2 2b 2 2(a 2 b2 ) b2 2a 2 (a 2 b2 )
00
K (e)
x 1 x x 1 y 6ab (a 2 b2 ) b2 2a 2 2(a 2 b2 ) a2 2b 2
u1 u2 u3 u 4 dxdy
ab b ab ab b ab b2 2a 2 (a 2 b2 ) a2 2b 2 2(a 2 b2 )

100
Finite Element Solution for Two Dimensional Laplace Equation with Dirichlet Boundary Conditions

u1 0 the known nodes are removed from the system. Now


u2 0 our system has only equations involving unknown
u (e) and F (e) = nodal values. This completes the adjustment of
u3 0
boundary conditions for the system equations and
u4 0 now the system is ready to solve.

Observe that K (e) is symmetrical i.e. 2.5 Solution of Global System

K ij(e) K (jie) Solve the system of equations for unknown u-


values using an iterative method. These values are
2.3.1 Assembly of Element Equations approximate solutions at the nodes. If the
approximations to u ( x, y ) at intermediate points in
There are four equations for every element.
the region are needed, we obtain them by using linear
Since some or all nodes of element (e) are shared
interpolating relations.
with other elements, the u-value for a shared node
appears in the equations of all elements that shared
3. Test Problem
the nodes. Combining all the element equations we
will get a global system coefficient matrix. This 2 2
u u
matrix has rows and columns as there are number of 2
0 0 x 0.5 0 y 0.5
x y2
nodes. We will assemble the system matrix in the
following way. u ( x, 0) 0, u ( x, 0.5) 200 x 0 x 0.5
u (0, y ) 0, u (0.5, y ) 200 y 0 y 0.5
Suppose there are ‘n’ nodes in the system. Label
the nodes in order from 1 to n. Associate the number Exact solution is u ( x, y ) 400 xy
of each node with row and column of every element
matrix where the u-value for that node appears on the 4. Conclusion
diagonal. In system matrix [6], the node numbers are
assigned to rows and columns in a manner like one In Figure 2 surface indicates the exact solution
described above. of Laplace equation while dots show the numerical
solution obtained using FEM. It is clear from the plot
We get the entry in row i and column j of the that results obtained by FEM are very close to exact
system matrix by adding the values from row of solution.
every element matrix that has row i , then adding
these in the columns where the column node number
match. After the assembly of local systems, the 100

global system of equations is of the form


80

[ K ] {U } {F } 60
z

40

2.4 Adjusting for Dirichlet Conditions


20

The u-values are specified for all the nodes on 0


0.5
the boundary. We substitute the known values in 0.4 0.5
0.45
every equation where it appears and shift them on 0.3
0.3
0.35
0.4
0.2 0.25
right hand side of the corresponding equation i.e. for 0.1 0.1
0.15
0.2
0.05
a particular node n, all the values in column ‘n’ of the y
0 0
x
matrix are multiplied by the known value and
subtract the result from right hand side of the
Fig. 2
corresponding row. The equations corresponding to
101
Pak. J. Engg. & Appl. Sci. Vol.10, Jan., 2012

X Y FEM Exact Absolute 5 References


Solution Solution Error
0.0000 0.0000 0.000000 0.000000 0.000000
0.1000 0.0000 0.000000 0.000000 0.000000 [1] Liu, C.S. A Modified Trefftz Method for Two-
0.2000 0.0000 0.000000 0.000000 0.000000
0.3000 0.0000 0.000000 0.000000 0.000000
Dimensional Laplace Equation Considering the
0.4000 0.0000 0.000000 0.000000 0.000000 Domain’s Characteristic Length. CMES,
0.5000 0.0000 0.000000 0.000000 0.000000 vol.21, no.1, pp.53-65, (2007).
0.0000 0.1000 0.000000 0.000000 0.000000
0.1000 0.1000 4.000000 4.000000 0.000000
0.2000 0.1000 8.000000 8.000000 0.000000 [2] Gil, S,Saleta, M. E & Tobia, D.Experimental
0.3000 0.1000 12.00000 12.00000 0.000000
0.4000 0.1000 16.00000 16.00000 0.000000
Study of the Neumann and Dirichlet Boundary
0.5000 0.1000 20.00000 20.00000 0.000000 Conditions in Two-Dimensional Electrostatic
0.0000 0.2000 0.000000 0.000000 0.000000 Problems, p 1208-1213 Am. J. Phys., Vol. 70,
0.1000 0.2000 8.000000 8.000000 0.000000
0.2000 0.2000 16.00000 16.00000 0.000000 No. 12, December (2002).
0.3000 0.2000 24.00000 24.00000 0.000000
0.4000 0.2000 32.00000 32.00000 0.000000
0.5000 0.2000 40.00000 40.00000 0.000000 [3] Burden, R.L. & Faires , J.D. Numerical
0.0000 0.3000 0.000000 0.000000 0.000000 Analysis, 7th ed., Thomson Brooks/Cole, (2001).
0.1000 0.3000 12.00000 12.00000 0.000000
0.2000 0.3000 24.00000 24.00000 0.000000
0.3000 0.3000 36.00000 36.00000 0.000000 [4] Reddy, J.N. An Introduction to the Finite
0.4000 0.3000 48.00000 48.00000 0.000000 Element Method., 3rd ed.,McGraw Hill
0.5000 0.3000 60.00000 60.00000 0.000000
0.0000 0.4000 0.000000 0.000000 0.000000 International Edition, (2006).
0.1000 0.4000 16.00000 16.00000 0.000000
0.2000 0.4000 32.00000 32.00000 0.000000
0.3000 0.4000 48.00000 48.00000 0.000000 [5] Hoffman, J.D. Numerical Methods for
0.4000 0.4000 64.00000 64.00000 0.000000 Engineers and Scientists, 2nd ed. Marcel Dekker,
0.5000 0.4000 80.00000 80.00000 0.000000
Inc.(2006).
0.0000 0.5000 0.000000 0.000000 0.000000
0.1000 0.5000 20.00000 20.00000 0.000000
0.2000 0.5000 40,00000 40,00000 0.000000 [6] Gerald, C.F. & Wheatly P.O. Applied
0.3000 0.5000 60.00000 60.00000 0.000000
0.4000 0.5000 0.800000 0.800000 0.000000 Numerical Analysis,6th ed.Pearson Education
0.5000 0.5000 100.0000 100.0000 0.000000 (Singapore) Pte. Ltd,( 2005).

102

View publication stats

You might also like