Upload
robbin
View
58
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Numerical Methods for Engineering MECN 3500. Professor: Dr. Omar E. Meza Castillo [email protected] http://www.bc.inter.edu/facultad/omeza Department of Mechanical Engineering Inter American University of Puerto Rico Bayamon Campus. Tentative Lectures Schedule. Finite Difference. - PowerPoint PPT Presentation
Citation preview
MEC
N 3
500
Int
er -
Baya
mon
Lecture
9Numerical Methods for Engineering
MECN 3500
Professor: Dr. Omar E. Meza [email protected]
http://www.bc.inter.edu/facultad/omezaDepartment of Mechanical EngineeringInter American University of Puerto Rico
Bayamon Campus
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Tentative Lectures Schedule
Topic LectureMathematical Modeling and Engineering Problem Solving 1Introduction to Matlab 2Numerical Error 3Root Finding 4-5-6System of Linear Equations 7-8Finite Difference 9Least Square Curve FittingPolynomial Interpolation Numerical IntegrationOrdinary Differential Equations
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Best known numerical method of approximation
Finite Difference
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
To understand the theory of finite differences.
To apply FD to the solution of specific problems as a function of accuracy, condition matrix, and performance of iterative methods.
Course Objectives
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
FINITE DIFFERENCE FORMULATIONOF DIFFERENTIAL EQUATIONS
finite difference form of the first derivative
Taylor series expansion of the function f about the point x,
The smaller the x, the smaller the error, and thus the more accurate the approximation.
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
• The forward Taylor series expansion for f(xi+2) in terms of f(xi) is
• Combine equations:
212
21
22
22
)()()(2)(
_______________________________________2)()()()(2
)2(2)()2)(()()(
)2(2)()2)(()()(
hxfxfxfxf
hxfhxfxfxf
hxfhxfxfxf
hxfhxfxfxf
iiii
iiii
iiii
iiii
FINITE DIFFERENCE APPROXIMATION OF HIGHER
DERIVATIVE
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
• Solve for f ''(xi):
• This formula is called the second forward finite divided difference and the error of order O(h).
• The second backward finite divided difference which has an error of order O(h) is
221
212
)()(2)()(
)()(2)()(
hxfxfxfxf
hxfxfxfxf
iiii
iiii
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
• The second centered finite divided difference which has an error of order O(h2) is
211 )()(2)()(
hxfxfxfxf iii
i
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
• High accurate estimates can be obtained by retaining more terms of the Taylor series.
hxfh
xfxfxf
hxfxxxfxfxf
iiii
iiiiii
2)('')()()(
2)(''))(()()(
1
211
• The forward Taylor series expansion is:
• From this, we can write
High-Accuracy Differentiation Formulas
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
• Substitute the second derivative approximation into the formula to yield:
• By collecting terms:
• Inclusion of the 2nd derivative term has improved the accuracy to O(h2).
• This is the forward divided difference formula for the first derivative.
hxfxfxfxf
hhxfxfxf
hxfxfxf
iiii
iii
iii
2)(3)(4)()(
2
)()(2)()()()(
12
212
1
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Forward Formulas
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Backward Formulas
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Centered Formulas
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Example
Estimate f '(1) for f(x) = ex + x using the centered formula of O(h4) with h = 0.25.
Solution
5.15.01225.125.01
175.025.015.05.012
12)()(8)(8)()(
2
1
1
2
2112
hxxhxx
xhxxhxx
hxfxfxfxfxf
ii
ii
i
ii
ii
iiiii
•From Tables
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
717.33
)149.2()867.2(8)740.4(8982.5)25.0(12
)5.0()75.0(8)25.1(8)5.1()(
ffffxf i
•In substituting the values:
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Error
Truncation Error: introduced in the solution by the approximation of the derivative Local Error: from each term of the
equation Global Error: from the accumulation of
local error Roundoff Error: introduced in the
computation by the finite number of digits used by the computer
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Numerical solutions can give answers at only discrete points in the domain, called grid points.
If the PDEs are totally replaced by a system of algebraic equations which can be solved for the values of the flow-field variables at the discrete points only, in this sense, the original PDEs have been discretized. Moreover, this method of discretization is called the method of finite differences.
Introduction to Finite Difference
(i,j)
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
x
Discretization: PDE FDE
Explicit Methods Simple No stable
Implicit Methods More complex Stables
¬∆x®
xm-1 x m m+1
yn+1
yn
yn-1
∆ym,nu
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Summary of nodal finite-difference relations for various configurations:
Case 1: Interior Node
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Case 2: Node at an Internal Corner with Convection
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Case 3: Node at Plane Surface with Convection
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Case 4: Node at an External Corner with Convection
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Case 5: Node at Plane Surface with Uniform Heat Flux
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Solving Finite Difference Equations
Heat Transfer Solved Problem
Lecture 9MEC
N 3
500
Int
er -
Baya
mon The Matrix Inversion
Method
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Jacobi Iteration Method
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Gauss-Seidel Iteration
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Error Definitions
Use absolute value. Computations are repeated until stopping
criterion is satisfied.
If the following Scarborough criterion is met
sa Pre-specified % tolerance
based on the knowledge of your solution
)%n)-(2s 10 (0.5
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Using Excel
=MINVERSE(A2:C4)
=MMULT(A7:C9,E2:E4)
Matrix Inversion Method
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Jacobi Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
43
Gauss-Seidel Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
A large industrial furnace is supported on a long column of fireclay brick, which is 1 m by 1 m on a side. During steady-state operation is such that three surfaces of the column are maintained at 500 K while the remaining surface is exposed to 300 K. Using a grid of ∆x=∆y=0.25 m, determine the two-dimensional temperature distribution in the column.
Ts=300 K
(1,1) (2,1) (3,1)
(1,2) (2,2) (3,2)
(1,3) (2,3) (3,3)
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
T11 T12 T13 T21 T22 T23 T31 T32 T33
-4 1 0 1 0 0 0 0 0 T11 -8001 -4 1 0 1 0 0 0 0 T12 -500
0 1 -4 0 0 1 0 0 0 T13
-1000
1 0 0 -4 1 0 1 0 0 T21 -3000 1 0 1 -4 1 0 1 0 T22 = 00 0 1 0 1 -4 0 0 1 T23 -5000 0 0 1 0 0 -4 1 0 T31 -8000 0 0 0 1 0 1 -4 1 T32 -500
0 0 0 0 0 1 0 1 -4 T33
-1000System of Linear Equations
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Matrix Inversion Method
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
48
Jacobi Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
49
Error Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
50
Gauss-Seidel Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
51
Error Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
55
Iteration Method using Excel
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
58
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Example 17.5
59
Fit the data with multiple linear regression
x1 x2 y0 0 52 1 102.5 2 97 3 04 6 35 2 27
1005.243
54
5448144825.765.16145.166
2
1
0
aaa
3,4,5 210 aaa
21 345 xxy
Lecture 9MEC
N 3
500
Int
er -
Baya
mon Regression in Matlab and Excel
60
Use the polyfit function
Regression in ExcelUse Add Trendline
Regression in Matlab
Lecture 9MEC
N 3
500
Int
er -
Baya
mon
Homework7 www.bc.inter.edu/facultad/omeza
Omar E. Meza Castillo Ph.D.
61