61
MECN 3500 Inter - Bayamon Lecture 9 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

Numerical Methods for Engineering MECN 3500

  • Upload
    robbin

  • View
    55

  • Download
    0

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

Page 1: Numerical Methods for Engineering  MECN 3500

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

Page 2: Numerical Methods for Engineering  MECN 3500

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

Page 3: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Best known numerical method of approximation

Finite Difference

Page 4: Numerical Methods for Engineering  MECN 3500

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

Page 5: Numerical Methods for Engineering  MECN 3500

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.

Page 6: Numerical Methods for Engineering  MECN 3500

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

Page 7: Numerical Methods for Engineering  MECN 3500

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

Page 8: Numerical Methods for Engineering  MECN 3500

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

Page 9: Numerical Methods for Engineering  MECN 3500

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

Page 10: Numerical Methods for Engineering  MECN 3500

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

Page 11: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Forward Formulas

Page 12: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Backward Formulas

Page 13: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Centered Formulas

Page 14: Numerical Methods for Engineering  MECN 3500

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

Page 15: Numerical Methods for Engineering  MECN 3500

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:

Page 16: Numerical Methods for Engineering  MECN 3500

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

Page 17: Numerical Methods for Engineering  MECN 3500

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)

Page 18: Numerical Methods for Engineering  MECN 3500

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

Page 19: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 20: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 21: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 22: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Summary of nodal finite-difference relations for various configurations:

Case 1: Interior Node

Page 23: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Case 2: Node at an Internal Corner with Convection

Page 24: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Case 3: Node at Plane Surface with Convection

Page 25: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Case 4: Node at an External Corner with Convection

Page 26: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Case 5: Node at Plane Surface with Uniform Heat Flux

Page 27: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Solving Finite Difference Equations

Heat Transfer Solved Problem

Page 28: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon The Matrix Inversion

Method

Page 29: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 30: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 31: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Jacobi Iteration Method

Page 32: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 33: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 34: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 35: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 36: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 37: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Gauss-Seidel Iteration

Page 38: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 39: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 40: Numerical Methods for Engineering  MECN 3500

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

Page 41: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Using Excel

=MINVERSE(A2:C4)

=MMULT(A7:C9,E2:E4)

Matrix Inversion Method

Page 42: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Jacobi Iteration Method using Excel

Page 43: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

43

Gauss-Seidel Iteration Method using Excel

Page 44: Numerical Methods for Engineering  MECN 3500

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)

Page 45: Numerical Methods for Engineering  MECN 3500

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

Page 46: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon Matrix Inversion Method

Page 47: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Iteration Method using Excel

Page 48: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

48

Jacobi Iteration Method using Excel

Page 49: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

49

Error Iteration Method using Excel

Page 50: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

50

Gauss-Seidel Iteration Method using Excel

Page 51: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

51

Error Iteration Method using Excel

Page 52: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 53: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 54: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 55: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

55

Iteration Method using Excel

Page 56: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 57: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Page 58: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

58

Page 59: Numerical Methods for Engineering  MECN 3500

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

Page 60: Numerical Methods for Engineering  MECN 3500

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

Page 61: Numerical Methods for Engineering  MECN 3500

Lecture 9MEC

N 3

500

Int

er -

Baya

mon

Homework7 www.bc.inter.edu/facultad/omeza

Omar E. Meza Castillo Ph.D.

61