# computational modeling for engineering mecn 6040

Post on 23-Feb-2016

32 views

Category:

## Documents

Embed Size (px)

DESCRIPTION

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. Finite differences. Best known numerical method of approximation. FINITE DIFFERENCE FORMULATION - PowerPoint PPT Presentation

TRANSCRIPT

Computational Modeling for EngineeringMECN 6040Professor: Dr. Omar E. Meza Castilloomeza@bayamon.inter.eduhttp://facultad.bayamon.inter.edu/omezaDepartment of Mechanical Engineering

Finite differencesBest known numerical method of approximation FINITE DIFFERENCE FORMULATIONOF DIFFERENTIAL EQUATIONS

finite difference form of the first derivativeTaylor 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.33The big question:How good are the FD approximations?

This leads us to Taylor series....4Numerical 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

5The 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=xWhat 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 point6Example: 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=2Since the higher order derivatives are zero,

7The Taylor Series(xi+1-xi)= hstep size (define first)Reminder term, Rn, accounts for all terms from (n+1) to infinity.

88Zero-order approximation

First-order approximation

Second-order approximation

99Example: Taylor Series Approximation of a polynomial Use zero- through fourth-order Taylor Series approximation to approximate the function:

From xi=0 with h=1. That is, predict the functions value at xi+1=1f(0)=1.2f(1)=0.2 - True value

10Zero-order approximation

First-order approximation

11Second-order approximation

12

12Third-order approximation

13Fourth-order approximation

14

15If we truncate the series after the first derivative termTaylor Series to Estimate Truncation Errors

First-order approximationTruncation Error

1616Forward Difference Approximation

Numerical Differentiation

1717The Taylor series expansion of f(x) about xi is

From this:

This formula is called the first forward divided difference formula and the error is of order O(h).

Numerical Differentiation18Or equivalently, the Taylor series expansion of f(x) about xi can be written as

From this:

This formula is called the first backward divided difference formula and the error is of order O(h).

19A third way to approximate the first derivative is to subtract the backward from the forward Taylor series expansions:

This yields to

This formula is called the centered divided difference formula and the error is of order O(h2).

20Forward Difference Approximation

Numerical Differentiation

2121Backward Difference Approximation

2222Centered Difference Approximation

2323Example: 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.5xi-1=0 - f(xi-1)=1.2xi=0.5 - f(xi)=0.925Xi+1=1 - f(xi+1)=0.2

24Forward Difference Approximation

Backward Difference Approximation

25Centered Difference Approximation

26h=0.25xi-1=0.25 - f(xi-1)=1.10351563xi=0.5 - f(xi)=0.925Xi+1=0.75 - f(xi+1)=0.63632813

Forward Difference Approximation

27Backward Difference Approximation

Centered Difference Approximation

28The forward Taylor series expansion for f(xi+2) in terms of f(xi) is

Combine equations:

FINITE DIFFERENCE APPROXIMATION OF HIGHER DERIVATIVE29Solve 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

30The second centered finite divided difference which has an error of order O(h2) is

31High accurate estimates can be obtained by retaining more terms of the Taylor series.

The forward Taylor series expansion is:

From this, we can writeHigh-Accuracy Differentiation Formulas32Substitute 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.

33

Forward Formulas34

Backward Formulas35

Centered Formulas36ExampleEstimate f '(1) for f(x) = ex + x using the centered formula of O(h4) with h = 0.25.Solution

From Tables37

In substituting the values:38ErrorTruncation Error: introduced in the solution by the approximation of the derivativeLocal Error: from each term of the equationGlobal Error: from the accumulation of local errorRoundoff Error: introduced in the computation by the finite number of digits used by the computer39Numerical 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.

40Introduction to Finite Difference(i,j) xDiscretization: PDE FDEExplicit MethodsSimpleNo stableImplicit MethodsMore complexStablesx xm-1 xmm+1yn+1ynyn-1ym,nu

Summary of nodal finite-difference relations for various configurations:Case 1: Interior Node

Case 2: Node at an Internal Corner with Convection

Case 3: Node at Plane Surface with Convection

Case 4: Node at an External Corner with Convection

Case 5: Node at Plane Surface with Uniform Heat Flux

SOLVING THE Finite difference EQUATIONSHeat Transfer Solved Problems The Matrix Inversion Method

jacobi ITERATION method

GAUSS-SEIDEL ITERATION

Error DefinitionsUse 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

USIG EXCEL64

=MINVERSE(A2:C4)=MMULT(A7:C9,E2:E4)Matrix Inversion Method65

Jacobi Iteration Method using Excel

66Gauss-Seidel Iteration Method using Excel

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)T11T12T13T21T22T23T31T32T33-410100000T11-8001-41010000T12-50001-4001000T13-1000100-410100T21-3000101-41010T22=000101-4001T23-500000100-410T31-8000000101-41T32-50000000101-4T33-1000

System of Linear Equations69

Matrix Inversion Method70Iteration Method using Excel

71Jacobi Iteration Method using Excel

72Error Iteration Method using Excel

73Gauss-Seidel Iteration Method using Excel

74Error Iteration Method using Excel

78Iteration Method using Excel