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
|
{
"metadata": {
"name": "",
"signature": "sha256:4e735a3e117e4e268af257af7ccec75bd1ac3fad4a8f848db2d81766258e8e27"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter5 -The ideal gas"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example1-pg 66"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate specific volumes at given pressure\n",
"##initialisation of variables\n",
"R= 8.314 ##J/mol K\n",
"M= 18.016 ##gms\n",
"T= 400. ##C\n",
"p= 0.01 ##Mpa\n",
"p1= 0.1 ##Mpa\n",
"p2= 20. ##Mpa\n",
"##CALCULATIONS\n",
"v= R*(273.156+T)/(M*p*1000)\n",
"v1= R*(273.156+T)/(M*p1*1000)\n",
"v2= R*(273.156+T)/(M*p2*1000)\n",
"##RESULTS\n",
"print'%s %.3f %s'%(' specific voulme =',v,'m^3/kg')\n",
"print'%s %.3f %s'%('specific voulme = ', v1,'m^3/kg')\n",
"print'%s %.3f %s'%('specific voulme = ',v2,'m^3/kg')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" specific voulme = 31.065 m^3/kg\n",
"specific voulme = 3.106 m^3/kg\n",
"specific voulme = 0.016 m^3/kg\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"example 3-pg73 "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate final temperature and pressure and work ,energy\n",
"##initialisation of variables\n",
"p1= 300.##kPa\n",
"V1= 0.03 ##m^3\n",
"V2= 0.08 ##m^3\n",
"T1= 27. ##C\n",
"##CALCULATIONS1\n",
"T2= T1+273\n",
"p2= p1*(V1/V2)*(T2/(T1+273))\n",
"W= 0\n",
"Q= 0\n",
"##RESULTS\n",
"print'%s %.2f %s'%('final temperature =',T2,'K')\n",
"print'%s %.1f %s'%('final pressure =',p2,'kPa')\n",
"print'%s %.f %s'%('work = ',W,'kJ')\n",
"print'%s %.f %s'%('energy =',Q,'kJ')\n",
" \n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"final temperature = 300.00 K\n",
"final pressure = 112.5 kPa\n",
"work = 0 kJ\n",
"energy = 0 kJ\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example4 -pg74\n",
"\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate mass of nitrogen and final temperature and piston rise\n",
"##initialisation of variables\n",
"p1= 2. ##Mpa\n",
"V1= 0.2 ##m^3\n",
"R= 8.314 ##J/mol K\n",
"T1= 500. ##C\n",
"M= 28. ##gms\n",
"p2= 0.3 ##Mpa\n",
"T2= 250 ##C\n",
"k= 1.4\n",
"A= 0.1 ##m^2\n",
"##CALCULATIONS\n",
"m1= p1*10*10*10*V1*M/(R*(273.15+T1))\n",
"m2= p2*10*10*10*V1*M/(R*(273.15+T2))\n",
"m3= -(m2-m1)\n",
"T3= (m1*(273.15+T1)-m2*(273.15+T2))/(k*m3)\n",
"z3= m3*R*T3/(p2*10*10*10*A*M)\n",
"##RESULTS\n",
"print'%s %.4f %s'%(' mass of nitrogen =',m3,'kg')\n",
"print'%s %.1f %s'%('final temperature =',T3,'K')\n",
"print'%s %.2f %s'%('piston rise =',z3,'m')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" mass of nitrogen = 1.3561 kg\n",
"final temperature = 603.1 K\n",
"piston rise = 8.10 m\n"
]
}
],
"prompt_number": 11
}
],
"metadata": {}
}
]
}
|