1
Onedimensional heat conduction: Shape
functions and nodebased FEformulation
Formulation of a FEproblem starting with the
weak form of the problem
MT531G FEM L5
2
Weak form of 1D heat flow
Find the function T(x) that fulfils the essential
boundary conditions and solves
0
0 0
d d d
d d
d d d
L L L
v T T
kA x v kA vQ x
x x x
(
= +
(
} }
for an arbitrary choice of v(x)
x
Q = 100 J/ms
x = 2 m x = 8 m
A = 10 m
2
, k = 5 J/ms
T = 0
q = 15 J/m
2
s
MT531G FEM L5
3
General idea with finite elements
We have one function to determine (T) and
one weight function (v).
Both are functions of x
Idea: approximate both functions using
cleverly chosen shape functions N(x)
MT531G FEM L5
4
Elements and shape functions
Example
x
Q = 100 J/ms
x = 2 m x = 8 m
A = 10 m
2
, k = 5 J/ms
T = 0
q = 15 J/m
2
s
Divide the region into three elements
1 2 3
1 2 3 4
x
x = 2 4 6 8
Three equally long elements (L
o
= 2m) and four nodes
MT531G FEM L5
5
Shape functions
Example
1 2 3
1 2 3 4
x
x = 2 4 6 8
Associate one shape function N(x) to each node,
e.g. for node 2:
1 2 3 4
x
1
0
N
2
x = 2 4 6 8
MT531G FEM L5
6
Shape functions continued
Example
In this way we have created four shape functions:
1 2 3 4
x
1
0
Now, approximate T(x) as a linear combination of the
contributions from each shape function:
( ) ( ) ( ) ( )
1 1 2 2 3 3 4 4
T N x T N x T N x T N x T = + + +
Note, each shape function have the fundamental property to
have the value 1 at the node it is associated with and the value
0 at all other nodes. Implies: T
i
= T at node i.
T for node 2
N
4
N
3
N
2
N
1
MT531G FEM L5
7
Shape functions continued
Generally write: T = Na
 
1 2 n
N N N = N
1
2
n
T
T
T
(
(
(
=
(
(
a where
n = number of nodes
Remember weak form:
(
= +
(
} }
0
0 0
d d d
d d
d d d
L L L
v T T
kA x v kA vQ x
x x x
 
1 1 2 2
1 2
1 2
d d
d d
d d d
d d d
n n
n
n
T
N T N T N T
x x
N N N
T T T
x x x
= + + +
(
= + + +
(
Need:
MT531G FEM L5
8
Shape functions continued
Generally write:
d
d
T
x
= Ba
where
d
dx
=
N
B
Example B
2
1 2 3 4
x
1/2
0
1/2
dN
2
/dx
see Fig. 9.6 page 166
MT531G FEM L5
9
Approximate T(x) in the weak formulation
Example
x
Q = 100 J/ms
x = 2 m x = 8 m
A = 10 m
2
, k = 5 J/ms
T = 0
q = 15 J/m
2
s
Weak formulation:
8 8 8
2
2 2
d d d
d d
d d d
v T T
kA x v kA vQ x
x x x
(
= +
(
} }
= (2) 0 T and
Introduce the approximation:
 
8 8
8
2
2 2
d
d d
d
v
kA x vAq vQ x
x
= +
} }
Ba
=
1
0 T and
MT531G FEM L5
10
Approximate T(x) continued
Example
 
8 8
8
2
2 2
d
d d
d
v
kA x vAq vQ x
x
= +
} }
Ba
a is a vector independent of x it can be moved out
 
8 8
8
2
2 2
d
d d
d
v
kA x vAq vQ x
x
= +
} }
B a
Now, approximate the weight function using the shape functions
v = Nc
MT531G FEM L5
11
Approximate the weight function
Trick to put nodal vector c on the correct side of the eqn
we will also need:
( )
T T T T T T
d d d
d d d
v
x x x
= = = c N c N c B
T T
v = c N
T T
d
d
v
x
= c B
( )
T
T T T
v v = = = Nc c N v is a scalar:
MT531G FEM L5
12
Approximate the weight function continued
Example
 
8 8
8
2
2 2
d
d d
d
v
kA x vAq vQ x
x
= +
} }
B a
8 8
8
T T T T T T
2
2 2
d d kA x Aq Q x
 
(
= +


\ .
} }
c B B a c N c N
Introduce the approximation of v(x):
where c is a vector independent of x. It can be moved out:
8 8
8
T T T T T T
2
2 2
d d kA x Aq Q x
 
(
= +


\ .
} }
c B B a c N c N
MT531G FEM L5
13
FEformulation
Example
8 8
8
T T T T T T
2
2 2
d d kA x Aq Q x
 
(
= +


\ .
} }
c B B a c N c N
Move everything to the left hand side and take out c
T
8 8
8
T T T T
2
2 2
d d 0
0
kA x Aq Q x
 
(
+ =

`

\ . )
} }
c B B a N N
The expression within the parenthesis have to be
zero since c should be arbitrary (to get v arbitrary)
MT531G FEM L5
14
FEformulation continued
Example
l
b
8 8
8
T T T
2
2 2
d d kA x Aq Q x
 
(
= +


\ .
} }
f
f
B B a N N
K
We get:
Essential b.c. are enforced on a directly
= Ka f where the natural b.c. are in f
MT531G FEM L5
15
Example
1 2 3
1 2 3 4
x
x = 2 4 6 8
Stiffness matrix K
 
(
(
(
= =
(
(
} }
1
8 8
2 T
1 2 3 4
3
2 2
4
d d
B
B
kA x kA B B B B x
B
B
K B B
=
}
8
2
d
ij i j
K kA B B x A typical element in K, row i column j:
MT531G FEM L5
16
Evaluation of K
Generally:
d
ij i j
L
K kA B B x =
}
ij ji
K K =
K is a symmetric matrix
K turns out as a symmetric matrix since we use the same
shape functions to approximate T and v.
This is known as Galerkins method.
MT531G FEM L5
17
Example
8
2
d
ij i j
K kA B B x =
}
1 2 3 4
x
1
0
Evaluation of K continued
x B
1
B
2
B
3
B
4
]2, 4[ 1/2 +1/2 0 0
]4, 6[ 0 1/2 +1/2 0
]6, 8[ 0 0 1/2 +1/2
The evaluation of K (by hand) is simplified by a table:
MT531G FEM L5
18
Evaluation of K continued
Example
8 4
11 1 1
2 2
1 1
d 50 d 25
2 2
K Ak B B x x
   
= = =
 
\ . \ .
} }
The table shows that B
1
0 only in region ]2,4[
8 4
12 1 2
2 2
1 1
d 50 d 25
2 2
K Ak B B x x
   
= = =
 
\ . \ .
} }
From 2nd and 3rd column, B
1
B
2
0 only in region ]2, 4[
MT531G FEM L5
19
Evaluation of K continued
Example
8
13 1 3
2
d 0 K Ak B B x = =
}
25 25 0 0
50 25 0
50 25
SYM 25
(
(
(
=
(
(
K Continued evaluation yield:
The tables 2nd and 4th column show that
there are no region where B
1
B
3
0
MT531G FEM L5
20
Evaluation of K continued
Generally:
d 0
ij i j
L
K kA B B x = =
}
only if the d.o.f.s i och j
are shared by an element
Important: This results in a banded stiffness matrix.
That is, K contains a lot of elements that are zero
Only nonzero elements have to be stored.
This leads to:
1. A very limited number of elements of K have to be stored
2. A substantial reduction in solution time
MT531G FEM L5
21
Evaluation of the boundary vector
l
b
T T T
0
0 0
d d
L L
L
kA x Aq Q x
 
(
= +


\ .
} }
f
f
B B a N N
K
Example
( )
( )
( )
( )
8
1
8
2
T
b
2
3
4
2
N x Aq
N x Aq
Aq
N x Aq
N x Aq
(
(
(
(
=
(
(
f N
The only N
i
0
existing for x = 2
and 8 are those
that are connected
to the boundary
nodes; i.e. nodes 1
and 4
MT531G FEM L5
22
Evaluation of f
b
continued
Example
( ) ( )
( ) ( )
( )
( )
( )
1
b
4
1
2
2 2
2
0
0
0
0
0
0
8
8 8
150
150
1
Aq
N Aq
Aq
Aq
N Aq
=
(
(
(
(
(
(
(
(
(
(
= = =
(
(
(
(
(
(
(
(
(
(
=
f
l
b
T T T
0
0 0
d d
L L
L
kA x Aq Q x
 
(
= +


\ .
} }
f
f
B B a N N
K
f
l
= ?
MT531G FEM L5
23
Evaluation of load vector
Example
( )
( )
( )
( )
( )
( )
( )
( )
8
4
1
1
2
2
8
6
2
8
2
2
T
2
l
8
8 2
3
3
2
4
8
8
4
4
2
6
1
d
d
1
d
d
2
d 100
2
d
1
d
d
d
N x Q x
N x x
N x Q x
N x x
Q x Q
N x Q x
N x x
N x Q x
N x x
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
= = = =
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
}
}
}
}
}
}
}
}
}
f N
MT531G FEM L5
24
System of equations
Example
We can now collect the system of equations:
= Ka f
( ) ( )
2
3
4
l
b
0
25 25 0 0 2 100 2 100
50 25 0 0 200 200
50 25 0 200 200
SYM 25 150 100 50
Aq Aq
T
T
T
+
= + =
(
( ( ( (
(
( ( ( (
(
( ( ( (
(
( ( ( (
(
( ( ( (
(
f
f
Essential b.c.
Natural b.c.
MT531G FEM L5
25
Solution of equation system
Example
Only T
2
, T
3
, T
4
are unknown. Rows 2, 3 & 4 give:
2
3
4
50 25 0 200
25 50 25 200
0 25 25 50
T
T
T
(
( (
(
( (
=
(
( (
(
( (
Solution gives:
2
3
4
14
20
18
T
T
T
(
(
(
(
=
(
(
(
(
MT531G FEM L5
26
Solution of equation system  continued
Example
1st row of original eq. system yields
( )
2
25 100 2 T Aq = +
Since T
2
is known from the solution, we arrive at
( ) ( )
2
2 25 14 100 /10 45 J/sm q = =
0
5
10
15
20
25
2 3 4 5 6 7 8
x (m)
T
(
c
)
MT531G FEM L5
27
Some observations and notations
The FEsolution turns out to be a good
approximation of T(x).
In this case it is exact at the nodal points but
this is a special feature of this problem and not a
general conclusion.
Each shape function is associated with a node in
a FEprogram this is organized in another way: the
shape functions are associated with the elements.
By designing the shape functions so that the value
of the shape function is 1 at the node and zero at
all other nodes we arrive at a banded K which
reduces both the need of computer memory and
the time to solve the resulting equation system.