Numerical Solutions of Ordinary Differential Equations Lecture 13: Boundary Value Problems MTH2212 – Computational Methods and Statistics
Numerical Solutions of Ordinary Differential Equations
Lecture 13:Boundary Value Problems
MTH2212 – Computational Methods and Statistics
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 22
Objectives
Introduction Shooting Method Finite Difference Method
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 33
Introduction
An ODE is accompanied by auxiliary conditions. These conditions are used to evaluate the integral that result during the solution of the equation. An nth order equation requires n conditions.
If all conditions are specified at the same value of the independent variable, then we have an initial-value problem.
If the conditions are specified at different values of the independent variable, usually at extreme points or boundaries of a system, then we have a boundary-value problem.
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 44
Introduction
Initial-value versus boundary-value problems
Initial-value problem where all the conditions are specified at the same value of the independent variable.
Boundary-value problem where the conditions are specified at different values of the independent variable.
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 55
Introduction
Determination of eigenvalues: Special class of boundary-value problems that are common in engineering involving vibrations, elasticity, and other oscillating systems.
Two general approaches for solving BVP: Shooting method Finite-difference method
Both approaches will be illustrated by an example of heat balance.
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 66
Heat balance problem
Heat balance of a long, thin rod Rod not insulated along its length and in a steady
state
aTTT 21
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 77
Heat balance problem
Equation describing the problem
Boundary value conditions
Analytical solution
200)(
40)0(
2
1
TLT
TT
204523.534523.73 1.01.0 xx eeT
2
2
2
01.0
10
20
0)(
mh
mL
T
TThdx
Td
a
a
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 88
The Shooting Method
Converts the boundary value problem to initial-value problem.
A trial-and-error approach is then implemented to solve the initial value approach.
For example, the 2nd order equation can be expressed as two first order ODEs:
An initial value is guessed, say z(0) = 10.
)( aTThdx
dz
zdx
dT
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 99
The Shooting Method
The solution is then obtained by integrating the two 1st order ODEs simultaneously.
Using a 4th order RK method with a step size of 2:T(10)=168.3797.
This differs from T(10)=200. Therefore a new guess is made, z(0)=20 and the computation is performed again:T(10)=285.8980
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1010
The Shooting Method
Because the original ODE is linear, the two sets of points, (z, T)1 and (z, T)2, are linearly related, a linear interpolation formula is used to compute the value of z(0) as
z(0) = 12.6907 is then used to determine the correct solution.
6907.12)3797.168200(3797.1688980.285
102010)0(
z
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1111
The Shooting Method
First shotz(0) = 10 T(10) = 168.3797
Second shotz(0) = 20 T(10) = 285.8980
Final exact hitz(0) = 12.6907 T(10) = 200
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1212
The Shooting Method
Nonlinear Two-Point Problems. For a nonlinear problem a better approach involves
recasting it as a roots problem.
Driving this new function, g(z0), to zero provides the solution.
200)()(
)(200
)(
00
0
010
zfzg
zf
zfT
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1313
Finite Differences Methods
The most common alternatives to the shooting method.
Finite differences are substituted for the derivatives in the original equation.
211
2
2 2
x
TTT
dx
Td iii
aiii TxhTTxhT 21
21 )2(
0)(2
211
aiiii TTh
x
TTT
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1414
Finite Differences Methods
Finite differences equation applies for each of the interior nodes. The first and last interior nodes, Ti-1 and Ti+1, respectively, are specified by the boundary conditions.
Thus, a linear equation transformed into a set of simultaneous algebraic equations.
It will be tridiagonal which can be solved efficiently.
aiii TxhTTxhT 21
21 )2(
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1515
Finite Differences Methods
If we use a segment length Δx = 2 m (4 interior nodes)
Thus, a set of simultaneous algebraic equations.
which can be solved for
8.004.2 11 iii TTT
8.200
8.0
8.0
8.40
04.2100
104.210
0104.21
00104.2
4
3
2
1
T
T
T
T
4795.1595382.1247785.939698.65TT
Dr. M. HrairiDr. M. Hrairi MTH2212 - Computational Methods and StatisticsMTH2212 - Computational Methods and Statistics 1616
Assignment # 6
Computational Methods 27.4, 27.5
Statistics Check with Dr Faiz