Professional Documents
Culture Documents
METU FEM Chapter 2
METU FEM Chapter 2
Chapter 2
Introduction to FEM
These notes are prepared with the hope to be useful to those who want to learn and teach FEM. You are free to use
them. Please send feedbacks to the above email address.
2-1
Disadvantages of Ritz and MWR
• They provide global solutions, i.e. a single approximate solution is valid over the whole
problem domain.
• Difficult to capture complicated 2D and 3D solutions on complex domains.
• Not suitable to solve problems with multiple materials.
Left: Right:
20 oC 𝑇(𝑥, 𝑦) = ? Insulated
Materials with two
different conductivities 𝑥
Bottom: Heat coming in
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-2
FEM vs. Ritz
• Finite Element Method (FEM)
• does NOT seek a global solution
• divides the problem domain into elements of simple shapes
• works with simple polynomial type approximate solutions over each element
Simple, low-order
polynomial solution
𝑦 over each element
𝑇 𝑦
𝑥
𝑥
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-3
Our First FE Solution
e.g. Example 2.1 Solve the following problem using FEM
𝑑2 𝑢
− 2 − 𝑢 = −𝑥 2 , 0<𝑥<1
𝑑𝑥
𝑢 0 =0 , 𝑢 1 =0
-0.01
sin 𝑥 + 2sin(1 − 𝑥)
𝑢𝑒𝑥𝑎𝑐𝑡 = + 𝑥2 − 2
sin(1) -0.02
-0.03
-0.04
-0.05
0 0.2 0.4 0.6 0.8 1
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-4
Our First FE Solution (Example 2.1) (cont’d)
• This solution will be very similar to previous Ritz solutions.
• In Chapter 3 we'll make it more algorithmic and easy to program. This will allow us to
write our first FE code.
• Following 5 node (NN = 5) and 4 element (NE = 4) mesh (grid) will be used.
1 2 3 4 5
𝑥 ℎ𝑒
Global node
number
Element
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-5
Our First FE Solution (Example 2.1) (cont’d)
• With linear elements we’ll obtain a piecewise linear solution
𝑢3
𝑢4
𝑢ℎ : Approximate FE solution
𝑢2
𝑢1 = 0 𝑢5 = 0
𝑥
𝑥1 𝑥2 𝑥3 𝑥4 𝑥5
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-6
Our First FE Solution (Example 2.1) (cont’d)
• FE solution of the previous slide can be written as
𝑁𝑁
𝑁𝑁 : Number of nodes
𝑢ℎ = 𝑢𝑗 𝜙𝑗 𝑢𝑗 : Nodal unknowns
𝑗=1
𝜙𝑗 (𝑥) : Approximation functions
1 𝜙1
𝑥 𝜙1 𝜙2 𝜙3 𝜙4 𝜙5
e=1 e=2 e=3 e=4 1
1 𝜙2 𝑥
e=1 e=2 e=3 e=4
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-8
Our First FE Solution (Example 2.1) (cont’d)
𝑢3 𝑢3 𝜙3
𝑢4 𝜙4 Each 𝜙𝑗 is multiplied by 𝑢𝑗
𝑢4
𝑢2 𝜙2
𝑢2
𝑢1 𝜙1 𝑢5 𝜙5
𝑢1 = 𝑢5 𝑥
e=1 e=2 e=3 e=4 𝑁𝑁
𝑢ℎ = 𝑢𝑗 𝜙𝑗
𝑗=1
𝑢3
𝑢4
𝑢2
𝑢1 𝑢5
𝑥
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-9
Our First FE Solution (Example 2.1) (cont’d)
• FEM uses weak form of the DE (same as Ritz) (𝑢 is used instead of 𝑢ℎ for clarity)
𝑑2 𝑢
𝑅 = − 2 − 𝑢 + 𝑥2
𝑑𝑥
1 1
𝑑2 𝑢
𝑤𝑅 𝑑𝑥 = 0 → −𝑤 2 − 𝑤𝑢 + 𝑤𝑥 2 𝑑𝑥 = 0
0 𝑥=0 𝑑𝑥
IBP
1 1
𝑑𝑤 𝑑𝑢 𝑑𝑢
𝑑𝑥 − 𝑤
0 𝑑𝑥 𝑑𝑥 𝑑𝑥 0
1 1
𝑑𝑤 𝑑𝑢 𝑑𝑢
Weak form : − 𝑤𝑢 + 𝑤𝑥 2 𝑑𝑥 − 𝑤 =0
0 𝑑𝑥 𝑑𝑥 𝑑𝑥 0
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-10
Our First FE Solution (Example 2.1) (cont’d)
• We need to write the weak form 𝑁𝑁 times with 𝑁𝑁 different 𝑤’s.
• In Galerkin FEM (GFEM) weight function selection is the same as Ritz
𝑤𝑖 = 𝜙𝑖 , 𝑖 = 1,2, … , 𝑁𝑁
1 𝑑𝜙1 𝑑𝑢 𝑑𝑢 𝑑𝑢
1st eqn (𝑤 = 𝜙1 ) : 0
− 𝜙1 𝑢 + 𝜙1 𝑥 2 𝑑𝑥 − 𝜙1 + 𝜙1 =0
𝑑𝑥 𝑑𝑥 𝑑𝑥 𝑑𝑥
0 𝑥=1 1 𝑥=0
1 𝑑𝜙2 𝑑𝑢 𝑑𝑢 𝑑𝑢
2nd eqn (𝑤 = 𝜙2 ) : 0 𝑑𝑥 𝑑𝑥
− 𝜙2 𝑢 + 𝜙2 𝑥 2 𝑑𝑥 − 𝜙2 𝑑𝑥 + 𝜙2 𝑑𝑥 =0
0 𝑥=1 0 𝑥=0
1 𝑑𝜙3 𝑑𝑢 𝑑𝑢 𝑑𝑢
3rd eqn (𝑤 = 𝜙3 ) : 0
− 𝜙3 𝑢 + 𝜙3 𝑥 2 𝑑𝑥 − 𝜙3 𝑑𝑥 + 𝜙3 𝑑𝑥 =0
𝑑𝑥 𝑑𝑥
0 𝑥=1 0 𝑥=0
1 𝑑𝜙4 𝑑𝑢 𝑑𝑢 𝑑𝑢
4th eqn (𝑤 = 𝜙4 ) : 0 𝑑𝑥 𝑑𝑥
− 𝜙4 𝑢 + 𝜙4 𝑥 2 𝑑𝑥 − 𝜙4 𝑑𝑥 + 𝜙4 𝑑𝑥 =0
0 𝑥=1 0 𝑥=0
1 𝑑𝜙5 𝑑𝑢 𝑑𝑢 𝑑𝑢
5th eqn (𝑤 = 𝜙5 ) : 0
− 𝜙5 𝑢 + 𝜙5 𝑥 2 𝑑𝑥 − 𝜙5 𝑑𝑥 + 𝜙5 𝑑𝑥 =0
𝑑𝑥 𝑑𝑥
1 𝑥=1 0 𝑥=0
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-11
Our First FE Solution (Example 2.1) (cont’d)
• Integrals
• are easier to evaluate over each element separately.
• are nonzero only over certain elements
• For example 3rd eqn’s integral is 4𝑥 − 1
1
2 − 4𝑥
𝑑𝜙3 𝑑𝑢 3 − 4𝑥 4𝑥 − 2
𝐼3 = − 𝜙3 𝑢 + 𝜙3 𝑥 2 𝑑𝑥
0 𝑑𝑥 𝑑𝑥
𝑤 = 𝜙3 = 4𝑥 − 1 𝑤 = 𝜙3 = 3 − 4𝑥
𝑢= 𝑢𝑗 𝜙𝑗 = 𝑢2 (2 − 4𝑥) + 𝑢3 (4𝑥 − 1) 𝑢= 𝑢𝑗 𝜙𝑗 = 𝑢3 (3 − 4𝑥) + 𝑢4 (4𝑥 − 2)
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-13
Our First FE Solution (Example 2.1) (cont’d)
97 47 97 25
• The result for 𝐼3 is : − 𝑢2 + 𝑢3 − 𝑢4 +
24 6 24 384
• Other integrals are calculated in Example2.1v2.m MATLAB code (See the next slide).
• The resultant 5 equations are
𝑄1
1 𝑑𝑢
47 97 −
− 𝑢1 − 𝑑𝑥
12 24 768 𝑥=0
97 47 97 7 0
− − 𝑢2 −
24 6 24 384
97 47 97 25 0
− − 𝑢3 = − +
24 6 24 384
97 47 97 𝑢4 55 0
− − −
24 6 24 384
97 47 𝑢5 27 𝑑𝑢
− −
24 12 256 𝑑𝑥 𝑥=1
𝑄5
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-15
Our First FE Solution (Example 2.1) (cont’d)
𝐾 𝑢 = 𝐹 + 𝑄
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-16
Our First FE Solution (Example 2.1) (cont’d)
• In practice we first want to solve for the unknown 𝑢’s, but not 𝑄’s.
• For this we apply reduction to the 𝑁𝑁 × 𝑁𝑁 system and drop the 1st and 5th
equations, because 𝑢1 and 𝑢5 are known.
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-17
Our First FE Solution (Example 2.1) (cont’d)
• Reduced system for this problem is
47 97 𝑢2 7 0
− 0 − −0−0
6 24 384
97 47 97 𝑢3 25 0
− − = − −0−0 +
24 6 24 384
97 47 𝑢4 55 0
0 − − −0−0
24 6 384
Because
𝑢2 −0.0232 𝑢1 = 0
• Solving this system gives 𝑢3 = −0.0405 𝑢5 = 0
𝑢4 −0.0392
𝑢2 −0.0234
• Exact values are 𝑢3 = −0.0408
𝑢4 𝑒𝑥𝑎𝑐𝑡 −0.0394
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-18
Our First FE Solution (Example 2.1) (cont’d)
coord = [0 0.25 0.5 0.75 1];
u = [0 -0.0232 -0.0405 -0.0392 0];
plot(coord, u, 'o-b', 'LineWidth', 2)
hold
x = 0:0.01:1;
uExact = (sin(x) + 2*sin(1-x)) / sin(1) + x.*x - 2;
plot(x, uExact, 'r', 'LineWidth', 2)
grid on
0
FEM
Exact
-0.01
-0.02
4 element FE solution
vs.
-0.03
exact solution
-0.04
-0.05
0 0.25 0.5 0.75 1
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-19
Our First FE Solution (Example 2.1) (cont’d)
• 𝑄1 and 𝑄5 values generally have physical meaning, such as heat flux or reaction force.
• After calculating PVs, these SVs can be calculated in two ways.
• First way : Use the 1st and 5th eqns of slide 2-14
47 97 1
𝑄1 = 𝑢 − 𝑢 + = 0.0951
12 1 24 2 768 Good match
97 47 27
𝑄5 = − 𝑢4 + 𝑢 + = 0.2639
24 12 5 256
• Second way : Use the derivatives of the FE solution at the boundaries
𝑑𝑢ℎ 𝑢2 − 𝑢1 −0.0232 − 0
𝑄1 = − =− 𝑒
=− = 0.0928
𝑑𝑥 𝑥=0
ℎ 0.25
𝑑𝑢ℎ 𝑢5 − 𝑢4 0 − (−0.0392)
𝑄5 = = = = 0.1568 No match
𝑑𝑥 𝑥=1
ℎ𝑒 0.25 Why?
Which one is better?
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-20
Our First FE Solution (Example 2.1) (cont’d)
• FEM provides very good nodal values, but what about the first derivative?
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-21
Remarks About Our First FEM Solution
• The procedure is not suitable to computer programming.
• Approximation function selection must be made mesh independent.
• Symbolic integration is costly and not readily available for many prog. languages.
• Numerical integration is used in FEM codes.
𝑢𝑒𝑥𝑎𝑐𝑡
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-22
Remarks (cont’d)
• 2D elements can be triangular or quadrilateral.
• In 3D they can be tetrahedral, triangular prism (wedge) or hexahedral (brick).
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-23
Remarks (cont’d)
• In our first FE solution we used linear (2-node) elements.
• It is possible to use higher order elements, which make use of more nodes.
• When we use quadratic (3-node) elements we can have quadratic polynomial solutions
over each element.
• The following sample solution makes use of 3 quadratic elements (𝑁𝐸 = 3) with a
total node number of 7 (𝑁𝑁 = 7).
𝑢6
𝑢5
𝑢3 𝑢4 𝑢7
𝑢2
𝑢1
𝑥
e=1 e=2 e=3
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-24
Remarks (cont’d)
• Our first FE solution was piecewise continuous.
• It was continuous across element interfaces, however its first deriative was not.
• This is known as a 𝐶 0 continuous solution, i.e. only the 0th derivative of the unknown
(which is the unknown itself) is continuous.
• For 2nd order DEs, the weak form contains first derivative of the unknown and the use
of 𝐶 0 continuous solution is enough.
• For higher order DEs, for example the 4th order one used for beam bending,
𝐶 0 continuity is not enough and a 𝐶 1 continuous solution is necessary.
• FEM results in a sparse stiffness matrix, i.e. a matrix with lots of zero entries.
• This is due to the compact support property of the approximation functions.
• For 2D and especially for 3D problems this feature is important to decrease memory
usage of the code.
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-25
Remarks (cont’d)
• The structure of the final linear algebraic equation system depends on how we
number the mesh nodes globally.
• When we do a different numbering, the final equation system does NOT change
mathematically, however the [𝐾] matrix changes.
• In certain linear system solution techniques [𝐾] is stored as a banded matrix and
bandwidth of [𝐾] is tried to be minimized to decrease memory usage.
• Bandwith of 𝐾 is directly related to how we number the mesh nodes. FE codes use
bandwidth reduction algorithms to minimize the bandwidth of [𝐾].
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-26
Remarks (cont’d)
• The DE we solved was linear.
• For a nonlinear DE, such as the following one, an extra linearization step is necessary
to obtain the system of linear algebraic equations.
𝑑2 𝑢
−𝑢 2 − 𝑢 = −𝑥 2
𝑑𝑥
METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 2-27