summaryrefslogtreecommitdiff
path: root/Chemical_Reaction_Engineering_by_O._Levenspiel/ch7.ipynb
blob: 6785eea51fbc224c4d57754d416eea3404d06a51 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 : Design for Parallel Reactions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2 page no : 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "#Initial Concentration(mol/litre)eactant in combined feed\n",
      "CAo = 10.\n",
      "CBo = 10. \n",
      "XA = 0.9;             # conversion\n",
      "CAf = CAo*(1-XA);\n",
      "CA = CAf;\n",
      "\n",
      "# Calculations\n",
      "def f4(CA): \n",
      "\t return 1./(1+CA**0.5)\n",
      "\n",
      "Qp = (-1./(CAo-CAf))* quad(f4,CAo,CAf)[0]\n",
      "\n",
      "CRf = 9*Qp;\n",
      "CSf = 9*(1-Qp)\n",
      "# Results\n",
      "print \" Part a\"\n",
      "print \" For Plug Flow\"\n",
      "print \" Concentration of R in the product stream is %.2f mol/litre\"%(CRf)\n",
      "print \" Csf is %.2f mol/litre\"%(CSf)\n",
      "\n",
      "Qm = CA/(CA+CA**1.5);\n",
      "CRf = 9*Qm;\n",
      "Csf = 9*(1-Qm)\n",
      "print \" Part b\"\n",
      "print \" For Mixed Flow\"\n",
      "print \" Concentration of R in the product stream is %.2f mol/litre \"%(CRf)\n",
      "print \" Csf is %.2f mol/litre\"%(Csf)\n",
      "\n",
      "CAo = 19.\n",
      "CB = 1;\n",
      "\n",
      "def f5(CA): \n",
      "\t return CA/(CA+CB**1.5)\n",
      "\n",
      "Q = -1./(CAo-CAf)* quad(f5,CAo,CAf)[0]\n",
      "CRf = 9*Q;\n",
      "Csf = 9*(1-Q)\n",
      "print \" Part c\"\n",
      "print \" For Plug flow A Mixed flow B\"\n",
      "print \" Concentration of R in the product stream is %.2f  mol/litre\"%(CRf)\n",
      "print \" Csf is %.2f mol/litre\"%(Csf)\n",
      "print ('The result for plug flow varies as there seems to be typographical error in integration done in book')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Part a\n",
        " For Plug Flow\n",
        " Concentration of R in the product stream is 2.86 mol/litre\n",
        " Csf is 6.14 mol/litre\n",
        " Part b\n",
        " For Mixed Flow\n",
        " Concentration of R in the product stream is 4.50 mol/litre \n",
        " Csf is 4.50 mol/litre\n",
        " Part c\n",
        " For Plug flow A Mixed flow B\n",
        " Concentration of R in the product stream is 7.85  mol/litre\n",
        " Csf is 1.15 mol/litre\n",
        "The result for plug flow varies as there seems to be typographical error in integration done in book\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3 page no : 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "CAo = 2;          # decomposition of A\n",
      "CA = 0.5;\n",
      "CAf = 0.;\n",
      "\n",
      "Csf = (CAo-CA)*2*CA/(1+CA)**2;\n",
      "\n",
      "print \" Part a\"\n",
      "print \" For Mixed Flow Reactor\"\n",
      "print \" Maximum expected Cs is %.3f\"%(Csf)\n",
      "\n",
      "# Calculations\n",
      "def f12(CA): \n",
      "\t return 2*CA/(1+CA)**2\n",
      "\n",
      "Csf = -1* quad(f12,CAo,CAf)[0]\n",
      "\n",
      "# Results\n",
      "print \" Part b\"\n",
      "print \" For Plug Flow\"\n",
      "print \" Maximum expected concentration of S is %.3f \"%(Csf)\n",
      "\n",
      "CA = 1.;\n",
      "Csf = (CAo-CA)*2*CA/(1+CA)**2;\n",
      "\n",
      "print \"Part c\"\n",
      "print \" For MFR with separation and recycle\" \n",
      "print \" Concentration of Csf is %.2f\"%(Csf)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Part a\n",
        " For Mixed Flow Reactor\n",
        " Maximum expected Cs is 0.667\n",
        " Part b\n",
        " For Plug Flow\n",
        " Maximum expected concentration of S is 0.864 \n",
        "Part c\n",
        " For MFR with separation and recycle\n",
        " Concentration of Csf is 0.50\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.4 page no : 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "CAo = 2.     # based on example 7.3\n",
      "CA = 1.\n",
      "Q = 0.5\n",
      "\n",
      "# Calculations\n",
      "Cs1 = Q*(CAo-CA);\n",
      "\n",
      "def f6(CA): \n",
      "\t return 2*CA/(1+CA)**2\n",
      "\n",
      "Cs2 = -1* quad(f6,1,0)[0]\n",
      "\n",
      "#Total amount of CS formed is\n",
      "Cs = Cs1+Cs2;\n",
      "\n",
      "# Results\n",
      "print \"Mixed flow followed by plug flow would be best\"\n",
      "print \" Total amount of CS formed is %.3f mol/litre\"%(Cs)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mixed flow followed by plug flow would be best\n",
        " Total amount of CS formed is 0.886 mol/litre\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}