chapter 5

Upload: mohamed-deqsabriye

Post on 07-Jan-2016

17 views

Category:

Documents


2 download

DESCRIPTION

Solutions for Chapter 5 - Lyuben

TRANSCRIPT

  • Process Modelling, Simulation and Control for ChemicalEngineering. Solved problems. Chapter 5: Simulation ex-amples.

    This document contains my own solutions to the problems proposed at theend of each chapter of the book Process Modelling, Simulation and Controlfor Chemical Engineers Second Edition, by William L. Luyben. As such, Icant guarantee that the proposed solutions are free from errors. Think aboutthem as a starting point for developing or as a means of checking your ownsolutions. Any comments or corrections will be appreciated. Contact me [email protected]

    The computer programs developed for this chapter (Matlab) are available at:https://www.dropbox.com/sh/75grbnmy4t7nfh9/AABEsHvjNdKm-xvGjWwiJ9pca?dl=0

    Problem 1

    Simulate the nonisothermal CSTR of Sec. 5.3, using Euler and fourth-orderRunge-Kutta, and compare maximum step sizes and computation times thatgive 0.1% accuracy.

    Solution

    The system corresponds to a non-isothermal CSTR, cooled by fluid circulatinginside a jacket, modelled by the following equations:

    dV

    dt= F0 F (1)

    d(V CA)

    dt= F0CA0 FCA V kCA (2)

    d(V T )

    dt= F0T0 FT V kCA

    Cp UAH

    Cp(T Tj) (3)

    dTjdt

    =Fj(Tj0 Tj)

    Vj+

    UAHjCp,jVj

    (T Tj) (4)

    k = eE/RT (5)F = 40 10(48 V ) (6)Fj = 49.9Kc(600 T ) (7)

    (1) and (2) are total and by-species mass balances at reactor, (3) is the energybalance, (4) is the energy balance for the jacket, (5) is a kinetic equation, (6)and (7) are control equations for reactor discharge rate and cooling fluid flowrate. Both reactor and jacket are treated as CSTRs. Values of the parametersare as following:

    1

  • F0 = 40ft3/h Vj = 3.85ft

    3 T0 = 530R

    E = 30000BTU/lbmol Cp = 0.75BTU/lbmR U = 150BTU/hft2 R

    Tj0 = 530R = 50lbm/ft3 Kc = 4ft/h R

    = 7.08 1010h1 R = 1.99BTU/lbmol R Ah = 250ft2 = 30000BTU/lbmol Cp,j = 1BTU/lbmol R j = 62.3lbm/ft3

    Starting values of the variables correspond to steady state values for CA0 =0.50, the perturbation corresponds to an increase in feed concentration to CA0 =0.55.

    First, the results for the solution of the problem using the parameters givenin the text, this is using a time step of 0.1 and the Euler method, are shown inFigure 1.

    Figure 1: Results for t = 0.1, Euler method.

    It is observed that using this time step the results of all monitored variablesconverge to steady state values approximately for t = 5 [h]. The code was mod-ified to perform the calculation using a variable time step (t), the calculationinterval considered was between 0 and 5 [h]. For each calculation around 20points were returned. The accuracy calculation was determined comparing thesolution for a given t, with the values for CA, T and Tj obtained using a timestep equal to 0.5 t. For the Runge-Kutta method, a maximum t equal to0.015298 gave the following values for the error (%):

    Error CA T TjAverage 2.8 104 3.5 103 0.028

    Max. 2.1 103 0.014 0.11The results are shown in Figure 2. It can be observed that the greatest

    error are obtained for the results corresponding to the jacket temperature (Tj).Althought the graphical results suggest a great deviation, the relative error issmall because of the magnitudes involved (the variation in Tj is around 1

    F ,whereas the value of Tj is around 600

    F ), 327 time steps were performed,equivalent to 1308 derivative evaluations.

    For the Euler method, a maximum t equal to 0.010996 gave the followingvalues for the error (%):

    2

  • Figure 2: Results for t = 0.015298, Runge-Kutta method.

    Error CA T TjAverage 4.5 103 3.7 103 0.028

    Max. 0.024 0.012 0.10

    The results are shown in Figure 3. Again, the jacket temperature presentsthe greatest error values, the graphical results show that the value of Tj starts tooscillate with increasing amplitude at the end of the interval considered, whichsuggest that if a greater time interval for the calculation were to be considered,a smaller t would be required, 455 time steps were performed, equivalent to455 derivative evaluations. From the results obtained, in this particular case,the Euler method solves the problem under the constraints imposed using fewerderivative evaluations.

    Figure 3: Results for t = 0.010996, Euler method.

    Code(s) used: P1 non isothermal cstr.m P1 error analysis.m

    Problem 2

    Simulate the ideal binary distillation column of Sec. 5.4, using Euler and fourth-order Runge-Kutta and compare computation times.

    3

  • Solution

    The systems corresponds to an ideal binary distillation column with liquid holdup, which is modelled by the following equations:

    dMndt

    = Ln+1 Ln (1)d(Mnxn)

    dt= Ln+1xn+1 + V yn1 Lnxn V yn (2)

    yn =xn

    1 + ( 1)xn (3)

    Ln = Ln +

    Mn Mn

    (4)

    (1) and (2) corresponds to total and by-component mass balances at eachtray, (3) is vapor-liquid phase equilibrium equation, and (4) is a liquid hydraulicrelationship. The perturbation corresponds to an increase in feed compositionfrom Z = 0.50 to Z = 0.55, both the reboiler and condenser composition arecontrolled varying the vapor flow rate V and reflux rate R, respectively, withset point values of 0.02 and 0.98.

    First, the results for the solution of the problem using the parameters givenin the text, this is using a time step of 0.005 and the Euler method are shownin Figure 4.

    Figure 4: Results for t = 0.005, Euler method.

    The code was modified in the same way as for Problem 1, the accuracy wasdetermined comparing the values obtained for reboiler composition (XB) andcondenser composition (XD), between the solution using a time step equal tot and the solution obtained using a time step equal to 0.5 t, considering acriterion of 0.1%.

    For the Runge-Kutta method, a maximum t of 0.0274925 gave the followingvalues for the error(%):

    4

  • Error XB XDAverage 0.037 2.2 104

    Max. 0.10 7.1 104

    The results are shown in Figure 5. The greatest values for the error corre-sponds to the results for reboiler composition XB. It can be observed that theresults are in good agreement with those shown in Figure 4, 909 time steps wereperformed, equivalent to 3636 derivative evaluations.

    Figure 5: Results for t = 0.0274925, Runge-Kutta method.

    For the Euler method, a maximum t of 0.0135 gave the following valuesfor the error (%):

    Error XB XDAverage 0.021 1.4 104

    Max. 0.10 5.9 104

    The results are shown in Figure 6. Again the geatest values for the errorcorreponds to XB. As in the case of Runge-Kutta method, the results are in goodagreement with the ones shown in Figure 4, 1852 time steps were performed,equivalent to 1852 derivative evaluations.

    For this particular problem, the Euler method solves the problem under theconstraints imposed using fewer derivative evaluations.

    Code(s) used: P2 binary distillation.m P2 error analysis.m

    Problem 3

    The initial startup of an adiabatic, gas-phase packed tubular reactor makes agood example on how a distributed system can be lumped into a series of CSTRsin order to study the dynamic response. The reactor is a cylindrical vessel (3feet ID by 20 feet long) packed with a metal packing. The packing occupies5 percent of the total volume, provides 50 ft2 of area per ft3 of total volume(a), weighs 400 lbm/ft

    3 and has a heat capacity of 0.1 BTU/lbmF . The heat

    transfer coefficient between the packing and the gas is 10 BTU/hft2 F .

    5

  • Figure 6: Results for t = 0.0135, Euler method.

    The reaction occuring is first order:

    Ak B

    A dilute mixture of reactant A in product B is fed into the reactor at y0mole fraction A and temperature T0 = 500

    F . The heat of reaction is -30000BTU/lbmol A. The specific reaction rate is given by:

    k = 4 102e15000/RT

    Assume perfect gases with molecular weights of 40 and heat capacities equalto 0.15 BTU/lbm

    FThe pressure at the inlet of the reactor is 100 psia. The pressure drop over

    the reactor is 5 psi and the design superficial velocity is 1 ft/s at inlet conditions.Assume that this distributed system can be adequately modeled by a five-

    lump model of equal lengths. Inside each lump the gas temperature and thecomposition vary with time, as does the packing temperature.

    The packing and gas in each section are initially at 500 F with no reactantin the system. At time zero, y0 is raised to 0.10 mole fraction A. Simulate thesystem on a digital computer and find the dynamic changes in temperaturesand concentrations in all the sections.

    Solution

    The equations that allow to model the system are: mass balance for componentA:

    VgdCA,idt

    = A (CA,i1vi1 CA,ivi) V akCA,iwhere the reaction was considered to occur at the surface of the packing,

    Ri = AkCA,i, the packing temperature was used to calculate the specific reac-tion rate.

    6

  • Energy balance for gas phase (the heat of reaction was considered to beabsorbed entirely by the gas phase):

    Cp,gMgdTg,idt

    = V ah(Tg,i Tp,i) V akCA,i+ACp,g(vi1i1Tg,i1 viiTg,i)

    And the energy balance for the packing:

    Cp,pMpdTp,idt

    = V ah(Tg,i Tp,i)The velocity was determined assuming a constant mass flow across each sec-

    tion, based on the conditions at the entrance of the reactor. Pressure drop wasassumed negligible. The results for concentration are shown in Figure 7, steadystate values are reached after approximately 400 seconds. The concentrationvalues increase in a short period, of approximately 5 seconds, as can be seenin Figure 8. An overshoot can be observed in the concentration values (mostlyfor Lump 1), this is due to the fast kinetics, which would require the use of atime step too small to afford a reasonable calculation time with the algorithmused (Runge-Kutta). So a slightly bigger time step was used, knowing that thetransient response calculated will not be accurate. The final values obtained areCi = (0.1066, 0.0161, 0.0025, 0.0004, 0.0001) 10

    3lbmol/ft3, respectively.

    Figure 7: Concentration.

    The results for packing temperature are shown in Figure 9, whereas the re-sults for gas temperature are shown in Figure 10. The profiles looks almostidentical, this is due to the high value of the heat transfer coefficient. The fi-nal values obtained for gas temperature are Ti = (921, 988, 998, 1000, 1000)

    F ,the values for packing temperatures are similar. The temperature values reach

    7

  • Figure 8: Concentration.

    steady state in approximately 1000 seconds, this also influences the concen-tration profile (due to the change in kinetic constant), but this effect is smallcompared to the effect of the jump in concentration entering the reactor.

    Figure 9: Packing temperature.

    Code(s) used: P3 lumped.m

    Problem 4

    A 6 [in] ID pipe, 300 feet long, connects two process units. The liquid flowsthrough in esentially plug flow conditions, so the pipe acts as a pure dead time.This dead time varies with the flow rate through the pipe. From time equals

    8

  • Figure 10: Gas temperature.

    zero, the flow rate is 1000 gpm for 2 minutes. Then it drops to 500 gpm andhold constant for 3 minutes. Then it jumps to 2000 gpm for 2 minutes andfinally returns to 1000 gpm. Liquid density is 50 lbm/ft

    3.While these flow rate changes are occurring, the temperature of the fluid

    entering the pipe varies sinusoidally:

    Tin(t) = 100 + 10sin(t)

    where Tin = inlet temperature,F .

    = 3 radians per minute.Write a digital computer program that gives the dynamic changes in the

    temperature of the liquid leaving the pipe, Tout(t), for this variable time deadtime process.

    Hint: The easiest way to handle dead time in a digital simulation is to setup an array for the variable to be delayed. At each point in time you use thevariable at the bottom of the array as the delayed variable. Then each value ismoved down one position in the array and the current undelayed value is stuffedinto the top of the array. For fixed step sizes and fixed dead times, this is easyto program. For variable step sizes and variable dead times, the programmingis more complex.

    Solution

    The inlet temperature as a function of time is shown in Figure 11.For every flow rate, the fluid velocity inside the pipe can be calculated as:

    v =q

    Ap

    9

  • Figure 11: Inlet temperature.

    Where q is the flow rate and Ap is the cross-sectional area of the pipe. Theresults for velocity as a function of time are shown in Figure 12.

    Figure 12: Fluid velocities.

    For the fluid entering the pipe at time t, the time required for it to exit atthe other end (travel time) was determined. A recursive function (ttime t) wasused:

    The inputs of the function are: t: time at which the fluid enters the pipe;tstart: an array containing the times at which the various velocity regimesstart (Figure 12); vel: the velocity values for each regime; ind: and indexindicating at which velocity regime the fluid enters the pipe and finally L:

    10

  • the distance that the fluid needs to travel before reaching the end of thepipe.

    First, it is assumed that the fluid reaches the end of the pipe under thesame velocity regime at which entered.

    It is verified that the travel time obtained this way is consistent with theprevious assumption, this is if t+ ttime < tstart(ind+ 1).

    If the fluid travels through the pipe under more than one velocity regime,then a recursive call to ttime t is done, and the travel time correspondsto the actual velocity regime part tstart(ind + 1) t and the rest of thetravel (recursive call with t, ind and L values).

    The algorithm is shown in Figure 13.

    Figure 13: Algorithm for determining travel time.

    The outlet temperature at t+ ttime corresponds to the inlet temperature attime t. The results are shown in Figure 14. It can be noted that in the transition

    11

  • from a flow rate of 1000 gpm to 500 gpm the outlet oscillations look wider (ascompared to inlet oscillations), because of the retardation experienced by thesignal. The contrary is observed in the transition from 500 gpm to 2000 gpm,where the outlet oscillations looks thinner. It must be remembered that for asingle dead time value, the oscillations travel the pipe unchanged, regardless thevalue of the velocity with which they are travelling.

    Figure 14: Outlet temperature.

    Code(s) used: P4 deadtime.m

    12