Professional Documents
Culture Documents
Lecture 2 - ODE (BVP) - Shooting
Lecture 2 - ODE (BVP) - Shooting
A differential equation is a mathematical equation that relates some function with its
derivatives.
𝑑𝑦
= 𝑓(𝑥, 𝑦)
𝑑𝑥
Differential equations describe the relation between physical quantities and their
If 𝑦(𝑡) is a function of time, then the following is an initial value problem (IVP):
𝑦 ′′ + 2𝑦 ′ + 2𝑦 = 0; 𝑦 0 = 1; 𝑦′ 0 = 0
where
𝑑 2𝑦 𝑑𝑦
𝑦 ′′ = 2 ; ′
𝑦 =
𝑑𝑡 𝑑𝑡
Boundary value problems
𝑦 ′′ + 2𝑦 ′ + 2𝑦 = 0; 𝑦 0 = 1; 𝑦 π =0
where
𝑑 2𝑦 𝑑𝑦
𝑦 ′′ = 2 ; 𝑦′ =
𝑑𝑥 𝑑𝑥
Examples in chemical engineering subjects
Flow of fluids in a pipe (with internal forces)
Mass diffusion (or convection)
Heat conduction (or convection)
𝑥=0 ∆𝑥 𝑥=𝐿 𝑑 𝑑𝑇
𝑘𝐴 − ℎ𝑃 𝑇𝑆 − 𝑇𝑎 = 0
𝑑𝑥 𝑑𝑥
𝑥 𝑥 + ∆𝑥 𝑑𝑇
𝑞1 = 𝑘𝐴 ቤ Rearranging:
𝑑𝑥 𝑥
𝒒𝟏 𝒒𝟐
𝑑𝑇
𝑞2 = −𝑘𝐴 ቤ 𝑑 2 𝑇 4ℎ
𝑑𝑥 𝑥+∆𝑥 2
− 𝑇𝑆 − 𝑇𝑎 = 0
𝑑𝑥 𝑘𝑑
𝑞3 = −ℎ𝑆(𝑇𝑎 − 𝑇𝑆 )
𝒒𝟑
Temperature distribution in a rod No radial variation of 𝑇 assuming:
- Very small diameter (high
metal rod
aspect ratio)
- High conductivity (metal)
𝑥=0 ∆𝑥 𝑥=𝐿
2
𝑇𝑆 ≅ 𝑇
𝑑 𝑇 4ℎ
2
− 𝑇𝑆 − 𝑇𝑎 = 0
𝑑𝑥 𝑘𝑑
𝑑 2 𝑇 4ℎ
ℎ = convective heat transfer coefficient of air 2
− 𝑇 − 𝑇𝑎 = 0
𝑑𝑥 𝑘𝑑
𝑘 = conductive heat transfer coefficient of the rod
𝑑 = rod diameter
𝑇𝑎 = ambient temperature
Dirichlet boundary condition, a.k.a the first type
The values of dependent variable are given at fixed values of independent
variable
In the closed interval of independent variables [𝑎, 𝑏], 𝑦(𝑎) and 𝑦(𝑏) are given.
For instance:
Steady-state temperature along a distance:
𝑇 = 𝑇0 at 𝑥 = 0 and 𝑇 = 𝑇𝐿 at 𝑥 = 𝐿
Metal rod
TC TC
Neumann boundary condition, a.k.a the second type
Derivatives of the dependent variable are given as constants or functions of
independent variable
In the closed interval of independent variables [𝑎, 𝑏], the values of 𝑦′(𝑎)
and/or 𝑦′(𝑏) are given.
For instance:
Perfect insulation on the edge of a wire with a length of 𝐿
Perfect insulator
𝑇ቚ = 𝑇0 𝑑𝑇
𝑥=0 ቤ =0
𝑑𝑥 𝑥=𝐿 Metal rod
TC
Robin boundary conditions, a.k.a the third type
A combination between Dirichlet and Neumann boundary conditions
For instance:
𝑑𝑇
−𝑘 = ℎ(𝑇 − 𝑇𝑎 )
Heating coil 𝑑𝑥
Metal rod
y2,f
y2(xf,)
y1,0
x0 xf
Target: to obtain the value of which results in 𝑦2 𝑥𝑓 , satisfying the specified boundary
condition 𝑦2,𝑓 that is: y2 x f , γ y2, f
The taylor series of the function () in the close vicinity of : γ γ γ
γ
γ O
2
For convergence: lim γ γ 0
γ 0
So that: γ
0 γ
γ
γ O
2
γ
γ
Newton-Raphson
γ y2 x f , γ y2, f 0 substitution
γ
the derivative: γ
y2 x f , γ γ
substitution
γ γ
becomes
where:
γ
y2 x f , γ y2, f
y
y y2 x f , γ y2, f y2 x f , γ y2 x f , γ
γ γ
= Correction to the previous guess in order to formulate the next guess:
γ𝑛𝑒𝑤 = γ𝑜𝑙𝑑 + ∆γ
𝑑𝑦1 𝑦1 0 = 0
= 𝑥𝑦1 + 𝑦2 𝑦2 1 = 1
𝑑𝑥
Initial guess of 𝑦2 0 = 𝛾 = 0.5
𝑑𝑦2
= 𝑦1 𝑦2 𝜀 = 0.00001
𝑑𝑥
ℎ = 0.01
Integration method: RK4 𝜌 = 0.5
Iteration #1 𝛾 = 0.5
𝑦2 target
𝑦2 𝑥𝑓 , 𝛾 = 0.679
𝛿𝑦2 = 0.321
𝑦2
𝜕𝑦2
= 0.509
𝜕𝛾
𝑦1
∆𝛾 = 0,630
𝛾𝑛𝑒𝑤 = 0.815
Iteration #2 𝛾 = 0.815
𝑦2 𝑥𝑓 , 𝛾 = 1.360
𝛿𝑦2 = −0.360
𝑦2
𝑦2 target 𝜕𝑦2
= 1.760
𝜕𝛾
𝑦1
∆𝛾 = −0.204
𝛾𝑛𝑒𝑤 = 0.713
Iteration #3 𝛾 = 0.713
𝑦2 𝑥𝑓 , 𝛾 = 1.110
𝛿𝑦2 = −0.111
𝑦2 𝑦2 target
𝜕𝑦2
= 1.235
𝜕𝛾
𝑦1
∆𝛾 = −0.089
𝛾𝑛𝑒𝑤 = 0.668
Iteration #5 𝛾 = 0.6630
𝑦2 target
𝑦2 𝑥𝑓 , 𝛾 = 0,9996
𝛿𝑦2 = 0.0004
𝑦2
𝜕𝑦2
= 1.024
𝜕𝛾
𝑦1
∆𝛾 = 0.0004
𝛾𝑛𝑒𝑤 = 0.6632
Iteration #7 𝛾 = 0.6632
𝑦2 target
𝑦2 𝑥𝑓 , 𝛾 = 0,9999
𝛿𝑦2 = 0.000001
𝑦2
𝜕𝑦2
= 1.025
𝜕𝛾
𝑦1
∆𝛾 = 0.000001
∆𝛄 ≤ 𝜺
Solve the previously derived model representing heat distribution in a rod. Perform a shooting method for the
case of 50-cm copper rod (𝑘 = 386 W/(m.K); 𝑑 = 5 mm) in atmospheric air (ℎ = 60 W/(m2.K)), at room
temperature (𝑇𝑎 = 298 K). Find the solution for this problem for several different arrangements as follows:
a) Both ends of the rod is connected to temperature controllers, set at 𝑇0 = 700 K and 𝑇𝑓 = 450 K
b) Both ends of the rod is connected to temperature controllers, set at 𝑇0 = 500 K and 𝑇𝑓 = 250 K
c) One end of the rod is connected to a temperature controller, set at 𝑇0 = 700 K, while the other end is
perfectly insulated
d) Repeat a), b), c) with shell side of the rod insulated (do not use any tools other than your intuition!)
Temperature distribution in a copper rod
𝑑 2 𝑇 4ℎ
metal rod 2
− 𝑇 − 𝑇𝑎 = 0
𝑑𝑥 𝑘𝑑
𝑥 = 0 cm 𝑥 = 50 cm
ℎ = 60 W/(m2.K) air
𝑘 = 386 W/(m.K) copper
𝑑2 𝑇
2
− 124 𝑇 − 293 = 0 𝑑 = 5 mm = 0.005 m
𝑑𝑥
𝑇𝑎 = 20 oC = 293 K
0,5 m
𝑇0 = 700 K TC TC 𝑇𝑓 = 450 K
0,5 m
𝑇0 = 500 K TC TC 𝑇𝑓 = 250 K
0,5 m
𝑑𝑇
ቤ =0
𝑑𝑥 𝑥=0,5
𝑇0 = 700 K TC
0,5 m
𝑇0 = 700 K TC TC 𝑇𝑓 = 450 K
0,5 m
𝑇0 = 500 K TC TC 𝑇𝑓 = 250 K
0,5 m
𝑇0 = 700 K TC
Solve the following differential equations:
𝑢 0 = 10
𝑑2 𝑢 𝑑𝑢 𝑢 2 =1
2
+6 −𝑢 =2
𝑑𝑥 𝑑𝑥
𝜀 = 0.00001
𝜌 = 0.5
Integration method: RK4
Canoncical forms: Boundary conditions:
𝑑𝑢 𝑢 0 = 10
=𝑣
𝑑𝑥 𝑢 2 =1
𝑑𝑣
= −6𝑣 + 𝑢 + 2
𝑑𝑥
For linear ODEs, we have a shortcut method to pinpoint the
solution, i.e. by performing interpolation of the results
Choose two arbitrary guesses of 𝑢 𝑥 = 0 = 𝛾 which result in two
values of 𝑢(𝑥 = 2, 𝛾) which straddle the target 𝑢 𝑥 = 2 = 1
First guess of 𝑢 𝑥 = 0 = 𝛾 = −100
𝑢 𝑥 = 2, 𝛾 = −9,04 Straddling the target
Second guess of 𝑢 𝑥 = 0 = 𝛾 = 0 𝑢 𝑥=2 =1
𝑢 𝑥 = 2, 𝛾 = 14,13
𝑑2 𝑢 𝑑𝑢
2
+6 −𝑢 =2
𝑑𝑥 𝑑𝑥
Boundary conditions:
𝑢 0 = 10
𝑢 2 =1
𝑢(𝑥)
Problem 1 Problem 2
Use the shooting method to solve the following Compound A diffuses through a 4-cm pipe and
ODE representing heat distribution in a rod, taking decomposes as it diffuses. The governing equation for
into account both convective and radiative heat diffusion with reaction is as follows:
loss:
𝑑2 [𝐴] 𝑛
𝐷 − 𝑘[𝐴] =0
𝑑𝑥 2
𝑑2𝑇 −7 4
− 1 × 10 𝑇 + 273 + 4 150 − 𝑇 = 0
𝑑𝑥 2 where [𝐴] is the concentration of A, 𝑥 is the distance
along the pipe, 𝐷 is diffusivity of A in the medium, 𝑘 is
the reaction rate constant, and 𝑛 is the reaction order
with boundary conditions 𝑇 0 = 200 and wrt 𝐴. If the tubular reactor is designed so that A is
𝑇 0.5 = 100! totally consumed right in the end of the pipe,
determine the concentration profile of A along the
pipe! (inlet concentration of A is 0.1 M, 𝑘 = 5 × 10−6
(a.u.), 𝐷 = 1.5 × 10−6 cm2/s, 𝑛 = 1; 2)