amme3060 engineering methods - studentvip

25
AMME3060 ENGINEERING METHODS LECTURE NOTES

Upload: others

Post on 09-Feb-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AMME3060 ENGINEERING METHODS - StudentVIP

AMME3060 ENGINEERING

METHODS LECTURE NOTES

Page 2: AMME3060 ENGINEERING METHODS - StudentVIP

1

Contents Introduction: ........................................................................................................................................... 5

Objective: ............................................................................................................................................ 5

Approach ......................................................................................................................................... 6

Assessment ..................................................................................................................................... 6

Laboratories .................................................................................................................................... 7

Approximate Solution by Trial Functions ................................................................................................ 7

Example 1.1: mass falling through air ................................................................................................. 7

Approximate solution method: ....................................................................................................... 8

Practice problem: .......................................................................................................................... 11

The heat equation ............................................................................................................................. 12

1D rod: .......................................................................................................................................... 12

Boundary Conditions ..................................................................................................................... 13

Method of Weighted Residuals ............................................................................................................ 17

Residual minimisation ....................................................................................................................... 17

Collocation: ................................................................................................................................... 17

Subdomain: ................................................................................................................................... 17

Galerkin: ........................................................................................................................................ 17

Galerkin Finite Element Method ....................................................................................................... 20

Solution: define trial function ....................................................................................................... 20

Summary of Galerkin FEA ............................................................................................................. 27

Writing this up in matlab .............................................................................................................. 28

Time savers: .................................................................................................................................. 29

Higher order Trial functions .............................................................................................................. 34

Quadratic Trial function ................................................................................................................ 34

Weighted residuals: ...................................................................................................................... 37

2D linear triangular elements ............................................................................................................... 42

Trial function ..................................................................................................................................... 42

Calculating points matrix and nodes:............................................................................................ 44

Solution: ............................................................................................................................................ 46

Define trial function: ..................................................................................................................... 46

Obtained weight residuals ............................................................................................................ 46

Integration by parts: ..................................................................................................................... 47

Element 2: ..................................................................................................................................... 50

Dealing with boundary conditions ................................................................................................ 52

Flux Boundary Conditions: ............................................................................................................ 56

Page 3: AMME3060 ENGINEERING METHODS - StudentVIP

2

Implementation in matlab: ............................................................................................................... 57

PDE toolbox Matlab ...................................................................................................................... 57

Summary FEA key concepts: ............................................................................................................. 58

What you should be able to do: .................................................................................................... 58

Mesh generation ................................................................................................................................... 58

Mesh classification: ........................................................................................................................... 60

Examples of mesh: ........................................................................................................................ 61

Swept mesh: .................................................................................................................................. 66

Quad/octree: ................................................................................................................................. 67

Mesh quality: .................................................................................................................................... 68

Aspect ratio test: ........................................................................................................................... 68

Skewness test: ............................................................................................................................... 68

Max/Min Angles ............................................................................................................................ 68

Consequences of poor mesh quality ................................................................................................. 68

Summary: Approaching mesh generation ........................................................................................ 70

Algorithms: ........................................................................................................................................ 71

Geometry: ..................................................................................................................................... 71

Data structures: ............................................................................................................................ 71

Classification: Unstructured Mesh .................................................................................................... 72

Indirect tri ..................................................................................................................................... 73

Indirect quad ................................................................................................................................. 73

Q morph ........................................................................................................................................ 73

Direct Quad: Medial Axis .............................................................................................................. 75

Algorithms for Generating Triangular/Tetrahedral meshes ............................................................. 76

Advancing front method ............................................................................................................... 76

Delaunay Mesh Generation .......................................................................................................... 76

Mesh Improvement: ......................................................................................................................... 76

Smoothing: .................................................................................................................................... 76

Summary 2: ....................................................................................................................................... 77

Finite Difference Methods .................................................................................................................... 78

Example: ............................................................................................................................................ 78

Solution: ............................................................................................................................................ 78

Taylor series: ................................................................................................................................. 79

General Method for finite difference approximations ..................................................................... 82

Neumann Boundary conditions: ................................................................................................... 83

Two dimensional finite differences: ............................................................................................. 84

Page 4: AMME3060 ENGINEERING METHODS - StudentVIP

3

Example: ........................................................................................................................................ 85

Error in Finite Difference Solution .................................................................................................... 86

Analysis: ........................................................................................................................................ 86

Finite Volume Method: Brief look......................................................................................................... 89

Solvers: .................................................................................................................................................. 90

Direct Solvers .................................................................................................................................... 91

Gaussian Elimindation ................................................................................................................... 91

LU Method .................................................................................................................................... 92

Rounding Errors: ........................................................................................................................... 95

Iterative Solvers ................................................................................................................................ 97

Jacobi Solver .................................................................................................................................. 98

Gauss Seidel Solver with SOR ...................................................................................................... 100

Unsteady Problems ............................................................................................................................. 102

Unsteady heat equation example: .................................................................................................. 103

Explicit Time Discretisation: ........................................................................................................ 104

Implicit Method; ......................................................................................................................... 105

Time – Space Accuracy .................................................................................................................... 108

Transient problems ..................................................................................................................... 108

Solver Algorithm: ............................................................................................................................ 108

Jacobi Solver Algorithm ............................................................................................................... 109

Unsteady problems 2: ..................................................................................................................... 110

Recall: unsteady problems .......................................................................................................... 110

Transient Finite Element Method ............................................................................................... 113

Error Analysis .............................................................................................................................. 121

Characteristics of PDEs........................................................................................................................ 122

Elliptic, Parabolic and Hyperbolic PDEs ........................................................................................... 122

Discriminant ................................................................................................................................ 122

Elliptic PDEs ................................................................................................................................. 123

Parabolic PDEs ............................................................................................................................. 123

Hyperbolic PDEs .......................................................................................................................... 124

Summary so far: .............................................................................................................................. 126

Numerical Stability .......................................................................................................................... 126

Von Neumann Stability Analysis: ................................................................................................ 126

Summary of Von Neumann Analysis ........................................................................................... 130

1D Wave Equation ...................................................................................................................... 131

Introduction to Computational Fluid Dynamics (CFD) ........................................................................ 135

Page 5: AMME3060 ENGINEERING METHODS - StudentVIP

4

CFD: ................................................................................................................................................. 135

1D advection-diffusion equation ................................................................................................ 136

Final comments: .............................................................................................................................. 140

Fluent: ............................................................................................................................................. 140

Discretisation scheme: ................................................................................................................ 140

Solver settings: ............................................................................................................................ 140

Final Comments: ............................................................................................................................. 141

Turbulence Modelling: ................................................................................................................ 141

Nonlinear Solvers ................................................................................................................................ 143

Linear systems:................................................................................................................................ 143

Nonlinear Solvers: ........................................................................................................................... 143

Eg: temperature dependent heat conductivitiy ......................................................................... 143

Newton Raphson Method: .............................................................................................................. 144

Example: (𝑇4) ............................................................................................................................. 144

In ANSYS: ..................................................................................................................................... 148

Code Verification, Model Validation, Solution Accuracy .................................................................... 150

Code Verification............................................................................................................................. 150

Model Validation ............................................................................................................................. 151

Solution Verification ....................................................................................................................... 152

Case Study: Loss of the Sleipner A platform ............................................................................... 153

Tutorials: ............................................................................................................................................. 156

Tute 1: ............................................................................................................................................. 156

Tute 2: ............................................................................................................................................. 159

Tute 3: ............................................................................................................................................. 161

Page 6: AMME3060 ENGINEERING METHODS - StudentVIP

5

AMME3060 Engineering Methods Lecture Notes Lecturer: Dr Nicholas Williamson

Room S411 in J07 level 4

[email protected]

Introduction:

Objective: - Understand numerical solution methods which can be used to solve engineering problems in

heat transfer, fluids and solids and the implementation of these methods in commercial

packages.

- Understand the mathematical basis of numerical solution methods:

o Ø finite element, finite difference and finite volume methods.

o Ø direct, iterative linear solvers and non-linear solvers.

o Ø mesh generation and best practice in commercial packages

o Ø numerical stability

- By the end of this course

o Ø you will be able to approach any commercial engineering software package and

have a deep understanding of how to different settings within a package will effect

computational efficiency, stability and accuracy.

o Ø You will have expert level competency in the use of computational software such

as ANSYS.

Page 7: AMME3060 ENGINEERING METHODS - StudentVIP

6

Approach

- Quiz in lectures

Assessment Quizzes ( 10% x 2 )

- 2 Quizzes will be held, each worth 10% of the course assessment

o Held in the Wednesday Lecture on WEEK 8 and 12. Closed book. Some students will

be directed to sit their quiz in ABS Seminar Room 2060. This will be indicated by an

student Id range to be announced later.

- Exam* ( 50% )

o 2 hours held in the Exam period

Page 8: AMME3060 ENGINEERING METHODS - StudentVIP

7

o *Require 50% in exam to pass the course.

- Assignment ( 12% x 2 )

o Assignments will involve writing Matlab code to solve steady and unsteady

problems. These will focus on heat transfer problems, but similar equations are

applicable to stress analysis and many types of engineering analysis.

o You will also use the ANSYS thermal solver package to solve assignment the

problems.

o You will learn the concepts in the lectures/tutorials, then get some initial assistance

with coding in the tutorials and learn ANSYS both in the lab sessions and in self

guided tutorials.

o The assignments will be difficult and lengthy. Manage your time effectively.

o Submit the assignments through Blackboard by 5pm on Friday of the week due. Late

penalties of 25% per day apply

Laboratories - Labs will be held on Weeks 2,3, 5,6,8 and 12. Ignore other timetabled lab slots.

o Each lab has a weighting of 1%. The marking breakdown:

Ø 0.5% for completion of all the lab tasks and

Ø 0.5% for answering oral questions posed by the tutors after completing

the lab tasks.

- If a lab is missed the tasks may be completed out of the lab session and presented to the

tutors at the start of the following lab.

- Work submitted later than the following lab session will not be marked without a formal

special consideration application.

Lecture 1. Wednesday, 2 August 2017

Approximate Solution by Trial Functions - Nice intro to FE method. Residual equation, shape function, solution error

- Useful in its own right

- Critical thinking for engineering problems

Example 1.1: mass falling through air A ball of mass m falls through air from a great height. The ball has an initial velocity of 𝑣 = 0 at time

𝑑 = 0. From Newton’s law we know the governing equation

𝐹𝐷

π‘Š

Page 9: AMME3060 ENGINEERING METHODS - StudentVIP

8

π‘šπ‘‘π‘£

𝑑𝑑= π‘šπ‘” βˆ’ 𝑏𝑣2

(where 𝑏 =1

2𝜌𝐴𝐢𝐷

- Exact solution is 𝑣 = (π‘šπ‘”

𝑏)

1

2tanh [(

𝑏𝑔

π‘š)

1

2𝑑]

Approximate solution method: - Trial function and collocation

1. Guess solution

Use intuition and consideration to guess solution shape.

- Graphing above, we know we:

o Start at 0

o Accelerate

o approach π‘£βˆž

o each 𝑑𝑑, velocity will be decreasing a bit

We could think of some solutions which might fit:

- exponential οΏ½ΜƒοΏ½(𝑑) = π‘£βˆž (1 βˆ’ π‘’βˆ’π‘‘

𝜏)

- quadratic: οΏ½ΜƒοΏ½(𝑑) = 𝑐1 + 𝑐2𝑑 + 𝑐3𝑑2

- sinusoidal: οΏ½ΜƒοΏ½(𝑑) = 𝑐1 sinπœ”π‘‘

- higher order polynomial

2. choose trial funciton

using our intuition, we look at the exponential; where 𝜏 is a time constant which we want to find

οΏ½ΜƒοΏ½ = π‘£βˆž (1 βˆ’ π‘’βˆ’π‘‘πœ)

Page 10: AMME3060 ENGINEERING METHODS - StudentVIP

9

3. obtain residual equation

substitute οΏ½ΜƒοΏ½ β†’ 𝑣 into the DE

π‘šπ‘‘π‘£

𝑑𝑑= π‘šπ‘” βˆ’ 𝑏𝑣2

Becomes

π‘šπ‘‘οΏ½ΜƒοΏ½

𝑑𝑑≅ π‘šπ‘” βˆ’ 𝑏�̃�2

using our trial function οΏ½ΜƒοΏ½ = π‘£βˆž (1 βˆ’ π‘’βˆ’π‘‘

𝜏) β†’π‘£βˆž

πœπ‘’βˆ’

𝑑

𝜏 gives

π‘šπ‘£βˆžπœπ‘’βˆ’π‘‘πœ β‰… π‘šπ‘” βˆ’ π‘π‘£βˆž

2 (1 βˆ’ π‘’βˆ’π‘‘πœ)2

This is an approximation, to make it exact; we need to add the residual β„›

π‘šπ‘£βˆžπœπ‘’βˆ’

π‘‘πœ = π‘šπ‘” βˆ’ π‘π‘£βˆž

2 (1 βˆ’ π‘’βˆ’π‘‘πœ)2

+β„›

To simplify the equation, we know that the terminal velocity is when 𝐹 = 0 β†’ π‘šπ‘” = π‘π‘£βˆž2 ; so we can

sub that in and cancel out π‘š

1

πœβˆšπ‘šπ‘”

π‘π‘’βˆ’

π‘‘πœ = 𝑔 βˆ’ 𝑔 (1 βˆ’ π‘’βˆ’

π‘‘πœ)2

+β„›

4. collocation

we want this to have a residual of 0 somewhere (in general, we can only do a finite number of

points).

- The process of finding 𝜏 to make β„› = 0 is collocation

For this problem; we’ll try β„› = 0 halfway between 0 and π‘£βˆž; so when π‘’βˆ’π‘‘

𝜏 = 0.5

- This is the collocation step

Substituting this into our DE:

1

πœβˆšπ‘šπ‘”

𝑏(0.5) = 𝑔 βˆ’ 𝑔(1 βˆ’ 0.5)2 + 0

Solving this, we get that 𝜏 = 0.67 (π‘š

𝑔𝑏)

1

2

So we can substitute this into our trial function to get

𝑣 β‰… οΏ½ΜƒοΏ½ = βˆšπ‘šπ‘”

𝑏

(

1 βˆ’ 𝑒

βˆ’π‘‘

0.67(π‘šπ‘”π‘)

12

)

Page 11: AMME3060 ENGINEERING METHODS - StudentVIP

10

Comparing to exact solution:

- Approximate in solid; exact in dashed

- We can see where we set the residual to be 0

- And error οΏ½ΜƒοΏ½ βˆ’ 𝑣

Page 12: AMME3060 ENGINEERING METHODS - StudentVIP

11

o Note that residual is error in the governing DE equation; whereas error is the

difference in the final solution (2 different things)

In the trial function and collocation method; we try and minimise the

residual (and not error)

L2 norm

We can compare different approximations by calculating the 𝐿2 norm of the error:

scaled 𝐿2 norm of solution error =1

𝐽‖𝐸‖2 =

1

𝐽(βˆ‘(𝑣(π‘₯𝑗) βˆ’ οΏ½ΜƒοΏ½(π‘₯𝑗))

2𝐽

𝑗=1

)

12

for 𝐽 discrete locations along the rod.

Practice problem: 𝑑𝑒

π‘‘π‘‘βˆ’1

2+ 𝑒 = 0

Domain is 𝑒 ∈ [0,1]; with 𝑒(𝑑 = 0) = 1. Try a second order trial function οΏ½ΜƒοΏ½(𝑑) = 1 βˆ’ 𝑑 + π‘Žπ‘‘2 (note

that this solves the boundary condition)

βˆ΄π‘‘οΏ½ΜƒοΏ½

π‘‘π‘‘βˆ’1

2+ οΏ½ΜƒοΏ½ = 𝑅

(βˆ’1 + 2π‘Žπ‘‘) βˆ’1

2+ (1 βˆ’ 𝑑 + π‘Žπ‘‘2) = 𝑅

π‘Žπ‘‘2 + 2π‘Žπ‘‘ βˆ’ 𝑑 βˆ’1

2= 𝑅

Make collocation point 𝑑 = 0.5; 𝑅 = 0

Page 13: AMME3060 ENGINEERING METHODS - StudentVIP

12

π‘Ž(0.5)2 + 2π‘Ž(0.5) βˆ’ (0.5) βˆ’1

2= 0

Giving π‘Ž = 0.8

∴ οΏ½ΜƒοΏ½ = 1 βˆ’ 𝑑 + 0.8𝑑2

Lecture 2.

The heat equation

1D rod: We will be looking at many heat transfer problems in this course. The governing equation for these

systems is called the β€˜Heat Equation’. It can be derived using an energy balance on a control volume.

Consider a round metal rod shown below.

Consider a control volume of Ξ”π‘₯, surface area 𝐴𝑠 = 2πœ‹π‘…π›Ώπ‘₯; cross sectional area 𝐴𝑐 = πœ‹π‘…2 and

volume 𝑉 = Ξ”π‘₯𝐴𝑐.

The heat in is 𝑄𝑖𝑛 and out π‘„π‘œπ‘’π‘‘, over Δ𝑑 time the temperature increases by Δ𝑇

We have heat transfer of:

- Conduction in and out by π‘žπ‘–βˆ’Ξ”π‘₯

2

; π‘žπ‘–+Ξ”π‘₯

2

(W/m2)

- Through outer rod surface π‘žπ‘  (W/m2) (radiation and convection)

- Internal source heating π‘žπ‘£ (W/m3) (eg, electrical current heating)

The heat balance can be written as:

𝑁𝑒𝑑 β„Žπ‘’π‘Žπ‘‘ = 𝐸𝑖𝑛 βˆ’ πΈπ‘œπ‘’π‘‘ πœŒπΆπ‘π‘‰Ξ”π‘‡ = Δ𝑑(𝑄𝑖𝑛 βˆ’ π‘„π‘œπ‘’π‘‘)

[𝑛𝑒𝑑 π‘”π‘Žπ‘–π‘› = π‘–π‘›π‘‘π‘’π‘Ÿπ‘›π‘Žπ‘™ π‘π‘œπ‘›π‘‘π‘’π‘π‘‘π‘–π‘œπ‘› + β„Žπ‘’π‘Žπ‘‘π‘–π‘›π‘” π‘‘β„Žπ‘Ÿπ‘œπ‘’π‘”β„Ž π‘ π‘’π‘Ÿπ‘“π‘Žπ‘π‘’ + π‘–π‘›π‘‘π‘’π‘Ÿπ‘›π‘Žπ‘™ β„Žπ‘’π‘Žπ‘‘ π‘ π‘œπ‘’π‘Ÿπ‘π‘’)

- Density 𝜌

Page 14: AMME3060 ENGINEERING METHODS - StudentVIP

13

- 𝐢𝑝 specific heat of rod material (J/kgK)

Giving:

πœŒπΆπ‘π‘‰Ξ”π‘‡ = Δ𝑑 ([π‘žπ‘–βˆ’Ξ”π‘₯2

βˆ’ π‘žπ‘–+Ξ”π‘₯2] 𝐴𝑐 + π‘žπ‘ π΄π‘  + π‘žπ‘£π‘‰)

So that

πœŒπΆπ‘π΄π‘Ξ”π‘‡

Δ𝑑= [βˆ’

Ξ”π‘žπ‘–Ξ”π‘₯]𝐴π‘₯ + π‘žπ‘ 2πœ‹π‘… + π‘žπ‘£π΄π‘

So that, as Ξ”π‘₯ β†’ πœ•π‘₯; Δ𝑑 β†’ πœ•π‘‘

πœŒπΆπ‘π΄π‘βˆ‚π‘‡

βˆ‚π‘‘= [βˆ’

βˆ‚π‘žπ‘–βˆ‚π‘₯] 𝐴π‘₯ + π‘žπ‘ 2πœ‹π‘… + π‘žπ‘£π΄π‘

Fourier’s law of conduction says that

π‘žπ‘– = βˆ’πœ…π‘‘π‘‡

𝑑π‘₯│𝑖

So we substitute

πœŒπΆπ‘π΄π‘βˆ‚π‘‡

βˆ‚π‘‘= [βˆ’

πœ•

πœ•π‘₯(βˆ’πœ…

𝑑𝑇

𝑑π‘₯)] 𝐴π‘₯ + π‘žπ‘ 2πœ‹π‘… + π‘žπ‘£π΄π‘

Simplifying into

πœ•π‘‡

πœ•π‘‘=

πœ…

πœŒπΆπ‘

πœ•2𝑇

πœ•π‘₯2+π‘žπ‘ πœŒπΆπ‘

2

𝑅+π‘žπ‘£πœŒπΆπ‘

We let πœ…

πœŒπΆπ‘= 𝛼 (the thermal disfussivity) and get that:

πœ•π‘‡

πœ•π‘‘= 𝛼

πœ•2𝑇

πœ•π‘₯2+ π‘†π‘œπ‘’π‘Ÿπ‘π‘’ π‘‘π‘’π‘Ÿπ‘šπ‘ 

Or in 3D:

πœ•π‘‡

πœ•π‘‘= π›Όβˆ‡2

πœ•2𝑇

πœ•π‘₯2+ π‘†π‘œπ‘’π‘Ÿπ‘π‘’ π‘‘π‘’π‘Ÿπ‘š

Boundary Conditions There are two common boundary conditions which we will encounter.

- Dirichlet

o Fixed boundary condition

Eg: temperature defined at boundary 𝑇(π‘₯ = 𝐿) = 40Β°

- Neumann

Page 15: AMME3060 ENGINEERING METHODS - StudentVIP

14

o Gradient at boundary is defined

Eg: constant heat conduction π‘žπ‘ (π‘₯ = 𝐿) is known, so that 𝑑𝑇

𝑑π‘₯(π‘₯ = 𝐿) =

βˆ’π‘žπ‘ (π‘₯=𝐿)

πœ…

Eg: insulated boundary π‘žπ‘₯(π‘₯ = 𝐿) = 0, as heat conduction is π‘žπ‘₯ =

βˆ’πœ…π‘‘π‘‡

𝑑π‘₯β”‚π‘₯; we get

𝑑𝑇

𝑑π‘₯β”‚π‘₯=𝐿 = 0

Example 2.1:

A round metal rod of length L is held at T = 0β—¦C at x = 0 and T = 100β—¦C at x = 1 m. An electrical current

is passed through the rod generating an internal heat source of 10 kW/m3 . With no heat transfer

through the rod surface, the governing equation is,

πœ•π‘‡

πœ•π‘‘=

πœ…

πœŒπΆπ‘

πœ•2𝑇

πœ•π‘₯2+π‘žπ‘£πœŒπΆπ‘

Assuming steady state, gives

πœ…

πœŒπΆπ‘

πœ•2𝑇

πœ•π‘₯2+π‘žπ‘£πœŒπΆπ‘

= 0

Solution with second order trial function

𝑇 β‰… οΏ½ΜƒοΏ½(𝑑) = 𝐢1 + 𝐢2π‘₯ + 𝐢3π‘₯(π‘₯ βˆ’ 𝐿)

As 𝑇(0) = 0; 𝑇𝐿 = 100; we get 𝐢1 = 0; 𝐢2 =100

𝐿

οΏ½ΜƒοΏ½(𝑑) =100

𝐿π‘₯ + 𝐢3π‘₯(π‘₯ βˆ’ 𝐿)

Giving the residual equation of:

𝑅 =πœ…

πœŒπΆπ‘

πœ•2οΏ½ΜƒοΏ½

πœ•π‘₯2+π‘žπ‘£πœŒπΆπ‘

=πœ…

πœŒπΆπ‘(2𝐢3) +

π‘žπ‘£πœŒπΆπ‘

- As this has no π‘₯ dependence, we can set 𝑅 = 0βˆ€π‘₯; giving 𝐢3 = βˆ’π‘žπ‘£

2πœ…

- This is the exact analytical solution

οΏ½ΜƒοΏ½ =100

𝐿π‘₯ βˆ’

π‘žπ‘£2πœ…π‘₯(π‘₯ βˆ’ 𝐿)

This remarkable result demonstrates the power of this approach. The trial function method (and

Finite Element method) is one of the few approximate methods where the exact result can be

Page 16: AMME3060 ENGINEERING METHODS - StudentVIP

15

obtained. We would rarely, if ever expect to see this however. If we were to change this problem

slightly, such as making qv a function of T, then this trial function would no longer be exact, but it

might still be a very good approximation.

Example 2.2:

A round metal rod of length L = 1m is held at T = 100β—¦C at x = 0 and is insulated at x = 1m, so dT/dx =

0. The rod is cooled air flow from a fan with π‘‡π‘Ž = 0β—¦C with heat transfer coefficient β„Ž (W/m2K).

Under steady conditions, with π‘žπ‘  = β„Ž(𝑇 βˆ’ π‘‡π‘Ž), the unsteady heat equation becomes

0 = πœ…πœ•2𝑇

πœ•π‘₯2βˆ’2β„Ž(𝑇 βˆ’ π‘‡π‘Ž)

𝑅

Letting 𝛾2 =2β„Ž

πœ…π‘…, we get

0 =πœ•2𝑇

πœ•π‘₯2βˆ’ 𝛾2𝑇

Say for 𝛾2 = 4:

Parabolic trial function

οΏ½ΜƒοΏ½ = 100 + 𝐢3π‘₯(π‘₯ βˆ’ 2)

Giving residual

β„› =πœ•2οΏ½ΜƒοΏ½

πœ•π‘₯2βˆ’ 𝛾2οΏ½ΜƒοΏ½ = 2𝐢3 βˆ’ 𝛾

2(100 + 𝐢3π‘₯(π‘₯ βˆ’ 2))

As π‘₯ ∈ [0,1]; try β„› = 0 π‘Žπ‘‘ x=0.5, giving

𝐢3 =400𝛾2

8 + 3𝛾2

Cubic trial function

οΏ½ΜƒοΏ½ = 100 + 𝐢3π‘₯(π‘₯ βˆ’ 2) + 𝐢4π‘₯(π‘₯2 βˆ’ 3)

Again, giving the residual equation of

β„› =πœ•2οΏ½ΜƒοΏ½

πœ•π‘₯2βˆ’ 𝛾2οΏ½ΜƒοΏ½ = 2𝐢3 + 6𝐢4π‘₯ βˆ’ 𝛾

2(100 + 𝐢3π‘₯(π‘₯ βˆ’ 2) + 𝐢4π‘₯(π‘₯2 βˆ’ 3))

- As this has two unkowns, we need to collocate twice. Choose π‘₯ =1

3;2

3 and solve to find

𝐢3 = 150.9; 𝐢4 = βˆ’40.55

We can compare quadratic and cubic to exact solutions:

Page 17: AMME3060 ENGINEERING METHODS - StudentVIP

16

Page 18: AMME3060 ENGINEERING METHODS - StudentVIP

17

Looking at the 𝐿2 norm of each:

So we see the cubic approximation is better, as it has the smaller norm

Lecture 3. Wednesday, 9 August 2017

Method of Weighted Residuals

In the collocation methods before, we always set the residual 𝑅 = 0 at some π‘₯ value. What if we

wanted to increase the accuracy of the method?

We could do this by

- Increasing the order of the polynomial; οΏ½ΜƒοΏ½ = 𝑐1 + 𝑐2π‘₯ + 𝑐3π‘₯2 + 𝑐4𝑐

3 +β‹―

- Method of residual minimisation

o Collocation

o Sub-domain

o Galerkin

- Number of approximations using piece wise solution

Residual minimisation Say we have a trial function

οΏ½ΜƒοΏ½ = 𝐢1π‘₯ + 𝐢2π‘₯2 +β‹―+ 𝐢𝑛π‘₯

𝑛

Collocation: The residual is minimised at discrete points only

β„›(π‘₯𝑖) = 0; βˆ€π‘– = 1,2, . . , 𝑛

Subdomain: - The solution space is divided into β€˜subdomains’, and the residual equally weighted in each

domain

∫ β„›(π‘₯)𝑑π‘₯Ω𝑖

= 0; βˆ€π‘– = 1,2,… , 𝑛

Galerkin: The residual is weighted by a function 𝑁𝑖(π‘₯)

Page 19: AMME3060 ENGINEERING METHODS - StudentVIP

18

βˆ«β„›(π‘₯)𝑁𝑖(π‘₯)𝑑π‘₯Ξ©

= 0; βˆ€π‘– = 1,2,… , 𝑛

Where 𝑁𝑖(π‘₯) is a shape function which weights the residuals.

Shape function

In galerkin method, if οΏ½ΜƒοΏ½ = βˆ‘ 𝐢𝑖π‘₯𝑖𝑛

𝑖=1 , then 𝑁𝑖 = π‘₯𝑖

Eg:

οΏ½ΜƒοΏ½(π‘₯) = 𝑐1π‘₯ + 𝑐2π‘₯2 + 𝑐3π‘₯

3

Then

𝑁1 = π‘₯;𝑁2 = π‘₯2;𝑁3 = π‘₯

3

Example 2.2 (again): by different methods

A round metal rod of length L = 1m is held at T = 100β—¦C at x = 0 and is insulated at x = 1m, so dT/dx =

0. The rod is cooled air flow from a fan with π‘‡π‘Ž = 0β—¦C with heat transfer coefficient β„Ž (W/m2K).

Under steady conditions, with π‘žπ‘  = β„Ž(𝑇 βˆ’ π‘‡π‘Ž), the unsteady heat equation becomes

0 = πœ…πœ•2𝑇

πœ•π‘₯2βˆ’2β„Ž(𝑇 βˆ’ π‘‡π‘Ž)

𝑅

οΏ½ΜƒοΏ½ = 100 + 𝐢3π‘₯(π‘₯ βˆ’ 2𝐿)

Letting 𝛾2 =2β„Ž

πœ…π‘…, we get

0 =πœ•2𝑇

πœ•π‘₯2βˆ’ 𝛾2𝑇

Say for 𝛾2 = 4:

We get the residual equation:

𝑅 =𝑑2οΏ½ΜƒοΏ½

𝑑π‘₯2βˆ’ 𝛾2 οΏ½ΜƒοΏ½

Page 20: AMME3060 ENGINEERING METHODS - StudentVIP

19

Collocation:

As π‘₯ ∈ [0,1]; try β„› = 0 π‘Žπ‘‘ x=0.5, giving

𝐢3 =400𝛾2

8 + 3𝛾2

Subdomain

∫ β„›(π‘₯)𝑑π‘₯Ω𝑖

= 0; βˆ€π‘– = 1,2,… , 𝑛

As there is one unkown, only 1 equation is required (one domain), so the subdomain is all π‘₯ ∈ [0, 𝐿]

∫ 𝑅(π‘₯)𝑑π‘₯𝐿

π‘₯=0

= βˆ«π‘‘2οΏ½ΜƒοΏ½

𝑑π‘₯2βˆ’ 𝛾2 �̃�𝑑π‘₯

𝐿

π‘₯=0

= 0

∴ ∫ (2𝐢 βˆ’ 𝛾2(100 + 𝐢π‘₯(π‘₯ βˆ’ 2𝐿)))𝐿

0

𝑑π‘₯ = 0

β†’ 𝐢 =100𝛾2

2 +23𝛾

2𝐿2

- Different to the constant from collocation

Gelarkin:

For

οΏ½ΜƒοΏ½ = 100 +𝐢3 π‘₯(π‘₯ βˆ’ 2𝐿)

𝑁1

There is only 1 unkown, and so 𝑛 = 1; with the final term of

𝑁1 = π‘₯(π‘₯ βˆ’ 2𝐿)

∴ βˆ«π‘…(π‘₯)𝑁(π‘₯)𝑑π‘₯Ξ©

= ∫ (2𝐢 βˆ’ 𝛾2(100 + 𝐢π‘₯(π‘₯ βˆ’ 2𝐿))) (π‘₯(π‘₯ βˆ’ 2𝐿))𝑑π‘₯𝐿

0

= 0

Integrating, and solving to get

𝐢 =100𝛾2

2 +45𝛾2𝐿2

Page 21: AMME3060 ENGINEERING METHODS - StudentVIP

20

Solution Comparrison:

- L2 norm of the galerkin is smallest, followed by collocation and subdomain (which is very

poor)

- Galerkin is a very good approach

Lecture 4. Thursday, 10 August 2017

Galerkin Finite Element Method - Piece wise solution:

Use piece-wise solution e.g. Finite Element Method. Can improve the accuracy

Solution: define trial function - Use a linear trial function.

Eg: for element 1, we can approximate

𝑇(π‘₯) = 𝑐1π‘₯ + 𝑐2π‘₯

Where 𝑐1,2 are unkown.

But: a better way is:

- We known at π‘₯1; 𝑇(π‘₯1) = 𝑇1, and so

Page 22: AMME3060 ENGINEERING METHODS - StudentVIP

21

𝑇1 = 𝐢1 + 𝐢2π‘₯1

𝑇2 = 𝐢1 + 𝐢2π‘₯2

Which we can eliminate 𝐢1,2 to find

𝑇(π‘₯) =π‘₯2 βˆ’ π‘₯

π‘₯2 βˆ’ π‘₯1𝑇1 +

π‘₯ βˆ’ π‘₯1π‘₯2 βˆ’ π‘₯1

𝑇2

or

𝑇(π‘₯) = 𝑁1(π‘₯)𝑇1 +𝑁2(π‘₯)𝑇2

With

𝑁1 =π‘₯2 βˆ’ π‘₯

π‘₯2 βˆ’ π‘₯1; and 𝑁2 =

π‘₯ βˆ’ π‘₯1π‘₯2 βˆ’ π‘₯1

The global temperature is described by piece-wise linear functions for each element. Now we just

have to obtain our residual equation and solve to find 𝑇2,3,4

Weighted residuals

We use the Galerkin method to find the nodal values of 𝑇𝑖 (our unkown fitting constants)

- For this example on element (1), we need 2 equations for 𝑇1 and 𝑇2

∫ 𝑅(π‘₯)𝑁𝑖(π‘₯)𝑑π‘₯Ξ©(1)

Example 4.1:

Recall the heated rod problem from example 2.1. A round metal rod of length L is held at T = 0β—¦C at x

= 0 and T = 100β—¦C at x = 1m. An electrical current is passed through the rod generating an internal

heat source of qv = 100 kW/m3. If there is no heat transfer through the rod surface, the governing

equation for the steady state solution can be written,

Page 23: AMME3060 ENGINEERING METHODS - StudentVIP

22

where = qv/ = 2000 k/m2 with = 50W/mk. Find T(x) using the finite element Galerkin method using

linear trial functions. Discretise the domain into four elements of equal length x.

solution:

rod divided into 4 elements:

- The temperateraures at π‘₯ = 0; 𝐿 are given as 𝑇1 = 0; 𝑇5 = 100. We want to find 𝑇2,3,4, and

we can linearly interpolate between all 𝑇

Eg: If our residual equation is

𝑅 =𝑑2𝑇

𝑑π‘₯2+ 𝛾

We have the substitution

∫ (𝑑2𝑇

𝑑π‘₯2+ 𝛾)𝑁𝑖(π‘₯)𝑑π‘₯

Ξ©(1)

= 0; 𝑖 = 1,2

- In finite element method; we can only solve a DE of the same order of our trial function

polynomial.

- To get around this, we’ll need to use integration by parts.

For the first element: we define the linear trial function

𝑇(π‘₯) = 𝑐1 + 𝑐2π‘₯

Finding that:

𝑇(π‘₯) =π‘₯2 βˆ’ π‘₯

π‘₯2 βˆ’ π‘₯1𝑇1 +

π‘₯ βˆ’ π‘₯1π‘₯2 βˆ’ π‘₯1

𝑇2

or

𝑇(π‘₯) = 𝑁1(π‘₯)𝑇1 +𝑁2(π‘₯)𝑇2

Where

𝑁1 =π‘₯2 βˆ’ π‘₯

π‘₯2 βˆ’ π‘₯1; and 𝑁2 =

π‘₯ βˆ’ π‘₯1π‘₯2 βˆ’ π‘₯1

- 𝑁1,2 are the shape function or interpolation function of the element (or basis function)

Page 24: AMME3060 ENGINEERING METHODS - StudentVIP

23

π‘₯ = π‘₯1, 𝑁1 = 1,𝑁2 = 0; π‘₯ = π‘₯2, 𝑁1 = 0,𝑁2 = 1

𝑁1 +𝑁2 = 1

For this problem, every element has 2 interpolation functions, which we distinguish with 𝑁1(𝑗)

For the other elements:

𝑇(2)(π‘₯) = 𝑁1(2)(π‘₯)𝑇2 + 𝑁2

(2)(π‘₯)𝑇3

𝑇(3)(π‘₯) = 𝑁1(3)(π‘₯)𝑇3 + 𝑁2

(3)(π‘₯)𝑇4

𝑇(4)(π‘₯) = 𝑁1(4)(π‘₯)𝑇4 +𝑁2

(4)(π‘₯)𝑇4

- A global temperature is now described by piecewise linear functions for each element

Obtaining weighted residuals

We now use Galerkin to find the nodal values of 𝑇

Above: we have that

∫ (𝑑2𝑇

𝑑π‘₯2+ 𝛾)𝑁𝑖(π‘₯)𝑑π‘₯

Ξ©(1)

= 0; 𝑖 = 1,2

So that:

βˆ«π‘‘2𝑇

𝑑π‘₯2𝑁𝑖(π‘₯)𝑑π‘₯

π‘₯2

π‘₯1

+∫ 𝛾𝑁𝑖(π‘₯)𝑑π‘₯π‘₯2

π‘₯1

= 0; 𝑖 = 1,2

We can write βˆ«π‘‘2𝑇

𝑑π‘₯2𝑁𝑖(π‘₯)𝑑π‘₯

π‘₯2π‘₯1

= [𝑁𝑖(π‘₯)𝑑𝑇

𝑑π‘₯]π‘₯1

π‘₯2+ ∫ 𝛾𝑁𝑖(π‘₯)𝑑π‘₯

π‘₯2π‘₯1

; 𝑖 = 1,2, so that overall

βˆ«π‘‘π‘‡

𝑑π‘₯

𝑑𝑁𝑖(π‘₯)

𝑑π‘₯𝑑π‘₯

π‘₯2

π‘₯1

= [𝑁𝑖(π‘₯)𝑑𝑇

𝑑π‘₯]π‘₯1

π‘₯2

+∫ 𝛾𝑁𝑖(π‘₯)𝑑π‘₯π‘₯2

π‘₯1

; 𝑖 = 1,2

Page 25: AMME3060 ENGINEERING METHODS - StudentVIP

24

- [𝑁𝑖(π‘₯)𝑑𝑇

𝑑π‘₯]π‘₯1

π‘₯2 is the boundar condition

- ∫ 𝛾𝑁𝑖(π‘₯)𝑑π‘₯π‘₯2π‘₯1

is a forcing function

We need 𝑑𝑇

𝑑π‘₯;𝑑𝑁𝑖

𝑑π‘₯ to solve this:

𝑁1 =π‘₯2 βˆ’ π‘₯

π‘₯2 βˆ’ π‘₯1; and 𝑁2 =

π‘₯ βˆ’ π‘₯1π‘₯2 βˆ’ π‘₯1

So we get

𝑑𝑁1𝑑π‘₯

= βˆ’1

π‘₯2 βˆ’ π‘₯1; 𝑑𝑁2𝑑π‘₯

=1

π‘₯2 βˆ’ π‘₯1

As 𝑇 = 𝑁1𝑇1 +𝑁2𝑇2

𝑑𝑇

𝑑π‘₯=𝑑𝑁1𝑑π‘₯

𝑇1 +𝑑𝑁2𝑑π‘₯

𝑇2 = βˆ’1

π‘₯2 βˆ’ π‘₯1(𝑇1 βˆ’ 𝑇2)

- This indicates that the temperature gradient across each element is constant; as 𝑇1 βˆ’ 𝑇2 is

constant. (we assumed a linear function, so this is obvious)

Substituting this in, we get that: for 𝑖 = 1

βˆ«π‘‘π‘‡

𝑑π‘₯

𝑑𝑁𝑖(π‘₯)

𝑑π‘₯𝑑π‘₯

π‘₯2

π‘₯1

= [𝑁𝑖(π‘₯)𝑑𝑇

𝑑π‘₯]π‘₯1

π‘₯2

+∫ 𝛾𝑁𝑖(π‘₯)𝑑π‘₯π‘₯2

π‘₯1

∫ βˆ’π‘‡1 βˆ’ 𝑇2π‘₯2 βˆ’ π‘₯1

βˆ’1

π‘₯2 βˆ’ π‘₯1𝑑π‘₯

π‘₯2

π‘₯1

= 𝑁1(π‘₯)𝑑𝑇

𝑑π‘₯β”‚π‘₯2 βˆ’π‘1(π‘₯)

𝑑𝑇

𝑑π‘₯β”‚π‘₯1 +∫

𝛾(π‘₯2 βˆ’ π‘₯)

π‘₯2 βˆ’ π‘₯1(π‘₯)𝑑π‘₯

π‘₯2

π‘₯1

As 𝑁1(π‘₯2) = 0;𝑁1(π‘₯1) = 1

1

π‘₯2 βˆ’ π‘₯1(𝑇1 βˆ’ 𝑇2) = βˆ’

𝑑𝑇

𝑑π‘₯β”‚π‘₯1 + 𝛾

π‘₯2 βˆ’ π‘₯12

Similarly, if 𝑖 = 2

1

π‘₯2 βˆ’ π‘₯1(βˆ’π‘‡1 + 𝑇2) = +

𝑑𝑇

𝑑π‘₯β”‚π‘₯2 + 𝛾

π‘₯2 βˆ’ π‘₯12

- 𝑑𝑇

𝑑π‘₯β”‚π‘₯1,π‘₯2 (boundary gradients) are unkown; but they will largly disappear near the end

Matrix

We now want to do this for each element. To make this easy, we’ll put this as a matrix:

1

Ξ”π‘₯(1 βˆ’1βˆ’1 1

) (𝑇1𝑇2) = (

βˆ’π‘‘π‘‡

𝑑π‘₯β”‚π‘₯1

+𝑑𝑇

𝑑π‘₯β”‚π‘₯2

)+(𝛾Δπ‘₯

2

𝛾Δπ‘₯

2

)