These sol uti ons are for a set of numeri cal probl ems i n chemi cal engi neeri ng devel oped for Sessi on 12 at the ASEE Chemi cal Engi neeri ng Summer School hel d i n Snowbi rd, Utah on August 13, 1997. The probl ems i n thi s set are i ntended to uti l i ze the basi c numeri cal methods i n probl ems whi ch are appro- pri ate to a vari ety of chemi cal engi neeri ng subject areas. The package used to sol ve each probl em i s the POLYMATH Numeri cal Computati on Package Versi on 4.0 whi ch i s wi del y used i n Chemi cal Engi neeri ng. The compl ete set of probl ems sol uti ons uti - l i zi ng the POLYMATH package i s avai l abl e from http://www.che.utexas/cache/. The POLYMATH Numeri cal Computati on Package has four compani on programs. - SI MULTANEOUS DI FFERENTI AL EQUATI ONS - SI MULTANEOUS ALGEBRAI C EQUATI ONS - SI MULTANEOUS LI NEAR EQUATI ONS - CURVE FI TTI NG AND REGRESSI ON POLYMATH i s a proven computati onal system whi ch has been speci cal l y created for educa- ti onal use by M. Shacham and M. B. Cutl i p. The vari ous POLYMATH programs al l ow the user to appl y effecti ve numeri cal anal ysi s techni ques duri ng i nteracti ve probl em sol vi ng on personal comput- ers. Resul ts are presented graphi cal l y for easy understandi ng and for i ncorporati on i nto papers and reports. Students wi th a need to sol ve numeri cal probl ems wi l l appreci ate the efci ency and speed of probl em sol uti on.Wi th POLYMATH, the user i s abl e to focus compl ete attenti on to the probl em rather that spendi ng val uabl e ti me i n l earni ng how to use or reuse the programs. I NEXPENSI VE SI TE LI CENSES AND SI NGLE COPI ES ARE AVAI LABLE FROM: CACHE CORPORATI ON** P. O. Box 7939 AUSTI N, TX 78713-7939 Phone: (512)471-4933 Fax: (512)295-4498 E-mai l : cache@uts.cc.utexas.edu I nternet: http://www.che.utexas/cache/
*The Ch. E. Summer School was sponsored by the Chemi cal Engi neeri ng Di vi si on of the Ameri can Soci ety for Engi neer- i ng Educati on. Thi s materi al i s copyri ghted by the authors, and permi ssi on must be obtai ned for dupl i cati on unl ess for educa- ti onal use wi thi n departments of chemi cal engi neeri ng.
**A non-prot educati onal corporati on supported by most North Ameri can chemi cal engi neeri ng departments and many chemi cal corporati on. CACHE stands for computer ai des for chemi cal engi neeri ng.
Mathematical Software - Session 12*
Mi chael B. Cutl i p, Department of Chemi cal Engi neeri ng, Box U-222, Uni ver- si ty of Connecti cut, Storrs, CT 06269-3222 (mcutl i p@uconnvm.uconn.edu) Mordechai Shacham, Department of Chemi cal Engi neeri ng, Ben-Guri on Uni - versi ty of the Negev, Beer Sheva, I srael 84105 (shacham@bgumai l .bgu.ac.i l )
Session 12 Page PM-2
MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING
Polymath Problem 1 Solution
Equati on (1) can not be rearranged i nto a form where
V
can be expl i ci tl y expressed as a functi on of
T
and
P
. However, i t can easi l y be sol ved numeri cal l y usi ng techni ques for nonl i near equati ons. I n order to sol ve Equati on (1) usi ng the POLYMATH
Simultaneous
Algebraic Equation Solver
, i t must be rewri tten i n the form
PM-(1)
where the sol uti on i s obtai ned when the functi on i s cl ose to zero, . Addi ti onal expl i ci t equa- ti ons and data can be entered i nto the POLYMATH program i n di rect al gebrai c form. The POLY- MATH program wi l l reorder these equati ons as necessary i n order to al l ow sequenti al cal cul ati on. The POLYMATH equati on set for thi s probl em are gi ven by
I n order to sol ve a si ngl e nonl i near equati on wi th POLYMATH, an i nterval for the expected sol u- ti on vari abl e,
V
i n thi s case, must be entered i nto the program. Thi s i nterval can usual l y be found by consi derati on of the physi cal nature of the probl em.
(a)
For part (a) of thi s probl em, the vol ume cal cul ated from the i deal gas l aw as
V
= 0.66 l i ter/g- mol can be a basi s for speci fyi ng the requi red sol uti on i nterval . An i nterval for the expected sol uti on for
V
can be entered as between 0.4 as the l ower l i mi t and 1.0 as the hi gher l i mi t. The POLYMATH sol uti on, whi ch i s gi ven i n Fi gure PM-(1) for
T
= 450 K and
P
= 56 atm, yi el ds
V
= 0.5749 l i ter/gmol where the compressi bi l i ty factor i s
Z
= 0.8718.
(b)
Sol uti on for the addi ti onal pressure val ues can be accompl i shed by changi ng the equati ons i n the POLYMATH program for
P
and
P
r
to
Pr=1 P=Pr*Pc
Addi ti onal l y, the bounds on the mol ar vol ume
V
may need to be al tered to obtai n an i nterval where there i s a sol uti on. Subsequent program executi on for the vari ous
P
r
s i s requi red.
(c)
The cal cul ated mol ar vol umes and compressi bi l i ty factors are summari zed i n Tabl e (1). These cal cul ated resul ts i ndi cate that there i s a mi ni mum i n the compressi bi l i ty factor
Z
at approxi - matel y
P
r
= 2. The compressi bi l i ty factor then starts to i ncrease and reaches
Z
= 2.783 for
P
r
= 20 . f V ( ) P a V 2 ------- +
V b ( ) RT = f V ( ) 0 Polymath Problem 1 Solution Page PM-3
Table PM-1
Compressibility Factor for Gaseous Ammonia at 450 K
P
(atm)
P
r
V Z
56 0.503 .574892 0.871827 111.3 1.0 .233509 0.703808 222.6 2.0 .0772676 0.465777 445.2 4.0 .0606543 0.731261 1113.0 10.0 .0508753 1.53341 2226.0 20.0 .046175 2.78348 Figure PM-1 Pl ot of f(V) versus V for van der Waal s Equati on Variable Value f( ) V 0.574892 0 P 56 R 0.08206 T 450 T c 405.5 P c 111.3 P r 0.503145 a 4.19695 b 0.03737712 Z 0.871827 f(V) Page PM-4
MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING
Polymath Problem 2 Solution (a)
The coefci ents and the constants i n the Equati on Set Equati on (6) can be di rectl y i ntroduced i nto the POLYMATH
Linear Equation Solver
i n matri x form as shown The sol uti on i s whi ch corresponds to the unknown ow rates of D
1
= 26.25 mol /mi n, B
1
= 17.5 mol /mi n, D
2
= 8.75 mol / mi n, and B
2
= 17.5 mol /mi n.
(b)
The overal l bal ances and i ndi vi dual component bal ances on col umn #2 gi ven i n Equati on Set (7) can be sol ved al gebrai cal l y to gi ve X
Dx
= 0.114, X
Ds
= 0.120, X
Dt
= 0.492 and X
Db
= 0.274. Si mi l arl y, overal l bal ance and i ndi vi dual component bal ances on col umn #3 presented as Equati on Set (8) yi el d X
Polymath Problem 3 Solution (a) Data Regression with a Polynomial
The POLYMATH
Polynomial, Multiple Linear and Nonlinear Regression Program
can be used to sol ve thi s probl em by rst enteri ng the data i n a si mi l ar manner to usi ng a spreadsheet. Let us denote the col umn of temperature data i n C as
TC
and the col - umn of pressure data as
P
. Thi s POLYMATH worksheet i s reproduced i n Fi gure PM-(2) where the rst two col umns are used i n the pol ynomi al regressi ons. A pol ynomi al regressi on opti on wi thi n POLYMATH when the dependent vari abl e col umn ti tl ed
P
i s regressed wi th the i ndependent vari abl e
TC
corresponds di rectl y to Equati on (9). The resul ts are summari zed i n Fi gure PM-(3) whi ch al so presents the val ue of the vari ance (var,) for each pol ynomi al . The vari ance i ndi cates that the pol ynomi al whi ch best represents the data i n thi s case i s the 4th degree.
(b) Regression with Clausius-Clapeyron Equation
Data regressi on wi th the Cl ausi us-Cl apey- ron expressi on, Equati on (10), can be accompl i shed by three addi ti onal transformed vari abl es (col - umns) i n the POLYMATH program used for part (a). Col umns can be dened by the rel ati onshi ps: l ogP = l og(P), TK= T + 273.15, and negi nvTK = -1/TK as i ndi cated i n Fi gure PM-(2). A request for l i n- ear regressi on when the rst (and onl y) i ndependent vari abl e col umn i s negi nvTK
and the dependent vari abl e col umn i s l ogP yi el ds the fol l owi ng pl ot and numeri cal resul ts from POLYMATH as shown i n Fi gure PM-(4).
(c) Regression with the Antoine Equation
Thi s expressi on, Equati on (11), cannot be l i neari zed and so i t must be regressed wi th nonl i near regressi on opti on of the POLYMATH
Polynomial, Multiple Linear and Nonlinear Regression Program
.
Wi th thi s opti on, the user must suppl y i ni ti al esti mates. I n thi s case, i t i s hel pful to use the i ni ti al esti mates for A and B whi ch were determi ned i n part (b) and use the esti mate for C as 273.15. Di rect entry of Equati on (11) wi th the i ni ti al esti mates gi ves the converged resul ts shown i n Fi gure PM-(5). Figure PM-2 POLYMATH Entry for Regressi ons Page PM-6
MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING Figure PM-3 POLYMATH Resul ts for Fi tti ng Pol ynomi al s to Vapor Pressure Data Parameter Value 0.95 Conf Interval A 8.75201 0.542335 B 2035.33 153.628 Var 0.00759156 Figure PM-4 POLYMATH Resul ts for Regressi on of Cl ausi us-Cl apeyron Equati on Polymath Problem 3 Solution Page PM-7 Figure PM-5 POLYMATH Resul ts for Nonl i near Regressi on of Antoi ne Equati on Page PM-8
MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING
Polymath Problem 4 Solution
The Equati on Set (13) can be entered i nto the POLYMATH
Simultaneous Algebraic Equation Solver,
but the nonl i near equi l i bri um expressi ons must be wri tten as functi ons whi ch are equal to zero at the sol uti on. A si mpl e transformati on of the equi l i bri um expressi ons of Equati on Set Equati on (12) to the requi red functi onal form yi el ds
PM-(2)
The above equati on set may be di fcul t to sol ve because the di vi si on by unknowns may make most sol uti on al gori thms di verge.
Expedi ti ng the Sol uti on of Nonl i near Equati ons
An addi ti onal si mpl e transformati on of the nonl i near functi on can make many functi ons much l ess nonl i near and easi er to sol ve by si mpl y el i mi nati ng di vi si on by the unknowns. I n thi s case, the Equa- ti on Set PM-(2) can be modi ed to
PM-(3)
The POLYMATH equati on set uti l i zi ng Equati on Set PM-(3) wi th the i ni ti al condi ti ons for part (a) i s gi ven bel ow.
The POLYMATH sol uti ons are summari zed i n Tabl e PM-(2) for the three sets of i ni ti al condi ti ons. Note that the i ni ti al condi ti ons for probl em part (a) converged to al l posi ti ve concen- trati ons. However the i ni ti al condi ti ons for parts (b) and (c) converged to some negati ve val ues for some of the concentrati ons. Thus a real i ty check on Tabl e PM-(2) for physi cal feasi bi l i ty reveal s that f C D ( ) C C C D C A C B ---------------- K C1 = f C X ( ) C X C Y C B C C ----------------- K C2 = f C Z ( ) C Z C A C X ----------------- K C3 = f C D ( ) C C C D K C1 C A C B = f C X ( ) C X C Y K C2 C B C C = f C Z ( ) C Z K C3 C A C X = Polymath Problem 4 Solution Page PM-9
the negati ve concentrati ons i n parts (b) and (c) are the basi s for rejecti ng these sol uti ons as not repre- senti ng a physi cal l y val i d si tuati on. Table PM-2 POLYMATH Solutions of the Chemical Equilibrium Problem Variable Part (a) Part (b) Part (c) C D 0.7053 0.05556 1.070 C X 0.1778 0.5972 -0.3227 C Z 0.3740 1.082 1.131 C A 0.4207 0.3624 -0.7006 C B 0.2429 -0.2348 -0.3779 C C 0.1536 -1.624 0.2623 C Y 0.5518 1.679 0.8078 Page PM-10 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING Polymath Problem 5 Solution (a) For condi ti ons si mi l ar to those of thi s probl em, the Reynol ds number wi l l not exceed 1000 so that onl y Equati ons (16) and (17) need to be appl i ed. The l ogi c whi ch sel ects the proper equati on based on the val ue of Re can be empl oyed usi ng the i f... then... el se... statement wi thi n the POLY- MATH Simultaneous Algebraic Equation Solver. PM-(4) Equati on (13) shoul d be rearranged i n order to avoi d possi bl e di vi si on by zero and negati ve square roots as i t i s entered i nto the form of a nonl i near equati on for POLYMATH. PM-(5) The fol l owi ng equati on set can be sol ved by POLYMATH. Equations: f(vt)=vt^2*(3*CD*rho)-4*g*(rhop-rho)*Dp g=9.80665 rhop=1800 rho=994.6 Dp=0.208e-3 vis=8.931e-4 Re=Dp*vt*rho/vis CD=if (Re<0.1) then (24/Re) else (24*(1+0.14*Re^0.7)/Re) vt(min)=0.0001, vt(max)=0.05 Speci fyi ng and l eads to the resul ts summari zed i n Tabl e PM-(3). (b) The termi nal vel oci ty i n the centri fugal separator can be cal cul ated by repl aci ng the g i n Equati on PM-(5) by 30g. I ntroducti on of thi s change to the equati on set gi ves the fol l owi ng resul ts: Table PM-3 Terminal Velocity Solution Variable Value f( ) vt 0.0157816 -8.882e-16 rho 994.6 g 9.80665 rhop 1800 Dp 0.000208 vis 0.0008931 Re 3.65564 CD 8.84266 C D i f Re 0.1 < ( ) = then 24 Re ( ) el se 24 1 0.14Re 0.7 + ( ) ( ) f v t ( ) v t 2 3C D ( ) 4g p ( )D p = v t mi n , 0.0001 = v t max , 0.05 = v t 0.2060 m s = Re 47.72 = and C D 1.5566 = Polymath Problem 6 Solution Page PM-11 Polymath Problem 6 Solution Equati ons (20) to (22), together wi th the numeri cal data and i ni ti al val ues gi ven i n the probl em statement, can be entered i nto the POLYMATH Simultaneous Differential Equation Solver. The i ni - ti al startup i s from a temperature of 20C i n al l three tanks, thus thi s i s the appropri ate i ni ti al condi - ti on for each tank temperature. The nal val ue or steady state val ue can be determi ned by sol vi ng the di fferenti al equati ons to steady state by gi vi ng a l arge ti me i nterval for the numeri cal sol uti on. Al ter- natel y one coul d set the ti me deri vati ves to zero, and sol ve the resul ti ng al gebrai c equati ons. I n thi s case, i t i s easi est just to numeri cal l y sol ve the di fferenti al equati ons to l arge val ue of t where steady state i s achi eved. The POLYMATH codi ng for thi s probl em i s shown bel ow. Equations: d(T1)/d(t)=(W*Cp*(T0-T1)+UA*(Tsteam-T1))/(M*Cp) d(T2)/d(t)=(W*Cp*(T1-T2)+UA*(Tsteam-T2))/(M*Cp) d(T3)/d(t)=(W*Cp*(T2-T3)+UA*(Tsteam-T3))/(M*Cp) W=100 Cp=2.0 T0=20 UA=10. Tsteam=250 M=1000 Initial Conditions: t(0)=0 T1(0)=20 T2(0)=20 T3(0)=20 Final Value: t(f)=200 The ti me to reach steady state i s usual l y consi dered to be the ti me to reach 99% of the nal steady state val ue for the vari abl e whi ch i s i ncreasi ng and responds the most sl owl y. For thi s probl em, T 3 i ncreases the most sl owl y, and the steady state val ue i s found to be 51.317C. I n POLYMATH, thi s can be easi l y done by di spl ayi ng the output i n tabul ar form for T 1 , T 2 , and T 3 so that the approach to steady state can accuratel y be observed. Thus the ti me must be determi ned when T 3 reaches 0.99(51.317) or 50.804 C. Agai n the tabul ar form of the output i s useful i n determi ni ng thi s ti me as i l l ustrated i n Tabl e 4 yi el di ng the ti me to steady state as approxi matel y 63.0 mi n. A pl ot of the three tank temperatures from POLYMATH i s gi ven i n Fi gure PM-(6). Table PM-4 Tabular Output Option from POLYMATH t T3 60 50.662233 60.5 50.688128 61 50.713042 61.5 50.737011 62 50.760068 62.5 50.782246 63 50.803577 63.5 50.82409 Page PM-12 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING 64 50.843817 64.5 50.862784 65 50.88102 Table PM-4 Tabular Output Option from POLYMATH t T3 Figure PM-6 Dynami c Temperature Response i n the Three Tanks Polymath Problem 7 Solution Page PM-13 Polymath Problem 7 Solution Sol vi ng Hi gher Order Ordi nary Di fferenti al Equati ons Most mathemati cal software packages can sol ve onl y systems of rst order ordi nary di fferenti al equa- ti ons (ODEs). Fortunatel y, the sol uti on of an n-th order ODE can be accompl i shed by expressi ng the equati on by a seri es of si mul taneous rst order di fferenti al equati ons each wi th a boundary condi ti on. Thi s i s the approach that i s typi cal l y used for the i ntegrati on of hi gher order ODEs. (a) Equati on (23) i s a second order ODE, but i t can be converted i nto a system of rst order equati ons by substi tuti ng new vari abl es for the hi gher order deri vati ves. I n thi s parti cul ar case, a new vari abl e y can be dened whi ch represent the rst deri vati on of C A wi th respect to z. Thus Equa- ti on (23) can be wri tten as the equati on set PM-(6) Thi s set of rst order ODEs can be entered i nto the POLYMATH Simultaneous Differential Equation Solver for sol uti on, but i ni ti al condi ti ons for both C A and y are needed. Si nce the i ni ti al condi ti on of y i s not known, an i terati ve method (al so referred to as a shooti ng method) can be used to nd the correct i ni ti al val ue for y whi ch wi l l yi el d the boundary condi ti on gi ven by Equati on (25). Shooti ng Method-Tri al and Error The shooti ng method i s used to achi eve the sol uti on of a boundary val ue probl em to one of an i terati ve sol uti on of an i ni ti al val ue probl em. Known i ni ti al val ues are uti l i zed whi l e unknown i ni ti al val ues are opti mi zed to achi eve the correspondi ng boundary condi ti ons. Ei ther tri al and error or vari abl e opti mi zati on techni ques are used to achi eve convergence on the boundary condi ti ons. For thi s probl em, a rst tri al and error val ue for the i ni ti al condi ti on of y, for exampl e y 0 = -150, i s used to carry out the i ntegrati on and cal cul ate the error for the boundary condi ti on desi gnated by . Thus the di fference between the cal cul ated and desi red nal val ue of y at z = L i s gi ven by PM-(7) Note that for thi s exampl e, y f ,desired = 0 and thus (y 0 ) = y f,calc onl y because thi s desi red boundary con- di ti on i s zero. The equati ons as entered i n the POLYMATH Si mul taneous Di fferenti al Equati on Sol ver for an i ni ti al tri al and error sol uti on are Equations: d(CA)/d(z)=y d(y)/d(z)=k*CA/DAB k=0.001 DAB=1.2E-9 err=y Initial Conditions: z(0)=0 CA(0)=0.2 y(0)=-150 Final Value: z(f)=0.001 The cal cul ati on of err i n the POLYMATH equati on set whi ch corresponds to Equati on PM-(7) i s onl y dC A dz ------------ y = dy dz ------- k D AB ------------C A = y 0 ( ) y f cal c , y f desi red , = Page PM-14 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING val i d at the end of the ODE sol uti on. Repeated reruns of thi s POLYMATH equati on set wi th di fferent i ni ti al condi ti ons for y can be used i n a tri al and error mode to converge upon the desi red boundary condi ti on for y 0 where (y 0 ) or err 0. Some resul ts are summari zed i n Tabl e PM-(5) for vari ous val ues of y 0 . The desi red i ni ti al val ue for y 0 l i es between -130 and -140. Thi s tri al and error approach can be conti nued to obtai n a more accurate val ue for y 0 , or an opti mi zati on techni que can be appl i ed. Newtons Method for Boundary Condi ti on Convergence A very useful method for opti mi zi ng the proper i ni ti al condi ti on i s to consi der thi s determi nati on to be a probl em i n ndi ng the zero of a functi on. I n the notati on of thi s probl em, the vari abl e to be opti mi zed i s y 0 and the objecti ve functi on i s (y 0 ) whi ch i s dened by Equati on PM-(7). Newtons method, an effecti ve method for opti mi zi ng a si ngl e vari abl e, can be appl i ed here to mi ni mi ze the above objecti ve functi on. Accordi ng to thi s method, an i mproved esti mate for y 0 can be cal cul ated usi ng the equati on PM-(8) where i s the deri vati ve of at . The deri vati ve, , can be esti mated usi ng a ni te di fference approxi mati on PM-(9) where i s a smal l i ncrement i n the val ue of . I t i s very conveni ent that can be cal cu- l ated simultaneously with the numerical ODE solution for thereby al l owi ng cal cul ati on of from Equati on PM-(9) and a new estimate for from Equati on PM-(8). Usi ng = 0.0001 for thi s exampl e, the POLYMATH equati on set for carryi ng out the rst step i n Newtons method procedure i s gi ven by Equations: d(CA)/d(z)=y d(y)/d(z)=k*CA/DAB d(CA1)/d(z)=y1 d(y1)/d(z)=k*CA1/DAB k=0.001 DAB=1.2E-9 err=y-0 err1=y1-0 y0=-130 L=.001 delta=0.0001 CAanal=0.2*cosh(L*(k/DAB)^.5*(1-z/L))/(cosh(L*(k/DAB)^.5)) derr=(err1-err)/(.0001*y0) ynew=y0-err/derr Initial Conditions: z(0)=0 Table PM-5 Trial Boundary Conditions for Equation Set (6) in Problem 7 Part (a) y 0 (z = 0) -120. -130. -140. -150. y f,calc (z = L) 17.23 2.764 -11.70 -26.16 (y 0 ) 17.23 2.764 -11.70 -26.16 y 0 new , y 0 y 0 ( ) ' y 0 ( ) = ' y 0 ( ) y y 0 = ' y 0 ( ) ' y 0 ( ) y 0 y 0 + ( ) y 0 ( ) y 0 ------------------------------------------------- y 0 y 0 y 0 y 0 + ( ) y 0 ( ) ' y 0 ( ) y 0 Polymath Problem 7 Solution Page PM-15 CA(0)=0.2 y(0)=-130 CA1(0)=0.2 y1(0)=-130.013 Final Value: z(f)=0.001 Thi s set of equati ons yi el ds the resul ts summari zed i n Tabl e 6 where the new esti mate for y 0 i s the nal val ue of the POLYMATH vari abl e ynew or -131.911. Another i terati on of Newtons method can be obtai ned by starti ng wi th the new esti mate and modi fyi ng the i ni ti al condi ti ons for y and y1 and the val ue of y0 i n the POLYMATH equati on set. The second i terati on i ndi cates that the err i s approxi matel y 3.e-4 and that ynew i s unchanged i ndi cati ng that convergence has been obtai ned. For the val ue of y0 = -131.911, the numeri cal and anal yti cal sol uti ons are equal to at l east si x si gni cant di gi ts. Table PM-6 Partial Results for Selected Variables during 1st Newtons Method Iteration Variable Initial Value Maximum Value Minimum Value Final Value z 0 0.001 0 0.001 y -130 2.76438 -130 2.76438 CA 0.2 0.2 0.140428 0.140461 err -130 2.76438 -130 2.76438 y1 -130.013 2.74558 -130.013 2.74558 CA1 0.2 0.2 0.140446 -0.142229 err1 -130.013 2.74558 -130.013 2.74558 derr 1 1.44642 1 1.44642 ynew -5.22675e-11 -5.22675e-11 -131.911 -131.911 Page PM-16 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING Polymath Problem 8 Solution Thi s probl em requi res the si mul taneous sol uti on of Equati on (27) whi l e the temperature i s cal cul ated from the bubbl e poi nt consi derati ons i mpl i ci t i n Equati on (29). A system of equati ons compri si ng of di fferenti al and i mpl i ci t al gebrai c equati ons i s cal l ed di fferenti al al gebrai c or a DAE system. There are several numeri cal methods for sol vi ng DAE systems. Most probl em sol vi ng software packages i ncl udi ng POLYMATH do not have the speci c capabi l i ty for DAE systems. Approach 1 The rst approach wi l l be to use the controlled integration technique proposed by Shacham, et al . 4 . Usi ng thi s method, the nonl i near Equati on (29) i s rewri tten wi th an error term gi ven by PM-(10) where the cal cul ated from thi s equati on provi des the basi s for keepi ng the temperature of the di sti l - l ati on at the bubbl e poi nt. Thi s i s accompl i shed by changi ng the temperature i n proporti on to the error i n an anal ogous manner to a proporti on control l er acti on. Thus thi s can be represented by another di fferenti al equati on PM-(11) where a proper choi ce of the proporti onal i ty constant K c wi l l keep the error bel ow a desi red error tol - erance. The cal cul ati on of K c i s a si mpl e tri al and error procedure for most probl ems. At the begi nni ng K c i s set to a smal l val ue (say K c = 1), and the system i s i ntegrated. I f i s too l arge, then K c must be i ncreased and the i ntegrati on repeated. Thi s tri al and error procedure i s conti nued unti l becomes smal l er than a desi red error tol erance throughout the enti re i ntegrati on i nterval . The temperature at the i ni ti al poi nt i s not speci ed i n the probl em, but i t i s necessary to start the probl em sol uti on at the bubbl e poi nt of the i ni ti al mi xture. Thi s separate cal cul ati on can be car- ri ed out on Equati on (29) for x 1 = 0.6 and x 2 = 0.4 and the Antoi ne equati ons usi ng the POLYMATH Simultaneous Algebraic Equation Solver. The sol uti on equati on set i s gi ven by Equations: f(Tbp)=xA*PA+xB*PB-760*1.2 xA=0.6 PA=10^(6.90565-1211.033/(Tbp+220.79)) PB=10^(6.95464-1344.8/(219.482+Tbp)) xB=1-xA yA=xA*PA/(760*1.2) yB=xB*PB/(760*1.2) Search Range: Tbp(min)=60, Tbp(max)=120 The resul ti ng i ni ti al temperature i s found to be . The system of equati ons for the batch di sti l l ati on as they are i ntroduced i nto the POLYMATH Simultaneous Differential Equation Solver usi ng are Equations: d(L)/d(x2)=L/(k2*x2-x2) d(T)/d(x2)=Kc*err Kc=0.5e6 1 k 1 x 1 k 2 x 2 = dT dx 2 --------- K c = T 0 95.5851 = K c 0.5 6 10 = Polymath Problem 8 Solution Page PM-17 k2=10^(6.95464-1344.8/(T+219.482))/(760*1.2) x1=1-x2 k1=10^(6.90565-1211.033/(T+220.79))/(760*1.2) err=(1-k1*x1-k2*x2) Initial Conditions: x2(0)=0.4 L(0)=100 T(0)=95.5851 Final Value: x2(f)=0.8 and the parti al resul ts from the sol uti on are summari zed i n Tabl e PM-(7) The nal val ues from the tabl e i ndi cate that 14.05 mol of l i qui d remai n i n the col umn when the concentrati on of the tol uene reaches 80%. Duri ng the di sti l l ati on the temperature i ncreases from 95.6 to 108.6 . The error cal cul ated from Equati on (10) i ncreases from about to duri ng the numeri cal sol uti on, but i t i s sti l l smal l enough for the sol uti on to be consi dered as accurate. Approach 2 A di fferent approach for sol vi ng thi s probl em can be used because Equati on (29) can be di fferenti ated wi th respect to x 2 to yi el d PM-(12) Thus Equati on PM-(12) can provi de the bubbl e poi nt temperature duri ng the si mul taneous i ntegra- ti on wi th Equati on (27). The equati on set to be used wi th the POLYMATH Simultaneous Differential Equation Solver i s gi ven by Equations: d(L)/d(x2)=L/(k2*x2-x2) d(T)/d(x2)=(k2-k1)/(ln(10)*(x1*k1*(-1211.033)/(220.79+T)^2+x2*k2*(-1344.8)/ (219.482+T)^2)) Table PM-7 Partial Results for DAE Binary Distillation Problem Variable Initial Value Maximum Value Minimum Value Final Value x2 0.4 0.8 0.4 0.8 L 100 100 14.0456 14.0456 T 95.5851 108.569 95.5851 108.569 k2 0.532535 0.785753 0.532535 0.785753 Kc 500000 500000 500000 500000 x1 0.6 0.6 0.2 0.2 k1 1.31164 1.8566 1.31164 1.8566 err -3.64587e-07 7.75023e-05 -3.64587e-07 7.75023e-05 C C 3.6 7 10 7.75 5 10 dT dx 2 --------- k 2 k 1 ( ) 10 ( ) x 1 k 1 B 1 C 1 T + ( ) 2 ------------------------- x 2 k 2 B 2 C 2 T + ( ) 2 ------------------------- + l n --------------------------------------------------------------------------------------------------------- = Page PM-18 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING k2=10^(6.95464-1344.8/(T+219.482))/(760*1.2) k1=10^(6.90565-1211.033/(T+220.79))/(760*1.2) x1=1-x2 Initial Conditions: x2(0)=0.4 L(0)=100 T(0)=95.5851 Final Value: x2(f)=0.8 The POLYMATH sol uti on to thi s probl em i s essenti al l y the same as that found i n Approach 1. Polymath Problem 9 Solution Page PM-19 Polymath Problem 9 Solution I ntroducti on of the above equati ons i ncl udi ng the numeri cal val ues of the parameter provi ded i n the probl em statement i nto the POLYMATH program yi el ds Equations d(x)/d(W)=-rA/FA0 d(T)/d(W)=(.8*(Ta-T)+rA*delH)/(CPA*FA0) d(y)/d(W)=-0.015*(1-.5*x)*(T/450)/(2*y) Ta=500 delH=-40000 CPA=40 FA0=5 k=.5*exp((41800/8.314)*(1/450-1/T)) CA=.271*(1-x)*(450/T)/(1-.5*x)*y CC=.271*.5*x*(450/T)/(1-.5*x)*y Kc=25000*exp(delH/8.314*(1/450-1/T)) rA=-k*(CA^2-CC/Kc) Initial Conditions: W(0)=0 x(0)=0 T(0)=450 y(0)=1 W(f)=20 (a) The requested pl ot for part (a) i s shown i n Fi gure PM-(7) where there i s a rapi d i ncrease i n conversi on and temperature wi thi n the reactor at approxi matel y the mi dpoi nt of the catal yst bed. The bed pressure drop i s enhanced by the i ncreased temperature and reduced pressure even though the number of mol es i s decreasi ng. (b) Thi s rapi d i ncrease i s due to the exothermi c reacti on rapi dl y accel erati ng due to the i ncreas- i ng temperature even though the reactant concentrati on fal l i ng. Equi l i bri um i s rapi dl y achi eved after thi s hot spot i s achi eved wi th the temperature and conversi on onl y reduci ng sl i ghtl y due to the exter- 10 -3 Figure PM-7 Conversi on, Reduced Pressure, and Temperature Prol es i n Catal yti c Reactor Page PM-20 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING nal heat transfer whi ch tends to sl i ghtl y cool the reactor as the reacti ng mi xture conti nues toward the reactor exi t. (c) The concentrati on prol es shown i n Fi gure PM-(8) reect the net effects of reacti on rate and changes i n temperature and pressure wi thi n the reactor. Figure PM-8 Concentrati on Prol es i n Catal yti c Reactor Polymath Problem 10 Solution Page PM-21 Polymath Problem 10 Solution Thi s probl em requi res the sol uti on of Equati ons (40) and (42) through (47) whi ch can be accompl i shed wi th the POLYMATH Simultaneous Differential Equation Solver. The step change i n the i nl et tem- perature can be i ntroduced at t = 10 by usi ng the POLYMATH i f... then... el se... statement to provi de the l ogi c for a vari abl e to change at a parti cul ar val ue of t. The generati on of a step change at t = 10, for exampl e, i s accompl i shed by the POLYMATH program statement step=if (t<10) then (0) else (1) (a) Open Loop Performance The step down of 20C i n the i nl et temperature at t = 10 i s i mpl e- mented bel ow i n the equati on set for the case where K c = 0 whi ch gi ves the open l oop response. Equations: d(T)/d(t)=(WC*(Ti-T)+q)/rhoVCp d(T0)/d(t)=(T-T0-(taud/2)*dTdt)*2/taud d(Tm)/d(t)=(T0-Tm)/taum d(errsum)/d(t)=Tr-Tm WC=500 rhoVCp=4000 taud=1 taum=5 Tr=80 Kc=0 tauI=2 step=if (t<10) then (0) else (1) Ti=60+step*(-20) q=10000+Kc*(Tr-Tm)+Kc/tauI*errsum dTdt=(WC*(Ti-T)+q)/rhoVCp Initial Conditions: t(0)=0 T(0)=80 T0(0)=80 Tm(0)=80 errsum(0)=0 t(f)=60 A pl ot of the temperatures T, T 0 and T m as generated by POLYMATH i s gi ven i n Fi gure PM-(9) whi ch al so veri es the steady state operati on for t < 10 mi n as there i s no change i n any of the temper- ature val ues. Si nce i t i s di fcul t to determi ne that the Pad approxi mati on for a short ti me del ay i s worki ng from a pl ot, the POLYMATH opti on to output data to a l e has been used to prepare Tabl e PM-(8). Thi s tabl e i ndi cates that there i s good agreement between T (at any t) and T 0 (one mi nute Table PM-8 Dead Time Generation by Pad Approxi mati on Ti me t mi n T C T 0 C Ti me t mi n T C T 0 C 9 80 80 15 75.352614 76.066236 10 80 80 16 74.723801 75.353633 11 78.824973 79.821167 17 74.168787 74.724624 12 77.788008 78.801988 18 73.678794 74.1693 13 76.873024 77.786106 19 73.246627 73.679511 14 76.065326 76.873588 20 72.865268 73.247303 Page PM-22 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING l ater) wi th more error at the i ni ti ati on of the step change. Thi s veri es that the Pad approxi mati on for dead ti me i s provi di ng the one mi nute ti me del ay. (b) Closed Loop Performance The cl osed l oop performance of the PI control l er requi res the change of K c from zero i n part (a) to the basel i ne proporti onal gai n of 50. Thi s si mpl e change resul ts i n the temperature transi ents shown i n Fi gure PM-(10). (c) Closed Loop Performance for K c = 500 The i ncrease of a factor of 10 i n the proporti onal gai n from the basel i ne case gi ves the unstabl e resul t pl otted i n Fi gure PM-(11). Thi s i s cl earl y an undesi r- abl e resul t. Figure PM-9 Open Loop Response to Step Down i n I nl et Feed Temperature at t = 10 mi n Polymath Problem 10 Solution Page PM-23 Figure PM-10 Cl osed Loop Response to Step Down i n I nl et Feed Temperature at t = 10 mi n. Figure PM-11 Cl osed Loop Response to Step Down i n I nl et Feed Temperature at t = 10 mi n for K c = 500. Page PM-24 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING (d) Closed Loop Performance for Only Proportional Control The removal of the i ntegral control acti on gi ves the stabl e resul t pl otted i n Fi gure PM-(12). Note that there i s offset from the set poi nt when the system returns to steady state operati on. Thi s i s al ways the case for onl y proporti onal con- trol , and the use of i ntegral control al l ows the offset to be el i mi nated. Figure PM-12 Cl osed Loop Response for onl y Proporti onal Control . Polymath Problem 10 Solution Page PM-25 (e) Closed Loop Performance with Limits on q There are many ti mes i n control when l i mi ts must be establ i shed. I n thi s exampl e, the l i mi ts on q can be achi eved by a POLYMATH i f... then... el se... statement whi ch can be uti l i zed as shown bel ow qlim=if(q<0)then(0)else(if(q>=2.6*10000)then(2.6*10000)else (q)) The compl ete POLYMATH equati on set for part (e) of thi s probl em i s Equations: d(T)/d(t)=(WC*(Ti-T)+qlim)/rhoVCp d(T0)/d(t)=(T-T0-(taud/2)*dTdt)*2/taud d(Tm)/d(t)=(T0-Tm)/taum d(errsum)/d(t)=Tr-Tm WC=500 Ti=60 rhoVCp=4000 taud=1 taum=5 Kc=5000 tauI=2 step=if (t<10) then (0) else (1) Tr=80+step*(10) q=10000+Kc*(Tr-Tm) qlim=if(q<0)then(0)else(if(q>=2.6*10000)then(2.6*10000)else (q)) dTdt=(WC*(Ti-T)+qlim)/rhoVCp Initial Conditions: t(0)=0 T(0)=80 T0(0)=80 Tm(0)=80 errsum(0)=0 t(f)=200 The val ues of q and q l i m pl otted i n Fi gure PM-(13) i ndi cate that thi s proporti onal control l er has wi de osci l l ati ons before settl i ng to a steady state, and the l i mi ts i mposed on q l i m are evi dent. The corre- spondi ng pl ots of the system temperatures are presented i n Fi gure PM-(14). Page PM-26 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING Figure PM-13 Cl osed Loop Response for onl y Proporti onal Control . Figure PM-14 Cl osed Loop Response for onl y Proporti onal Control .