summaryrefslogtreecommitdiff
path: root/Introduction_to_flight_by_J_D_Anderson/Appendix_B.ipynb
blob: 283ba0a63ad3ef13db6bc6c59b8f287038276f3e (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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Appendix B"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mass of vapour:  2.77 Kg\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf8 -*-\n",
    "from __future__ import division\n",
    "#Example: 13.3\n",
    "'''Consider 100 m 3 of an air–water vapor mixture at 0.1 MPa, 35◦C, and 70% relative\n",
    "humidity. Calculate the humidity ratio, dew point, mass of air, and mass of vapor.'''\n",
    "\n",
    "#Variable Declaration: \n",
    "r = 0.70\t\t\t#relative humidity\n",
    "Pg = 5.628\t\t\t#saturation pressure in kPa\n",
    "P = 100\t\t\t\t#net pressure kPa \n",
    "V = 100\t\t\t\t#volume in m**3\n",
    "Ra = 0.287\t\t\t#gas constant for water vapour\n",
    "T = 308.2\t\t\t#Temperature in K\n",
    "\n",
    "#Calculations:\n",
    "Pv = r*Pg\t\t\t#vapour pressure in kPa\n",
    "Pa = P-Pv\t\t\t#Partial pressure of air\n",
    "w = 0.622*Pv/Pa\t\t#humidity ratio formula\n",
    "ma = Pa*V/(Ra*T)\t#mass in kg\n",
    "mv = w*ma\t\t\t#mass of vapour\n",
    "\n",
    "#Results:\n",
    "print 'Mass of vapour: ', round(mv,2),'Kg'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mass of vapour condense 2.175 Kg\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf8 -*-\n",
    "from __future__ import division\n",
    "#Example: 13.4\n",
    "'''Calculate the amount of water vapor condensed if the mixture of Example 13.3 is cooled\n",
    "to 5◦C in a constant-pressure process.'''\n",
    "\n",
    "#Variable Declaration: \n",
    "w1 = 0.0255\t\t#w1 = w, humidity ratio at initial temperature\n",
    "ma = 108.6\t\t#mass of air in kg\n",
    "P = 100\t\t\t#kPa net pressure\n",
    "Pg2 = 0.8721\n",
    "\n",
    "#Calculations:\n",
    "Pv2 = Pg2\n",
    "w2 = 0.622*Pv2/(P-Pg2)\n",
    "mc = ma*(w1-w2)\n",
    "\n",
    "#Results:\n",
    "print 'Mass of vapour condense',round(mc,3) ,'Kg'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transferred per unit mass:  -41.65  kJ/kg of dry air\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf8 -*-\n",
    "from __future__ import division\n",
    "#Example: 13.5\n",
    "''' An air-conditioning unit is shown in Fig. 13.5, with pressure, temperature, and relative\n",
    "humidity data. Calculate the heat transfer per kilogram of dry air, assuming that changes\n",
    "in kinetic energy are negligible.'''\n",
    "\n",
    "#Variable Declaration: \n",
    "r1 = 0.80\t\t\t\t#realtive humidity at state 1\n",
    "Pg1 = 4.246\t\t\t\t#saturation pressure of vapour in kPa\n",
    "P1 = 105\t\t\t\t#net pressure at state 1 in kPa\n",
    "P2 = 100\t\t\t\t#net pressure at state 2 in kPa\n",
    "r2 = 0.95\t\t\t\t#relative humidity at state 2\n",
    "Pg2 = 1.7051\t\t\t#saturation pressure of vapour in kPa\n",
    "T1 = 30\t\t\t\t\t#C\n",
    "T2 = 15\t\t\t\t\t#C\n",
    "Cp = 1.004\t\t\t\t#specific heat of water vapour in kJ/kg\n",
    "hv2 = 2528.9\t\t\t#enthalpy of vapourisation of vapour in kJ/kg\n",
    "hv1 = 2556.3\t\t\t#enthalpy of vapourisation of vapour in kJ/kg\n",
    "hl2 = 62.99\t\t\t\n",
    "\n",
    "#Calculations:\n",
    "Pv1 = r1*Pg1\t\t\t#partial pressure of vapour in kPa\n",
    "w1 = 0.622*Pv1/(P1-Pv1)\t#humidity ratio at state 1\n",
    "Pv2 = r2*Pg2\t\t\t#partial pressure of vapour in kPa\n",
    "w2 = 0.622*Pv2/(P2-Pv2)\t#humidity ratio at state 2\n",
    "q = Cp*(T2-T1)+w2*hv2-w1*hv1+hl2*(w1-w2)\t\t#kJ/kg\n",
    "\n",
    "#Results:\n",
    "print 'Heat transferred per unit mass: ',round(q,2),' kJ/kg of dry air'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transferred -339.1 kJ\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf8 -*-\n",
    "from __future__ import division\n",
    "#Example: 13.6\n",
    "''' A tank has a volume of 0.5 m 3 and contains nitrogen and water vapor. The temperature\n",
    "of the mixture is 50◦C, and the total pressure is 2 MPa. The partial pressure of the water\n",
    "vapor is 5 kPa. Calculate the heat transfer when the contents of the tank are cooled to\n",
    "10◦C.'''\n",
    "\n",
    "#Variable Declaration: \n",
    "Pn2 = 1995\t\t\t\t#Pressure of nitrogen in kPa\n",
    "V = 0.5\t\t\t\t\t#Volume in m**3\n",
    "Rn2 = 0.2968\t\t\t#Gas constant for nitrogen in kJ/kg.K\n",
    "Rv = 0.4615\t\t\t\t#gas constant for vapour\n",
    "T1 = 323.2\t\t\t\t#Temperature in K\n",
    "T2 = 283.2\t\t\t\t#Temperature in K\n",
    "Pv1 = 5\t\t\t\t\t#Pressure of water vapour in kPa at state 1\n",
    "Pv2 = 1.2276\t\t\t#Pressure of water vapour in kPa at state 2\n",
    "uv1 = 2443.1\t\t\t#specific internal energy of vapour in kJ/kg at state 1\n",
    "uv2 = 2389.2\t\t\t#specific internal energy of vapour in kJ/kg at state 2\n",
    "ul2 = 42.0\t\t\t\t#specific internal energy of liquid water in kJ/kg\n",
    "Cv = 0.745\t\t\t\t#specific heat at constant volume in kJ/kg.K\n",
    "\n",
    "#Calculations:\n",
    "mn2 = Pn2*V/(Rn2*T1)\t#mass of nitrogen\n",
    "mv1 = Pv1*V/(Rv*T1)\t\t#mass of vapour in kg\n",
    "mv2 = Pv2*V/(Rv*T2)\t\t#mass of vapour in kg\n",
    "ml2 = mv1-mv2\t\t\t#mass of liquid condensed n kg\n",
    "Q = mn2*Cv*(T2-T1)+mv2*uv2+ml2*ul2-mv1*uv1\n",
    "\n",
    "#Results:\n",
    "print 'Heat transferred',round(Q,1),'kJ'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Relative humidity:  0.0107\n",
      "Humidity ratio:  0.399\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf8 -*-\n",
    "from __future__ import division\n",
    "#Example: 13.7\n",
    "'''The pressure of the mixture entering and leaving the adiabatic saturator is 0.1 MPa, the\n",
    "entering temperature is 30◦C, and the temperature leaving is 20◦C, which is the adiabatic\n",
    "saturation temperature. Calculate the humidity ratio and relative humidity of the air–water\n",
    "vapor mixture entering.'''\n",
    "\n",
    "#Variable Declaration: \n",
    "P = 100\t\t\t\t#net pressure n kPa \n",
    "Pg2 = 2.339\t\t\t#saturation pressure of vapour in kPa\n",
    "Cpa = 1.004\t\t\t#specific heat n kJ/kg/K\n",
    "T2 = 20\t\t\t\t#final temp in C\n",
    "T1 = 30\t\t\t\t#initial temp in C\n",
    "Hfg2 = 2454.1\t\t#specific heat difference at state 2 in kJ/kg\n",
    "hv1 = 2556.3\t\t#enthalpy of water vapour at state 1 in kJ/kg\n",
    "hl2 = 83.96\t\t\t#enthalpy of liquid water in kJ/kg\n",
    "Pg1 = 4.246\t\t\t#saturation pressure at state 1 in kPa\n",
    "\n",
    "#Calculations:\n",
    "Pv2 = Pg2\t\t\t#partial pressure of vapour\n",
    "w2 = 0.622*Pv2/(P-Pg2)\n",
    "w1 = (Cpa*(T2-T1)+w2*Hfg2)/(hv1-hl2)\n",
    "Pv1 = 100*w1/(0.622+w1)\n",
    "r = Pv1/Pg1\t\t\t#humidity ratio\n",
    "\n",
    "#Results:\n",
    "print 'Relative humidity: ',round(w1,4)\n",
    "print 'Humidity ratio: ',round(r,3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}