summaryrefslogtreecommitdiff
path: root/Thermodynamics_for_Engineers/Chapter_15_3.ipynb
blob: 25cf3bae9ca7c790ed3f1567a40f9cbeeec2822f (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:d798b16416897dedbfd57aff5c233c1f7e9c52a7f0081b45c972d6ab47468c7c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15 - Thermodynamics of chemical reactions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the amount of dissociation\n",
      "#Initalization of variables\n",
      "import math\n",
      "import numpy\n",
      "kp=math.pow(10,(1.45))\n",
      "#calculations\n",
      "s=[1-kp*kp , 0, -3, 2]\n",
      "vec=numpy.roots(s)\n",
      "X=numpy.real(vec[2])\n",
      "xper=X*100\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Amount of dissociaton =\",xper,\"percent\")\n",
      "print '%s %.3f %s %.3f %s %.3f %s' %(\"\\n Of each original mole of CO2, there will be\",X,\"mole of CO \",X/2.,\" mol of Oxygen and\",(1-X),\"mol of CO2\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Amount of dissociaton = 12.7 percent\n",
        "\n",
        " Of each original mole of CO2, there will be 0.127 mole of CO  0.063  mol of Oxygen and 0.873 mol of CO2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the max. temperature reached\n",
      "#Initalization of variables\n",
      "U=121200. #Btu/mol\n",
      "Uco2=51635. #Btu/mol\n",
      "Un2=27589. #Btu/mol\n",
      "Uco22=57875. #Btu/mol\n",
      "Un22=21036. #Btu/mol\n",
      "T1=5000. #R\n",
      "T2=5500. #R\n",
      "#calculations\n",
      "Ut1=Uco2+1.88*Un2\n",
      "Ut2=Uco22 + 1.88*Un22\n",
      "print '%s' %(\"By extrapolation,\")\n",
      "Tx=5710 #R\n",
      "#results\n",
      "print '%s %d %s' %(\"Max. Temperature reached =\",Tx,\"R\")\n",
      "print '%s' %(\"The calculation for Ut2 is wrong in textbook. Please use a calculator.\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "By extrapolation,\n",
        "Max. Temperature reached = 5710 R\n",
        "The calculation for Ut2 is wrong in textbook. Please use a calculator.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the max. obtainable temperature\n",
      "#Initalization of variables\n",
      "print '%s' %(\"By trial and error,\")\n",
      "import math\n",
      "X=0.201\n",
      "X1=0.2\n",
      "R=59.3 #universal gas constant\n",
      "T=5000 #R\n",
      "U=121200 #Btu/mol\n",
      "Uco2=51635. #Btu/mol\n",
      "Un2=27907. #Btu/mol\n",
      "U3=29616. #Btu/mol\n",
      "U4=27589. #Btu/mol\n",
      "#calculations\n",
      "kp1=R*(1-X1)/math.pow(X1,1.5) /math.pow(T,0.5)\n",
      "kp2=R*(1-X)/math.pow(X,1.5) /math.pow(T,0.5)\n",
      "q=(1-X)*Uco2 + X*Un2+ X/2 *U3 +1.88*U4 + X*U\n",
      "print '%s' %(\"Interpolating between T=4500 R and T=5000 R, we get\")\n",
      "T2=4907 #R\n",
      "#results\n",
      "print '%s %d %s' %(\"Max. obtainable temperature =\",T2,\" R\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "By trial and error,\n",
        "Interpolating between T=4500 R and T=5000 R, we get\n",
        "Max. obtainable temperature = 4907  R\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}