CHE654_2012_Homework3_Solutions.pdf

October 7, 2017 | Author: mbolantenaina | Category: Equations, Ordinary Differential Equation, Gases, Kilogram, Pressure
Share Embed Donate


Short Description

Download CHE654_2012_Homework3_Solutions.pdf...

Description

CHE654 Modeling Chemical Processes Using MATLAB

Homework Set #3 Solutions Class-16

Prepared by

Dr. Hong-ming Ku

King Mongkut’s University of Technology Thonburi Chemical Engineering Department Chemical Engineering Practice School  July 2004-2012 – Use with Permission of the Author Only

1

29. Solving for Terminal Velocity of Solid Particles with Successive Substitution The direct method (or successive substitution) can be used to solve a nonlinear algebraic equation. The algorithm is iterative in which a newly calculated value of x (the unknown) is used as the next guess according to the following formula: xk+1 = F(xk)

k = 0, 1, 2, …..

Note that this formula requires that x be expressed explicitly as the unknown on the left-hand side in the nonlinear equation (although the right-hand side F(x) will also contain x). Terminal velocity of a solid spherical particle falling in fluid media can be expressed by the equation:

νt =

where

vt g

ρP DP CD

= = = = =

4 g ( ρ P − ρ ) DP = F (ν t ) 3C D ρ

(1-1)

the terminal velocity (m/s) gravitational acceleration (= 9.80665 m/s2) the particle density (kg/m3) the diameter of a spherical particle (m) dimensionless drag coefficient

The drag coefficient varies with the Reynolds number (Re) as follows:

where

CD =

24 Re

for Re < 0.1

(1-2)

CD =

24 (1 + 0.14 Re0.7) Re

for 0.1 ≤ Re ≤ 1000

(1-3)

Re = ρ = µ =

vt DP ρ / µ the density of the fluid (kg/ m3) the fluid viscosity (Pa-s)

Consider uniform spherical iron pellets with DP = 0.5 mm, ρP = 7860 kg/ m3 that are falling in air (ρ = 1.23 kg/ m3, µ = 1.79 x 10-5 Pa-s) at terminal velocity. Write a MATLAB program to do the following (use “format short” in all calculations): (a) Plot F(vt) and vt versus vt in the range 0.01 ≤ vt ≤ 10 m/s and locate the approximate root of equation (1-1), which will be used as the initial guess in Part (b) of the direct method. (b) Implement the direct method to solve for the terminal velocity and accept the solution only if | vt − F(vt) | ≤ 0.0001.

2

Solution: The MATLAB Script File: % % ChE 654: Problem #29 % % Solving for Terminal Velocity of Solid Particles with Successive Substitution % % Part (a): Plot F(vt) and vt versus vt in the range 0.01 0 | P2 > 0 fprintf('\n') if flag == 1 fprintf ('IT IS BEN''S TURN \n') else

7

fprintf ('IT IS JEN''S TURN \n') end fprintf('Pile 1: %2i',P1), fprintf(', Pile 2: %2i\n',P2) choice = input('Enter 1 to remove rods from one pile and 2 to remove rods from both piles: '); if choice == 1 p = input ('Which pile? (1 or 2): '); if p == 1 r1 = input('Enter the number of rods to remove from Pile 1: '); while r1 P1 r1 = input('Enter the number of rods to remove from Pile 1: '); end P1 = P1 - r1; r2 = 0; else r2 = input('Enter the number of rods to remove from Pile 2: '); while r2 P2 r2 = input('Enter the number of rods to remove from Pile 2: '); end P2 = P2 - r2; r1 = 0; end else r1 = input('Enter the number of rods to remove from both piles: '); while r1 P1 | r1 > P2 r1 = input('Enter the number of rods to remove from both piles: '); end P1 = P1 - r1; P2 = P2 - r1; r2 = r1; end if flag == 1 fprintf ('Ben takes %2i from Pile 1 and %2i from Pile 2 \n', r1, r2) flag = 2; fprintf ('\n') if P1 == 0 & P2 == 0 fprintf ('Ben wins! Jen loses! \n') end else fprintf ('Jen takes %2i from Pile 1 and %2i from Pile 2 \n', r1, r2) flag = 1; fprintf ('\n') if P1 == 0 & P2 == 0 fprintf ('Jen wins! Ben loses! \n') end end end

8

33. Mass Balance in a Two-Tank System Consider the following two vessels connected in series. Initially (at t = 0), Tank 1 is filled with 20 kg of brine solution with 10 kg of dissolved salt (i.e. 10 kg water + 10 kg salt), while Tank 2 is filled with 10 kg of pure water. Pure water is then added to Tank 1. At the same time, 1 + 0.1t kg/min of liquid from Tank 1 flows into Tank 2 (meaning that this inter-vessel flow increases linearly with time, while 2 kg/min of liquid from Tank 2 flows out. 2 kg/min, pure water

2 kg/min

x2

x1 1+ 0.1t kg/min

Tank 1

Tank 2

(a) If we define x1 and x2 as the mass fraction of salt in Tank 1 and Tank 2, respectively, derive an analytical expression of x1 as a function of time t. Calculate the concentration (i.e. mass fraction) of salt in Tank 1 at the time when there is a maximum amount of liquid in Tank 1. Answer: x1 (t = 10.0 min) = ___0.2114____ when liquid in Tank 1 is at maximum Useful integration formula:

 ω   tan −1   γ  γ  

2

+



dx = B



2

if γ = 0

ω



if γ > 0

 ω  2  tanh −1   −γ  −γ  

if γ < 0

where B = a + bx + cx2, γ = 4ac – b2, ω = b + 2cx (b) Derive an ODE dx2/dt, and together with dx1/dt in Part (a) use MATLAB to solve for the numerical solutions of x1 and x2 of this system of two ODEs using ode45. Run your model from t = 0 to t = 30 minutes. Make a plot of the numerical solutions as well. Your solution should show x2 going through a maximum, as salt enters Tank 2 but then its brine solution becomes more dilute as more pure enters 9

Tank 1. Based on MATLAB solutions, answer the following questions (correct to 1 decimal place for time and 3 decimal places for mass fractions): Questions: 1. x2 (at t = __8.0__ mins) = ___0.248___ when x2 goes through a maximum 2. Did x1 and x2 ever become equal? Yes or No: __Yes__ If yes, x1 = x2 (at t = __8.0__ mins) = ___0.248____

Solution: (a)

Overall mass balance for Tank 1

dM 1 = 2 − (1 + 0.1t ) = 1 − 0.1t dt

M 1 = 20 + t − 0.05t 2

Salt mass balance for Tank 1

d ( x1 M 1 ) = −(1 + 0.1t ) x1 dt

M1

or

dx1 dM 1 + x1 = − x1 − 0.1tx1 dt dt

(20 + t − 0.05t 2 )

dx1 + x1 (1 − 0.1t ) = − x1 − 0.1tx1 dt

(20 + t − 0.05t 2 )

dx1 + x1 − 0.1tx1 = − x1 − 0.1tx1 dt

(20 + t − 0.05t 2 )

dx1 = −2 x1 dt



x1

0.5¨

t dx1 dt =∫ 2 0 x1 0.025t − 0.5t − 10

Using the given integration formula, we found: a = −10, b = −0.5, c = 0.025 B = a + bt + ct2 = −10 – 0.5t + 0.025t2 So γ = 4ac – b2 = −1.25

ω = b + 2cx = −0.5 + 0.05t t

 0.05t − 0.5  −2  x  ln 1  = tanh −1   1.25 1.25  0  0.5  

10

  2  −1  0.05t − 0.5  x1 = 0.5 exp−  + 0.48121 tanh  1.25   1.25        0.05t − 0.5   + 0.86082  x1 = 0.5 exp− 1.78885 tanh −1  1.25     

Overall mass balance for Tank 2

dM 2 = 1 + 0.1t − 2 = 0.1t − 1 dt

M 2 = 10 + 0.05t 2 − t

Salt mass balance for Tank 2

d (x 2 M 2 ) = (1 + 0.1t ) x1 − 2 x 2 or dt dx dM 2 M 2 2 + x2 = (1 + 0.1t ) x1 − 2 x 2 dt dt (10 + 0.05t 2 − t )

dx2 + (0.1t − 1) x 2 = (1 + 0.1t ) x1 − 2 x 2 dt

(10 + 0.05t 2 − t )

dx2 + 0.1tx 2 − x 2 = (1 + 0.1t ) x1 − 2 x 2 dt

dx 2 (1 + 0.1t ) x1 − (1 + 0.1t ) x 2 = dt 10 + 0.05t 2 − t

So the two ODEs in x1 and x2 are:

dx1 x1 = 2 dt 0.025t − 0.5t − 10

s.t.

dx 2 (1 + 0.1t ) x1 − (1 + 0.1t ) x 2 = dt 10 + 0.05t 2 − t

x1 (0) = 0.5

s.t.

The MATLAB Script File:

11

x 2 ( 0) = 0

% % Mass Balance in a Two-Tank System % clc clear format short simtime = [0:0.1:30]; initx = [0.5; 0]; [t, x] = ode45('x1x2', simtime, initx); [t, x] plot(t,x) title('Concentration Profile of Salt in Tank 1 and Tank 2') xlabel('Time in Minutes') ylabel('Mass Fraction of Salt in Tank 1 and Tank 2') legend('Tank 1', 'Tank 2')

The MATLAB M-File: function fx = ode(t, x) fx = zeros(2,1); fx(1) = x(1)/(0.025*t^2-0.5*t-10); fx(2) = ((1+0.1*t)*x(1)-(1+0.1*t)*x(2))/(10+0.05*t^2-t);

The MATLAB Output: ans = 0 0.5000 1.0000 0.4535 2.0000 0.4130 3.0000 0.3774 4.0000 0.3458 5.0000 0.3176 6.0000 0.2922 7.0000 0.2691 8.0000 0.2482 9.0000 0.2290 10.0000 0.2114 11.0000 0.1951 12.0000 0.1801 13.0000 0.1661 14.0000 0.1530 15.0000 0.1407 16.0000 0.1292 17.0000 0.1184 18.0000 0.1082 19.0000 0.0986 20.0000 0.0894 21.0000 0.0807 22.0000 0.0723

0 0.0497 0.0975 0.1413 0.1793 0.2095 0.2309 0.2434 0.2475 0.2444 0.2364 0.2250 0.2119 0.1983 0.1849 0.1720 0.1599 0.1486 0.1380 0.1282 0.1190 0.1104 0.1023 12

23.0000 24.0000 25.0000 26.0000 27.0000 28.0000 29.0000 30.0000

0.0644 0.0568 0.0494 0.0424 0.0355 0.0289 0.0224 0.0160

0.0947 0.0874 0.0806 0.0740 0.0678 0.0617 0.0560 0.0504

13

34. A Two-Tank System A large tank is connected to a smaller tank by means of a valve, which remains closed at all times. The large tank contains nitrogen (assume it is an ideal gas) at 700 kPa, while the small tank is evacuated (vacuum). The valve between the two tanks starts to leak and the rate of gas leakage is proportional to the pressure difference between the two tanks, as given by Leak Flow = CV PAVG ( P1 − P2 ) where PAVG = average absolute pressure across the valve = (P1 + P2)/2 Valve constant CV = 3.6×10-4 kmol/kPa-hour. Tank volumes are 30 m3 and 15 m3. Assume constant temperature of 293.15 K in both tanks. Universal gas constant = 8.31439 kPa-m3/kmol-K.

Nitrogen P2 V2 P1 V1 Leak

(a) Derive an analytical expression of dn1/dt as a function of n1, where n1 is the number of moles of nitrogen in the large tank. This ODE of yours should contain only n1 as the unknown variable. Use MATLAB to solve for n1 (use ode45 and “format short”), and run the model up until t = 25 hours.

Answer: n1 (t = 25 hours) = ___5.8098____ kmoles (b) As a good chemical engineer, you always look for ways to simplify your engineering calculations. In this particular problem, it is possible to derive an analytical solution when t is small, i.e. when P2
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF