Are you sure?
This action might not be possible to undo. Are you sure you want to continue?
3. 1
3. Basic concepts of FEM: solution of 1D bar problem
Table of contents
3.1 Basic concepts : mesh, nodes, elements, interpolation, ...
3.2 FEA of axially loaded bar
3.3 Notes : direct method, higherorder elements, …
3.4 Principle of Virtual Work (PVW) approach
3.5 Galerkin Weighted Residual (GWR) method
3.6 Implementation issues
MAK 539E
3. 2
3.1 Basic concepts
• The FEM is also based on the RRM, but
– the basis functions are easy to find : interpolation
– the q
i
have a physical significance : nodal displacements
• Basic idea
– Discretize the domain with a finite element mesh composed of nodes and
elements
– Compute the “best values” of the nodal displacements (based, for example, on the
PMPE)
– Use interpolation to find the solution everywhere else in the discretized domain
• There are many elements of different types and geometries : 1D, 2D, 3D, plane
stress, plane strain, plates, shells, structural, thermal, fluid mechanics, electromagnetic,
elastic, plastic, static, dynamic, …
NODE
ELEMENT
MAK 539E
3. 3
3.2 FEA of axially loaded bar
In this section, we introduce the 6 basic steps of a FEA by solving the following simple
structural problem
p
o
(N/m)
x
0
L
Stiffness E
Crosssection A(x)=A
o
(1x/aL) with a > 1
(we will take a=10)
Exact solution
GDE:
d
dx
EA
o
1−
x
aL

\

¹

du
dx

\

¹

= −p
o
for 0 ≤ x ≤ L
BC :
u 0
( )
= 0
EA L
( )
du
dx
L
= 0
¦
´
¦
¹
¦
Solution :
EA
o
u
ex
x
( )
= p
o
L
2
a
x
L
+ a
2
− a
( )
ln 1−
x
aL

\

¹

¸
(
¸
(
σ
ex
x
( )
= E
du
ex
dx
=
p
o
L
A
o
1−
x
L
1−
x
aL
¸
(
¸
(
(
(
¦
´
¦
¦
¦
¹
¦
¦
¦
MAK 539E
3. 4
FEA of axially loaded bar
Finite element solution
We will use the PMPE. The total potential energy Π for this problem is
Π = U + V =
1
2
EA
du
dx

\

¹

2
dx − p
o
u x ( )dx
0
L
∫
0
L
∫
Every FEA consists of 6 steps
Step 1 : Discretization
Let’s choose 3 elements of equal length with constant crosssection
(computed at element center: x=L/6, x=L/2 and x=5L/6)
•
•
•
•
L/3 L/3 L/3
1 2 3
4 1 2 3
4 nodes
3 elements
This image cannot currently be displayed.
E,
59A
o
60
E,
57A
o
60
E,
55A
o
60
MAK 539E
3. 5
FEA of axially loaded bar
Step 2 : Property of an individual (generic) element
Let’s look at a generic 2node element of length l, stiffness E and constant crosssection A
• •
local coordinate s
E, A, l a
b
local numbering
The basic idea of the FEM is to write the approximate displacement in an element as the
interpolation between the (so far unknown) nodal values U
a
and U
b
˜ u s ( )
For a twonode element, the interpolation is linear
•
•
s
E, A, l a b
•
•
U
a
U
b
u(s)
~
˜ u s ( ) = U
a
1−
s
l

\

¹
 + U
b
s
l
= U
a
N
a
s ( ) +U
b
N
b
s ( )
MAK 539E
3. 6
N
a
(s) and N
b
(s) play an important role in FEA and are called interpolation or shape
functions
Since we have the approximate expression of u(s) on the generic element, we can
compute the (approximate) contribution of the element to the total potential energy
= ˜ u (s) ( )
Π
e
≈
˜
Π
e
=
1
2
E A
d˜ u
ds

\

¹

2
ds − p
o
˜ u s ( )ds
0
l
∫
0
l
∫
o ( )
• •
l
a
b
•
•
N
b
(s)=s/l
N
a
(s)=1s/l
1
1
but ˜ u s ( ) = U
a
N
a
s ( ) +U
b
N
b
s ( )
thus
d˜ u s ( )
ds
= U
a
dN
a
s ( )
ds
+ U
b
dN
b
s ( )
ds
Substitutein o ( )
˜
Π
e
=
1
2
EA U
a
dN
a
ds
+U
b
dN
b
ds
¸
(
¸
(
2
ds − p
o
U
a
N
a
s ( ) +U
b
N
b
s ( )
 
ds
0
l
∫
0
l
∫
FEA of axially loaded bar
MAK 539E
3. 7
FEA of axially loaded bar
Expand the square term :
˜
Π
e
=
1
2
EA U
a
2
dN
a
ds

\

¹

2
+ 2U
a
U
b
dN
a
ds
dN
b
ds
+U
b
2
dN
b
ds

\

¹

2
¸
(
¸
(
(
ds − p
o
U
a
N
a
s ( ) +U
b
N
b
s ( )  ds
0
l
∫
0
l
∫
Put in a matrix form :
˜
Π
e
=
1
2
U
a
U
b
EA
dN
a
ds

\

¹

2
ds
0
l
∫
EA
dN
a
ds

\

¹

dN
b
ds

\

¹

ds
0
l
∫
EA
dN
a
ds

\

¹

dN
b
ds

\

¹

ds
0
l
∫
EA
dN
b
ds

\

¹

2
ds
0
l
∫
¸
(
¸
(
(
(
(
(
U
a
U
b
¦
´
¹
¹
`
)
− U
a
U
b
p
o
N
a
s ( )ds
0
l
∫
p
o
N
b
s ( )ds
0
l
∫
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
local stiffness matrix
[k]
local load vector
{r}
In short notation :
˜
Π
e
=
1
2
U
a
U
b
k  
U
a
U
b
¦
´
¹
¦
¹
`
)
¦
− U
a
U
b
r { }
MAK 539E
3. 8
Since we know that
N
a
s ( ) = 1−
s
l
and N
b
s ( ) =
s
l
we can compute [k] and {r}. For example,
k
12
= k
21
= EA
dN
a
ds
dN
b
ds
ds = EA
−1
l

\

¹

1
l

\

¹

ds = −
EA
l
0
l
∫
0
l
∫
Find
k   =
EA
l
1 −1
−1 1
¸
(
¸
( r { }= p
o
l
1/ 2
1/ 2
¦
´
¹
¹
`
)
MAK 539E
3. 9
FEA of axially loaded bar
Step 3 : Assemble the elements (i.e., put the pieces together)
Now that we know the properties of a generic element, we can go back to the global level
• • • •
L/3 L/3 L/3
1 2 3
4 1 2 3
4 nodes
3 elements
The objective is to find the 4 nodal displacements
D = U
1
U
2
U
3
U
4
Once these are determined, we can use the shape functions to interpolate the displacement
field inside each element
• • • •
1 2 3 4
U
1
U
2
U
3
U
4
u(s)
~
MAK 539E
3. 10
FEA of axially loaded bar
Note : the approximate displacement solution is continuous within and between
elements
– Within an element :why?
– Between elements : why?
˜ u s ( )
To solve for the nodal displacement vector {D}, we need a system of 4 equations.
These equations will be obtained through the PMPE for the whole structure.
The first thing we need to do is to write the (approximate) expression of the total potential
energy of the structure by adding the contribution of all three elements (using the result of Step 2).
Recall that, for a generic 2node element of length l :
˜
Π
e
=
1
2
U
a
U
b
k  
U
a
U
b
¦
´
¹
¦
¹
`
)
¦
− U
a
U
b
r { }
k   =
EA
l
1 −1
−1 1
¸
(
¸
( r { }= p
o
l
1/ 2
1/ 2
¦
´
¹
¹
`
)
with
Objective : write the (approximate) total potential energy as
˜
Π
TOT
=
˜
Π
e
e
∑
=
1
2
D K   D { } − D R { }
MAK 539E
3. 11
FEA of axially loaded bar
Let’s add the contribution of all three elements to the total potential energy
• Element #1 : l=L/3 a=1 b=2 A=59A
o
/60
⇒
˜
Π
(1)
=
1
2
U
1
U
2
59EA
o
20L
−
59EA
o
20L
−
59EA
o
20L
59EA
o
20L
¸
(
¸
(
(
(
U
1
U
2
¦
´
¹
¹
`
)
− U
1
U
2
p
o
L
6
p
o
L
6
¦
´
¦
¹
¦
¹
`
¦
)
¦
˜
Π
TOT
=
1
2
U
1
U
2
U
3
U
4
59EA
o
20L
−
59EA
o
20L
0 0
−
59EA
o
20L
59EA
o
20L
0 0
0 0 0 0
0 0 0 0
¸
(
¸
(
(
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
− U
1
U
2
U
3
U
4
p
o
L
6
p
o
L
6
0
0
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
Its contribution to the total
potential energy is :
MAK 539E
3. 12
FEA of axially loaded bar
• Element #2 : l=L/3 a=2 b=3 A=57A
o
/60
⇒
˜
Π
(2)
=
1
2
U
2
U
3
57EA
o
20L
−
57EA
o
20L
−
57EA
o
20L
57EA
o
20L
¸
(
¸
(
(
(
U
2
U
3
¦
´
¹
¹
`
)
− U
2
U
3
p
o
L
6
p
o
L
6
¦
´
¦
¹
¦
¹
`
¦
)
¦
˜
Π
TOT
=
1
2
U
1
U
2
U
3
U
4
59EA
o
20L
−
59EA
o
20L
0 0
−
59EA
o
20L
59EA
o
20L
+
57EA
o
20L
−
57EA
o
20L
0
0 −
57EA
o
20L
57EA
o
20L
0
0 0 0 0
¸
(
¸
(
(
(
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
−
U
1
U
2
U
3
U
4
p
o
L
6
p
o
L
6
+
p
o
L
6
p
o
L
6
0
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
Its contribution to the total
potential energy is :
MAK 539E
3. 13
FEA of axially loaded bar
• Element #3 : l=L/3 a=3 b=4 A=55 A
o
/60
⇒
˜
Π
(3)
=
1
2
U
3
U
4
55EA
o
20L
−
55EA
o
20L
−
55EA
o
20L
55EA
o
20L
¸
(
¸
(
(
(
U
3
U
4
¦
´
¹
¹
`
)
− U
3
U
4
p
o
L
6
p
o
L
6
¦
´
¦
¹
¦
¹
`
¦
)
¦
˜
Π
TOT
=
1
2
U
1
U
2
U
3
U
4
59EA
o
20L
−
59EA
o
20L
0 0
−
59EA
o
20L
59EA
o
20L
+
57EA
o
20L
−
57EA
o
20L
0
0 −
57EA
o
20L
57EA
o
20L
+
55EA
o
20L
−
55EA
o
20L
0 0 −
55EA
o
20L
55EA
o
20L
¸
(
¸
(
(
(
(
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
−
U
1
U
2
U
3
U
4
p
o
L
6
p
o
L
6
+
p
o
L
6
p
o
L
6
+
p
o
L
6
p
o
L
6
¦
´
¦
¦
¦
¦
¹
¦
¦
¦
¦
¹
`
¦
¦
¦
¦
)
¦
¦
¦
¦
Its contribution to the total
potential energy is :
MAK 539E
3. 14
FEA of axially loaded bar
We have thus achieved our objective :
˜
Π
TOT
=
1
2
D K   D { } − D R { }
where [K] is the GLOBAL STIFFNESS MATRIX
{R} is the GLOBAL LOAD VECTOR
D = U
1
U
2
U
3
U
4
K
 
=
EA
o
20L
59 −59 0 0
−59 116 −57 0
0 −57 112 −55
0 0 −55 55
¸
(
¸
(
(
(
(
R { }= p
o
L
1/ 6
1/ 3
1/ 3
1/ 6
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
Here
MAK 539E
3. 15
FEA of axially loaded bar
At this point, we apply the PMPE by choosing the nodal displacements which minimize
the approximate total potential energy of the structure :
∂
˜
Π
TOT
∂U
1
=
∂
˜
Π
TOT
∂U
2
=
∂
˜
Π
TOT
∂U
3
=
∂
˜
Π
TOT
∂U
4
= 0
or, in matrix form,
∂
˜
Π
TOT
∂ D { }
= 0 { }
Since
we get the linear system
Note : in practice, one does not need to compute the total potential energy in (*): just go
directly to (**) by assembling [k] and {r} into [K] and {R}, respectively.
˜
Π
TOT
=
1
2
D K   D { } − D R { }
(*)
K   D { } = R { }
(**)
MAK 539E
3. 16
FEA of axially loaded bar
Step 4 : Apply load and displacement boundary conditions
First, we impose the nodal (concentrated) loads. In this case, we only have the reaction R
o
at the wall (node 1)
• • • •
1 2 3 4
R
o
All the nodal loads are added to the global load vector {R}
EA
o
20L
59 −59 0 0
−59 116 −57 0
0 −57 112 −55
0 0 −55 55
¸
(
¸
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
= p
o
L
1/ 6
1/ 3
1/ 3
1/ 6
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
+
−R
o
0
0
0
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
Next, we apply the displacement boundary conditions. The linear system above is singular
(i.e., det[K]=0). To remove the singularity, we have to impose the fact that
U
1
= 0
We can thus remove the first row and column from our 4*4 system and reduce it to a 3*3 system.
MAK 539E
3. 17
FEA of axially loaded bar
The final form of the linear system is thus :
EA
o
20L
116 −57 0
−57 112 −55
0 −55 55
¸
(
¸
(
(
(
U
2
U
3
U
4
¦
´
¦
¹
¦
¹
`
¦
)
¦
= p
o
L
1/ 3
1/ 3
1/ 6
¦
´
¦
¹
¦
¹
`
¦
)
¦
Notes :  When the displacement b.c. are applied, the unknown reactions (here R
o
) disappear
from the system
 Is our approximate solution admissible? Why/why not?
Step 5 : Solve the linear system
Find
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
=
p
o
L
2
EA
o
0
0.28249
0.45492
0.51853
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
MAK 539E
3. 18
FEA of axially loaded bar
Step 6 : Postprocessing
In this step, we
• plot the deformed shape of the structure
• obtain the stresses and strains in each element
• compute the nodal reactions at the supports
1) Deformed shape
Using the nodal values and the
interpolation functions, we get :
Note: the nodal values are NOT exact!
MAK 539E
3. 19
FEA of axially loaded bar
2) Axial stress and strain in each element
Let’s go back to the generic element :
• •
E, A, l a
b
U
a
U
b
Since we have used a linear interpolation between U
a
and U
b
, the approximate axial strain
is constant in the element
˜
ε
xx
=
d˜ u s ( )
ds
= U
a
dN
a
ds
+U
b
dN
b
ds
= U
a
−1
l
+U
b
1
l
=
1
l
U
b
−U
a
( )
Similarly, the approximate stress is also constant in the element
˜ σ
xx
= E
˜
ε
xx
=
E
l
U
b
− U
a
( )
MAK 539E
3. 20
Let’s review the elements one by one and use the nodal displacements we just obtained in Step 5.
• Element #1 : l=L/3 a=1 b=2
U
a
= U
1
= 0 U
b
= U
2
= 0.28249
p
o
L
2
EA
o
⇒ ˜ σ
xx
(1)
=
E
L / 3
U
2
− U
1
( )
= 0.84746
p
o
L
A
o
• Element #2 : l=L/3 a=2 b=3
U
a
= U
2
= 0.28249
p
o
L
2
EA
o
U
b
= U
3
= 0.45792
p
o
L
2
EA
o
⇒ ˜ σ
xx
(2)
=
E
L / 3
U
3
− U
2
( )
= 0.52632
p
o
L
A
o
• Element #3 : l=L/3 a=3 b=4
U
a
= U
3
= 0.45792
p
o
L
2
EA
o
U
b
= U
4
= 0.51853
p
o
L
2
EA
o
⇒ ˜ σ
xx
(3)
=
E
L / 3
U
4
− U
3
( )
= 0.18182
p
o
L
A
o
MAK 539E
3. 21
FEA of axially loaded bar
MAK 539E
3. 22
FEA of axially loaded bar
3) Reactions at supports
Let’s reconsider the equation we deleted from the original system in Step 4 when we applied
the displacement boundary conditions:
Now that we know the nodal displacements, we can use that equation to solve for the unknown
reaction R
o
. We find
R
o
=
1
6
p
o
L +
59EA
o
20L
0.28249
p
o
L
2
EA
= p
o
L as expected!
EA
o
20L
59 −59 0 0
−59 116 −57 0
0 −57 112 −55
0 0 −55 55
¸
(
¸
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
= p
o
L
1/ 6
1/ 3
1/ 3
1/ 6
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
+
−R
o
0
0
0
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
MAK 539E
3. 23
3.3 Notes
Conclusions :
The finite element method
• is a special form of the RRM
• is based on the interpolation (using shape functions) of nodal displacement values
• contains 6 basic steps
1) discretization : mesh, nodes, elements
2) property of a generic element : local stiffness matrix [k] and load vector {r}
3) assembling : global load matrix [K] and load vector {R}
4) apply the load and displacement boundary conditions
5) solve the linear system [K] {D} = {R}
6) postprocessing : deformed shape, element stresses and support reactions
Important notes :
1) What if we use more elements? (N of them)
The property of a generic 2node element remains unchanged :
k   =
E A
l
1 −1
−1 1
¸
(
¸
r { } = p
o
l
1/ 2
1/ 2
{ }
But now, we have • l=L/N
• (N+1) unknown nodal displacements : U
1
, U
2
, …, U
N+1
MAK 539E
3. 24
N = 10
MAK 539E
3. 25
N = 10
MAK 539E
3. 26
Notes (Cont’d)
2) Why do we call [k] the element stiffness matrix?
To understand the physical significance of [k], let’s examine the behavior of a generic element
subjected to nodal forces
•
•
E, A, l a b
F
a
F
b
U
a
U
b
(1) Let’s fix U
a
>0 and U
b
=0, and compute the nodal forces F
a
and F
b
to achieve these displa
cements:
ε
xx
=
U
b
−U
a
l
= −
U
a
l
σ
xx
= Eε
xx
= −E
U
a
l
(compressive)
We have thus
F
a
= E AU
a
/ l
F
b
= −E AU
a
/ l
¦
´
¹
¦
•
•
a b
F
a
>0
U
a
F
b
<0
MAK 539E
3. 27
Notes (Cont’d)
(2) Now let’s fix U
a
=0 and U
b
>0, and compute the corresponding nodal forces F
a
and F
b
ε
xx
=
U
b
−U
a
l
=
U
b
l
σ
xx
= Eε
xx
= E
U
b
l
We have thus
F
a
= −E AU
b
/ l
F
b
= E AU
b
/ l
¦
´
¹
¦
• •
a b
F
a
<0
U
b
F
b
>0
(3) In the general case, U
a
and U
b
≠0. We can combine (1) and (2) to get:
F
a
F
b
¦
´
¹
¦
¹
`
)
¦
=
EA/ l −EA/ l
−EA/ l EA/ l
¸
(
¸
(
U
a
U
b
¦
´
¹
¦
¹
`
)
¦
= k  
U
a
U
b
¦
´
¹
¦
¹
`
)
¦
Thus [k] represents the stiffness of the element
[K] represents the stiffness of the whole structure
MAK 539E
3. 28
Notes (Cont’d)
3) How to incorporate a concentrated load?
Concentrated (nodal) loads must be added in Step 4.
p
o
(N/m)
x
0 L
P (N)
R
o
E.g.,
EA
o
20L
59 −59 0 0
−59 116 −57 0
0 −57 112 −55
0 0 −55 55
¸
(
¸
(
(
(
(
U
1
U
2
U
3
U
4
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
= p
o
L
1/ 6
1/ 3
1/ 3
1/ 6
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
+
−R
o
0
0
P
¦
´
¦
¦
¹
¦
¦
¹
`
¦
¦
)
¦
¦
MAK 539E
3. 29
Notes (Cont’d)
4) Higherorder elements
Instead of increasing the number of elements, we could increase the order of the shape
functions from order 1 (linear) to order 2 (quadratic).
Then each element has 3 nodes and 3 shape functions:
˜ u s ( ) = U
a
N
a
s ( ) + U
b
N
b
s ( ) + U
c
N
c
s ( )
•
•
•
l/2 a
b
c
U
a
U
b
U
c
parabola
l/2
where
•
•
•
l/2
a
b
c
1
l/2
s
N
a
s ( ) =
2
l
2
s −
l
2

\

¹
 s − l ( )
•
•
•
l/2
a
b
c
1
l/2
s
N
b
s ( ) = −
4
l
2
s s − l ( )
N
a
(s) = ?
N
b
(s) = ?
MAK 539E
3. 30
Two applications
x
x = 0
x = L
x = L/2
µ µµ µ J
m
o
1) Use the finite element method (direct and PMPE approaches) to solve the following problem:
2) Define a suitable mesh and derive the 2 and 3node finite element formulation ([k] and {r})
for the following linearly elastic beam torsion problem:
1 2 3 4 5
k
1
k
2
k
3
k
4
k
5
k
6
Q
P
1
2 3 4
5
6
• • • • •
MAK 539E
3. 31
Notes (Cont’d)
5) Other methods to derive the FE formulation
So far, we have seen 2 ways to derive the FE formulation (i.e., to derive [k] and {r}) for the
1D axially loaded bar problem :
• the direct method
• the PMPE approach
But, as indicated earlier, there are two other ways to obtain the same results:
• the method based on the Principle of Virtual Work (PVW)
• the Galerkin Weighted Residual Method (GWRM)
These two methods are discussed in the next two sections.
MAK 539E
3. 32
3.4 PVW approach
For the axially loaded bar problem examined earlier, the PVW is written as
δW = δW
in
+δW
ex
= − E
du
dx
dδu
dx
Adx + p
o
δu dx = 0 ∀δu
0
L
∫
0
L
∫
Let us introduce in δW the interpolationbased approximation
u x ( ) ≈ ˜ u x ( ) = N x ( ) D { }
where, for a Nelement & N+1node mesh
D = U
1
U
2
U
3
... U
N
U
N+1
N x ( ) = N
1
x ( ) N
2
x ( ) N
3
x ( ) ... N
N
x ( ) N
N+1
x ( )
• • • • •
•
•
1 2 3 4 5 6 7
N
3
(x) N
5
(x) N
7
(x)
MAK 539E
3. 33
Then, we have
du
dx
≈
d˜ u
dx
=
dN x ( )
dx
D { }
The PVW becomes
δW = − EA
dδu
dx
dN x ( )
dx
dx
0
L
∫
¸
(
¸
(
(
D { } + p
o
δu dx
0
L
∫
= 0 ∀δu
⇒ δW = − EA
dN
i
x ( )
dx
dN x ( )
dx
dx
0
L
∫
¸
(
¸
(
(
D { } + p
o
N
i
x ( ) dx
0
L
∫
= 0 for i = 1,..., N + 1
At this point, let us choose δu = N
i
(x) (i=1, 2, 3, …., N, N+1)
In a matrix form :
− K   D { } + R { } = 0 { }
where
K
ij
= E A
dN
i
x ( )
dx
0
L
∫
dN
j
x ( )
dx
dx
R
i
= p
o
N
i
x ( ) dx
0
L
∫
Just like we did before, we construct the global stiffness matrix [K] and global load vector {R}
by computing [k] and {r} at the element level and then assembling into [K] and {R}.
MAK 539E
3. 34
3.5 Galerkin Weighted Residual approach
• For physical problems which do not have a functional form, from which the differential
equations and nonessential (i.e., natural) boundary conditions can be derived (e.g., when the
DEQ contains oddorder terms).
• We need a different approach which starts from the DEQ itself, or, more precisely, from an
integral formulation (or weak form) of the problem. This approach is called the weighted
residual method (WRM).
• There are many types of WRM.
3.5.1. Presentation of the WRM
Let us write the DEQ and natural BC as
Du − f = 0 in V
Bu − g = 0 on S ⊂∂V
¦
´
¹
where u is the unknown function of x, D and B are differential operators and f and g are known
functions of x.
E.g., for beam bending problems:
D ≡ E I
d
4
dx
4
f ≡q x
( )
B ≡ E I
d
2
dx
2
g ≡ M
B ≡ EI
d
3
dx
3
g ≡V
¦
´
¦
¹
¦
MAK 539E
3. 35
Look for approximation satisfying essential boundary conditions and choose
the unknown coefficients
˜
u x, a ( )
a
i
i = 1, n ( ) such that
˜
u x, a ( ) is "close to" u x ( )
But
˜
u x, a ( ) is not exact ⇒ DEQ are not satisfied.
Let us denote the residues by
R
D
= R
D
a, x ( ) = D˜ u − f
R
B
= R
B
a, x
( )
= B˜ u − g
¦
´
¹
The objective is thus to find the coefficients a
i
such that the residues are small.
There are many different options to compute the residues:
* Collocation method
R
D
a, x
i
( ) = 0 i = 1, 2,..., j −1
R
B
a, x
i
( )
= 0 i = j, j +1,..., n
¦
´
¹
¦
* Subdomain (collocation) method
R
D
a, x
( )
V
i
∫
dV = 0 i = 1, 2,..., j −1
R
B
a, x ( )dS
S
i
∫
= 0 i = j, j + 1,..., n
¦
´
¦
¦
¹
¦
¦
MAK 539E
3. 36
* (Continuous) least squares method
∂ I
∂ a
i
= 0 with I = R
D
a, x ( )  
V
∫
2
dV + α R
B
a, x ( )  
S
∫
2
dS
where α is a scalar multiplier for dimensional homogeneity and to stress the relative
importance of R
D
vs. R
B
.
* Least squares collocation method
∂ I
∂ a
k
=0 k = 1,...,n ( ) with I = R
D
a, x
i
( )
 
2
i=1
j−1
∑
+ α R
B
a, x
i
( )
 
2
i= j
m
∑
• Simple collocation if m = n.
• Overdetermined collocation if m > n.
* Galerkin method
Let v
i
x ( ) denote some weight functions (chosen as ∂˜ u ∂a
i
 see example).
Then find the coefficients a
i
such that
R
i
= v
i
x ( ) R
D
a, x ( )dV
V
∫
= 0 i = 1, 2,...,n ( )
I.e., R
D
is made orthogonal to the shape functions v
i
x ( ).
Before solving (*), use integration by parts to balance the continuity requirements
and to introduce the natural bc (through R
B
).
Note: if a variational principle is available, the Galerkin and RR methods yield
identical solutions with the same approximating function
˜ u
MAK 539E
3. 37
WRM: application
Problem description:
E, A, L
p(x) = po * x/L
P
MAK 539E
3. 38
WRM: application
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
0 0.2 0.4 0.6 0.8 1
u(x)/cL^3
x/L
Residual methods for axially loaded bar with b/cL^2=1
exact
point collocation at x=L/3
subdomain and continuous least squares
Galerkin
Solution:
b
c L
2
=
P
p
o
L
= 1
MAK 539E
3. 39
WRM: application
0
0.2
0.4
0.6
0.8
1
0 0.2 0.4 0.6 0.8 1
u(x)/cL^3
x/L
Residual methods for axially loaded bar with b/cL^2=0.1
exact
point collocation at x=L/3
subdomain and continuous least squares
Galerkin
b
c L
2
=
P
p
o
L
= −0.1
MAK 539E
3. 40
As indicated earlier, we start from the GDE itself :
E A ′ ′ u x ( ) = − p
o
0 ≤ x ≤ L ( )
The basic idea of the GWRM is as follows : instead of satisfying the GDE at every point in the
domain (0 ≤ x ≤ L), we will only satisfy it in a “weighted average sense” (weak form) :
E A ′ ′ u x ( ) = − p
o
( )
v x ( ) dx
0
L
∫
where v(x) is any weight function defined on the domain vanishing where essential boundary
conditions are applied on u (here, the essential BC is u(0) = 0 and thus we must have v(0) = 0).
E A ′ ′ u x ( ) v x ( ) dx
0
L
∫
= − p
o
v x ( ) dx
0
L
∫
(*)
In (*), the continuity requirements for u(x) and v(x) are “uneven”: u(x) must be at least ?? while
v(x) has to be ?? only.
3.5.2. Galerkin finite element method
MAK 539E
3. 41
= 0 = 0
Thus (*) becomes
E A ′ u x ( ) ′ v x ( ) dx
0
L
∫
= p
o
v x ( ) dx
0
L
∫
(**)
E A ′ ′ u v dx
0
L
∫
= E A ′ u v  
0
L
− E A ′ u ′ v dx
0
L
∫
= E A ′ u L ( )v L ( ) − E A ′ u 0 ( )v 0 ( ) − E A ′ u ′ v dx
0
L
∫
To balance these requirements, let us integrate the lefthand side by parts :
E A
dN x ( )
dx
0
L
∫
′ v x ( ) dx D { } = p
o
v x ( ) dx
0
L
∫
At this point, we introduce into (**) the interpolationbased approximation for u(x) :
and choose our weight functions to be the shape functions : v(x) = N
i
(x) (i=1, …, N+1)
⇒ E A
dN x ( )
dx
¦
´
¹
¹
`
)
dN x ( )
dx
dx
0
L
∫
K  
1 2 4 4 4 4 4 3 4 4 4 4 4
D { } = p
o
N x ( ) { }dx
0
L
∫
R  
1 2 4 4 3 4 4
MAK 539E
3. 42
Or, in component form :
K
ij
= E A
dN
i
x ( )
dx
0
L
∫
dN
j
x ( )
dx
dx
R
i
= p
o
N
i
x ( ) dx
0
L
∫
MAK 539E
3. 43
X X X 0 0 X 0 0 0 0
X X X X X X X 0 0 0
X X X X X 0 0 0 0 0
0 X X X X X 0 X 0 0
0 X X X X X X 0 X X
X X 0 X X X X X X 0
0 X 0 0 X X X X X X
0 0 0 X 0 X X X X X
0 0 0 0 X X X X X X
0 0 0 0 X 0 X X X X

\

¹













X X X 0 0 X 0 0 0 0
X X X X X X X 0 0 0
X X X X X 0 0 0 0 0
0 X X X X X 0 X 0 0
0 X X X X X X 0 X X
X X 0 X X X X X X 0
0 X 0 0 X X X X X X
0 0 0 X 0 X X X X X
0 0 0 0 X X X X X X
0 0 0 0 X 0 X X X X

\

¹










3.6 Implementation issues
1) Mesh numbering and storage scheme
N*B
2
/2
N*B Storage: N
2
/2
Computations: N
3
/6
The global stiffness matrix [K] contains a lot of zeros: which components?
There is no need to keep everything…
There are two basic approaches to organize [K] to reduce storage requirements:
1) banded form
X X X 0 0 X
X X X X X X
X X X 0 0 0
X X X 0 X 0
X X X 0 X X
X X X X 0 0
X X X X 0 0
X X X 0 0 0
X X 0 0 0 0
X 0 0 0 0 0

\

¹










B
N N
B
Write down the algorithm to compute the half bandwidth B for a given mesh
composed of N 2node elements (with 1 dof/node).
MAK 539E
3. 44
2) skyline form
X X 0 X 0 0
X X X 0 0 0
0 X X 0 0 X
X 0 0 X X 0
0 0 0 X X 0
0 0 X 0 0 X

\

¹





2 vectors:
• component vector (a
11
, a
12
, a
22
, a
23
, a
33
,
a
14
, a
24
, a
34
, a
44
, a
45
, a
55
, a
36
, a
46
, a
56
, a
66
)
• index vector = position of diagonal terms
(1, 3, 5, 9, 11, 15)
The node numbering plays a big role on the size of [K].
Example: trusslike structure with 6 nodes and 1 DOF/node, with [K] stored in banded form.
What are the best and worst node numberings for this problem, and what are the corres
ponding half bandwidths? What would be your algorithm to derive the bandwidth for a
larger mesh with this type of element? Then derive a more general algorithm to compute
the half bandwidth for a finite element mesh composed of M elements, each with P
nodes and K dofs/node.
• • •
• • •
MAK 539E
3. 45
Implementation issues
2) How to handle prescribed degrees of freedom?
Let us consider the following problem:
u
imposed
x = 0
x = L
E, A
p x
( )
= p
0
x
L
1−
x
L

\

¹

The corresponding BVP is
GDE : E A ′ ′ u = − p
o
x
L
1−
x
L

\

¹

for 0 ≤ x ≤ L
BC:
u 0
( )
= 0
u L
( )
= u
imposed
¦
´
¹
The exact solution is given by
E A u
ex
x
( )
p
o
L
2
=
1
12
x
L

\

¹

4
−
1
6
x
L

\

¹

3
+ η+
1
12

\

¹

x
L
with η =
E A u
imposed
p
o
L
2
MAK 539E
3. 46
Let us solve this problem using N equal size 2node axially loaded bar elements.
There are three ways to handle the imposed degrees of freedom
•
• • • • • •
1 2 3 … N1 N N+1
1 2 N1 N
U
1
= 0
U
N+1
= u
imposed
¦
´
¹
in the finite element code.
Method #1: modify corresponding rows of [ K ] and { R }
X X 0 0 0 ... 0 0
X X X 0 0 ... 0 0
0 X X X 0 ... 0 0
... ... ... ... ... ... ... ...
0 0 0 0 ... X X X
0 0 0 0 ... 0 X X
¸
(
¸
(
(
(
(
(
(
(
U
1
U
2
U
3
...
U
N
U
N+1
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
=
X
X
X
X
X
X
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
1 0 0 0 0 ... 0 0
X X X 0 0 ... 0 0
0 X X X 0 ... 0 0
... ... ... ... ... ... ... ...
0 0 0 0 ... X X X
0 0 0 0 ... 0 0 1
¸
(
¸
(
(
(
(
(
(
(
U
1
U
2
U
3
...
U
N
U
N+1
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
=
0
X
X
X
X
u
imposed
¦
´
¦
¦
¦
¹
¦
¦
¦
¹
`
¦
¦
¦
)
¦
¦
¦
MAK 539E
3. 47
% PROGRAM AXIAL_BAR_1
%
% BASIC INPUT
%
format long % number of significant digits in screen output
N=input(' Enter the number of elements N ... ')
L=1 % beam length (in m)
A=0.1 % beam crosssection (in m^2)
E=10000 % beam stiffness (in Pa)
po=500 % distributed load (in N/m)
uimposed=0.01 % imposed displacement at x=L (in m)
%
% INITIALIZATIONS
%
numnp=N+1; % number of nodes
numel=N; % number of elements
% initialize the global stiffness matrix K and global load vector R
K=sparse(zeros(N+1,N+1));
R=zeros(N+1,1);
% create coordinate vector x(N+1) and connectivity table lm(2,N)
x=zeros(N+1,1);
x(1)=0;
for i=1:N
x(i+1)=x(i)+L/N;
end
lm=zeros(2,N);
for i=1:N
lm(1,i)=i;
lm(2,i)=i+1;
end
% FINITE ELEMENT SOLUTION
%
% loop over the N elements
for i=1:N
% initialize local stiffness matrix k(2,2) and local load vector r(2)
k=zeros(2,2);
r=zeros(2,1);
% get element length l
l=abs(x(i+1)x(i));
% get load on the element (= value of p(x) at the center of the
element)
xm=(x(i)+x(i+1))/2; % location of element center
pm=po*xm*(Lxm)/L^2;
% compute local sm and local lv
k(1,1)=E*A/l;
k(1,2)=k(1,1);
k(2,1)=k(1,2);
k(2,2)=k(1,1);
r(1)=pm*l/2;
r(2)=pm*l/2;
% assemble into K and R
n1=lm(1,i);
n2=lm(2,i);
K(n1,n1)=K(n1,n1)+k(1,1);
K(n1,n2)=K(n1,n2)+k(1,2);
K(n2,n1)=K(n2,n1)+k(2,1);
K(n2,n2)=K(n2,n2)+k(2,2);
R(n1)=R(n1)+r(1);
R(n2)=R(n2)+r(2);
end
spy(K) %to view the structure of the stiffness matrix
pause
MAK 539E
3. 48
% account for boundary conditions
K(1,1)=1;
K(N+1,N+1)=1;
for i=2:N+1
K(1,i)=0;
K(N+1,i1)=0;
end
R(1)=0;
R(N+1)=uimposed;
% solve linear system
u=zeros(N+1,1);
u=K\R;
% POSTPROCESSING
% compute exact solution
uex1=zeros(N+1,1); % used for pointwise comparison
xx=zeros(501,1); % used for plotting exact solution
xx=0:L/500:L;
uex2=zeros(501,1); % used for plotting exact solution
eta=E*A*uimposed/(po*L^2);
uex1=po*L^2/(E*A)*(((x/L).^4)/12
((x/L).^3)/6+(1/12+eta)*(x/L));
uex2=po*L^2/(E*A)*(((xx/L).^4)/12
((xx/L).^3)/6+(1/12+eta)*(xx/L));
% print and plot displacement solution
sprintf('%s','nodal displacements')
iii=1:1:numnp;
aux=[iii;x';u';uex1'];
sprintf(' node %d x = %8.3f u = %15.5f uex = %15.5f\n',aux)
plot(x/L,E*A*u/(po*L^2),'ro',xx/L,E*A*uex2/(po*L^2),'b
','linewidth',2)
xlabel 'x/L'
ylabel 'E*A*u/(po*L^2)'
legend('numerical','analytical',0)
% compute largest difference between exact and FE values at the
nodes (*100/uimposed)
error=100*max(abs(uuex1))/uimposed;
sprintf(' maximum error on nodal displacement = %17.10f percent
\n',error)
MAK 539E
3. 49
>> axial_bar_1
Enter the number of elements N ... 6
N =
6
L =
1
A =
0.10000000000000
E =
10000
po =
500
uimposed =
0.01000000000000
ans =
nodal displacements
ans =
node 1 x = 0.000 u = 0.00000 uex = 0.00000
node 2 x = 0.167 u = 0.00818 uex = 0.00826
node 3 x = 0.333 u = 0.01452 uex = 0.01465
node 4 x = 0.500 u = 0.01788 uex = 0.01802
node 5 x = 0.667 u = 0.01785 uex = 0.01798
node 6 x = 0.833 u = 0.01484 uex = 0.01492
node 7 x = 1.000 u = 0.01000 uex = 0.01000
ans =
maximum error on nodal displacement = 1.4467592593 percent
Typical Matlab output
Advantages and disadvantages of Method #1
Pros: simplicity
Cons: unnecessary computations
possible illconditioning of [ K ]
MAK 539E
3. 50
The global degreeoffreedom vector < D > is composed of free (to be determined) and
prescribed (known) degrees of freedom. Let us organize < D > as
D { }=
D
f
D
p
¦
´
¹
¹
`
)
where { D
f
} is the (column) vector regrouping all free dofs, and { D
p
} is the (column) vector
regrouping all prescribed dofs.
The linear system [ K ] { D } = { R } can then be rewritten as
K
ff
K
fp
K
pf
K
pp
¸
(
¸
(
D
f
D
p
¦
´
¹
¹
`
)
=
R
f
R
p
¦
´
¹
¹
`
)
We thus solve for the unknown quantities < D
f
> and < R
p
> as follows:
1) solve for < D
f
> through K
ff
 
D
f
{ }
= R
f
{ }
− K
fp
 
D
p
{ }
2) solve for < R
p
> through R
p
{ }
= K
pf
 
D
f
{ }
+ K
pp
 
D
p
{ }
How to achieve this “reorganization” of { D }? By defining an equation number vector
(details provided in class).
Method #2: partitioning of [ K ] and { R }
MAK 539E
3. 51
% PROGRAM AXIAL_BAR_2
% Same as AXIAL_BAR_1 with partitioning of K and R
% Only the sections that are different are listed
%
% BASIC INPUT (same as before)
%
% create basic FE quantities
numel=N; % number of elements
numnp=N+1; % number of nodes
numimp=2; % number of imposed dof
numeq=numnpnumimp; % number of equations
idof=zeros(numnp,1); % vector with equation numbers
idof(1)=1; % negative for first and last nodes
idof(numnp)=2;
for i=2:numnp1
idof(i)=i1; % positive for other nodes
end
%initialize the global stiffness matrices Kff, Kpf and Kpp
% and global load vectors Rf and Rp
Kff=sparse(zeros(numeq,numeq));
Kpf=sparse(zeros(numimp,numeq));
Kpp=sparse(zeros(numimp,numimp));
Rf=zeros(numeq,1);
Rp=zeros(numimp,1);
%initialize the global dof vectors Uf(numeq) and Up(numimp)
Uf=zeros(numeq,1);
Up=zeros(numimp,1);
Up(1)=0.;
Up(2)=uimposed;
%
% start of FEA
%
% loop over the N elements
for i=1:N
% initialize local stiffness matrix k(2,2) and local load vector r(2)
% get distributed load pm on the element (= value of p(x) at the center
of the element)
% compute local sm and local lv
% assemble into Kff, Kpf, Kpp and Rf, Rp
iaux=zeros(2,1);
iaux(1)=idof(n1);
iaux(2)=idof(n2);
for jj=1:2
nj=iaux(jj);
for kk=1:2
nk=iaux(kk);
if nj>0 & nk>0
Kff(nj,nk)=Kff(nj,nk)+k(jj,kk);
elseif nj<0 & nk>0
Kpf(nj,nk)=Kpf(nj,nk)+k(jj,kk);
elseif nj<0 & nk<0
Kpp(nj,nk)=Kpp(nj,nk)+k(jj,kk);
end
end
if nj>0
Rf(nj)=Rf(nj)+r(jj);
else
Rp(nj)=Rp(nj)+r(jj);
end
end
end % end of loop over elements
% account for displacement boundary conditions (stored in Up)
Rf=Rf(Kpf)'*Up;
% solve linear system
Uf=Kff\Rf;
MAK 539E
3. 52
% POSTPROCESSING
%
% 1) rebuild, display and plot the global displacement vector U(numnp)
U=zeros(numnp,1);
for i=1:numnp
if idof(i) > 0
U(i)=Uf(idof(i));
else
U(i)=Up(idof(i));
end
end
% compute exact solution
uex1=zeros(N+1,1); % used for nodewise comparison
xx=zeros(501,1); % used for plotting exact solution
xx=0:L/500:L;
uex2=zeros(501,1); % used for plotting exact solution
eta=E*A*uimposed/(po*L^2);
uex1=po*L^2/(E*A)*(((x/L).^4)/12((x/L).^3)/6+(1/12+eta)*(x/L));
uex2=po*L^2/(E*A)*(((xx/L).^4)/12((xx/L).^3)/6+(1/12+eta)*(xx/L));
% print and plot displacement solution
sprintf('%s','nodal displacements')
iii=1:1:numnp;
aux=[iii;x';U';uex1'];
sprintf(' node %d x = %8.3f u = %15.8f uex = %15.8f\n',aux)
subplot(1,2,1),plot(x/L,E*A*U/(po*L^2),'r+:',xx/L,E*A*uex2/(po*L^2)
,'b.','linewidth',2)
title(' displacement');
xlabel 'x/L'
ylabel 'E*A*u/(po*L^2)'
legend('numerical','analytical',0)
%
% 2) compute, print and plot stress distribution
stress=zeros(numel,1);
xc=zeros(numel,1);
for i=1:numel
n1=lm(1,i);
n2=lm(2,i);
l=abs(x(n2)x(n1));
strain=(U(n2)U(n1))/l;
stress(i)=E*strain;
xc(i)=(x(n1)+x(n2))/2;
end
sprintf('%s','axial stress distribution')
iii=1:1:numel;
aux=[iii;xc';stress'];
sprintf(' element %d xc = %8.4f stress = %15.8f Newtons\n',aux)
xx=zeros(2*numel,1); % used to plot the FE stress distribution
stress2=zeros(2*numel,1); % used to plot the FE stress distribution
for i=1:numel
xx(2*i1)=x(lm(1,i));
xx(2*i)=x(lm(2,i));
stress2(2*i1)=stress(i);
stress2(2*i)=stress(i);
end
xxx=zeros(501,1); % used to plot the exact stress distribution
xxx=0:L/500:L;
sigma_ex=po*L/A*(((xxx/L).^3)/3((xxx/L).^2)/2+(1/12+eta));
subplot(1,2,2),plot(xxx/L,A*sigma_ex/(po*L),'b.',xx/L,A*stress2/(po*L),'r.:','linewidth',2);
title(' axial stress')
xlabel('x/L')
ylabel('A*sigma/(po*L)')
legend('analytical','numerical',0)
%
% 3) obtain and print reactions at supports
sprintf('%s','support reactions')
Rp=Rp(Kpf*Uf+Kpp*Up);
for i=1:numnp
if idof(i)<0
sprintf('node # %d reaction = %15.5f Newtons',i,Rp(idof(i)))
end
end
MAK 539E
3. 53
>> axial_bar_2
Enter the number of elements N ... 6
N =
6
L =
2
A =
0.10000000000000
E =
10000
po =
500
uimposed =
0.01000000000000
ans =
nodal displacements
ans =
node 1 x = 0.000 u = 0.00000000 uex = 0.00000000
node 2 x = 0.333 u = 0.02770833 uex = 0.02802984
node 3 x = 0.667 u = 0.04808642 uex = 0.04860082
node 4 x = 1.000 u = 0.05650463 uex = 0.05708333
node 5 x = 1.333 u = 0.05141975 uex = 0.05193416
node 6 x = 1.667 u = 0.03437500 uex = 0.03469650
node 7 x = 2.000 u = 0.01000000 uex = 0.01000000
ans =
axial stress distribution
ans =
element 1 xc = 0.1667 stress = 831.25000000 Newtons
element 2 xc = 0.5000 stress = 611.34259259 Newtons
element 3 xc = 0.8333 stress = 252.54629630 Newtons
element 4 xc = 1.1667 stress = 152.54629630 Newtons
element 5 xc = 1.5000 stress = 511.34259259 Newtons
element 6 xc = 1.8333 stress = 731.25000000 Newtons
ans =
support reactions
ans =
node # 1 reaction = 89.49074 Newtons
ans =
node # 7 reaction = 79.49074 Newtons
Advantages and disadvantages of Method #2
Pros: only solve for actual unknown dof
reorganization useful for optimization
Cons: more complex
MAK 539E
3. 54
Error analysis
Comparison between numerical and exact solutions for N = 2, 4, 6 and 8.
N = 2
N = 4
N = 6
N = 8
Exact
MAK 539E
3. 55
Error analysis
Loglog plot of the relative error at x = L/2 for the axially loaded bar with two prescribed
displacements
2
1
Scheme is O(h
2
)
N = 2
N = 100
MAK 539E
3. 56
Let us write the imposed DOF relations as
Method #3: penalty method
t {}= C
 
D { }− Q { }
U
1
= 0
U
N+1
= u
imposed
¦
´
¹
i.e., C
 
=
1 0 ... 0 0
0 0 ... 0 1
¸
(
¸
(
and Q { }=
0
u
imposed
¦
´
¹
¹
`
)
So that {t} = {0}defines satisfaction of the displacement boundary conditions.
In our case, we simply have
Π=
1
2
D K
 
D { }− D R { } +
1
2
t α
 
t {}
Let us modify the expression of the total potential energy Π by adding a penalty function
where [ α ] is a diagonal matrix of “penalty numbers” α
i
.
(*)
Substitute (*) and use the PMPE to get
∂Π/∂ D { }= 0 { }
( )
K
 
+ C
 
T
α
 
C
 
( )
D { }= R { }+ C
 
T
α
 
Q { }
If [α] is zero, the BCs are not imposed. As [α] increases, {D} changes in such a way that
the BCs are “more and more satisfied”.
MAK 539E
3. 57
What value should we use for the penalty numbers?
• For simplicity, one often uses a single penalty number, i.e., [α] = α [ I ]
• You want to use a large number to impose the BCs (ideally, you want to use
infinity), but, if α is too large, it may lead to ill conditioning of the linear system.
Implementation (into ‘AXIAL_BAR_1’ code):
%account for boundary conditions
C=zeros(2,N+1); % constraint matrix
C(1,1)=1;
C(2,N+1)=1;
Q=zeros(2,1); % list of imposed dof values
Q(2)=uimposed;
aa=input(' enter penalty constant value alpha ')
alpha=diag(aa*ones(2,1)); % creates diagonal matrix with alpha along diagonal
K=K+C'*alpha*C; %modify K matrix to account for constraints
R=R+C'*alpha*Q; %modify R vector to account for constraints
% solve linear system
u=zeros(N+1,1);
u=K\R;
MAK 539E
3. 58
α αα α = 10,000
α α α α = 100,000
α αα α = 1,000,000
α αα α = 10,000,000
MAK 539E
3. 59
Condition number vs. penalty number α
MAK 539E
3. 60
Relative error at x=L/2 and x=L vs. penalty number α (N=10)
This action might not be possible to undo. Are you sure you want to continue?