Finite Difference Method 10EL20.ppt
-
Upload
muhammad-sarwar -
Category
Documents
-
view
215 -
download
1
Transcript of Finite Difference Method 10EL20.ppt
Presentation Presentation of of
Numerical MethodsNumerical Methods
05/03/23 2
Presented To: Ma’am Ayesha Kanwal
Presented By: Muhammad Sarwar 10EL20
Finite Difference Method
”Read Euler: he is our master in everything.”
Pierre-Simon Laplace (1749-1827)
3
Introduction To Differential Eq. An equation that consists of derivatives is
called a differential equation. Differential equations have applications in all
areas of science and engineering. Mathematical formulation of most of the
physical and engineering problems leads to differential equations.
So, it is important for engineers and scientists to know how to set up differential equations
4
Types of Diff. EqsDifferential equations are of two types
A. Ordinary differential equations (ODE) B. Partial differential equations (PDE)
An ordinary differential equation is that in which all the derivatives are with respect to a single independent variable.
Examples of Ordinary Differential Equations.
5
ODEs with Initial Value Conditions
These are the types of problems we have been solving with RK methods.
All conditions are specified at the same value of the independent variable!
6
ODEs with Boundary Value Conditions
In the field of differential equations, a boundary value problem is a differential equation together with a set of additional constraints, called the boundary conditions.
A solution to a boundary value problem is a solution to the differential equation which also satisfies the boundary conditions.
7
ayay )( and byby )(
Types of Boundary ConditionsThree types of spatial boundary conditions:
Dirichlet Condition
Neumann Condition
Mixed Boundary Condition
No. of Boundary conditions required is order of highest derivative appearing in each independent variable
Here We’ll discuss BVPs with Dirichlet Conditions only… Note that boundary value problems as position-dependent
and initial value problems as time-dependent in most cases.
8
What are Finite Differences?A finite difference is a mathematical
expression of the form f(x + b) − f(x + a). If a finite difference is divided by b − a, one gets a difference quotient. T
he approximation of derivatives by finite differences plays a central role in finite difference methods for the numerical solution of differential equations, especially boundary value problems.
9
Finite Differences…To find derivative (Slope) of function y=f(x) at
Xn, take a small increment in value of f(x) at Xn and then divide that
increment by the difference of values of function at both points..
10
Types of Finite Differences
Three forms are commonly considered: forward, backward, and central differences.
A forward difference is an expression of the form
A backward difference uses the function values at x and x − h, instead of the values at x + h and x:
Finally, the central difference is given by11
Geometrical Interpretation of Finite
Differences
12
Derivative in terms of FDs
13
First Order derivate with First order Accuracy
First Order Derivate with 2nd order accuracy
2nd order derivative expressed as finite difference
xyy
dxdy ii
1
211
2
2 2x
yyydxyd iii
xyy
dxdy ii
211
Errors in Finite DifferencesThe two sources of error in finite difference
methods are round-off error, the loss of precision due to computer rounding of decimal quantities, and truncation error or discretization error, the difference between the exact solution of the finite difference equation and the exact quantity assuming perfect arithmetic (that is, assuming no round-off).
14
AccuracyThe accuracy of the finite difference
approximations is given by:forward difference: truncation error:
backwards difference: truncation error:
central difference: truncation error:
15
xO
xO
2xO
Solving an ODE using FDsFor example, consider the ordinary
differential equation
For solving this equation we use the finite difference quotient
to approximate the differential equation by first substituting in for u'(x) and applying a little algebra to get
16
Finite Difference Method for Boundary
Value ODEs
17
The finite difference method is used to solve ordinary differential equations that have conditions imposed on the boundary rather than at the initial point. These problems are called boundary-value problems. In this chapter, we solve second-order ordinary differential equations of the form
with boundary conditions ayay )( and byby )(
FD Method
18
General graphical interpretation of FD method
Substitute finite difference equations for derivatives in the original ODE.This will give us a set of simultaneous algebraic equations that are solved a nodes.
FD Method
19
Proof
FD Method--Basic Procedure
20
Replace derivatives of governing equations with algebraic difference quotients
Results in a system of algebraic equations solvable for dependent variables at discrete grid points
Analytical solutions provide closed-form expressions –variation of dependent variables in the domain
Numerical solutions (finite difference) - values at discrete points in the domain
21
ExampleFor a Circuit containing two storing elements (either both capacitor or both inductors or one capacitor and one inductor), the mathematical model for the circuit takes the form of a second order equation. The boundary values for the given equation are known by measuring voltage across the output terminals.
0122
2
ru
drdurdr
ud
The equation can be modeled using finite differences for derivatives
211
2
2 2r
uuudrud iii
ruu
drdu ii
1
Substituting these approximations gives you,
012
21
211
i
iii
i
iii
ru
ruu
rruuu
0111211122212
ii
iii
i
ur
urrrr
urrr
22
SolutionStep 1 At node "5,0 0 ari "0038731.00 u
Step 2 At node "6.56.05,1 01 rrri
06.06.5
16.01
6.51
6.06.51
6.02
6.01
2212202
uuu
00754.38851.57778.2 210 uuu
Step 3 At node ,2i "2.66.06.512 rrr
06.02.6
16.01
2.61
6.02.61
6.02
6.01
3222212
uuu
00466.38504.57778.2 321 uuu
23
Solution ContStep 4 At node ,3i "8.66.02.623 rrr
06.08.6
16.01
8.61
6.08.61
6.02
6.01
4232222
uuu
00229.38223.57778.2 432 uuu
Step 5 At node
Step 6 At node
,4i "4.76.08.634 rrr
06.04.7
16.01
4.71
6.04.71
6.02
6.01
5242232
uuu
00030.37990.57778.2 543 uuu
,5i 86.04.745 rrr
"0030769.0|5 bruu
24
Solving system of equations
0030769.00000
0038731.0
1000000030.37990.57778.200000229.38223.57778.200000466.38504.57778.200000754.38851.57778.2000001
5
4
3
2
1
0
uuuuuu
0038731.00 u
0036165.01 u
0034222.02 u
0032743.03 u
0031618.04 u
0030769.05 u
25
Solution Cont
ruu
drdu
ar
01
6.00038731.00036165.0 00042767.0
2130700042767.03.05
0038731.03.01
10302
6
max
2130720538 tE 59.768
%744.310020538
2130720538
t
Solving the Diff. Eq. Analytically gives the True Value=20538
26
Need more accurate answers???
211
2
2 2x
yyydxyd iii
Using the approximation of
xyy
dxdy ii
211and
02
122
112
11
i
iii
i
iii
ru
ruu
rruuu
0
211121
21
122212
i
ii
ii
i
urrr
urr
urrr
Gives you
27
Solution Cont5,0 0 ariStep 1 At node
0038731.00 u
Step 2 At node
Step 3 At node
"6.56.05,1 01 rrri
06.06.52
16.01
6.51
6.02
6.01
6.06.521
2212202
uuu
09266.25874.56297.2 210 uuu
,2i 2.66.06.512 rrr
06.02.62
16.01
2.61
6.02
6.01
6.02.621
3222212
uuu
09122.25816.56434.2 321 uuu
28
Solution ContStep 4 At node ,3i 8.66.02.623 rrr
06.08.62
16.01
8.61
6.02
6.01
6.08.621
4232222
uuu
09003.25772.56552.2 432 uuu
Step 5 At node
Step 6 At node
,4i 4.76.08.634 rrr
06.04.72
16.01
4.71
6.02
6.01
6.04.721
5242232
uuu
08903.25738.56651.2 543 uuu
,5i "86.04.745 rrr
"0030769.0|5 bruu
29
Solving system of equations
0030769.00000
0038731.0
1000008903.25738.56651.200009003.25772.56552.200009122.25816.56434.200009266.25874.56297.2000001
5
4
3
2
1
0
uuuuuu
0038731.00 u
0036115.01 u
0034159.02 u
0032689.03 u
0031586.04 u
0030769.05 u
30
Solution Cont 0004925.0
)6.0(20034159.00036115.040038731.03
243 200
ruuu
drdu
ar
206660004925.03.05
0038731.03.01
10302
6
max
1282066620538 tE
%62323.010020538
2066620538
t
31
The Finite Difference TableTable 1 Comparisons of answers from two methods
r uexact u1st order |єt| u2nd order |єt|
5 0.0038731 0.0038731 0.0000 0.0038731 0.0000
5.6 0.0036110 0.0036165 1.5160×10−1 0.0036115 1.4540×10−2
6.2 0.0034152 0.0034222 2.0260×10−1 0.0034159 1.8765×10−2
6.8 0.0032683 0.0032743 1.8157×10−1 0.0032689 1.6334×10−2
7.4 0.0031583 0.0031618 1.0903×10−1 0.0031586 9.5665×10−3
8 0.0030769 0.0030769 0.0000 0.0030769 0.0000
Solution of given BVP using MATLAB
32
Applying BVPs in Real LifeThere are uncountable applications of
differential equations in Real life…In electrical engineering, the behavior of a
RLC circuit is studied using differential equations.
Finding size of capacitor in designing a power supply.
Finding the time instant at which voltage across a capacitor becomes zero.
33
Thank You!
Any Questions?
34