Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo Department.

Similar presentations


Presentation on theme: "COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo Department."— Presentation transcript:

1 COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo omeza@bayamon.inter.edu http://facultad.bayamon.inter.edu/omeza Department of Mechanical Engineering

2 FINITE DIFFERENCES Best known numerical method of approximation

3 FINITE DIFFERENCE FORMULATION OF 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. 3

4 THE BIG QUESTION : How good are the FD approximations? This leads us to Taylor series.... 4

5 ▪ Numerical Methods express functions in an approximate fashion: The Taylor Series. ▪ What is a Taylor Series? Some examples of Taylor series which you must have seen EXPASION OF TAYLOR SERIES 5

6 ▪ The general form of the Taylor series is given by provided that all derivatives of f(x) are continuous and exist in the interval [x,x+h], where h= ∆ x What does this mean in plain English? GENERAL TAYLOR SERIES As Archimedes would have said, “ Give me the value of the function at a single point, and the value of all (first, second, and so on) its derivatives at that single point, and I can give you the value of the function at any other point ” 6

7 ▪ Example: Find the value of f(6) given that f(4)=125, f’(4)=74, f’’(4)=30, f’’’(4)=6 and all other higher order derivatives of f(x) at x=4 are zero. ▪ Solution: x=4, x+h=6  h=6-x=2 ▪ Since the higher order derivatives are zero, 7

8 THE TAYLOR SERIES ▪ (x i+1 -x i )= h step size (define first) ▪ Reminder term, R n, accounts for all terms from (n+1) to infinity. 8

9 ▪ Zero-order approximation ▪ First-order approximation ▪ Second-order approximation 9

10 ▪ Example: Taylor Series Approximation of a polynomial Use zero- through fourth-order Taylor Series approximation to approximate the function: ▪ From x i =0 with h=1. That is, predict the function’s value at x i+1 =1 ▪ f(0)=1.2 ▪ f(1)=0.2 -  True value 10

11 ▪ Zero-order approximation ▪ First-order approximation 11

12 ▪ Second-order approximation 12 12

13 ▪ Third-order approximation 13

14 ▪ Fourth-order approximation 14

15 15

16 ▪ If we truncate the series after the first derivative term TAYLOR SERIES TO ESTIMATE TRUNCATION ERRORS First-order approximation Truncation Error 16

17 ▪ Forward Difference Approximation NUMERICAL DIFFERENTIATION 17

18 The Taylor series expansion of f ( x ) about x i is The Taylor series expansion of f ( x ) about x i is From this: From this: This formula is called the first forward divided difference formula and the error is of order O ( h ). This formula is called the first forward divided difference formula and the error is of order O ( h ). NUMERICAL DIFFERENTIATION 18

19 Or equivalently, the Taylor series expansion of f ( x ) about x i can be written as Or equivalently, the Taylor series expansion of f ( x ) about x i can be written as From this: From this: This formula is called the first backward divided difference formula and the error is of order O ( h ). This formula is called the first backward divided difference formula and the error is of order O ( h ). 19

20 A third way to approximate the first derivative is to subtract the backward from the forward Taylor series expansions: A third way to approximate the first derivative is to subtract the backward from the forward Taylor series expansions: This yields to This yields to This formula is called the centered divided difference formula and the error is of order O ( h 2 ). This formula is called the centered divided difference formula and the error is of order O ( h 2 ). 20

21 ▪ Forward Difference Approximation NUMERICAL DIFFERENTIATION 21

22 ▪ Backward Difference Approximation 22

23 ▪ Centered Difference Approximation 23

24 ▪ Example: To find the forward, backward and centered difference approximation for f(x) at x=0.5 using step size of h=0.5, repeat using h=0.25. The true value is -0.9125 ▪ h=0.5 ▪ x i-1 =0 -  f(x i-1 )=1.2 ▪ x i =0.5 -  f(x i )=0.925 ▪ X i+1 =1 -  f(x i+1 )=0.2 24

25 ▪ Forward Difference Approximation ▪ Backward Difference Approximation 25

26 ▪ Centered Difference Approximation 26

27 ▪ h=0.25 ▪ x i-1 =0.25 -  f(x i-1 )=1.10351563 ▪ x i =0.5 -  f(x i )=0.925 ▪ X i+1 =0.75 -  f(x i+1 )=0.63632813 ▪ Forward Difference Approximation 27

28 ▪ Backward Difference Approximation ▪ Centered Difference Approximation 28

29 The forward Taylor series expansion for f ( x i +2 ) in terms of f ( x i ) is The forward Taylor series expansion for f ( x i +2 ) in terms of f ( x i ) is Combine equations: Combine equations: FINITE DIFFERENCE APPROXIMATION OF HIGHER DERIVATIVE 29

30 Solve for f ''( x i ): Solve for f ''( x i ): This formula is called the second forward finite divided difference and the error of order O ( h ). 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 The second backward finite divided difference which has an error of order O ( h ) is 30

31 The second centered finite divided difference which has an error of order O ( h 2 ) is The second centered finite divided difference which has an error of order O ( h 2 ) is 31

32 High accurate estimates can be obtained by retaining more terms of the Taylor series. High accurate estimates can be obtained by retaining more terms of the Taylor series. The forward Taylor series expansion is: The forward Taylor series expansion is: From this, we can write From this, we can write High-Accuracy Differentiation Formulas 32

33 Substitute the second derivative approximation into the formula to yield: Substitute the second derivative approximation into the formula to yield: By collecting terms: By collecting terms: Inclusion of the 2 nd derivative term has improved the accuracy to O ( h 2 ). Inclusion of the 2 nd derivative term has improved the accuracy to O ( h 2 ). This is the forward divided difference formula for the first derivative. This is the forward divided difference formula for the first derivative. 33

34 Forward Formulas 34

35 Backward Formulas 35

36 Centered Formulas 36

37 Example Estimate f '(1) for f ( x ) = e x + x using the centered formula of O ( h 4 ) with h = 0.25. Solution From Tables From Tables 37

38 In substituting the values: In substituting the values: 38

39 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 39

40 ▪ 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. 40 INTRODUCTION TO FINITE DIFFERENCE (i,j)

41 x n Discretization: PDE FDE n Explicit Methods u Simple u No stable n Implicit Methods u More complex u Stables  ∆x∆x  x m-1 x mm+1 y n+1 y n y n-1 ∆y∆y m,n u

42

43

44

45 SUMMARY OF NODAL FINITE- DIFFERENCE RELATIONS FOR VARIOUS CONFIGURATIONS: Case 1: Interior Node

46 Case 2: Node at an Internal Corner with Convection

47 Case 3: Node at Plane Surface with Convection

48 Case 4: Node at an External Corner with Convection

49 Case 5: Node at Plane Surface with Uniform Heat Flux

50 SOLVING THE FINITE DIFFERENCE EQUATIONS Heat Transfer Solved Problems

51 THE MATRIX INVERSION METHOD

52

53

54 JACOBI ITERATION METHOD

55

56

57

58

59

60 GAUSS-SEIDEL ITERATION

61

62

63 ERROR DEFINITIONS ▪ Use absolute value. ▪ Computations are repeated until stopping criterion is satisfied. ▪ If the following Scarborough criterion is met 63 Pre-specified % tolerance based on the knowledge of your solution

64 USIG EXCEL 64 =MINVERSE(A2:C4) =MMULT(A7:C9,E2:E4) Matrix Inversion Method

65 65 Jacobi Iteration Method using Excel

66 66 Gauss-Seidel Iteration Method using Excel

67 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. T s =300 K (1,1) (2,1)(3,1) (1,2) (2,2)(3,2) (1,3) (2,3)(3,3)

68 T 11 T 12 T 13 T 21 T 22 T 23 T 31 T 32 T 33 -410100000T 11 -800 1-41010000T 12 -500 01-4001000T 13 -1000 100-410100T 21 -300 0101-41010T 22 = 0 00101-4001T 23 -500 000100-410T 31 -800 0000101-41T 32 -500 00000101-4T 33 -1000 System of Linear Equations

69 69 Matrix Inversion Method

70 70 Iteration Method using Excel

71 71 Jacobi Iteration Method using Excel

72 72 Error Iteration Method using Excel

73 73 Gauss-Seidel Iteration Method using Excel

74 74 Error Iteration Method using Excel

75

76

77

78 78 Iteration Method using Excel

79

80


Download ppt "COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo Department."

Similar presentations


Ads by Google