middle east technical university department of mechanical engineering...

36
Middle East Technical University Department of Mechanical Engineering ME 413 Introduction to Finite Element Analysis Chapter 3 Computer Implementation of 1D FEM These notes are prepared by Dr. Cüneyt Sert http://www.me.metu.edu.tr/people/cuneyt [email protected] 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. 3-1

Upload: others

Post on 28-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Middle East Technical University

Department of Mechanical Engineering

ME 413 Introduction to Finite Element Analysis

Chapter 3

Computer Implementation of 1D FEM

These notes are prepared by

Dr. Cüneyt Sert

http://www.me.metu.edu.tr/people/cuneyt

[email protected]

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.

3-1

Page 2: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Summary of Chapter 2

• In Chapter 2 Ritz method was improved into FEM.

• Solution is not global anymore.

• Solution over each element is simple. Complicated 2D and 3D solutions on complex domains can be obtained, by using necessary number of elements.

• Problems with multiple materials can be solved.

• Approximation function selection is very well defined and independent of BCs.

• But the procedure of Chapter 2 still have difficulties.

• Writing approximation functions one-by-one for each node is difficult. In 2D and 3D it’ll be even more difficult.

• Approximation functions change when mesh changes.

• Symbolic math is limited and costly.

Exercise : Modify Example2_1v2.m code so that it asks the user to enter 𝑁𝐸 and works automatically. Using tic & toc commands, measure computation time for 𝑁𝐸 = 5, 10, 50, 100, 1000. Improve the speed of the code in any way you can.

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-2

Page 3: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

What Is This Chapter About?

• We’ll improve the solution procedure of Chapter 2 so that

• it is almost completely mesh independent

• approximation function calculations are easy

• symbolic calculations are avoided

• solution is efficient and very algorithmic

• To achieve these we’ll use

• Elemental weak form

• Master element concept

• Gauss Quadrature numerical integration

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-3

Page 4: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Node Based Integral Calculation of Chapter 2

• In FEM 𝜙’s have local support.

• For linear elements, 𝜙’s are nonzero over at most two elements.

• Integral of the 𝑖𝑡ℎ eqn. contains 𝜙𝑖 in all its terms (see slide 2-12).

• But 𝜙𝑖 is nonzero only over elements e-1 and e.

• Therefore integral calculations simplify as follows

Integral of eqn. i : 𝐼𝑖 = 𝑓 𝜙𝑖 𝑑𝑥

Ω

= 𝑓 𝜙𝑖 𝑑𝑥

Ω𝑒−1 + 𝑓 𝜙𝑖 𝑑𝑥

Ω𝑒

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-4

i

e 𝑥

e-1 e+1

𝜙𝑖

i-2 i-1 i+1

e+2

i+2 i+3

e-2

i-3

e-3

Over the whole problem domain

Over element e-1 only

Over element e only

Page 5: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Node Based Integral Calculation of Chapter 2 (cont’d)

• For a 5 node mesh

• All integrals are

𝐼1 = 𝑓 𝜙1 𝑑𝑥

Ω1

𝐼2 = 𝑓 𝜙2 𝑑𝑥

Ω1 + 𝑓 𝜙2 𝑑𝑥

Ω2

𝐼3 = 𝑓 𝜙3 𝑑𝑥

Ω2 + 𝑓 𝜙3 𝑑𝑥

Ω3

𝐼4 = 𝑓 𝜙4 𝑑𝑥

Ω3 + 𝑓 𝜙4 𝑑𝑥

Ω4

𝐼5 = 𝑓 𝜙5 𝑑𝑥

Ω4

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-5

i=1 i=2 i=3 i=4 i=5 𝑥

1 𝜙1 𝜙2 𝜙3 𝜙4 𝜙5

• This is node based thinking.

• We evaluate the integral of each equation, which are associated with one node and one 𝜙.

• In FEM codes we prefer element based operations.

Page 6: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

New Element Based Integral Calculation

• Instead of thinking about each equation individually, concentrate on elements and

determine the contribution of each element to each equation.

𝐼1 = 𝑓 𝜙1 𝑑𝑥

Ω1

𝐼2 = 𝑓 𝜙2 𝑑𝑥

Ω1 + 𝑓 𝜙2 𝑑𝑥

Ω2

𝐼3 = 𝑓 𝜙3 𝑑𝑥

Ω2 + 𝑓 𝜙3 𝑑𝑥

Ω3

𝐼4 = 𝑓 𝜙4 𝑑𝑥

Ω3 + 𝑓 𝜙4 𝑑𝑥

Ω4

𝐼5 = 𝑓 𝜙5 𝑑𝑥

Ω4

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-6

e=1 e=2 e=3 e=4 𝑥

1 e=1 contributes to 𝐼1 and 𝐼2

e=2 contributes to 𝐼2 and 𝐼3

e=3 contributes to 𝐼3 and 𝐼4

e=4 contributes to 𝐼4 and 𝐼5

Page 7: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• For the following model DE

−𝑑

𝑑𝑥𝑎𝑑𝑢

𝑑𝑥+ 𝑏

𝑑𝑢

𝑑𝑥+ 𝑐𝑢 = 𝑓 , 0 < 𝑥 < 𝐿

weak form is

𝑎𝑑𝑢

𝑑𝑥

𝑑𝑤

𝑑𝑥+ 𝑏𝑤

𝑑𝑢

𝑑𝑥+ 𝑐𝑤𝑢 𝑑𝑥

𝐿

0

= 𝑤𝑓 𝑑𝑥𝐿

0

+ 𝑤𝑎𝑑𝑢

𝑑𝑥𝐿

𝑄𝐿

− 𝑤𝑎𝑑𝑢

𝑑𝑥0

𝑄0

• In Chapter 2 FE solution of this resulted in a 𝑁𝑁 × 𝑁𝑁 global system

𝐾 𝑢 = 𝐹 + 𝑄

• The new idea is to

• write weak form over each element individually

• obtain elemental systems

• add them up to get the global system

Elemental Thinking

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-7

Page 8: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Consider the following linear element

• Elemental weak form of the model DE is

𝑎𝑑𝑢

𝑑𝑥

𝑑𝑤

𝑑𝑥+ 𝑏𝑤

𝑑𝑢

𝑑𝑥+ 𝑐𝑤𝑢 𝑑𝑥

𝑥2𝑒

𝑥1𝑒

= 𝑤𝑓 𝑑𝑥𝑥2𝑒

𝑥1𝑒

+ 𝑤𝑑𝑢

𝑑𝑥𝑥2𝑒

− 𝑤𝑑𝑢

𝑑𝑥𝑥1𝑒

which will result in the following 𝑁𝑁 × 𝑁𝑁 elemental system

𝐾𝑒 𝑢 = 𝐹𝑒 + 𝑄𝑒

Local Node Numbering and Elemental Weak Form

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-8

i e 𝑥 i+1

𝑥𝑖 𝑥𝑖+1

Global node numbers

1 e 𝑥 2

𝑥1𝑒 𝑥2

𝑒

Local node numbers

Page 9: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

𝐾𝑒 𝑢 = 𝐹𝑒 + 𝑄𝑒

• Elemental systems are sparse.

• On a mesh of 4 linear elements

Elemental System

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-9

e=1 e=2 e=3 e=4 𝑥

1

⨂ ⨂ ⋅ ⋅ ⋅⨂ ⨂ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅

⨂⨂⋅⋅⋅

=

⨂⨂⋅⋅⋅

+

⨂⨂⋅⋅⋅

⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⨂ ⨂ ⋅⋅ ⋅ ⨂ ⨂ ⋅⋅ ⋅ ⋅ ⋅ ⋅

⋅⋅⨂⨂⋅

=

⋅⋅⨂⨂⋅

+

⋅⋅⨂⨂⋅

For e=1

For e=3

⋅ ⋅ ⋅ ⋅ ⋅⋅ ⨂ ⨂ ⋅ ⋅⋅ ⨂ ⨂ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅

⋅⨂⨂⋅⋅

=

⋅⨂⨂⋅⋅

+

⋅⨂⨂⋅⋅

For e=2

For e=4 ⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⨂ ⨂⋅ ⋅ ⋅ ⨂ ⨂

⋅⋅⋅⨂⨂

=

⋅⋅⋅⨂⨂

+

⋅⋅⋅⨂⨂

Page 10: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Each elemental system contributes to only 2 eqns of the global system.

• It is better to think of elemental systems as 𝑁𝐸𝑁 × 𝑁𝐸𝑁, instead of 𝑁𝑁 × 𝑁𝑁

where 𝑁𝐸𝑁 is the number of element’s nodes (=2 for linear elements)

𝐾𝑒 𝑢𝑒 = 𝐹𝑒 + 𝑄𝑒

• For example for e=3, small elemental system is

𝐾113 𝐾12

3

𝐾213 𝐾22

3 𝑢13

𝑢23 =

𝐹13

𝐹23 +

𝑄13

𝑄23

Small Elemental Systems of Size NEN x NEN

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-10

⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅ ⨂ ⨂ ⋅⋅ ⋅ ⨂ ⨂ ⋅⋅ ⋅ ⋅ ⋅ ⋅

⋅⋅⨂⨂⋅

=

⋅⋅⨂⨂⋅

+

⋅⋅⨂⨂⋅

Elemental stiffness matrix

𝑁𝐸𝑁 × 𝑁𝐸𝑁

Elemental unknown vector

𝑁𝐸𝑁 × 1

Elemental force vector

𝑁𝐸𝑁 × 1

Elemental boundary term vector 𝑁𝐸𝑁 × 1

Assembly operation

Page 11: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

From Approximation Functions to Shape Functions

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-11

𝜙𝑖+1

i

e 𝑥

e-1 e+1

𝜙𝑖

i-2 i-1 i+1

e+2

i+2 i+3

e-2 Node based

thinking

i e 𝑥

i+1

Element based thinking

1 e 𝑥

2

𝑆1𝑒 𝑆2

𝑒

ℎ𝑒 = 𝑥𝑖+1 − 𝑥𝑖 = 𝑥2𝑒 − 𝑥1

𝑒

Shape functions 1

Page 12: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Shape Functions

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-12

𝑥1𝑒

e 𝑥 𝑥2𝑒

𝑆1𝑒 𝑆2

𝑒

1

• Similar to 𝜙’s, shape functions also have the Kronecker-delta property

𝑆𝑖𝑒 𝑥𝑗

𝑒 = 1 if 𝑖 = 𝑗0 if 𝑖 ≠ 𝑗

• For a linear element shape functions are

𝑆1𝑒 =

𝑥2𝑒 − 𝑥

ℎ𝑒 , 𝑆2

𝑒 =𝑥 − 𝑥1

𝑒

ℎ𝑒

• FE solution over element e is

𝑢𝑒 = 𝑢𝑗𝑒 𝑆𝑗

𝑒

𝑁𝐸𝑁

𝑗=1

Number of element’s nodes (=2 for linear elements)

Nodal unknown at element e’s 𝑗𝑡ℎ node

e

𝑢1𝑒

𝑆1𝑒 𝑆2

𝑒

𝑢2𝑒

𝑢𝑒

1

𝑥

Page 13: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Difficulties with these shape functions are

• For each element they will be different functions of 𝑥.

• Integration over an element will have limits of 𝑥1

𝑒 and 𝑥2𝑒 , which are not

appropriate for Gauss Quadrature integration.

Shape Functions (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-13

• The cure is to use the concept of master element.

𝑥1𝑒

e 𝑥 𝑥2𝑒

𝑆1𝑒 𝑆2

𝑒

1

Page 14: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Master Element

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-14

• 1D, linear master element is defined using the local coordinate 𝜉 (ksi).

• For all linear elements in a 1D mesh, there is only a single master element.

• Master element has a length of 2.

• End points are 𝜉 = −1 and 𝜉 = 1, which are suitable for Gauss Quadrature.

Node 1 Node 2

𝑆1(𝜉) 𝑆2(𝜉)

1

𝜉

2

𝜉 = -1 𝜉 = 1

Superscript ‘‘e’’ is NOT necessary here

𝑆1 =1 − 𝜉

2

𝑆2 =

1 + 𝜉

2

Page 15: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• If a mesh has only linear elements, than we only need to define 2 shape functions.

• This is a great simplification, but it comes with a price.

Mapping Between an Actual Element & Master Element

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-15

• In order to express everything in the integrals in terms of 𝜉, we need to obtain the relation between the global 𝑥 coordinate and the local 𝜉 coordinate.

• This relation is linear as shown

𝑥 = 𝐴𝜉 + 𝐵

• Using the fact that end points of the actual element coincide with those of the master element, we get

𝑥 =ℎ𝑒

2𝜉 +

𝑥1𝑒 + 𝑥2

𝑒

2

𝑥1𝑒 𝑥2

𝑒 𝑥

An actual element of length ℎ𝑒

𝜉 𝜉 = −1 𝜉 = 1

Master element of length 2

𝑥(𝜉) =?

This relation is different for each and every element

Page 16: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• In the integrals of the weak form we have the first derivative of 𝑢.

𝑢𝑒 = 𝑢𝑗𝑒𝑆𝑗

𝑁𝐸𝑁

𝑗=1

→ 𝑑𝑢𝑒

𝑑𝑥= 𝑢𝑗

𝑒𝑑𝑆𝑗

𝑑𝑥

𝑁𝐸𝑁

𝑗=1

• Master element shape functions are written in terms of 𝜉.

• Therefore 𝑥 derivatives should be expressed in terms of 𝜉 derivatives.

𝑑𝑆𝑗

𝑑𝑥=𝑑𝑆𝑗

𝑑𝜉 𝑑𝜉

𝑑𝑥

• 𝐽𝑒 =𝑑𝑥

𝑑𝜉=

ℎ𝑒

2 is the Jacobian of element e. It is the ratio of actual element’s length to

the length of the master element.

Jacobian of an Element

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-16

=2

ℎ𝑒 (using the boxed

equation of the previous slide.

𝑑𝑆1𝑑𝜉

= −0.5 , 𝑑𝑆2𝑑𝜉

= 0.5

Page 17: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Example 3.1 Solve the following problem using a uniform mesh of 4 linear elements of length ℎ𝑒 = 0.25.

−𝑑2𝑢

𝑑𝑥2− 𝑢 = −𝑥2 , 0 < 𝑥 < 1

𝑢 0 = 0 , 𝑢 1 = 0

• Elemental weak form is

𝑑𝑢

𝑑𝑥

𝑑𝑤

𝑑𝑥− 𝑤𝑢 𝑑𝑥

𝑥2𝑒

𝑥1𝑒

= −𝑤𝑥2 𝑑𝑥𝑥2𝑒

𝑥1𝑒

+ 𝑤𝑑𝑢

𝑑𝑥𝑥2𝑒

− 𝑤𝑑𝑢

𝑑𝑥𝑥1𝑒

• To get 2x2 elemental system of eqns, substitute the following approximate solution into the elemental weak form

𝑢 = 𝑢𝑗𝑒𝑆𝑗

𝑁𝐸𝑁

𝑗=1

Example 3.1

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-17

e.g.

Page 18: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

𝑑

𝑑𝑥 𝑢𝑗

𝑒𝑆𝑗𝑑𝑤

𝑑𝑥− 𝑤 𝑢𝑗

𝑒𝑆𝑗 𝑑𝑥Ω𝑒

= −𝑤𝑥2 𝑑𝑥Ω𝑒

+ 𝑤𝑑𝑢

𝑑𝑥𝑥2𝑒

− 𝑤𝑑𝑢

𝑑𝑥𝑥1𝑒

• Elemental system is 2x2 and we need 2 weight functions to get it.

• In GFEM 𝑤1 = 𝑆1 , 𝑤2 = 𝑆2

Eqn 1 : 𝑑

𝑑𝑥 𝑢𝑗

𝑒𝑆𝑗𝑑𝑆1𝑑𝑥

− 𝑆1 𝑢𝑗𝑒𝑆𝑗 𝑑𝑥

Ω𝑒 = −𝑆1𝑥

2 𝑑𝑥Ω𝑒

+ 𝑆1 0

𝑑𝑢

𝑑𝑥𝑥2𝑒

0

− 𝑆1 1

𝑑𝑢

𝑑𝑥𝑥1𝑒

𝑄1𝑒

Eqn 2 : 𝑑

𝑑𝑥 𝑢𝑗

𝑒𝑆𝑗𝑑𝑆2𝑑𝑥

− 𝑆2 𝑢𝑗𝑒𝑆𝑗 𝑑𝑥

Ω𝑒 = −𝑆2𝑥

2 𝑑𝑥Ω𝑒

+ 𝑆2 1

𝑑𝑢

𝑑𝑥𝑥2𝑒

𝑄2𝑒

− 𝑆1 0

𝑑𝑢

𝑑𝑥𝑥1𝑒

0

• In general the 𝑖𝑡ℎ eqn of element e is obtained by using 𝑤 = 𝑆𝑖

Eqn i : 𝑢𝑗𝑒𝑑𝑆𝑗

𝑑𝑥

𝑑𝑆𝑖𝑑𝑥

− 𝑆𝑖 𝑢𝑗𝑒𝑆𝑗 𝑑𝑥

Ω𝑒 = −𝑆𝑖𝑥

2 𝑑𝑥Ω𝑒

+ 𝑄𝑖𝑒

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-18

Page 19: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Change the integration parameter from 𝑥 to 𝜉 (refer to slide 3-16)

Eqn i : 𝑢𝑗𝑒𝑑𝑆𝑗

𝑑𝑥

𝑑𝑆𝑖𝑑𝑥

− 𝑆𝑖 𝑢𝑗𝑒𝑆𝑗 𝑑𝑥

1

−1

= −𝑆𝑖𝑥2 𝑑𝑥

1

−1

+ 𝑄𝑖𝑒

Eqn i : 𝑢𝑗𝑒𝑑𝑆𝑗

𝑑𝜉

1

𝐽𝑒𝑑𝑆𝑖𝑑𝜉

1

𝐽𝑒− 𝑆𝑖 𝑢𝑗

𝑒𝑆𝑗 𝐽𝑒𝑑𝜉1

−1

= 𝑆𝑖 𝑓 𝜉 𝐽𝑒𝑑𝜉1

−1

+ 𝑄𝑖𝑒

• Take the summation sign outside the integral and take the integrand into 𝑢𝑗𝑒

paranthesis.

Eqn i : 𝑑𝑆𝑖𝑑𝜉

1

𝐽𝑒 𝑑𝑆𝑗

𝑑𝜉

1

𝐽𝑒− 𝑆𝑖𝑆𝑗 𝐽𝑒𝑑𝜉

1

−1

𝑢𝑗𝑒 = 𝑆𝑖 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

+ 𝑄𝑖𝑒

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-19

𝑑𝑆

𝑑𝑥=𝑑𝑆

𝑑𝜉

1

𝐽𝑒

𝑑𝑥 = 𝐽𝑒𝑑𝜉

𝑥 =ℎ𝑒

2𝜉 +

𝑥1𝑒 + 𝑥2

𝑒

2

Page 20: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Eqn i : 𝑑𝑆𝑖𝑑𝜉

1

𝐽𝑒 𝑑𝑆𝑗

𝑑𝜉

1

𝐽𝑒− 𝑆𝑖𝑆𝑗 𝐽𝑒𝑑𝜉

1

−1

𝑢𝑗𝑒 = 𝑆𝑖 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

+ 𝑄𝑖𝑒

• Summation sign is over 𝑗 = 1, 2.

• 𝑖 index also goes from 1 to 2.

• 𝑖 = 1 gives the first equation, 𝑖 = 2 gives the second equation.

• 2x2 elemental system is 𝐾𝑒 𝑢 = 𝐹𝑒 + 𝑄𝑒

• We don’t need to do any calculations for 𝑄𝑖𝑒 values (Details will come).

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-20

𝐾𝑖𝑗𝑒 𝐹𝑖

𝑒

Page 21: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• For each element ℎ𝑒 = 0.25.

• Jacobian for each element is 𝐽𝑒 = ℎ𝑒/2 = 0.125

• All elements are linear. Shape functions and their derivatives are

𝑆1 =1 − 𝜉

2 , 𝑆2 =

1 + 𝜉

2

𝑑𝑆1𝑑𝜉

= −0.5 , 𝑑𝑆2𝑑𝜉

= 0.5

• We need everything to evalute the entries of 𝐾𝑒 and 𝐹𝑒 one-by-one for each element.

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-21

1 2 3 4 5 𝑥

0.25 𝑥 = 1

Page 22: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

𝐾𝑖𝑗𝑒 =

𝑑𝑆𝑖𝑑𝜉

1

𝐽𝑒 𝑑𝑆𝑗

𝑑𝜉

1

𝐽𝑒− 𝑆𝑖𝑆𝑗 𝐽𝑒𝑑𝜉

1

−1

• For e=1

𝐾111 =

𝑑𝑆1𝑑𝜉

1

𝐽𝑒 𝑑𝑆1𝑑𝜉

1

𝐽𝑒− 𝑆1𝑆1 𝐽𝑒𝑑𝜉

1

−1

=47

12

𝐾121 =

𝑑𝑆1𝑑𝜉

1

𝐽𝑒 𝑑𝑆2𝑑𝜉

1

𝐽𝑒− 𝑆1𝑆2 𝐽𝑒𝑑𝜉

1

−1

= −97

24

𝐾211 = 𝐾12

1 ([𝐾𝑒] is symmetric. Interchange 𝑖 & 𝑗 and see)

𝐾221 =

𝑑𝑆2𝑑𝜉

1

𝐽𝑒 𝑑𝑆2𝑑𝜉

1

𝐽𝑒− 𝑆2𝑆2 𝐽𝑒𝑑𝜉

1

−1

=47

12

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-22

𝐾1 =

47

12−97

24

−97

24

47

12

Page 23: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• No need to calculate [𝐾2] , [𝐾3] or [𝐾4] .

• They will all be equal to [𝐾1]. This is a special case for this problem. Can you see why?

• Let’s start {𝐹𝑒} calculations.

𝐹𝑖𝑒 = 𝑆𝑖 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

• For e=1 :

𝑓 = −ℎ𝑒

2𝜉 +

𝑥1𝑒 + 𝑥2

𝑒

2

2

= −𝜉 + 1

8

2

𝐹11 = 𝑆1 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

= −1

768 , 𝐹2

1 = 𝑆2 𝑓 𝜉 𝐽𝑒𝑑𝜉1

−1

= −3

768

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-23

𝑓 𝜉 = − 𝑥 𝜉 2

Page 24: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• For e=2 : 𝑓 = −𝜉+3

8

2

𝐹12 = 𝑆1 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

= −11

768 , 𝐹2

2 = 𝑆2 𝑓 𝜉 𝐽𝑒𝑑𝜉1

−1

= −17

768

• For e=3 : 𝑓 =? (find yourself)

𝐹13 = 𝑆1 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

= −33

768 , 𝐹2

3 = 𝑆2 𝑓 𝜉 𝐽𝑒𝑑𝜉1

−1

= −43

768

• For e=4 : 𝑓 =? (find yourself)

𝐹14 = 𝑆1 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

= −67

768 , 𝐹2

4 = 𝑆2 𝑓 𝜉 𝐽𝑒𝑑𝜉1

−1

= −81

768

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-24

Page 25: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Four elemental systems are

For e=1 : 1

2494 −97−97 94

𝑢11

𝑢21 = −

1

76813+

𝑄11

𝑄21

For e=2 : 1

2494 −97−97 94

𝑢12

𝑢22 = −

1

7681117

+𝑄12

𝑄22

For e=3 : 1

2494 −97−97 94

𝑢13

𝑢23 = −

1

7683343

+𝑄13

𝑄23

For e=4 : 1

2494 −97−97 94

𝑢14

𝑢24 = −

1

7686781

+𝑄14

𝑄24

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-25

e=1 e=2 e=3 e=4 𝑥

1

Example 3.1 (cont’d)

Page 26: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Assemble elemental systems into 5x5 global system (see slide 3-9).

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-26

e=1 e=2 e=3 e=4 𝑥

1

𝐾111 𝐾12

1 0 0 0

𝐾211 𝐾22

1 + 𝐾112 𝐾12

2 0 0

0 𝐾212 𝐾22

2 + 𝐾113 𝐾12

3 0

0 0 𝐾213 𝐾22

3 + 𝐾114 𝐾12

4

0 0 0 𝐾214 𝐾22

4

𝑢1𝑢2𝑢3𝑢4𝑢5

=

𝐹11

𝐹21 + 𝐹1

2

𝐹22 + 𝐹1

3

𝐹23 + 𝐹1

4

𝐹24

+

𝑄11

𝑄21 + 𝑄1

2

𝑄22 + 𝑄1

3

𝑄23 + 𝑄1

4

𝑄24

Page 27: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Put the numbers in to get

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-27

e=1 e=2 e=3 e=4 𝑥

1

1

24

94 −97−97 94 + 94 −97

−97 94 + 94 −97−97 94 + 94 −97

−97 94

𝑢1𝑢2𝑢3𝑢4𝑢5

= −1

768

13 + 1117 + 3343 + 6781

+

𝑄11

𝑄21 + 𝑄1

2

𝑄22 + 𝑄1

3

𝑄23 + 𝑄1

4

𝑄24

• Balance of secondary variables :

𝑄21 + 𝑄1

2 =𝑑𝑢

𝑑𝑥𝑥21

+ −𝑑𝑢

𝑑𝑥𝑥12

= 0

𝑄22 + 𝑄1

3 =𝑑𝑢

𝑑𝑥𝑥22

+ −𝑑𝑢

𝑑𝑥𝑥13

= 0

𝑄23 + 𝑄1

4 =𝑑𝑢

𝑑𝑥𝑥23

+ −𝑑𝑢

𝑑𝑥𝑥14

= 0

Page 28: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Global system is

1

24

94 −97−97 188 −97

−97 188 −97−97 188 −97

−97 94

𝑢1𝑢2𝑢3𝑢4𝑢5

= −1

768

1145011081

+

𝑄1000𝑄5

• 𝑢1 and 𝑢5 are known.

• Reduce the system by dropping the 1st and 5th equations.

1

24

188 −97−97 188 −97

−97 188

𝑢2𝑢3𝑢4

= −1

768

1450110

+000

• FE solution is 𝑢2𝑢3𝑢4

=−0.0232−0.0405−0.0392

Example 3.1 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-28

Page 29: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Reduction is not easy to implement in a computer code.

• A simpler technique is to keep the 1st and 5th eqns, but modify them as follows

1 0 0 0 0𝐾21 𝐾22 𝐾23 𝐾24 𝐾25𝐾31 𝐾32 𝐾33 𝐾34 𝐾35𝐾41 𝐾42 𝐾43 𝐾44 𝐾450 0 0 0 1

𝑢1𝑢2𝑢3𝑢4𝑢5

=

𝑈1000𝑈5

+

00000

• Disadvantages are

• symmetry of [K] is lost.

• an unnecessarily large system is solved.

Apply EBCs without Reduction

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-29

Equate diagonal entries to 1, and non-diagonal entries to zero

These are the specified values

of 𝑢1 and 𝑢5

Equate unknown 𝑄’s to zero.

Page 30: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• A third alternative for EBCs modifies 1st and 5th eqns as follows

𝐿 × 𝐾11 𝐾12 𝐾13 𝐾14 𝐾15𝐾21 𝐾22 𝐾23 𝐾24 𝐾25𝐾31 𝐾32 𝐾33 𝐾34 𝐾35𝐾41 𝐾42 𝐾43 𝐾44 𝐾45𝐾51 𝐾52 𝐾53 𝐾54 𝐿 × 𝐾55

𝑢1𝑢2𝑢3𝑢4𝑢5

=

𝐿 × 𝐾11 × 𝑈1𝐹2𝐹3𝐹4

𝐿 × 𝐾55 × 𝑈5

+

00000

where 𝐿 is large enough number.

• If 𝐿 is large enough the 1st and 5th eqns simplify to

𝐿𝐾11𝑢1 + Negligibly small terms = 𝐿𝐾11𝑈1 → 𝑢1 = 𝑈1

𝐿𝐾55𝑢5 + Negligibly small terms = 𝐿𝐾55𝑈5 → 𝑢5 = 𝑈5

• This technique preserves possible symmetry of [𝐾].

Apply EBCs without Reduction (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-30

Page 31: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• If a NBC is provided, the specified 𝑄 value is used in the global system.

• Similar to the Ritz method, NBCs are satisfied not exactly, but approximately.

• Be careful in determining the SV correctly.

• If a heat conduction problem is formulated starting from

−𝑑

𝑑𝑥𝑘𝐴

𝑑𝑇

𝑑𝑥+ . . . . . . = 0

then 𝑄1 = − 𝑘𝐴𝑑𝑇

𝑑𝑥 0 and 𝑄𝑁𝑁 = 𝑘𝐴

𝑑𝑇

𝑑𝑥 𝐿

• If in the same problem 𝑘𝐴 is constant and dropped from the DE

−𝑑

𝑑𝑥

𝑑𝑇

𝑑𝑥+ . . . . . . = 0

then 𝑄1 = −𝑑𝑇

𝑑𝑥 0 and 𝑄𝑁𝑁 =

𝑑𝑇

𝑑𝑥 𝐿

NBCs

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-31

SV is heat in Watts

SV is temperature gradient in K/m

Page 32: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• Put the given mixed BC into the form

𝑆𝑉 = 𝛼𝑃𝑉 + 𝛽

where 𝛼 and 𝛽 are known values.

• Use 𝛼𝑃𝑉 + 𝛽 in the proper place of the 𝑄 vector.

• Transfer 𝛼𝑃𝑉 to the [K] matrix and leave 𝛽 on the RHS of the global system.

• If a mixed BC is given at the 5th (last) node of a 4 element mesh

𝐾11 𝐾12 𝐾13 𝐾14 𝐾15𝐾21 𝐾22 𝐾23 𝐾24 𝐾25𝐾31 𝐾32 𝐾33 𝐾34 𝐾35𝐾41 𝐾42 𝐾43 𝐾44 𝐾45𝐾51 𝐾52 𝐾53 𝐾54 𝐾55

𝑢1𝑢2𝑢3𝑢4𝑢5

=

𝐹1𝐹2𝐹3𝐹4𝐹5

+

𝑄1000

𝛼𝑢5 + 𝛽

MBCs

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-32

Modify 𝐾55 as 𝐾55 − 𝛼

Page 33: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• In FEM integrals similar to the following ones need to be evaluated

𝐾𝑖𝑗𝑒 =

𝑑𝑆𝑖𝑑𝜉

1

𝐽𝑒 𝑑𝑆𝑗

𝑑𝜉

1

𝐽𝑒− 𝑆𝑖𝑆𝑗 𝐽𝑒𝑑𝜉

1

−1

, 𝐹𝑖𝑒 = 𝑆𝑖 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

• The limits [-1,1] are suitable for GQ integration, which converts an integral into a summation

𝐼 = 𝑔 𝜉 𝑑𝜉1

−1

= 𝑔(𝜉𝑘)𝑊𝑘

𝑁𝐺𝑃

𝑘=1

GQ Integration (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-33

Number of GQ points

GQ weights

Coordinates of GQ points

Page 34: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

• GQ points and weights for different 𝑁𝐺𝑃 values are

• 𝑁𝐺𝑃 point GQ integration can evaluate (2 𝑁𝐺𝑃 − 1) order polynomial functions exactly.

Gauss Quadrature (GQ) Integration

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-34

NGP 𝝃𝒌 𝑾𝒌

1 0.0 2.0

2 −1/ 3 = −0.577350269189626

1/ 3 = 0.577350269189626

1.0 1.0

3 − 0.6 = −0.774596669241483

0.0

0.6 = 0.774596669241483

5/9 = 0.555555555555555 8/9 = 0.888888888888889 5/9 = 0.555555555555555

4

− 0.861136311594953 − 0.339981043584856

0.339981043584856 0.861136311594953

0.347854845137454 0.652145154862546 0.652145154862546 0.347854845137454

Page 35: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Example 3.2

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-35

Example 3.2 Evaluate 𝐾111 and 𝐹1

1 of Example 3.1 using GQ integration.

𝐾111 =

𝑑𝑆1𝑑𝜉

1

𝐽𝑒 𝑑𝑆1𝑑𝜉

1

𝐽𝑒− 𝑆1𝑆1 𝐽𝑒𝑑𝜉

1

−1

= (−0.5)1

0.125(−0.5)

1

0.125−

1 − 𝜉

2

1 − 𝜉

2 0.125 𝑑𝜉

1

−1

= −𝜉2 + 2𝜉 + 63

32

𝑔(𝜉)

𝑑𝜉1

−1

• Using 1 point GQ : 𝐾111 = 2𝑔 0 = 1.9688

• Using 2 point GQ : 𝐾111 = 𝑔 −

1

3+ 𝑔

1

3= 3.9167

• Using 3 point GQ : 𝐾111 =

5

9𝑔 − 0.6 +

8

9𝑔 0 +

5

9𝑔 0.6 = 3.9167

e.g.

Both are exact

Page 36: Middle East Technical University Department of Mechanical Engineering …courses.me.metu.edu.tr/courses/me413/section2/files/... · 2013-08-21 · METU – Dept. of Mechanical Engineering

Example 3.2 (cont’d)

METU – Dept. of Mechanical Engineering – ME 413 Int. to Finite Element Analysis – Lecture Notes of Dr. Sert 3-36

𝐹11 = 𝑆1 𝑓 𝜉 𝐽𝑒𝑑𝜉

1

−1

= −1 − 𝜉

2

𝜉 + 1

8

2

0.125 𝑑𝜉1

−1

= 𝜉3 + 𝜉2 − 𝜉 − 1

1024

𝑔(𝜉)

𝑑𝜉1

−1

• Using 1 point GQ : 𝐹11 = 2𝑔 0 = −0.0019531

• Using 2 point GQ : 𝐹11 = 𝑔 −

1

3+ 𝑔

1

3= −0.0013021

• Using 3 point GQ : 𝐹11 =

5

9𝑔 − 0.6 +

8

9𝑔 0 +

5

9𝑔 0.6 = −0.0013021

Both are exact