You are on page 1of 17

CE 601: Numerical Methods

L t
Lecture 40

Galerkin FEM for


Laplace Equation‐2

Course Coordinator:
Dr. Suresh A. Kartha,
Associate Professor,
Department of Civil Engineering,
IIT Guwahati.
Galerkin FEM
We were discussing on how Galerkin FEM
can be applied
pp for 2-D cases.
→ to solve 2-D Laplace equation
(or Poisson equation).
∂2 f ∂2 f ⎫
+ 2 = F ( x, y )

∂x 2
∂y ⎪⎪
i.e. or ⎬ with appropriate BCs.
∂2 f ∂2 f ⎪
+ 2 =0 ⎪
∂x 2
∂y ⎪⎭
→ two dimensional domain was rectangular in shape.
→ In our case we discretised the domain
using rectangular elements.
∴ The x − axis is discretised i = 1, 2,3,..., I nodes or discrete points
The y − axis is discretised j = 1, 2,3,..., J nodes.
∴ For this rectangular domain there are a total of ( I × J ) discrete nodes.
→ Any general node is given as (i, j ) in the suffix.
suffix
→ Four nodes constitute an
rectangular element
element. There
are a total of ( I − 1) × ( J − 1)
elements. Any general element
elements.
is given as i, j in the superfix.
→ As described for the one-dimensional
one dimensional case
case, there will be
combination of approximating polynomial for ' f ' in the entire domain
I −1 J −1
i.e. f ( x, y ) ≈ f ( x, y ) = ∑∑ f [ i , j ] ( x, y )
i =1 j =1

((i.e. Sum of series of local interpolating


p g polynomials)
p y )
→ For an element i, j → the approximation is f [ i , j ] ( x, y )
→ As there are four nodes (i, j ), (i + 1, j ), (i + 1, j + 1) and (i, j + 1)
associated with the element i, j , the approximation is given as:
f [i , j ] ( x, y ) = f1 N1 ( x, y ) + f 2 N 2 ( x, y ) + f3 N 3 ( x, y ) + f 4 N 4 ( x, y )
i.e. for the element i, j , the g
global node numbers are replaced
p
by local node numbers 1, 2,3, 4 and N1 , N 2 , N 3 , N 4 are
shape functions for the element i, j .
→ We defined the Residual for the problem
and evaluated weighted integral.
∂2 f ∂2 f
R ( x, y ) = 2 + 2 − F
∂x ∂y
⎛ ∂2 f ∂2 f ⎞
xI y I

∴ I ( f ( x, y )) = ∫
x1
∫y W ( x, y) × ⎜⎝ ∂x 2 + ∂y 2 − f ⎟⎠ dydx = 0
1

∂2 f ∂ ⎛ ∂f ⎞ ∂W ∂f
To do integration: see W 2 = ⎜ W ⎟−
∂x ∂x ⎝ ∂x ⎠ ∂x ∂x
∂2 f ∂ ⎛ ∂f ⎞ ∂W ∂f
and W 2 = ⎜ W ⎟−
∂y ∂y ⎝ ∂y ⎠ ∂y ∂y
⎡ ∂ ⎛ ∂f ⎞ ∂ ⎛ ∂f ⎞ ∂W ∂f ∂W ∂f ⎤
∴ I = ∫ ∫ ⎢ ⎜W ⎟ + ⎜W ⎟− − − F ⎥dxdy = 0
⎣ ∂x ⎝ ∂x ⎠ ∂y ⎝ ∂y ⎠ ∂x ∂x ∂y ∂y ⎦
Using Stokes' theorem
∂ ⎛ ∂f ⎞ ∂f
∫∫ ∂x ⎜⎝ ∂x ⎟⎠
W dxdy = v∫ ∂x nx ds
W

∂ ⎛ ∂f ⎞ ∂f
∫∫ ∂y ⎜⎝W ∂y ⎟⎠dxdy = v∫ W ∂y ny ds
where nˆ = nx iˆ + n y ˆj
⎡ ∂ ⎛ ∂f ⎞ ∂ ⎛ ∂f ⎞ ⎤ ⎛ ∂f ∂f ⎞
∴ ∫ ∫ ⎢ ⎜W ⎟ + ⎜ W ⎟⎥ dxdy = ∫
v ⎜ W n + W n y ⎟ ds
⎣ ∂x ⎝ ∂x ⎠ ∂y ⎝ ∂y ⎠ ⎦ ⎝ ∂x ∂y ⎠
x

⎛ ∂f ˆ ∂f ˆ ⎞
Note that nˆ ⋅∇f = (nx i + n y j ) ⋅ ⎜ i +
ˆ ˆ j⎟
⎝ ∂x ∂y ⎠
∂f ∂f
= nx + ny ≡ flux of f through boundary = qn
∂x ∂y
⎡ ∂ ⎛ ∂f ⎞ ∂ ⎛ ∂f ⎞ ∂W ∂f ∂W ∂f ⎤
∴ I = ∫ ∫ ⎢ ⎜W ⎟ + ⎜W ⎟− − − F ⎥dxdy = 0
⎣ ∂x ⎝ ∂x ⎠ ∂y ⎝ ∂y ⎠ ∂x ∂x ∂y ∂y ⎦
⎛ ∂W ∂f ∂W ∂f ⎞
= v∫ Wqn ds − ∫ ∫ ⎜ + + WF ⎟dxdy = 0
B ⎝ ∂x ∂x ∂y ∂y ⎠
The
h li
line integral
i l describes
d ib the
h flux
fl qn normall to the
h outer
boundary B of the solution domain.
→ For
F allll interior
i t i elements
l t that
th t do
d nott coincide
i id
with the outer boundary, you have v∫ Wq ds = 0
B
n

→ For Neumann BCs you have values for v∫ Wq ds


B
n
∴ Globally the integral will be in terms of approximate solution:
I ( f ( x, y )) = I [1,1] + I [2,1] + " + I [ i , j ] + " + I [ I −1, J −1] + Wq ds = 0
v∫ n
B

⎛ ∂W ∂f ∂W ∂f ⎞
where I = − ∫∫ ⎜
[i , j ]
+ + WF ⎟ dxdy for interior elements.
⎝ ∂x ∂x ∂y ∂y ⎠
In Galerkin approach we use the shape functions itself as the
weighing function W .
Recall,, f [i , j ] ( x , y ) = f1 × ((1 − x − y + x y ) + f 2 × ( x − x y )
+ f3 × ( x y ) + f 4 × ( y − x y )
∂f
∴ = f1 × ( −1 + y ) + f 2 × (1 − y ) + f3 × ( y ) + f 4 × ( − y )
∂x
∂f
Similarly
Similarly, = f1 × ( −1 + x ) + f 2 × ( − x ) + f3 × ( x ) + f 4 × (1 − x )
∂y
→ As the weighing functions N k[i , j ] ( x , y ) are applicable
only in the element i , j and elsewhere being zero we can
write total integral
xI y I xi +1 yi +1

I ( f ( x, y )) = ∫ ∫ [ ]dxdy = ∫ ∫ [ ]dxdy
x1 y1 xi yi

i.e. Integration of the i, j element.


→ Adopting local system and also the normalised coordinates
for this element i, j , we need to transform
xi +1 yi +1 ∆x ∆y 1 1

∫ ∫ [ ]dxdy → ∫ ∫ [ ]dxdy → ∫ ∫ [ ]dxdy


xi yi 0 0 0 0
→ In the integration the four shape functions are used
N1 ( x , y ) = (1 − x − y + x y )
∂N1 ∂N1
You can have = −1 + y ; = −1 + x
∂x ∂y
xi +1 yi +1
⎡ ∂W ∂f ∂W ∂f ⎤
I =−∫ ∫ ⎢ + + WF ⎥dxdyy = 0
xi yi ⎣
∂x ∂x ∂y ∂y ⎦
1 1
⎡ ∂W ∂f 1 ∂W ∂f 1 ⎤
= −∫ ∫ ⎢ + + WF ⎥dxdy∆x∆y = 0
0 0 ⎣
∂x ∂x (∆x) 2
∂y ∂y (∆y ) 2

∂f
= f1 × (−1 + y ) + f 2 × (1 − y ) + f3 × y + f 4 × (− y )
∂x
∂f
= f1 × (−1 + x ) + f 2 × (− x ) + f3 × x + f 4 × (1 − x )
∂y
Substitute W = N1 in equation 1 and obtain first element equation
Si il l putt W = N 2 andd obtain
Similarly bt i secondd element
l t equation
ti
Again third and fourth element equations are obtained by
b tit ti W = N 3 andd W = N 4 in equation
substituting ti 1.1
→ The general node (i, j ) is part of four elements
i − 1, j − 1 , i, j − 1 , i, j , i − 1, j .
→ Using the above procedure,
four element equations each for the
remaining three elements
i − 1, j − 1 , i, j − 1 , and i − 1, j
are also generated.
→ The corresponding element equations for which
the
h shape
h functions
f i have
h magnitude
i d 1.0 at the d ( i,j
h node i j)
are assembled to obtain nodal equations for (i, j ).
→ The assembled nodal equation is subsequently applied
at each of the unknown nodes in the domain.
→ System of algebraic equations in nodal values
f1,1 , f 2,1 ,....., fi , j ,.... f I , J are generated.
→ Adjust for boundary conditions.
→ The nodal equation is modified for those
elements that are part of the domain boundary
by incorporating the term v∫ Wq ds
B
n

→ This modification is required only for those elemnts having


non-zero Neumann B.C.s
→ The system of algebraic equations are solved
to obtain the nodal values.
Finite‐Difference Method for Hyperbolic
Partial
i l Differential
iff i l equations
i
• As discussed, the spatial first derivative in
hyperbolic PDE may be subjected to backward
difference formula (Upwind scheme).
• There are Lax‐Wendroff methods to solve
PDEs:
• Lax and Wendroff developed O ( ∆x 2 ) and O ( ∆t 2 )
approximations for solving convection
equations. ∂∂ft + u ∂∂fx = 0
∂f ∂f 2
∂ f ∂ f
2
= −u =u
2
• They suggested ∂t ∂x
and
∂t
2
∂x 2

and substituted them in Taylor’s Series.


• Lax
Lax‐Wendroff
Wendroff one step:
• Keeping base point as f ( xi , ti ) → fi ( n ).
(n) (n)
∂f 1 ∂f
f i ( n +1) = fi ( n ) +
∂t
.∆t + .
2! ∂t
( )
.∆t 2 + O ∆t 3
i i

∂2 f ∂ ⎛ ∂f ⎞ ∂ ⎛ ∂f ⎞ ∂
(n) (n)
∂f ∂f
2
f
• Now, ∂t
= −u
∂x
and ∂t 2
= −
∂t ⎝⎜ ∂x ⎠⎟
u = −u
∂x ⎝⎜ ∂t ⎟

= u 2

∂x 2
i i

(n) (n)
∂f ∂ f
( )
2
1
∴ f i ( n +1) = f i ( n ) − u ⋅ .∆t + u 2 ⋅ 2 .∆t 2 + O ∆t 3
∂x i 2 ∂x i


• Using second order centered‐difference
centered difference
scheme:
( n +1) f i +( n1) − f i −( n1) 1 2 ⎛ f i +( n1) − 2. fi ( n ) + f i −( n1) ⎞ 2
fi = fi (n)
−u⋅ ⋅ ∆t + ⋅ u ⋅ ⎜ ⎟ ⋅ ∆t
2∆x 2 ⎝ ∆ x 2

u ∆t
• Let us define convection number as c=
∆x
.
= f − ( f − f ) + ⋅ ( f − 2. f + f )
2
c
( n +1) c (n) (n) (n) (n) (n) (n)
fi i i +1 i −1 i +1 i i −1
2 2
This is the Lax‐Wendroff one step p
approximation.
Here c = u∆t ≤ 1.0
Here, 1 0 for stability
stability.
∆x

You might also like