AMME3060 ENGINEERING
METHODS LECTURE NOTES
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
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
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
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
5
AMME3060 Engineering Methods Lecture Notes Lecturer: Dr Nicholas Williamson
Room S411 in J07 level 4
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.
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
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
πΉπ·
π
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 β πβπ‘π)
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
)
10
Comparing to exact solution:
- Approximate in solid; exact in dashed
- We can see where we set the residual to be 0
- And error οΏ½ΜοΏ½ β π£
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
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 π
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
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
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:
16
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 ππ(π₯)
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 οΏ½ΜοΏ½
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
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
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,
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)
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
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
)