Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite Deference Method

Similar presentations


Presentation on theme: "Finite Deference Method"— Presentation transcript:

1 Finite Deference Method
by Dr. Samah Mohamed Mabrouk

2 Finite-difference method

3 Different Difference formulas
B C x f(x) f(x+x) i i+1 Different Difference formulas Taylor series expansion First forward difference approximation Solve for order of x First forward difference approximation

4 First backward difference approximation
f(x) f(x-x) i i-1 First backward difference approximation Taylor series expansion Solve for order of x First backward difference approximation

5 Central difference approximation
Subtracting (2) from (1) Central difference approximation B C x f(x) f(x+x) f(x-x) A i-1 i i+1

6 Second derivative Multiply (1) by 2 and subtracting it from (2)
Solve for forward difference approximation

7 backward difference approximation
Central difference approximation

8 backward difference approximation
forward difference approximation backward difference approximation Central difference approximation

9 BVP IVP ODE the conditions given are specified at the same value of x,
Initial Value Problems IVP Boundary Value Problems BVP the conditions given are specified at the same value of x, the two conditions are specified at different values of x.

10 Dirichlet BC

11 y0 = y y y y4 =0 x x x x x4 We then substitute in the difference equation for the inner nodes (unknowns) as follows: Rearrange the equations and substitute by the boundary values y0 =0, y4 =0, we get the following 3x3 system

12 Writing this system in matrix-vector form as

13 Solving this system in Matlab
>> Y=A\b Y = >> format long >> Y=inv(A)*b

14 In case of Neumann BC: we apply FD for the first derivative, for example: This means that the value un at the last node is unknown and will need an extra equation at that node In this equation we replace un+1 from the approximation of Neumann BC

15 Example: Solve Using FD method. Let h=0.25 Solution du/dx=1 u0 = u u u u4 x x x x x4 We then substitute in the difference equation for the inner nodes (unknowns) and the Neumann boundary node as follows:

16 x x x x x4 u0 = u u u u4 du/dx=1 u5 We substitute by u5 in the last equation from the Neumann BC as

17 This will lead to a linear system of equations of four unknowns
In matrix form Au=b

18 Heat equation The conservation of heat can be used to develop a heat balance for a long, thin rod. If the rod is not insulated along its length and the system is at steady state. The equation that results is: T1 T2 Ta

19 For L= 10 m rod with T(0) = 40, T(L) = 200, Ta = 20 and h = 0.01
Solve Solution

20 Divide the rod into a grid by  x = 2m
40 200 i=

21 Writing this system in matrix-vector form as

22 Exercise

23 Exercises


Download ppt "Finite Deference Method"

Similar presentations


Ads by Google