File: README

package info (click to toggle)
gastables 0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 348 kB
  • ctags: 337
  • sloc: python: 1,698; makefile: 36
file content (388 lines) | stat: -rw-r--r-- 14,564 bytes parent folder | download | duplicates (3)
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
NOTATIONS:
---------
M - mach number, 
A - area, 
P - pressure, 
T - temperature, 
rho - density,
F - impulse function
f - mean coefficient of friction
D - hydraulic mean diameter
Lmax - maximum pipe length required for choking conditions
g = Cp/Cv (ratio of specific heats) (can be set to required value using
__init__ while creating the instance of the class)

SUBSCRIPTS:
----------
o - Stagnation quantity
x - Upstream of shock
y - Downstream of shock
star - corresponding to choking condition (M = 1)
starref - corresponding to M = 1/(sqrt(gamma))

Note: All the angles here are in degrees.

I. Isentropic: Isentropic Flow Relations
------------------------------------------
Python module for isentropic flow properties

Assumptions:
1) One dimensional isentropic flow
2) Perfect gas with constant specific heats and molecular weights

Here is an example on how to use the module:

In [1]: from gastables.Isentropic import Isentropic

In [2]: isen = Isentropic()

In [3]: isen.get_
isen.get_AP_by_AstarPo_from_M         isen.get_M_from_T_by_To
isen.get_AP_by_AstarPo_from_P_by_Po   isen.get_M_from_rho_by_rhoo
isen.get_AP_by_AstarPo_from_T_by_To   isen.get_Mstar_from_M
isen.get_A_by_Astar_from_M            isen.get_P_by_Po_from_M
isen.get_A_by_Astar_from_P_by_Po      isen.get_P_by_Po_from_T_by_To
isen.get_A_by_Astar_from_T_by_To      isen.get_P_by_Po_from_rho_by_rhoo
isen.get_A_by_Astar_from_rho_by_rhoo  isen.get_T_by_To_from_M
isen.get_F_by_Fstar_from_M            isen.get_T_by_To_from_P_by_Po
isen.get_F_by_Fstar_from_P_by_Po      isen.get_T_by_To_from_rho_by_rhoo
isen.get_F_by_Fstar_from_T_by_To      isen.get_rho_by_rhoo_from_M
isen.get_F_by_Fstar_from_rho_by_rhoo  isen.get_rho_by_rhoo_from_P_by_Po
isen.get_M_from_A_by_Astar            isen.get_rho_by_rhoo_from_T_by_To
isen.get_M_from_P_by_Po               

In [3]: isen.get_P_by_Po_from_M(0.5)
Out[3]: 0.84301917542255311

In [4]: isen.get_P_by_Po_from_M(2.0)
Out[4]: 0.12780452546295096

In [5]: isen.get_M_from_T_by_To(0.5)
Out[5]: 2.2360679774997898

II. NormalShock: Normal Shock Relations
-----------------------------------------
Python module for properties across a normal shock in perfect gases

Assumptions:
1) One dimensional flow
2) Constant area duct
3) Perfect gas with constant specific heat and molecular weights
4) Adiabatic flow

Here is an example on how to use the module:

In [1]: from gastables.NormalShock import NormalShock

In [2]: ns = NormalShock()

In [3]: ns.get
ns.get_Mx_from_My                    ns.get_Poy_by_Px_from_My
ns.get_Mx_from_Poy_by_Pox            ns.get_Poy_by_Px_from_Poy_by_Pox
ns.get_Mx_from_Poy_by_Px             ns.get_Poy_by_Px_from_Py_by_Px
ns.get_Mx_from_Py_by_Px              ns.get_Poy_by_Px_from_Ty_by_Tx
ns.get_Mx_from_Ty_by_Tx              ns.get_Poy_by_Px_from_rhoy_by_rhox
ns.get_Mx_from_rhoy_by_rhox          ns.get_Py_by_Px_from_Mx
ns.get_My_from_Mx                    ns.get_Py_by_Px_from_My
ns.get_My_from_Poy_by_Pox            ns.get_Py_by_Px_from_Poy_by_Pox
ns.get_My_from_Poy_by_Px             ns.get_Py_by_Px_from_Poy_by_Px
ns.get_My_from_Py_by_Px              ns.get_Py_by_Px_from_Ty_by_Tx
ns.get_My_from_Ty_by_Tx              ns.get_Ty_by_Tx_from_Mx
ns.get_My_from_rhoy_by_rhox          ns.get_Ty_by_Tx_from_My
ns.get_Poy_by_Pox_from_Mx            ns.get_Ty_by_Tx_from_Poy_by_Pox
ns.get_Poy_by_Pox_from_My            ns.get_Ty_by_Tx_from_Poy_by_Px
ns.get_Poy_by_Pox_from_Poy_by_Px     ns.get_Ty_by_Tx_from_Py_by_Px
ns.get_Poy_by_Pox_from_Py_by_Px      ns.get_Ty_by_Tx_from_rhoy_by_rhox
ns.get_Poy_by_Pox_from_Ty_by_Tx      ns.get_rhoy_by_rhox_from_Mx
ns.get_Poy_by_Pox_from_rhoy_by_rhox  ns.get_rhoy_by_rhox_from_My
ns.get_Poy_by_Px_from_Mx             

In [3]: ns.get_Poy_by_Po
ns.get_Poy_by_Pox_from_Mx            ns.get_Poy_by_Pox_from_Py_by_Px
ns.get_Poy_by_Pox_from_My            ns.get_Poy_by_Pox_from_Ty_by_Tx
ns.get_Poy_by_Pox_from_Poy_by_Px     ns.get_Poy_by_Pox_from_rhoy_by_rhox

In [3]: ns.get_Poy_by_Pox_from_Mx(5)
Out[3]: 0.061716319748617687

In [4]: ns.get_Poy_by_Pox_from_My(0.5)
Out[4]: 0.4431116697730248

In [5]: ns.get_Ty_by_Tx_from_Po
ns.get_Ty_by_Tx_from_Poy_by_Pox  ns.get_Ty_by_Tx_from_Poy_by_Px

In [5]: ns.get_Ty_by_Tx_from_Poy_by_Px(26.539)
Out[5]: 4.87513640205

In [6]: ns.get_Mx
ns.get_Mx_from_My            ns.get_Mx_from_Poy_by_Px     ns.get_Mx_from_Ty_by_Tx
ns.get_Mx_from_Poy_by_Pox    ns.get_Mx_from_Py_by_Px      ns.get_Mx_from_rhoy_by_rhox

In [6]: ns.get_Mx_from_Py_by_Px(25.059)
Out[6]: 4.6499462362483293


III. ObliqueShock: Oblique Shock Relations.
---------------------------------------------
Python module for properties behind an oblique shock in perfect gases

An Oblique shock wave is inclined at an angle to the direction of upstream
flow. Supersonic flow passing through an oblique shock (wave angle = beta)
is deflected through an angle (delta).

Assumptions:
1) Perfect gas with constant specific heats and molecular weights
2) Adiabatic flow
3) Absence of body forces
4) Absence of external work

Note: By default the shcok is assumed to be a weak shock. The third
argument in some functions can be passed as True for strong shock.

Here is an example on how to use the module:

In [2]: from gastables.ObliqueShock import ObliqueShock

In [3]: os = ObliqueShock()

In [4]: os.get_My_from_Mx_and_Turn_Angle(2.021,22.766)
Out[4]: 1.0385397188618728

In [5]: os.get_Wave_Angle_from_Mx_and_Turn_Angle(2.021,22.766)
Out[5]: 59.9807566824

# For strong shock pass True as third argument
In [6]: os.get_Wave_Angle_from_Mx_and_Turn_Angle(2.021,22.766,True)
Out[6]: 69.0023737176

In [7]: os.get_
os.get_My_from_Mx_and_Turn_Angle            os.get_Turn_Angle_from_Mx_and_Wave_Angle
os.get_Poy_by_Pox_from_Mx_and_Turn_Angle    os.get_Ty_by_Tx_from_Mx_and_Turn_Angle
os.get_Poy_by_Pox_from_Mx_and_Wave_Angle    os.get_Ty_by_Tx_from_Mx_and_Wave_Angle
os.get_Poy_by_Px_from_Mx_and_Turn_Angle     os.get_Wave_Angle_from_Mx_and_Turn_Angle
os.get_Poy_by_Px_from_Mx_and_Wave_Angle     os.get_rhoy_by_rhox_from_Mx_and_Turn_Angle
os.get_Py_by_Px_from_Mx_and_Turn_Angle      os.get_rhoy_by_rhox_from_Mx_and_Wave_Angle
os.get_Py_by_Px_from_Mx_and_Wave_Angle      

In [7]: os.get_Poy_by_Pox
os.get_Poy_by_Pox_from_Mx_and_Turn_Angle  os.get_Poy_by_Pox_from_Mx_and_Wave_Angle

In [7]: os.get_Poy_by_Pox_from_Mx_and_Turn_Angle(3.0,30.0)
Out[7]: 7.679656883341166

IV. FannoFlow: Flow of perfect gases with friction.
----------------------------------------------------
Python module for flow properties of perfect gases with friction

In Fanno flow, friction in the passage leads to increase in entropy
and takes the process towards the choking conditions, (M = M* = 1).

Assumptions:
1) One dimensional flow with friction
2) Constant area duct
3) perfect gas with constant specific heats and molecular weights
4) adiabatic flow

Here is an example on how to use the module:

In [1]: from gastables.FannoFlow import FannoFlow

In [2]: fanno = FannoFlow()

In [3]: fanno.get
fanno.get_4fLmax_by_D_from_M                fanno.get_P_by_Pstar_from_M
fanno.get_4fLmax_by_D_from_P_by_Pstar       fanno.get_P_by_Pstar_from_T_by_Tstar
fanno.get_4fLmax_by_D_from_T_by_Tstar       fanno.get_P_by_Pstar_from_rho_by_rhostar
fanno.get_4fLmax_by_D_from_rho_by_rhostar   fanno.get_Po_by_Postar_from_M
fanno.get_F_by_Fstar_from_M                 fanno.get_Po_by_Postar_from_P_by_Pstar
fanno.get_F_by_Fstar_from_P_by_Pstar        fanno.get_Po_by_Postar_from_T_by_Tstar
fanno.get_F_by_Fstar_from_T_by_Tstar        fanno.get_Po_by_Postar_from_rho_by_rhostar
fanno.get_F_by_Fstar_from_rho_by_rhostar    fanno.get_T_by_Tstar_from_M
fanno.get_M_from_4fLmax_by_D                fanno.get_T_by_Tstar_from_P_by_Pstar
fanno.get_M_from_F_by_Fstar                 fanno.get_T_by_Tstar_from_rho_by_rhostar
fanno.get_M_from_P_by_Pstar                 fanno.get_rho_by_rhostar_from_M
fanno.get_M_from_Po_by_Postar               fanno.get_rho_by_rhostar_from_P_by_Pstar
fanno.get_M_from_T_by_Tstar                 fanno.get_rho_by_rhostar_from_T_by_Tstar
fanno.get_M_from_rho_by_rhostar             

In [4]: fanno.get_4
fanno.get_4fLmax_by_D_from_M               fanno.get_4fLmax_by_D_from_T_by_Tstar
fanno.get_4fLmax_by_D_from_P_by_Pstar      fanno.get_4fLmax_by_D_from_rho_by_rhostar

In [4]: fanno.get_4fLmax_by_D_from_M(0.5)
Out[4]: 1.0690603127182559

In [5]: fanno.get_F_by_Fstar_from_P_by_Pstar(2.052)
Out[5]: 1.17863071465

In [6]: fanno.get_Po_by_Postar_from_M(1.2)
Out[6]: 1.0304397530864196

In [7]: fanno.get_M_from_Po_by_Postar(1.005)
Out[7]: (0.92428188796465904, 1.0790452746820094)

In [8]: fanno.get_M_from_F_by_Fstar(1.1)
Out[8]: (0.60703129627133123, 1.8436507466136263)

V. Isothermal: Isothermal flow of perfect gases with friction.
---------------------------------------------------------------
Python module for isothermal flow of perfect gases with friction

The combined effect of friction and heat transfer in long ducts can be
condidered to isothermal flow model.

Here the reference value of the properties (p*, rho*,c*,To*,po* and Lmax)
are taken at the Mach number M* = 1/sqrt(gamma)

Assumptions:
1) One dimensional flow with friction and heat transfer
2) Constant area duct
3) Perfect gas with constant specific heat and Molecular weights
4) Isothermal flow

Here is an example on how to use the module:

In [1]: from gastables.Isothermal import Isothermal

In [2]: isot = Isothermal()

In [3]: isot.get_
isot.get_4fLmax_by_D_from_M
isot.get_4fLmax_by_D_from_P_by_Pstarref
isot.get_4fLmax_by_D_from_Po_by_Postarref
isot.get_4fLmax_by_D_from_To_by_Tostarref
isot.get_4fLmax_by_D_from_rhostarref_by_rho
isot.get_M_from_4fLmax_by_D
isot.get_M_from_P_by_Pstarref
isot.get_M_from_Po_by_Postarref
isot.get_M_from_To_by_Tostarref
isot.get_M_from_rhostarref_by_rho
isot.get_P_by_Pstarref_from_4fLmax_by_D
isot.get_P_by_Pstarref_from_M
isot.get_P_by_Pstarref_from_Po_by_Postarref
isot.get_P_by_Pstarref_from_To_by_Tostarref
isot.get_P_by_Pstarref_from_rhostarref_by_rho
isot.get_Po_by_Postarref_from_4fLmax_by_D
isot.get_Po_by_Postarref_from_M
isot.get_Po_by_Postarref_from_P_by_Pstarref
isot.get_Po_by_Postarref_from_To_by_Tostarref
isot.get_Po_by_Postarref_from_rhostarref_by_rho
isot.get_To_by_Tostarref_from_4fLmax_by_D
isot.get_To_by_Tostarref_from_M
isot.get_To_by_Tostarref_from_P_by_Pstarref
isot.get_To_by_Tostarref_from_Po_by_Postarref
isot.get_To_by_Tostarref_from_rhostarref_by_rho
isot.get_rhostarref_by_rho_from_4fLmax_by_D
isot.get_rhostarref_by_rho_from_M
isot.get_rhostarref_by_rho_from_P_by_Pstarref
isot.get_rhostarref_by_rho_from_Po_by_Postarref
isot.get_rhostarref_by_rho_from_To_by_Tostarref

In [3]: isot.get_P_by_Pstarref_from_M(0.5)
Out[3]: 1.6903085094570331

In [4]: isot.get_M_from_P_by_Pstarref(1.69)
Out[4]: 0.50009127498728789

In [5]: isot.get_Po_by_Postarref_from_M(0.72)
Out[5]: 1.0389216000603498

In [6]: isot.get_Po_by_Postarref_from_4fLmax_by_D(0.0573)
Out[6]: (1.0389074471204016, 1.0045176597541905)

In [7]: isot.get_M_from_4fLmax_by_D(0.0573)
Out[7]: (0.72002864714503501, 1.0112028829769613)

V. RayleighFlow: Flow of perfect gases with friction
-------------------------------------------------------
Python module for flow properties of perfect gases with heat transfer

In Rayleigh flow, heat addition increases the entropy and takes the process
towards the choking conditions, (M = M* = 1). This behaviour imposes a limit
to heat addition, therefore for a given initial Mach number there is a fixed
value of the maximum possible heat transfer (Qmax).

Assumptions:
1) One dimensional flow with Heat transfer
2) Constant area duct
3) Perfect gas with constant specific heats and molecular weights

Here is an example on how to use the module:

In [1]: from gastables.RayleighFlow import RayleighFlow

In [2]: rf = RayleighFlow()

In [3]: rf.get_
rf.get_M_from_P_by_Pstar                 rf.get_Qmax_by_CpT_from_T_by_Tstar
rf.get_M_from_Po_by_Postar               rf.get_Qmax_by_CpT_from_To_by_Tostar
rf.get_M_from_T_by_Tstar                 rf.get_Qmax_by_CpT_from_rho_by_rhostar
rf.get_M_from_To_by_Tostar               rf.get_T_by_Tstar_from_M
rf.get_M_from_rho_by_rhostar             rf.get_T_by_Tstar_from_P_by_Pstar
rf.get_P_by_Pstar_from_M                 rf.get_T_by_Tstar_from_Po_by_Postar
rf.get_P_by_Pstar_from_Po_by_Postar      rf.get_T_by_Tstar_from_To_by_Tostar
rf.get_P_by_Pstar_from_T_by_Tstar        rf.get_T_by_Tstar_from_rho_by_rhostar
rf.get_P_by_Pstar_from_To_by_Tostar      rf.get_To_by_Tostar_from_M
rf.get_P_by_Pstar_from_rho_by_rhostar    rf.get_To_by_Tostar_from_P_by_Pstar
rf.get_Po_by_Postar_from_M               rf.get_To_by_Tostar_from_Po_by_Postar
rf.get_Po_by_Postar_from_P_by_Pstar      rf.get_To_by_Tostar_from_T_by_Tstar
rf.get_Po_by_Postar_from_T_by_Tstar      rf.get_To_by_Tostar_from_rho_by_rhostar
rf.get_Po_by_Postar_from_To_by_Tostar    rf.get_rho_by_rhostar_from_M
rf.get_Po_by_Postar_from_rho_by_rhostar  rf.get_rho_by_rhostar_from_P_by_Pstar
rf.get_Qmax_by_CpT_from_M                rf.get_rho_by_rhostar_from_Po_by_Postar
rf.get_Qmax_by_CpT_from_P_by_Pstar       rf.get_rho_by_rhostar_from_T_by_Tstar
rf.get_Qmax_by_CpT_from_Po_by_Postar     rf.get_rho_by_rhostar_from_To_by_Tostar

In [3]: rf.get_P_by_Pstar_from_M(0.5)
Out[3]: 1.7777777777777777

In [4]: rf.get_M_from_rho_by_rhostar(2.0)
Out[4]: 0.54232614454664041

In [5]: rf.get_M_from_rho_by_rhostar(2.0)
Out[5]: 0.54232614454664041

In [6]: rf.get_M_from_To_by_Tostar(0.810)
Out[6]: (0.59188297137319557, 1.9193987012093878)

In [7]: rf.get_Po_by_Postar_from_To_by_Tostar(0.9)
Out[7]: (1.0464160348349931, 1.1402610122255414)

VII: PrandtlMeyer: Prandtl Meyer functions and mach angles.
------------------------------------------------------------
Python module for Prandtl Meyer functions with Mach angles

Assumptions:
1) Perfect gas with constant specific heats and molecular weights
2) Isentropic flow

Here is an example on how to use the module:

In [1]: from gastables.PrandtlMeyer import PrandtlMeyer

In [2]: pm = PrandtlMeyer()

In [3]: pm.get_
pm.get_M_from_Mach_Angle    pm.get_Mach_Angle_from_M    
pm.get_M_from_Prandtl_Func  pm.get_Prandtl_Func_from_M  

In [3]: pm.get_Prandtl_Func_from_M(2.0)
Out[3]: 26.379760813416457

In [4]: pm.get_M_from_Prandtl_Func(_)
Out[4]: 2.0

In [5]: pm.get_M_from_Prandtl_Func(30.0)
Out[5]: 2.13390503323

In [6]: pm.get
pm.get_M_from_Mach_Angle    pm.get_Mach_Angle_from_M    
pm.get_M_from_Prandtl_Func  pm.get_Prandtl_Func_from_M  

In [6]: pm.get_Mach_Angle_from_M(2.0)
Out[6]: 30.000000000000004


Author: Varun Hiremath

-- Varun Hiremath <varunhiremath@gmail.com>  Sat, 24 Mar 2007 17:23:54 +0530