You are on page 1of 39

Muhammad Ibadurrohman, PhD (DIC)

 A differential equation is a mathematical equation that relates some function with its

derivatives.

𝑑𝑦
= 𝑓(𝑥, 𝑦)
𝑑𝑥

 Differential equations describe the relation between physical quantities and their

rates of changes with respect to space (𝑥, 𝑦, 𝑧, 𝑟) and/or time (𝑡)


 Initial value problems: ordinary differential equations with known initial

conditions (either the value of the function or its derivative or combination)

 Boundary value problems: ordinary differential equations with known

conditions at two boundaries (either the values of the function or its


derivatives or combination)
 Initial value problems

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

If 𝑦(𝑥) is a function of position, then the following is a boundary value problem


(BVP):

𝑦 ′′ + 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)

 Given conditions at two spatial locations


 Mass transfer:
 Known concentration or mass flux at two points
 Heat transfer:
 Known temperature or heat flux at two points
 Temperature distribution in a rod Heat balance:
𝑞1 + 𝑞2 + 𝑞3 = 0
metal rod
𝑑𝑇 𝑑𝑇
𝑘𝐴 ቤ −𝑘𝐴 ቤ −ℎ𝑆(𝑇𝑎 − 𝑇𝑆 ) = 0
𝑑𝑥 𝑥 𝑑𝑥 𝑥+∆𝑥
𝑥=0 ∆𝑥 𝑥=𝐿
Rearranging and recalling 𝑆 = 𝜋𝑑∆𝑥:
𝑥 𝑥 + ∆𝑥 𝑑𝑇
𝑞1 = 𝑘𝐴 ቤ 𝑑𝑇 𝑑𝑇
𝑑𝑥 𝑥 𝑘𝐴 ฬ −𝑘𝐴 ฬ
𝑑𝑥 𝑥+∆𝑥 𝑑𝑥 𝑥
𝒒𝟏 𝒒𝟐 − ℎ𝑃 𝑇𝑆 − 𝑇𝑎 = 0
𝑑𝑇 ∆𝑥
𝑞2 = −𝑘𝐴 ቤ
𝑑𝑥 𝑥+∆𝑥 where 𝑃 = 𝜋𝑑
𝑞3 = −ℎ𝑆(𝑇𝑎 − 𝑇𝑆 )
𝒒𝟑
 Temperature distribution in a rod 𝑘𝐴
𝑑𝑇 𝑑𝑇
ฬ −𝑘𝐴 ฬ
𝑑𝑥 𝑥 𝑑𝑥 𝑥+∆𝑥
− ℎ𝑃 𝑇𝑆 − 𝑇𝑎 = 0
metal rod ∆𝑥
Take the limit as ∆𝑥 approaching zero:

𝑥=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

 Cauchy boundary condition


 Derivatives of dependent variable are given as a function of dependent
variable itself
 Adopting the techniques employed to solve IVP, save that an iterative
calculation is performed until all boundary conditions are satisfied.
 The unspecified initial value (or derivative) of dependent variable is
guessed, and integration of the differential equations is performed as an
initial value problem
 In the end of integration, the calculated final values were evaluated
against the boundary conditions; guess of initial values is then corrected
 The procedure is repeated until the final values satisfy that which is
specified according to convergence criteria
 ODE:  Boundary  Guess of initial
conditions: value of 𝑦2 :
 f1  x, y1 , y2 
dy1
dx y1 x0   y1, 0 y2  x0   γ
y2 x f   y2, f
 f 2  x, y1 , y2 
dy2
dx
 Performing simultaneous integration

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

 Rearranging results in: γ   y2 x f , γ   y2, f  0

 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:

γ𝑛𝑒𝑤 = γ𝑜𝑙𝑑 + ∆γ

 Correction to maintain convergence (relaxation factor):

γ𝑛𝑒𝑤 = γ𝑜𝑙𝑑 ± 𝜌∆γ 0≤𝜌≤1

 Calculation continues until ∆γ ≤ 𝜀


1. Guess the unspecified initial values of dependent variables
y j x0   γ j j  r  1,..., n
2. Integrate the ODEs simultaneously using methods for IVP
dy j
 f j x, y1 , y2 ,..., yn  x0  x  x f ; j  1,2,..., n
dx

3. Evaluate the Jacobian matrix  yr 1 


yr 1 yr 1
 ... 
 γ r 1 γ r  2 γ n xf 
J x f , γ    ...
xf xf
... ... ... 
 y yn yn 
 n ... 
 γ r 1 γ r  2 γ n x 
 xf xf f

4. Correct 𝛾
 yr 1 x f , γ   yr 1, f 
 
 
γ  Jx f , γ  δy
1 δy    .......... 
 yn x f , γ   yn , f 
 
γ𝑛𝑒𝑤γ=baru
γ𝑜𝑙𝑑 ±
γ lama
𝜌∆γ ργ 0≤0 𝜌ρ≤ 1

5. Repeat steps 1 – 4 until ∆𝛾 ≤ 𝜀


 Solve the following differential equations:

𝑑𝑦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)

You might also like