You are on page 1of 8

Lecture 11

FEM in 1D and 2D: Quadratic Shape Functions


(Lecture notes taken by Paul Thompson and Jason Andrus)


Steady state problem in 1D.

-u
xx
+ Cu =
u(u), u(I) gi:cn.
Find the weak equation by multiplying the differential equation by with (0) = (L) = 0 and
integrating by parts
o(u, ) ](u
x

x
+Cu) = ] l().

Quadratic shape functions in 1D.

In order to obtain more accurate approximations use quadratic and not linear shape functions.
Express the values as a function of unknown constants
u
c
= o
1
+o
21
x +o
3
x
2

= x - x


Then u can be written as a function of and new values
u
c
= o
1
+ o
2
+ o
3

2

Example Problem Use the below axis, assume u
1
= u(0), u
2
= u(h/2), u
3
= u(h)

u
1
c
= o
1
+ o
2
u + o
3
- u
2

u
2
c
= o
1
+ o
2
b
2
+ o
3
(b2)
2

u
3
c
= o
1
+ o
2
b + o
3
b
2

In matrix form
_
u
1
c
u
2
c
u
3
c
_ = _
1 u u
1 b2 (b2)
2
1 b b
2
__
o
1
o
2
o
3
_

Let us define matrix A as
A = _
1 u u
1 b2 (b2)
2
1 b b
2
_
This is written in vector form
u
c
= Ao e R
3

A
-1
u
c
= o
The inverse of A is
A
-1
= B = _
1 u u
-Sb 4b -1b
2b
2
-4b
2
2b
2
_


Express u as a function of u
1
, u
2
, and u
3
through the use of shape function Q
i
, which will
be defined later,
u
c
=
1
()u
1
c
+
2
()u
2
c
+
3
()u
3
c

Let us analyze Q
1

1
= o
1
+b
1
+ c
1

1
(u) = 1,
1
_
b
2
] = u,
1
(b) = u
_
1
u
u
_ = _
1 u u
1 b2 (b2)
2
1 b b
2
__
o
1
b
1
c
1
_
c
1
= A_
o
1
b
1
c
1
_, c
2
= A_
o
2
b
2
c
2
_, c
3
= A_
o
3
b
3
c
3
_
This means the coefficients of the Q
i
are in column i of the inverse of A, which we wrote as B.

1
= 1 - _
S
b
] +(2b
2
)
2

2
= u + _
4
b
] +(4b
2
)
2

3
= u - _
1
b
] +(2b
2
)
2

Element matrices (3x3) in 1D.



o(u, ) = l()
o(u
c
,

) = l(

)
o(u
1
c

1
+u
2
c

2
+u
3
c

3
,

) = l(

)
o(
1
,

)u
1
c
+ o(
2
,

)u
2
c
+ o(
3
,

)u
3
c
= l(

Thus the element matrix k


e
is dimension 3x3
k
c
= |k
]
c
] onJ k
]
c
= o(
]
,

).
The right hand side matrix must then be 3x1
J
c
= |J

c
] onJ J

c
= l(

).
Use the following notation

m
i
wbcrc m
1
= u, m
2
= 1 onJ m
3
= 2.

= B(t, i)
m
i
3
i =1
and
]
= B(, i)
m
]
3
] =1

From these definitions one can analyze a(Q
j
,Q
i
)
o(
]
,

) = _(
]{
+
{
) +C
]


o(
]
,

) = B(, ])
]
m
]

m
]
-1
B(t , i)m
i

m
i
-1
i
+C B(, ])
]

m
]
B(t, i)
m
i
i

o(
]
,

) = B(, ])
]
|_m
]

m
]
-1
m
i

m
i
-1
+ C
m
]

m
i
]B(t , i)
i

g(t , ) = |_m
]

m
]
-1
m
i

m
i
-1
+ C
m
]

m
i
]
o(
]
,

) = |B
1
0B]
ij
Lastly the right hand side of the equation:

J

c
= _

= |B
1
F]

F =
`

_
m
1
_
m
2
_
m
3
/



Error estimates for a test case: fem1d.m
Take an example Equation: - u
xx
+ u = 32 where u(0) = 0 and u(2) = 4
Define the error = u(ih) u
i
where we can choose to use either a linear or quadratic
shape function for u
i

Table1:ErrorComparisonforWeightingFunctions
n errorinlinearfem errorinquadraticfem
6 0.0978 2.75E04
11 0.0248 2.12E05
21 0.0062 1.49E06
41 0.0015 9.80E08
O(h
2
) O(h
4
)


Extension to 2D.

u
c
(x, y) = o
1
+ o
2
x + o
3
y + o
4
x
2
+ o
5
xy + o
6
y
2


Where the element is shown by:



Consider the change of coordinates shown as:
5
4
3
2
1
6


With the change of coordinates the element is now represented as:

u
c
(, p) = o
1
+ o
2
+ o
3
p + o
4

2
+ o
5
p + o
6
p
2


The equations at the six nodes give the vector equation

l
l
l
l
l
l
l
u
1
c
u
2
c
u
3
c
u
4
c
u
5
c
u
6
c
1
1
1
1
1
1
1
=
l
l
l
l
l
l
l
l
l
1 -b u
1
o - b
2
u
1 o u
(-b)
2
u u
(
o - b
2
)
2
u u
o
2
u u
1
o
2
c
2
1 u c
1
-b
2
c
2
(
o
2
)
2
oc
4
(
c
2
)
2
u u c
2
(
-b
2
)
2
-bc
4
(
c
2
)
2
1
1
1
1
1
1
1
1
1
l
l
l
l
l
l
o
1
o
2
o
3
o
4
o
5
o
6
1
1
1
1
1
1



Which otherwise can be represented as:
u
c
= Ao e R
6

A
-1
u
c
= o or Bu
c
= o wbcrc B = A
-1


We can represent the element values of u as a combination of sources:
u
c
= u
1
c

1
(, p) + + u
6
c

6
(, p)

(, p) = o

+ b

+ c

p + J

2
+ c

p+

p
2


x
y
c
b
a

Thus:


c

= A _
o

_ - B(: , i) =
l
l
l
l
l
l
o

1
1
1
1
1
1
sincc B = A
-1


Element matrices (6x6) \in 2D.

The element matrices k
e
are 6 x 6 matrices.

k
]
c
= o(
]
,

) wbcrc o comcs rom u =


o(u, ) = _u
x

x
+ u


o(
]
,

) =
]{

{
c
+
]q

q
JJp
After a number of computations as in the 1D case this can be expressed as

o(
]
,

) = |B
1
0B]
]

G follows from the differential equation and the integration formulas:
b(m, n) =
m
p
n

=
c
n+1
|u
m+1
-(-b)
m+1
]m!n!
(m+n+2)!


The values of a,b and c will change from one element to the next and can be computed
from the coordinates of the element nodes:
a = [(x
3
x
5
)(x
3
x
1
) (y
5
y
3
)(y
3
y
1
)]/r

b = [(x
5
x
1
)(x
3
x
1
) +(y
5
y
1
)(y
3
y
1
)]/r

c = [(y
5
y
3
)(x
3
x
1
) + (x
3
x
5
)(y
3
y
1
)]/r

r = ((x
3
x
1
)
2
+ (y
3
y
1
)
2
)
1/2

You might also like