Upload
sushant-sethi
View
233
Download
0
Embed Size (px)
Citation preview
8/13/2019 CAD LAB-II
1/38
SOLUTION FOR THE GIVEN COLLECTION OF
TEN NUMERICAL PROBLEMS IN
CHEMICAL ENGINEERING
COMPUTER AIDEd DESIGN LAB-II
SUBMITTED BY
SUSANTA SETHI
ROLL NO. : 110CH0109
UNDER THE GUIDANCE OF
DR. ARVIND KUMAR
ASST. PROF. DEPARTMENT OF CHEMICAL ENGINEERING
8/13/2019 CAD LAB-II
2/38
PROBLEM NO. 1 :
The ideal gas law can represent the pressure-volume-temperature (PVT) relationship of gases only atlow (near atmospheric) pressures. For higher pressures more complex equations of state should be used.
The calculation of the molar volume and the compressibility factor using complex equations of statetypically requires a numerical solution when the pressure and temperature are specified. The van derWaals equation of state is given by;
SOLUTION:C++ PROGRAMMING CODE:
//bisection method for finding the root of a function//
//roll no. 110CH0109//
#include
#include
#include
using namespace std;
8/13/2019 CAD LAB-II
3/38
int main()
{
double v,v0,b,R,T,p,a,Tc,Pc;
double Tr,Pr,Z;
coutp;
coutT;
coutR;
coutTr;
coutPr;
v0=(R*T)/p;
Tc=T/Tr;
Pc=p/Pr;
cout
8/13/2019 CAD LAB-II
4/38
cout
8/13/2019 CAD LAB-II
5/38
enter the gas constant value in atm-lit./gmol-K :0.08
enter the given reduced temperature :1
enter the given reduced pressuren :1
the critical temperature was found to be :450
the critical pressure was found to be :56
the calculated constant a is :10.2727
the calculated constant b is :0.0824263
the calculated molar volume is :0.546188
the compressibility factor is given by :0.828297
PROBLEM-2
8/13/2019 CAD LAB-II
6/38
C++ PROGRAMMING CODE:-
/************* material balance using Gauss elimination for solving linear equations *************/
#include
#include
#include
using namespace std;
int main()
{
int n,i,j,k,temp;
float a[10][10],c,d[10]={0};
float D1,D2,B1,B2;
float D,B;
coutn;
cout
8/13/2019 CAD LAB-II
7/38
cin>>a[i][j];
}
for(i=n-1;i>0;i--) // partial pivoting//
{
if(a[i-1][0]
8/13/2019 CAD LAB-II
8/38
for(i=k;i
8/13/2019 CAD LAB-II
9/38
d[i]=(a[i][n]-c)/a[i][i];
}
//******** RESULT DISPLAY *********//
for(i=0;i
8/13/2019 CAD LAB-II
10/38
equation: 1 0.07 0.18 0.15 0.24 10.50
equation: 2 0.04 0.24 0.10 0.65 17.50
equation: 3 0.54 0.42 0.54 0.10 28
equation: 4 0.35 0.16 0.21 0.01 14
the stream D1 in kmol is : 26.25
the stream B1 in kmol is : 17.5
the stream D2 in kmol is: 8.75
the stream B2 in kmol is : 17.5
the stream D flow rate is : 43.75
the stream B flow rate is : 26.25
PROBLEM-3
8/13/2019 CAD LAB-II
11/38
C++ PROGRAMMING CODE :
/************* calculation of terminal velocity of faliing coal particles *************/
#include
#include
#include
using namespace std;
int main()
{
float Vt,d,dp,g,Dp,u,CD,Rep,V,R;
coutDp;
coutdp;
coutd;
coutu;
coutg;
Rep = ((Dp*Dp*Dp*g*d)* (dp-d))/(18*u*u);
cout
8/13/2019 CAD LAB-II
12/38
if (Rep
8/13/2019 CAD LAB-II
13/38
getch();
return 0;
}
RESULT:
Enter the coal particle dia Dp in meter unit : 0.000298
Enter the coal particle density in kg/m3 unit : 1800
Enter the fluid density in kg/m3 unit : 994.6
Enter the viscosity of fluid in kg/m.s unit : 0.0008931
Enter the acceleration due to gravity in m/s2 unit : 9.81
The calculated Reynolds No. is : 14.4846
The calculated drag coefficient value is : 3.16378
The calculated terminal velocity in m/s unit is : 0.0315857
PROBLEM NO. 4:
8/13/2019 CAD LAB-II
14/38
SOLUTION :
POLYMATH SIMULATION CODE
Model:Pressure = a0 + a1*Temperature + a2*Temperature^2 + a3*Temperature^3 + a4*Temperature^4
Variable Value 95 confidence
a0 24.67876 0.7872334
a1 1.606196 0.0544632
a2 0.0360443 0.0010089
a3 0.0004131 4.005E-05
a4 3.963E-06 4.514E-07
GeneralDegree of polynomial = 4Number of observations = 10Statistics
R^2 0.9999963
R^2adj 0.9999934
Rmsd 0.1410532
Variance 0.3979203
Source data points and calculated data points
Temperature Pressure Pressure calc Delta Pressure
1 -36.7 1 1.047712 -0.04771252 -19.6 5 4.518359 0.481641
3 -11.5 10 10.41537 -0.4153728
4 -2.6 20 20.73923 -0.7392276
5 7.6 40 39.16234 0.8376636
8/13/2019 CAD LAB-II
15/38
6 15.4 60 59.69417 0.305826
7 26.1 100 100.3384 -0.3384191
8 42.2 200 200.2647 -0.2647227
9 60.6 400 399.7679 0.232079310 80.1 760 760.0518 -0.0517552
4(a)
Showing 4th degree polynomial curve fitting
4(b)
POLYMATH Results for Regression of Clausius-Clapeyron Equation.
8/13/2019 CAD LAB-II
16/38
4(c)
POLYMATH Results for Nonlinear Regression of Antoine Equation.
PROBLEM NO . 5 :
8/13/2019 CAD LAB-II
17/38
SOLUTION:
POLYMATH SIMULATION CODE
f (CX) =(CX*CY )-(KC2*CB*CC) CX(0) =10 #nonlinear equaiton in terms of CX f (CZ) =CZ-(KC3*CA*CX) CZ(0) =10 #nonlinear equation in terms of CZ f (CD) =(CC*CD)-(KC1*CA*CB) CD(0) =10 #nonlinear equation in terms of CD CB =CB0-CD-CY # linear equation in terms of CB CA =CA0-CD-CZ # linear equation in terms of CA CY =CX+CZ # linear equation in terms of CYCC=CD-CY # KC1=1.06KC2=2.63KC3=5CA0=1.5CB0=1.5#for condition 1 that is CD=CX=CZ=0#for condition 2 that is CD=CX=CZ=1#for condition 3 that is CD=CX=CZ=10RESULT:Condition : 1CD=CX=CZ=0
Calculated values of NLE variables
Variable Value f(x) Initial Guess
1 CD 0.7053344 3.577E-13 0
2 CX 0.1777924 3.588E-13 0
3 CZ 0.3739766 -2.287E-13 0
Variable Value
1 CA 0.420689
2 CA0 1.5
3 CB 0.2428966
4 CB0 1.5
8/13/2019 CAD LAB-II
18/38
5 CC 0.1535654
6 CY 0.551769
7 KC1 1.06
8 KC2 2.639 KC3 5.
Nonlinear equations
1 f(CX) = (CX*CY)-(KC2*CB*CC) = 0
nonlinear equaiton in terms of CX
2 f(CZ) = CZ-(KC3*CA*CX) = 0
nonlinear equation in terms of CZ
3 f(CD) = (CC*CD)-(KC1*CA*CB) = 0
nonlinear equation in terms of CD
Explicit equations
1 CB0 = 1.5
2 CA0 = 1.5
3 CY = CX+CZ
linear equation in terms of CY
4 CC = CD-CY
5 KC1 = 1.06
6 KC2 = 2.63
7 KC3 = 5
8 CA = CA0-CD-CZ
linear equation in terms of CA
9 CB = CB0-CD-CY
linear equation in terms of CB
Condition : 2CD=CX=CZ=1Calculated values of NLE variables
Variable Value f(x) Initial Guess
1 CD 0.0555561 6.523E-08 1.
2 CX 0.5972196 8.249E-08 1.
8/13/2019 CAD LAB-II
19/38
3 CZ 1.082074 -2.602E-08 1.
Variable Value
1 CA 0.3623704
2 CA0 1.5
3 CB -0.2348492
4 CB0 1.5
5 CC -1.623737
6 CY 1.679293
7 KC1 1.06
8 KC2 2.63
9 KC3 5.
Nonlinear equations
1 f(CX) = (CX*CY)-(KC2*CB*CC) = 0
nonlinear equaiton in terms of CX
2 f(CZ) = CZ-(KC3*CA*CX) = 0
nonlinear equation in terms of CZ
3 f(CD) = (CC*CD)-(KC1*CA*CB) = 0nonlinear equation in terms of CD
Explicit equations
1 CB0 = 1.5
2 CA0 = 1.5
3 CY = CX+CZ
linear equation in terms of CY
4 CC = CD-CY
5 KC1 = 1.06
6 KC2 = 2.63
7 KC3 = 5
8 CA = CA0-CD-CZ
linear equation in terms of CA
8/13/2019 CAD LAB-II
20/38
9 CB = CB0-CD-CY
linear equation in terms of CB
Condition 3:CD=CX=CZ=10Calculated values of NLE variables
Variable Value f(x) Initial Guess
1 CD 1.070104 1.574E-09 10.
2 CX -0.3227156 8.159E-09 10.
3 CZ 1.130534 3.941E-09 10.
Variable Value
1 CA -0.7006376
2 CA0 1.53 CB -0.377922
4 CB0 1.5
5 CC 0.2622862
6 CY 0.8078179
7 KC1 1.06
8 KC2 2.63
9 KC3 5.Nonlinear equations
1 f(CX) = (CX*CY)-(KC2*CB*CC) = 0
nonlinear equaiton in terms of CX
2 f(CZ) = CZ-(KC3*CA*CX) = 0
nonlinear equation in terms of CZ
3 f(CD) = (CC*CD)-(KC1*CA*CB) = 0
nonlinear equation in terms of CD
Explicit equations
1 CB0 = 1.5
2 CA0 = 1.5
3 CY = CX+CZ
linear equation in terms of CY
8/13/2019 CAD LAB-II
21/38
4 CC = CD-CY
5 KC1 = 1.06
6 KC2 = 2.63
7 KC3 = 58 CA = CA0-CD-CZ
linear equation in terms of CA
9 CB = CB0-CD-CY
linear equation in terms of CB
General Settings
Total number of equations 12
Number of implicit equations 3
Number of explicit equations 9
Elapsed time 0.0000 sec
Solution method SAFENEWT
Max iterations 150
Tolerance F 0.0000001
Tolerance X 0.0000001
Tolerance min 0.0000001
PROBLEM 6:
8/13/2019 CAD LAB-II
22/38
SOLUTION :
POLYMATH SIMULATION CODE
d(T3) / d(t) =(W*Cp*(T2-T3)+UA*(Ts-T3))/(M*Cp) #temperature distribution in tank-III T3(0) =20 d(T2) / d(t) =(W*Cp*(T1-T2)+UA*(Ts-T2))/(M*Cp) #Temperature distribution in tank-II T2(0) =20 d(T1) / d(t) =(W*Cp*(T0-T1)+UA*(Ts-T1))/(M*Cp) #Temperature distribution in tank-I
T1(0) =20#data given:W=100 # in kg per minuteCp=2.0 T0=20UA=10Ts=250M=1000#given intial condition:
t(0)=0#given final value:t(f )=200
RESULT:Calculated values of DEQ variables
Variable Initial value Minimal value Maximal value Final value
1 Cp 2. 2. 2. 2.
2 M 1000. 1000. 1000. 1000.
3 t 0 0 200. 200.
4 T0 20. 20. 20. 20.
5 T1 20. 20. 30.95238 30.95238
6 T2 20. 20. 41.38322 41.38322
7 T3 20. 20. 51.31735 51.31735
8/13/2019 CAD LAB-II
23/38
8 Ts 250. 250. 250. 250.
9 UA 10. 10. 10. 10.
10 W 100. 100. 100. 100.
Differential equations
1 d(T3)/d(t) = (W*Cp*(T2-T3)+UA*(Ts-T3))/(M*Cp)
temperature distribution in tank-III
2 d(T2)/d(t) = (W*Cp*(T1-T2)+UA*(Ts-T2))/(M*Cp)
Temperature distribution in tank-II
3 d(T1)/d(t) = (W*Cp*(T0-T1)+UA*(Ts-T1))/(M*Cp)
Temperature distribution in tank-I
Explicit equations
1 W = 100
2 Cp = 2.0
3 T0 = 20
4 UA = 10
5 Ts = 250
6 M = 1000
PROBLEM 7:
8/13/2019 CAD LAB-II
24/38
SOLUTION :
POLYMATH SIMULATION CODE
d( y1) / d(z) =k *CA1/DAB #variation of y1 w.r.t. z y1(0) = -130.30 d(CA1) / d(z) = y1 #variation of CA1 w.r.t. z CA1(0) =0.2 d( y ) / d(z) =k *CA/DAB #variation of y w.r.t. z y (0) = -130 d(CA) / d(z) = y #variation of CA w.r.t. z CA(0) =0.2 err = y -0 err1 = y1-0 derr =(err1-err)/(0.0001* y0) CAanal =0.2*cosh ( L*(k /DAB)^0.5*(1-z/L) )/(cosh (L*(k /DAB)^0.5)) # variation of CA #initial given data :
k =0.001DAB=1.2E-9 z(0)=0 L=0.001delta=0.0001 y0=-130#final value:z(f )=0.001
Calculated values of DEQ variables Variable Initial value Minimal value Maximal value Final value
1 CA 0.2 0.1404279 0.2 0.1404606
2 CA1 0.2 0.1400944 0.2 0.1401171
3 CAanal 0.2 0.1382726 0.2 0.1382726
8/13/2019 CAD LAB-II
25/38
4 DAB 1.2E-09 1.2E-09 1.2E-09 1.2E-09
5 delta 0.0001 0.0001 0.0001 0.0001
6 derr 23.07692 23.07692 33.37887 33.37887
7 err -130. -130. 2.764383 2.7643838 err1 -130.3 -130.3 2.330458 2.330458
9 k 0.001 0.001 0.001 0.001
10 L 0.001 0.001 0.001 0.001
11 y -130. -130. 2.764383 2.764383
12 y0 -130. -130. -130. -130.
13 y1 -130.3 -130.3 2.330458 2.330458
14 z 0 0 0.001 0.001
Differential equations
1 d(y1)/d(z) = k*CA1/DAB
variation of y1 w.r.t. z
2 d(CA1)/d(z) = y1
variation of CA1 w.r.t. z
3 d(y)/d(z) = k*CA/DAB
variation of y w.r.t. z
4 d(CA)/d(z) = y
variation of CA w.r.t. z
Explicit equations
1 err = y-0
2 err1 = y1-0
3 y0 = -130
4 L = 0.001
5 k = 0.0016 DAB = 1.2E-9
7 CAanal = 0.2*cosh( L*(k/DAB)^0.5*(1-z/L) )/(cosh(L*(k/DAB)^0.5))
variation of CA
8 delta = 0.0001
8/13/2019 CAD LAB-II
26/38
9 derr = (err1-err)/(0.0001*y0)
PROBLEM 8:
SOLUTION:
POLYMATH SIMULATION CODE #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
8/13/2019 CAD LAB-II
27/38
d(L) /d(x2) =L/((k2*x2)-x2) d(T)/d(x2)=Kc*errT0=95.59Kc=0.5e6
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.4L(0)=100T(0)=95.5851#Final Value: x2(f )=0.8RESULTS:Calculated values of DEQ variables
Variable Initial value Minimal value Maximal value Final value
1 err -3.646E-07 -3.646E-07 7.747E-05 7.747E-05
2 k1 1.311644 1.311644 1.856602 1.856602
3 k2 0.5325348 0.5325348 0.7857526 0.7857526
4 Kc 5.0E+05 5.0E+05 5.0E+05 5.0E+05
5 L 100. 14.04555 100. 14.045556 T 95.5851 95.5851 108.5693 108.5693
7 T0 95.59 95.59 95.59 95.59
8 x1 0.6 0.2 0.6 0.2
9 x2 0.4 0.4 0.8 0.8
Differential equations
1 d(L)/d(x2) = L/((k2*x2)-x2)
2 d(T)/d(x2) = Kc*errExplicit equations
1 T0 = 95.59
2 Kc = 0.5e6
3 k2 = 10^(6.95464-1344.8/(T+219.482))/(760*1.2)
4 x1 = 1-x2
8/13/2019 CAD LAB-II
28/38
5 k1 = 10^(6.90565-1211.033/(T+220.79))/(760*1.2)
6 err = (1-k1*x1-k2*x2)
PROBLEM 9:
SOLUTION:
POLYMATH SIMULATION CODE
d(T)/d(W)=(.8*(Ta-T)+rA*delH)/(CPA*FA0)
8/13/2019 CAD LAB-II
29/38
d( y )/d(W)=-0.015*(1-.5*x)*(T/450)/(2* y ) d(x)/d(W)=-rA/FA0 CA=.271*(1-x)*(450/T)/(1-.5*x)* y CC=.271*.5*x*(450/T)/(1-.5*x)* y
Ta=500delH=-40000CPA=40FA0=5k =.5*exp ((41800 /8.314)*(1/450-1/T)) Kc=25000 *exp (delH/8.314*(1/450-1/T)) rA=-k *(CA 2-CC/Kc) #Initial Conditions: W(0)=0x(0)=0T(0)=450 y (0)=1W(f )=20Calculated values of DEQ variables
Variable Initial value Minimal value Maximal value Final value
1 CA 0.271 0.0350883 0.271 0.0350883
2 CC 0 0 0.0510418 0.0462521
3 CPA 40. 40. 40. 40.
4 delH -4.0E+04 -4.0E+04 -4.0E+04 -4.0E+04
5 FA0 5. 5. 5. 5.
6 k 0.5 0.5 475.9749 448.6209
7 Kc 2.5E+04 35.28512 2.5E+04 37.34129
8 rA -0.0367205 -0.9690852 0.0033395 0.0033395
9 T 450. 450. 1165.41 1149.637
10 Ta 500. 500. 500. 500.
11 W 0 0 20. 20.
12 x 0 0 0.7271791 0.7249973
13 y 1. 0.766806 1. 0.766806
Differential equations
1 d(T)/d(W) = (.8*(Ta-T)+rA*delH)/(CPA*FA0)
8/13/2019 CAD LAB-II
30/38
2 d(y)/d(W) = -0.015*(1-.5*x)*(T/450)/(2*y)
3 d(x)/d(W) = -rA/FA0
Explicit equations
1 CA = .271*(1-x)*(450/T)/(1-.5*x)*y
2 CC = .271*.5*x*(450/T)/(1-.5*x)*y
3 Ta = 500
4 delH = -40000
5 CPA = 40
6 FA0 = 5
7 k = .5*exp((41800/8.314)*(1/450-1/T))
8 Kc = 25000*exp(delH/8.314*(1/450-1/T))
9 rA = -k*(CA^2-CC/Kc)
(a) The requested plot for part (a) is shown in Figure given below ,where there is a rapid increase inconversion and temperature within the reactor at approximately the midpoint of the catalyst bed. Thebed pressure drop is enhanced by the increased temperature and reduced pressure even though thenumber of moles is decreasing.
(b) This rapid increase is due to the exothermic reaction rapidly accelerating due to the increasingtemperature even though the reactant concentration falling. Equilibrium is rapidly achieved afterthis hot spot is achieved with the temperature and conversion only reducing slightly due to the exter-nal heat transfer which tends to slightly cool the reactor as the reacting mixture continues toward thereactor exit.
8/13/2019 CAD LAB-II
31/38
(c) The concentration profiles shown in Figure given below, reflect the net effects of reaction rate andchanges in temperature and pressure within the reactor.
Concentration Profiles in Catalytic Reactor
PROBLEM 10:
8/13/2019 CAD LAB-II
32/38
SOLUTION :
POLYMATH SIMULATION CODE #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=500rhoVCp=4000
taud=1taum=5Tr=80Kc=0tauI=2step=if (t
8/13/2019 CAD LAB-II
33/38
8/13/2019 CAD LAB-II
34/38
7 tauI = 2
8 step = if (t
8/13/2019 CAD LAB-II
35/38
10 (c) Closed Loop Performance for Kc = 500The increase of a factor of 10 in the proportional gainfrom the baseline case gives the unstable result plotted in Figure PM-(11). This is clearly an undesirableresult.
Closed Loop Response to Step Down in Inlet Feed Temperature att = 10 min for Kc = 500.
10 (d) Closed Loop Performance for Only Proportional ControlThe removal of the integral controlaction gives the stable result plotted in Figure PM-(12). Note that there is offset from the set point. whenthe system returns to steady state operation. This is always the case for only proportional control,and the use of integral control allows the offset to be eliminated.
Closed Loop Response for only Proportional Control.
8/13/2019 CAD LAB-II
36/38
(e) Closed Loop Performance with Limits on qThere are many times in control when limitsmust be established. In this example, the limits on q can be achieved by a POLYMATH if... then... else... statement which can be utilized as shown below:
POLYMATH CODE #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=500Ti=60rhoVCp=4000taud=1taum=5Kc=5000tauI=2step=if (t
8/13/2019 CAD LAB-II
37/38
6 rhoVCp 4000. 4000. 4000. 4000.
7 step 0 0 1. 1.
8 T 80. 80. 97.47784 89.08812
9 t 0 0 200. 200.10 T0 80. 80. 98.4204 89.0909
11 taud 1. 1. 1. 1.
12 tauI 2. 2. 2. 2.
13 taum 5. 5. 5. 5.
14 Ti 60. 60. 60. 60.
15 Tm 80. 80. 92.13203 89.09319
16 Tr 80. 80. 90. 90.
17 WC 500. 500. 500. 500.
Differential equations
1 d(T)/d(t) = (WC*(Ti-T)+qlim)/rhoVCp
2 d(T0)/d(t) = (T-T0-(taud/2)*dTdt)*2/taud
3 d(Tm)/d(t) = (T0-Tm)/taum
4 d(errsum)/d(t) = Tr-Tm
Explicit equations
1 WC = 500
2 Ti = 60
3 rhoVCp = 4000
4 taud = 1
5 taum = 5
6 Kc = 5000
7 tauI = 2
8 step = if (t
8/13/2019 CAD LAB-II
38/38
I)
Closed Loop Response for only Proportional Control.II)
Closed Loop Response for only Proportional Control.