Presentation on theme: "ORDINARY DIFFERENTIAL EQUATIONS (ODE). Differential Equations Heat transfer Mass transfer Conservation of momentum, thermal energy or mass (4.1) (4.2)"— Presentation transcript:
ORDINARY DIFFERENTIAL EQUATIONS (ODE)
Differential Equations Heat transfer Mass transfer Conservation of momentum, thermal energy or mass (4.1) (4.2) (4.3) ODE PDE
ODE Definition Example A 3 rd order differential equation for = (t) Solution independent dependent (4.4)(4.5)(4.6) (4.7)
Important Issues 1.Existence of a solution 2.Uniqueness of the solution 3.How to determine a solution
Linear Equation (1) 1.Rewrite Determine integrating factor where (t) is called an integrating factor (4.8) (4.9) for all t (4.10) (4.11)
Linear Equation (2) 3.Multiply both sides of equation 4.10 by (t) Observe that the left-hand side of eqn 4.12 can be written as or (4.12) (4.13)
Linear Equation (3) Equation (4.12) can be rephrase as: 4.Integrate both sides of Equation (4.14) with respect to the independent variable: (4.14) (4.15) cconstant of integration where c is the constant of integration
Example 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 2 l /min, C A ( l /min) CACA ½ kg salt/ l
Example 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.
THEOREM If the functions p and g are continuous on an open interval < x < containing the point x = x 0, then there exists a unique function y = (x) that satisfies the differential equation y’ + p(x)y = g(x) for < x < , and that also satisfies the initial condition y(x 0 ) = y 0 where y 0 is an arbitrary prescribed initial value.
Higher ODE Reduces to 1 st Order In general, it is sufficient to solve first-order ordinary differential equations of the form
Nonlinear equations can be reduced to linear ones by a substitution. Example: y’ + p(x)y = q(x)y n and if n 0,1 then (x) = y 1-n (x) reduces the above equation to a linear equation. (4.16) (4.17)
Example 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 C A0 and that C B (t) is the concentration of B at time t. Then C A0 – C B (t) is the concentration of A at time t. Determine C B (t) if C B (0) = C B0.
NONLINEAR ORDINARY DIFFERENTIAL EQUATIONS
NONLINEAR EQUATIONS Rewrite as If M is a function of t only, and N is a function of only, then Separable
NONLINEAR EQUATIONS Consider subject to Then, it is separable and results in: (4.16)
Simplifying left-hand side; 1 st consider the fraction where and are constants to be determined. Then: If we put then (4.17)
Rewrite equation 4.17 If we put then
And equation 4.16 becomes which integrates to: where m 1 is an arbitrary constant to be determined with the given initial t = 0, C B = C B0, then
Example 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.
Example (cont…) List of assumptions 1.Combine the two tanks into a single stage 2.Express stream-flow rates on solute-free basis 3.Steady flowrate for each phase 4.Toluene and water are immiscible 5.Feed concentration is constant 6.Mixing is efficient, the two streams leaving the stage are in equilibrium with each other given by y = mx 7.Composition stream leaving is the same with the composition in the stage 8.The stage initially contains V 1 liter toluene, V 2 liter water and no benzoic acid
Problem 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 65 o F. 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 Q (Btu/min) = 33.0(T-65 o F) and the engine is started with the inside air temperature equal to 65 o F. 1.Derive a differential equation for the variation of the outlet temperature with time. 2.Calculate the steady state air temperature if the engine runs continuously for indefinite period of time, using C v = 5.00 Btu/lb- mole o F.
Problem 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 r A (mol/liter.s) = kC A where C A (mol/liter) is the reactant concentration. The tank is initially empty. At time t=0, a solution containing A at a concentration C A0 (mol/liter) is fed to the tank at a steady rate (liters/s). Develop differential balances on the total volume of the tank contents, V, and on the moles of A in the tank, n A.
Solving 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
General Procedure Re-write the dy and dx terms as Δy and Δx and multiply by Δx Literally doing this is Euler’s method
Tank mixing problem
Mixing tank tt Error E t at t=
Error analysis We saw that the error depended on the time step sizeWhy? Extrapolating the curve using a linear function
Improvements to Euler’s Method Euler Heun’s method Heun’s method (predictor-corrector) Procedure calc y i+1 with Euler (predictor) calc slope at y i+1 calc average slope use this slope to calc new y i+1 (corrector)
Midpoint Method Use Euler to calculate a midpoint location evaluate slope y’ at the midpoint use that to calculate full step location
R-K – General form
R-K – 1st Order Form
R-K – 2 nd Order Form y(x) x i x i+1 x
RK2 – Options y(x) x i x i+1 x
RK2 – Options y(x) x i x i+1 x y(x) x i x i+1 x
R-K – 2 nd Order Form
RK – 3rd Order Form y(x) x i x i+1 x
RK – 4th Order y(x) x i x i+1 x
Example y ΄ =x+y, y(0)=0 xyok1=fi k2=f(x+h/2,y+h /2k1) k3=f(x+h/2,y+h /2k2) k4=f(x+h,y+ hk3) yn=yo+1/6(k1+2k2+2k 3+k4)h