You are on page 1of 11

DIFFERENTIAL

EQUATIONS
Prof. Anand Tiwari
DDIT Nadiad
Overview
■ Ordinary Differential Equations (ODEs), dependent variables (such as temperature,
concentration, etc.) vary with only one independent variable (a spatial variable or time).
■ All lumped-parameter problems in a transient regime, as well as all distributed-
parameter problems in a steady state varying with just one of the three spatial variables,
are described by ODEs
■ Two approaches for numerical integration of ODEs
– Explicit – sequential solution, next condition (i+1) is calculated based on previous
condition i
– Implicit – simultaneous solution (i+1) calculated based on both i and i+1. difficult
to implement but good for stiff systems (dependent variable varies abruptly with
independent variable). They are more stable numerically
– Taylor’s series method, Euler’s method, RK method
Taylor’s series meThod
■ Consider the one dimensional initial value problem y' = f(x, y), y(x0) = y0
■ f is a function of two variables x and y and (x0 , y0) is a known initial points on the
solution curve.
■ If the existence of all higher order partial derivatives is assumed for y at x = x0, then by
Taylor series the value of y at any neighboring point x+h can be written as

𝒉𝟐 𝒉𝟐
𝒚(𝒙𝟎 + 𝒉) = 𝒚(𝒙𝟎) + 𝒉 𝒚′(𝒙𝟎) + 𝒚′′(𝒙𝟎) + 𝒚′′′(𝒙𝟎) +R
𝟐! 𝟑!
h = xi+1 - xi = Δx

■ Since at x0, y0 is known, y' at x0 can be found by computing f(x0,y0). Similarly higher
derivatives of y at x0 also can be computed by making use of the relation y' = f(x, y)
■ The increase in the number of terms generates more accurate results
■ If a lower increment h were considered, the curves obtained from the Taylor series
would be closer to the analytical solution.
■ More precise results are obtained for bigger number of terms but more terms in the
series result in more difficult calculation. Taylor series methods too expensive in
numerical solution
■ Error in the approximation : The Taylor series method of order p has the property that
the final global error is of order o(hp+1); hence p can be chosen as large as necessary to
make the error is as small as desired. If the order p is fixed, it is theoretically possible to
a priori determine the size of h so that the final global error will be as small as desired.
euler’s meThod
■ Based on forward differencing (Explicit)

𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓 𝑦𝑛 , 𝑥𝑛

■ Based on backward differencing (Implicit)

𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓 𝑦𝑛+1 , 𝑥𝑛+1

■ Trapezoidal (average, modified)


𝑦𝑛+1 = 𝑦𝑛 + 𝑓 𝑦𝑛+1 , 𝑥𝑛+1 + 𝑓 𝑦𝑛 , 𝑥𝑛
2
RK Method
■ The general formula for the Runge–Kutta (RK) family of methods is

ω, a, and c are parameters of RK methods

■ The second order Runge–Kutta method (RK2),


■ The expression for the fourth-order Runge–Kutta method (RK4)
Problem
■ Find y at x = 1.1 and 1.2 by solving y' = x2 + y2 , y(1) = 2.3 using Taylor series method

y' = f(x, y) = x2 + y2 At x0 = 1.0 and y0 = 2.3

y'' = 2x+2yy' Take h = .1

y''' = 2 + 2y'2 + 2yy''

y(x0+h) = y(x0) + h y'(x0, y0) + h2 y''(x0, y0)/2! + h3 y'''(x0, y0)/3!


Problem
Exact
𝑑𝑦
= −20𝑦 + 7𝑒 −0.5𝑥 y(0) = 5 𝑦 = 5𝑒 −20𝑥 + 0.37 𝑒 −0.5𝑥 − 𝑒 −20𝑥
𝑑𝑥

Explicit h = 0.01

𝑦1 = 5 + 0.01 𝑦 ′ (0) 𝑦2 = 𝑦1 + 0.01 𝑦 ′ (1)

Implicit 𝑦𝑛+1 − 𝑦𝑛
= −20𝑦𝑛+1 + 7𝑒 −0.5𝑥𝑛+1 yn+1

𝑦𝑛+1 − 𝑦𝑛 1
Trapezoidal = −20𝑦𝑛+1 + 7𝑒 −0.5𝑥𝑛+1 + −20𝑦𝑛 + 7𝑒 −0.5𝑥𝑛+1
ℎ 2
Problem
■ Assume that a fluid at 20 C is fed into a cylindrical tube of length (L) 60 m and radius
(R) 0.2 m at a rate (Q) of 4 m3/h. Assume also that this tube exchanges heat with a
jacket, whose temperature is 300 C. Determine the axial profile of the temperature inside
the tube. Consider that the system is in a steady state and there is no radial or angular
variation of temperature inside the tube. Consider also that the thermal diffusion is not
important in any direction (axial, radial, or angular).
Problem
■ Suppose chemical A is in solution in a perfectly stirred tank and its concentration is CA0
(g/L) . The constant volumetric flow of pure liquid into and out of the tank is F (L/min)
and the tank volume is V(L). Develop the model for tracing the exit concentration profile
compare the different methods for solution. Take V/F = 0.5, h= 0.1 and CA0 = 1 g/L

Mass Balance of A

Exact Solution

𝐶𝐴(𝑛+1) − 𝐶𝐴𝑛 𝐹
= − 𝐶𝐴𝑛
ℎ 𝑉

𝑦𝑛+1 − 𝑦𝑛
= 𝑓 𝑦𝑛 , 𝑡𝑛

You might also like