summaryrefslogtreecommitdiff
path: root/Chemical_Reactor_Design_by_P_Harriott/1-Homogeneous_Kinetics.ipynb
blob: 03315417a01696bd8e735129dc2bb9fa9bcb2cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 1: Homogeneous Kinetics"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.4: Activation_energy_from_packed_bed_data.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436. \n",
"//Chapter-1 Ex1.4  Pg No. 23\n",
"//Title: Activation energy from packed bed data\n",
"//=========================================================================================================\n",
"clear\n",
"clc\n",
"clf\n",
"// COMMON INPUT\n",
"L= [0 1 2 3 4 5 6 9];//Bed length in feet(ft)\n",
"T=[330 338 348 361 380 415 447 458 ] //Temperature Corresponding the bed length given (°C) \n",
"R=1.98587E-3;//Gas constant (kcal/mol K)\n",
"\n",
"//CALCLATION (Ex1.4.a)\n",
"//Basis is 1mol of feed A(Furfural) X moles reacted to form Furfuran and CO \n",
"x=(T-330)./130;//Conversion based on fractional temperature rise\n",
"n=length (T);//6 moles of steam per mole of Furfural is used to decrease temperature rise in the bed\n",
"P_mol=x+7;//Total No. of moles in product stream\n",
"for i=1:(n-1)\n",
"    T_avg(i)= (T(i)+T(i+1))/2\n",
"    P_molavg(i)= (P_mol(i)+P_mol(i+1))/2\n",
"    delta_L(i)=L(i+1)-L(i)\n",
"    k_1(i)=((P_molavg(i))/delta_L(i))*log((1-x(i))/(1-x(i+1)))\n",
"    u1(i)=(1/(T_avg(i)+273.15));\n",
"end\n",
"v1=(log(k_1));\n",
"i=length(u1);\n",
"X1=[u1 ones(i,1) ];\n",
"result1= X1\v1;\n",
"k_1_dash=exp(result1(2,1));\n",
"E1=(-R)*(result1(1,1));\n",
"\n",
"//OUTPUT (Ex1.4.a)\n",
"//Console Output\n",
"mprintf('\n OUTPUT Ex1.4.a');\n",
"mprintf('\n========================================================================================\n')\n",
"mprintf('L \t \t T \t\t x \t\t T_average \t(7+x)ave \tk_1')\n",
"mprintf('\n(ft) \t \t (°C) \t\t   \t\t (°C) \t  ')\n",
"mprintf('\n========================================================================================')\n",
"for i=1:n-1\n",
"mprintf('\n%f \t %f \t %f ',L(i+1),T(i+1),x(i+1))\n",
"mprintf('\t %f \t %f \t %f',T_avg(i),P_molavg(i),k_1(i))\n",
"end\n",
"mprintf('\n\nThe activation energy from the slope =%f kcal/mol',E1 );\n",
"//=====================================================================================================\n",
"\n",
"\n",
"//Title: II Order Reaction \n",
"//=========================================================================================================\n",
"//CALCULATION (Ex 1.4.b)\n",
"for i=1:(n-1)\n",
"    T_avg(i)= (T(i)+T(i+1))/2\n",
"    P_molavg(i)= (P_mol(i)+P_mol(i+1))/2\n",
"    delta_L(i)=L(i+1)-L(i)\n",
"    k_2(i)=((P_molavg(i))/delta_L(i))*((x(i+1)-x(i))/((1-x(i+1))*(1-x(i))))\n",
"    u2(i)=(1/(T_avg(i)+273.15));\n",
"end\n",
"v2=(log(k_2));\n",
"plot(u1.*1000,v1,'o',u2.*1000,v2,'*');\n",
"xlabel('1000/T (K^-1)');\n",
"ylabel('ln k_1 or ln k_2');\n",
"xtitle('ln k vs 1000/T ');\n",
"legend('ln k_1','ln k_2');\n",
"j=length(u2);\n",
"X2=[u2 ones(j,1) ];\n",
"result2= X2\v2;\n",
"k_2_dash=exp(result2(2,1));\n",
"E2=(-R)*(result2(1,1));\n",
"\n",
"//OUTPUT (Ex 1.4.b)\n",
"mprintf('\n OUTPUT Ex1.4.b');\n",
"mprintf('\n========================================================================================\n')\n",
"mprintf('L \t \t T \t\t x \t\t T_average \t(7+x)ave \tk_2')\n",
"mprintf('\n(ft) \t \t (°C) \t\t   \t\t (°C) \t  ')\n",
"mprintf('\n========================================================================================')\n",
"for i=1:n-1\n",
"mprintf('\n%f \t %f \t %f ',L(i+1),T(i+1),x(i+1))\n",
"mprintf('\t %f \t %f \t %f',T_avg(i),P_molavg(i),k_2(i))\n",
"end\n",
"mprintf('\n\nThe activation energy from the slope =%f kcal/mol',E2 );\n",
"\n",
"//FILE OUTPUT\n",
"fid= mopen('.\Chapter1-Ex4-Output.txt','w');\n",
"mfprintf(fid,'\n OUTPUT Ex1.4.a');\n",
"mfprintf(fid,'\n========================================================================================\n')\n",
"mfprintf(fid,'L \t \t T \t\t x \t\t T_average \t(7+x)ave \tk_1')\n",
"mfprintf(fid,'\n(ft) \t \t (°C) \t\t   \t\t (°C) \t  ')\n",
"mfprintf(fid,'\n========================================================================================')\n",
"for i=1:n-1\n",
"mfprintf(fid,'\n%f \t %f \t %f ',L(i+1),T(i+1),x(i+1))\n",
"mfprintf(fid,'\t %f \t %f \t %f',T_avg(i),P_molavg(i),k_1(i))\n",
"end\n",
"mfprintf(fid,'\n\nThe activation energy from the slope =%f kcal/mol',E1 );\n",
"mfprintf(fid,'\n\n========================================================================================\n')\n",
"mfprintf(fid,'\n OUTPUT Ex1.4.b');\n",
"mfprintf(fid,'\n========================================================================================\n')\n",
"mfprintf(fid,'L \t \t T \t\t x \t\t T_average \t(7+x)ave \tk_2')\n",
"mfprintf(fid,'\n(ft) \t \t (°C) \t\t   \t\t (°C) \t  ')\n",
"mfprintf(fid,'\n========================================================================================')\n",
"for i=1:n-1\n",
"mfprintf(fid,'\n%f \t %f \t %f ',L(i+1),T(i+1),x(i+1))\n",
"mfprintf(fid,'\t %f \t %f \t %f',T_avg(i),P_molavg(i),k_2(i))\n",
"end\n",
"mfprintf(fid,'\n\nThe activation energy from the slope =%f kcal/mol',E2 );\n",
"mclose(all);\n",
"\n",
"//============================================================END OF PROGRAM===========================================\n",
"//Disclaimer (Ex1.4.a):The last value of tavg and k_1  corresponding to L=9 in Table 1.6 (Pg No. 25)of the textbook is a misprint.\n",
"// The value should be 452.5 and 4.955476 respectively instead of 455 and 18.2 as printed in the textbook.\n",
"//Hence there is a change in the activation energy obtained from the code \n",
"// The answer obtained is 21.3935 kcal/mol instead of 27 kcal/mol as reported in the textbook.\n",
"//Figure 1.8 is a plot between ln k_1 vs 1000/T instead of k_1 vs 1000/T as stated in the solution of Ex1.4.a\n",
"//=========================================================================================================\n",
"//Disclaimer (Ex1.4.b): There is a discrepancy between the computed value of activation energy and value reported in textbook \n",
"// Error could have been on similar lines as reported for example Ex.1.4.a \n",
"// Further, intermeidate values for Ex.1.4.b is not available/ reported in textbook and hence could not be compared. \n",
"//Figure 1.8 is a plot between ln k_2 vs 1000/T instead of k_2 vs 1000/T as stated in the solution of Ex1.4.b\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.5: Methods_to_determine_km_and_vm.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Harriot P.,2003,Chemical Reactor Design (I-Edition) Marcel Dekker,Inc.,USA,pp 436. \n",
"//Chapter-1 Ex1.5 Pg No. 29\n",
"//Title: Methods to determine km and vm\n",
"//========================================================================================\n",
"clear\n",
"clc\n",
"clf\n",
"//INPUT\n",
"S=[2;5;10;15]*10^(-3);//Concentration of substrate [HCO3]\n",
"r_reciprocal=[95;45;29;25]*10^(3);//Reciprocal rates (L-sec/mol)\n",
"\n",
"//CALCULATION\n",
"//Plot 1 refer equation 1.24 Pg No.29\n",
"x1=(S).^(-1);\n",
"y1=r_reciprocal;\n",
"scf(0)\n",
"plot(x1,y1*10^(-3),'RED');\n",
"xlabel('1/[S]');\n",
"ylabel('(1/r)*10^-3');\n",
"xtitle('1/r versus 1/S');\n",
"p=length(x1);\n",
"X_1=[x1 ones(p,1)];\n",
"R1=X_1\y1;\n",
"slope(1)=R1(1,1);\n",
"intercept(1)=R1(2,1);\n",
"v_m(1)=(1/(intercept(1)));//Maximum Reaction Rate(mol/L-sec)\n",
"k_m(1)=slope(1)*v_m(1);//Michaelis-Menton constant\n",
"\n",
"//Plot 2 refer equation 1.25 Pg No.29\n",
"x2=S;\n",
"y2=S.*r_reciprocal;\n",
"scf(1)\n",
"plot(x2*10^(3),y2);\n",
"xlabel('(S)*10^3');\n",
"ylabel('(S)/r');\n",
"xtitle('(S)/r versus (S)');\n",
"q=length(x2);\n",
"X_2=[x2 ones(q,1)];\n",
"R2=X_2\y2;\n",
"slope(2)=R2(1,1);\n",
"intercept(2)=R2(2,1);\n",
"v_m(2)=1/(slope(2));//Maximum Reaction Rate (mol/L-sec)\n",
"k_m(2)=intercept(2)/(slope(2));//Michaelis-Menton constant\n",
"\n",
"\n",
"//OUTPUT\n",
"mprintf('\n======================================================================================');\n",
"mprintf('\n    \t\tMethod_1\tMethod_2');\n",
"mprintf('\n======================================================================================');\n",
"i=1\n",
"    mprintf('\n  Slope    \t%f\t%f',slope(i),slope(i+1));\n",
"    mprintf('\n  Intercept  \t%f\t%f',intercept(i),intercept(i+1));\n",
"    mprintf('\n  Km (M)      \t%f\t%f',k_m(i),k_m(i+1));\n",
"    mprintf('\n  Vm(mol/L-sec) %f\t%f',v_m(i),v_m(i+1));\n",
"\n",
"//FILE OUTPUT\n",
"fid= mopen('.\Chapter1-Ex5-Output.txt','w');\n",
"mfprintf(fid,'\n======================================================================================');\n",
"mfprintf(fid,'\n    \t\tMethod_1\tMethod_2');\n",
"mfprintf(fid,'\n======================================================================================');\n",
"i=1\n",
"    mfprintf(fid,'\n  Slope    \t%f\t%f',slope(i),slope(i+1));\n",
"    mfprintf(fid,'\n  Intercept  \t%f\t%f',intercept(i),intercept(i+1));\n",
"    mfprintf(fid,'\n  Km (M)      \t%f\t%f',k_m(i),k_m(i+1));\n",
"    mfprintf(fid,'\n  Vm(mol/L-sec) %f\t%f',v_m(i),v_m(i+1));\n",
"mclose(fid);\n",
"\n",
"//========================================================================END OF PROGRAM=================================\n",
"//Disclaimer: Least Square method is used to find the slope and intercept in this example.\n",
"// Hence the values differ from the graphically obtained values of slope and intercept in the textbook.\n",
" \n",
""
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}