Title: ORDINARY DIFFERENTIAL EQUATIONS (ODE)
1ORDINARY DIFFERENTIAL EQUATIONS(ODE)
2Differential Equations
- Heat transfer
- Mass transfer
- Conservation of momentum, thermal energy or mass
(4.1)
(4.2)
(4.3)
3ODE
- Definition
- Example
- A 3rd order differential equation for r r(t)
- Solution
4Important Issues
- Existence of a solution
- Uniqueness of the solution
- How to determine a solution
5Linear Equation (1)
- Rewrite 4.9
- Determine
where m(t) is called an integrating factor
6Linear Equation (2)
- Multiply both sides of equation 4.10 by m(t)
- Observe that the left-hand side of eqn 4.12 can
be written as - or
7Linear Equation (3)
- Equation (4.12) can be rephrase as
- Integrate both sides of Equation (4.14) with
respect to the independent variable
(4.14)
where c is the constant of integration
8Example 1
- Water containing 0.5 kg of salt per liter is
poured into a tank at a rate of 2 l/min, and the
well-stirred mixture leaves at the same rate.
After 10 minutes, the process is stopped and
fresh water is poured into the tank at a rate of
2 l/min, with the new mixture leaving at 2 l/min.
Determine the amount (kg) of salt in the tank at
the end of 20 minutes if there were 100 liters of
pure water initially in the tank.
2 l/min
½ kg salt/l
CA
2 l/min, CA (l/min)
9Solution
10Example 2
- Consider a tank with a 500 l capacity that
initially contains 200 l of water with 100 kg of
salt in solution. Water containing 1 kg of salt/l
is entering at a rate of 3 l/min, and the mixture
is allowed to flow out of the tank at a rate of
2 l/min. Determine the amount (kg) of salt in the
tank at any time prior to the instant when the
solution begins to overflow. Determine the
concentration (kg/l) of salt in the tank when it
is at the point of overflowing. Compare this
concentration with the theoretical limiting
concentration if the tank had infinite capacity.
11Solution
12THEOREM
- If the functions p and g are continuous on an
open interval a lt x lt b containing the point x
x0, then there exists a unique function y f(x)
that satisfies the differential equation - y p(x)y g(x)
- for a lt x lt b , and that also satisfies the
initial condition - y(x0) y0
- where y0 is an arbitrary prescribed initial value.
13Higher ODE Reduces to 1st Order
In general, it is sufficient to solve first-order
ordinary differential equations of the form
14- Nonlinear equations can be reduced to linear ones
by a substitution. Example - y p(x)y q(x)yn
- and if n ¹ 0,1 then
- n(x) y1-n(x)
- reduces the above equation to a linear equation.
(4.16)
(4.17)
15Example 3
- Suppose that in a certain autocatalytic chemical
reaction a compound A reacts to form a compound
B. Further, suppose that the initial
concentration of A is CA0 and that CB(t) is the
concentration of B at time t. Then CA0 CB (t)
is the concentration of A at time t. Determine
CB(t) if CB(0) CB0.
16Solution
17NONLINEAR ORDINARY DIFFERENTIAL EQUATIONS
18NONLINEAR EQUATIONS
If M is a function of t only, and N is a function
of r only, then
19NONLINEAR EQUATIONS
subject to
Then, it is separable and results in
(4.16)
20- Simplifying left-hand side 1st consider the
fraction
(4.17)
where a and g are constants to be determined.
Then
If we put
then
21If we put
then
22- And equation 4.16 becomes
- which integrates to
where m1 is an arbitrary constant to be
determined with the given initial condition. _at_ t
0, CB CB0, then
23Example of Problem Setup
- Consider the continuous extraction of benzoic
acid from a mixture of benzoic acid and toluene,
using water as the extracting solvent. Both
streams are fed into a tank where they are
stirred efficiently and the mixture is then
pumped into a second tank where it is allowed to
settle into two layers. The upper organic phase
and the lower aqueous phase are removed
separately, and the problem is to determine what
proportion of the acid has passed into the
solvent phase.
24Example (cont)
- List of assumptions
- Combine the two tanks into a single stage
- Express stream-flow rates on solute-free basis
- Steady flowrate for each phase
- Toluene and water are immiscible
- Feed concentration is constant
- Mixing is efficient, the two streams leaving the
stage are in equilibrium with each other given by
y mx - Composition stream leaving is the same with the
composition in the stage - The stage initially contains V1 liter toluene, V2
liter water and no benzoic acid
25Problem 1
- Consider an engine that generates heat at a rate
of 8,530 Btu/min. Suppose this engine is cooled
with air, and the air in the engine housing is
circulated rapidly enough so that the air
temperature can be assumed uniform and is the
same as that of the outlet air. The air is fed to
the housing at 6lb-mole/min and 65oF. Also, an
average of 0.20 lb-mole of air is contained
within the engine housing and its temperature
variation can be neglected. If heat is lost from
the housing to its surroundings at a rate of
Ql(Btu/min) 33.0(T-65oF) and the engine is
started with the inside air temperature equal to
65oF. - Derive a differential equation for the variation
of the outlet temperature with time. - Calculate the steady state air temperature if the
engine runs continuously for indefinite period of
time, using Cv 5.00 Btu/lb-mole oF.
26Problem 2
- A liquid-phase chemical reaction with
stoichiometry A ? B takes place in a semi-batch
reactor. The rate of consumption of A per unit
volume of the reactor is given by the first order
rate expression - rA (mol/liter.s) kCA
- where CA (mol/liter) is the reactant
concentration. The tank is initially empty. At
time t0, a solution containing A at a
concentration CA0(mol/liter) is fed to the tank
at a steady rate f(liters/s). Develop
differential balances on the total volume of the
tank contents, V, and on the moles of A in the
tank, nA .
27Solving ODEs using Numerical Methods
- Initial Value Problem (IVP)
- y -yx
- y(0) 2, y(0) 1
- Boundary Value Problem (BVP)
- y -yx
- y(0) 2, y(1) 1
28General Procedure
- Re-write the dy and dx terms as ?y and ?x and
multiply by ?x - Literally doing this is Eulers method
29Tank mixing problem
30Mixing tank
Dt Error Et at t600
300 1.4
150 0.61
100 0.39
50 0.19
30 0.11
15 0.055
10 0.036
5 0.018
3 0.011
31Matlab output
32Error analysis
- We saw that the error depended on the time step
size - Why?
- Extrapolating the curve using a linear function
33Improvements to Eulers Method
- Euler
- Heuns method (predictor-corrector)
- Procedure
- calc yi1 with Euler (predictor)
- calc slope at yi1
- calc average slope
- use this slope to calc new yi1 (corrector)
34Heun example
35Midpoint Method
- Use Euler to calculate a midpoint location
- evaluate slope y at the midpoint
- use that to calculate full step location
36Runge-Kutta
37R-K General form
38R-K 1st Order Form
39R-K 2nd Order Form
y(x)
xi xi1 x
40RK2 Options
41RK2 Options
42R-K 2nd Order Form
43RK 3rd Order Form
y(x)
xi xi1 x
44RK 4th Order
y(x)
xi xi1 x
45Example y?xy, y(0)0
x yo k1fi k2f(xh/2,yh/2k1) k3f(xh/2,yh/2k2) k4f(xh,yhk3) ynyo1/6(k12k22k3k4)h
0 0 0 0.1 0.11 0.222 0.02140
0.2 0.0214 0.221 0.344 0.356 0.493 0.0918
0.4 0.092 0.492 0.641 0.656 0.823 0.2221
0.6 0.222 0.822 1.004 1.023 1.227 0.4255
0.8 0.426 1.226 1.448 1.470 1.720 0.718
1 0.718 1.718 1.990 2.017 2.322 1.120
1.2 1.120 2.320 2.652 2.685 3.057 1.655
1.4 1.655 3.055 3.461 3.501 3.955 2.353
1.6 2.353 3.953 4.448 4.498 5.052 3.250
1.8 3.250 5.050 5.654 5.715 6.393 4.389