summaryrefslogtreecommitdiff
path: root/Concepts_of_Thermodynamics/Chapter12.ipynb
blob: f88c4b5ffc07e61a247fbed142c03d5cd5e415ec (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 - The ideal gas and deviations of real gases"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the work done in the process\n",
      "#Initialization of variables\n",
      "import math\n",
      "n=1.3\n",
      "T1=460+60. #R\n",
      "P1=14.7 #psia\n",
      "P2=125. #psia\n",
      "R=1545.\n",
      "M=29.\n",
      "#calculations\n",
      "T2=T1*math.pow((P2/P1),((n-1)/n))\n",
      "wrev=R/M *(T2-T1)/(1-n)\n",
      "#results\n",
      "print '%s %d %s' %(\"Work done =\",wrev,\"ft-lbf/lbm\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done = -58988 ft-lbf/lbm\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the change in kinetic energy\n",
      "#Initialization of variables\n",
      "import math\n",
      "P2=10. #psia\n",
      "P1=100. #psia\n",
      "T1=900. #R\n",
      "w=50 #Btu/lbm\n",
      "k=1.39\n",
      "cp=0.2418\n",
      "#calculations\n",
      "T2=T1*math.pow((P2/P1),((k-1)/k))\n",
      "T2=477\n",
      "KE=-w-cp*(T2-T1)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Change in kinetic energy =\",KE,\" Btu/lbm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in kinetic energy = 52.3  Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final temperature of the system\n",
      "#Initialization of variables\n",
      "T1=900. #R\n",
      "P1=100. #psia\n",
      "P2=10. #psia\n",
      "#calculations\n",
      "print '%s' %(\"From table B-9\")\n",
      "pr1=8.411\n",
      "pr2=pr1*P2/P1\n",
      "T2=468. #R\n",
      "#results\n",
      "print '%s %d %s' %(\"Final temperature =\",T2,\"R \")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table B-9\n",
        "Final temperature = 468 R \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcuate the final temperature, pressure, enthalpy and the work done in the process\n",
      "#Initialization of variables\n",
      "cr=6\n",
      "p1=14.7 #psia\n",
      "t1=60.3 #F\n",
      "M=29.\n",
      "R=1.986\n",
      "#calculations\n",
      "print '%s' %(\"from table b-9\")\n",
      "vr1=158.58 \n",
      "u1=88.62 #Btu/lbm\n",
      "pr1=1.2147\n",
      "vr2=vr1/cr\n",
      "T2=1050. #R\n",
      "u2=181.47 #Btu/lbm\n",
      "pr2=14.686\n",
      "p2=p1*(pr2/pr1)\n",
      "dw=u1-u2\n",
      "h2=u2+T2*R/M\n",
      "#results\n",
      "print '%s %d %s' %(\"final temperature =\",T2,\" R\")\n",
      "print '%s %.1f %s' %(\"\\n final pressure =\",p2,\"psia\")\n",
      "print '%s %.2f %s' %(\"\\n work done =\",dw,\"Btu/lbm\")\n",
      "print '%s %.1f %s' %(\"\\n final enthalpy =\",h2,\" Btu/lbm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "from table b-9\n",
        "final temperature = 1050  R\n",
        "\n",
        " final pressure = 177.7 psia\n",
        "\n",
        " work done = -92.85 Btu/lbm\n",
        "\n",
        " final enthalpy = 253.4  Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}