summaryrefslogtreecommitdiff
path: root/Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-11 17:31:11 +0530
committerhardythe12015-06-11 17:31:11 +0530
commit251a07c4cbed1a5a960f5ed416ce6ac13c8152b7 (patch)
treecb7f084fad6d7ee6ae89e586fad0e909b5408319 /Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb
parent47d7279a724246ef7aa0f5359cf417992ed04449 (diff)
downloadPython-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.tar.gz
Python-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.tar.bz2
Python-Textbook-Companions-251a07c4cbed1a5a960f5ed416ce6ac13c8152b7.zip
add books
Diffstat (limited to 'Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb')
-rwxr-xr-xGas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb1421
1 files changed, 1421 insertions, 0 deletions
diff --git a/Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb b/Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb
new file mode 100755
index 00000000..8633bde3
--- /dev/null
+++ b/Gas_Dynamics_and_Jet_Propulsion_by_P._Murugaperumal/ch3.ipynb
@@ -0,0 +1,1421 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e125bf54ea1a9a80b48556c3a0d9bfe5a0daef9c6dd0d17606321588bbf0db06"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3 : Flow through constant area duct adiabatic flow"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.1 page : 11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
+ "M2 = 1 \t\t\t\t#Mach number at exit\n",
+ "D = 0.04 \t\t\t\t#inner tude diameter in m\n",
+ "f = 0.002 \t\t\t\t#frictional factor\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter at entry from gas tables @M1 = 0.25\n",
+ "X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter at exit from gas tables @M2 = 1\n",
+ "X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter i.e. (4*f*L)/D\n",
+ "L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.3f m'%(L)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 42.685 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.2 page : 11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.1 \t\t\t\t#Mach number at entrance\n",
+ "M2 = 0.5 \t\t\t\t#Mach number at a section\n",
+ "M3 = 1 \t\t\t\t#Mach number at critical condition\n",
+ "D = 0.02 \t\t\t\t#Diameter of duct in m\n",
+ "f = 0.004 \t\t\t\t#Frictional factor\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "X1 = 66.922 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1 = 0.1\n",
+ "X2 = 1.069 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 0.5\n",
+ "X3 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M3 = 1\n",
+ "X4 = X1-X3 \t\t\t\t#\t\t\t\t#frictional consmath.tant fanno parameter from M2 = 0.1 to M3 = 1\n",
+ "L1 = (X4*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "X5 = X2-X3 \t\t\t\t#frictional consmath.tant fanno parameter from M2 = 0.5 to M3 = 1\n",
+ "L2 = (X5*D)/(4*f) \t\t\t\t#Addition length of the pipe required to accelerate into critical condition in m\n",
+ "L = L1-L2 \t\t\t\t#Length of the pipe required to accelerate the flow from M1 = 0.1 to M2 = 0.5 in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output \n",
+ "print 'A)Length of the pipe required to accelerate the flow from M1 = %3.1f to M2 = %3.1f is %3.3f m \\\n",
+ "\\nB)Additional length required to accelerate into critical condition is %3.5f m'%(M1,M2,L,L2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe required to accelerate the flow from M1 = 0.1 to M2 = 0.5 is 82.316 m \n",
+ "B)Additional length required to accelerate into critical condition is 1.33625 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.3 page : 12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D = 0.05 \t\t\t\t#inner pipe diameter in m\n",
+ "Po = 10 \t\t\t\t#Stagnation Pressure at reservoir in bar\n",
+ "To = 400 \t\t\t\t#Stagnation temperature at reservoir in K\n",
+ "f = 0.002 \t\t\t\t#frictional factor \n",
+ "M1 = 3 \t\t\t\t#Mach number at entrance\n",
+ "M2 = 1 \t\t\t\t#Mach number at end of pipe\n",
+ "R = 287 \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "X1 = 0.522 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1 = 3\n",
+ "X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 1\n",
+ "X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "p1 = 0.0272 \t\t\t\t#Pressure ratio from gas tables (M = 3,k = 1.4,isentropiC)\n",
+ "P1 = p1*Po \t\t\t\t#Static pressure at entrance in bar\n",
+ "t1 = 0.3571 \t\t\t\t#Temperature ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
+ "T1 = t1*To \t\t\t\t#Static temperature at entrance in K\n",
+ "d1 = (P1*10**5)/(R*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
+ "A1 = (math.pi*D**2)/4 \t\t\t\t#Cross sectional area of pipe in m**2\n",
+ "m = d1*A1*C1 \t\t\t\t#Mass flow rate in kg/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.2f m \\\n",
+ "\\nB)Mass flow rate is %3.4f kg/s'%(L,m)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 3.26 m \n",
+ "B)Mass flow rate is 0.9363 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.4 page : 13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "C1 = 235. \t\t\t\t#Velocity at entrance in m/s\n",
+ "P1 = 13. \t\t\t\t#Static Pressure at entry in bar\n",
+ "P2 = 10. \t\t\t\t#Static Pressure at a point in duct in bar\n",
+ "T1 = 543. \t\t\t\t#Static temperature at entry in Kelvin\n",
+ "D = 0.15 \t\t\t\t#inner duct diameter in m\n",
+ "f = 0.005 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
+ "M1 = C1/a1 \t\t\t\t#Mach number at entry\n",
+ "p1 = 2.138 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
+ "Pt = P1/p1 \t\t\t\t#Static critical pressure in bar\n",
+ "t1 = 1.143 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5) \n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "c1 = 0.534 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "p2 = 1.644 \t\t\t\t#Pressure ratio from gas tables (fanno flow tables,k = 1.4)\n",
+ "M2 = 0.64 \t\t\t\t#Mach number from gas tables (fanno flow tables,k = 1.4,p2)\n",
+ "c2 = 0.674 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,p2)\n",
+ "C2 = Ct*c2 \t\t\t\t#Air velocity at P2 in m/s\n",
+ "t2 = 1.109 \t\t\t\t#Temperature ratio from gas tables (fanno flow tables,k = 1.4,p2)\n",
+ "T2 = t2*Tt \t\t\t\t#Satic temperature at P2 is K\n",
+ "X1 = 1.06922 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1\n",
+ "X2 = 0.353 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2\n",
+ "X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Temperature and velocity at section of the duct where the pressure has dropped to %3i bar \\\n",
+ "\\ndue to friction are %3.1f K and %3.2f m/s \\\n",
+ "\\nB)The Distance between two section is %3.3f m'%(P2,T2,C2,L)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Temperature and velocity at section of the duct where the pressure has dropped to 10 bar \n",
+ "due to friction are 526.8 K and 296.61 m/s \n",
+ "B)The Distance between two section is 5.372 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.5 page : 14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "P1 = 120. \t\t\t\t#Static pressure at entrance in bar\n",
+ "T1 = 313. \t\t\t\t#Static temperature at entry in Kelvin\n",
+ "M1 = 2.5 \t\t\t\t#Mach number at entrance\n",
+ "M2 = 1.8 \t\t\t\t#Mach number at exit\n",
+ "D = 0.2 \t\t\t\t#inner pipe diameter in m\n",
+ "f = 0.01/4 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
+ "p1 = 0.292 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
+ "Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
+ "t1 = 0.533 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "c1 = 1.826 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "X1 = 0.432 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1 = 3\n",
+ "X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 1\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L1 = (X3*D)/(4*f) \t\t\t\t#Maximum length of the pipe in m\n",
+ "p2 = 0.474 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
+ "P2 = Pt*p2 \t\t\t\t#Static pressure in kPa\n",
+ "t2 = 0.728 \t\t\t\t#static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
+ "T2 = Tt*t2 \t\t\t\t#Static temperature in K\n",
+ "c2 = 1.536 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
+ "C2 = c2*Ct \t\t\t\t#Critical velocity in m/s\n",
+ "X4 = 0.242 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M = 1.8\n",
+ "X5 = X4-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L2 = (X5*D)/(4*f) \t\t\t\t#Length between sonic and oulet section\n",
+ "L = L1-L2 \t\t\t\t#Length of the pipe in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Maximum length of the pipe is %3.2f m \\\n",
+ "\\nB)Properties of air at sonic condition: \\\n",
+ "\\nPressure is %3i kPa \\\n",
+ "\\nTemperature is %3.2f K \\\n",
+ "\\nVelocity is %3.1f m/s \\\n",
+ "\\nC)Length of the pipe is %3.1f m \\\n",
+ "\\nD)Properties of air at M2 = %3.1f: \\\n",
+ "\\nPressure is %3i kPa \\\n",
+ "\\nTemperature is %3.2f K \\\n",
+ "\\nVelocity is %3.2f m/s'%(L1,Pt,Tt,Ct,L,M2,P2,T2,C2)\n",
+ "\n",
+ "# note : rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Maximum length of the pipe is 8.64 m \n",
+ "B)Properties of air at sonic condition: \n",
+ "Pressure is 410 kPa \n",
+ "Temperature is 587.24 K \n",
+ "Velocity is 485.5 m/s \n",
+ "C)Length of the pipe is 3.8 m \n",
+ "D)Properties of air at M2 = 1.8: \n",
+ "Pressure is 194 kPa \n",
+ "Temperature is 427.51 K \n",
+ "Velocity is 745.77 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.6 page : 15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
+ "ds = 0.124 \t\t\t\t#Change in entropy in kJ/kg-K\n",
+ "P1 = 700. \t\t\t\t#Static pressure at entrance in bar\n",
+ "T1 = 333. \t\t\t\t#Static temperature at entry in Kelvin\n",
+ "D = 0.05 \t\t\t\t#inner pipe diameter in m\n",
+ "f = 0.006 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "p1 = math.exp(ds/R) \t\t\t\t#Ratio of Stagnation pressure at inlet to outlet \n",
+ "t1 = 0.987 \t\t\t\t#Ratio of Static Temperature to Stagnation temperature at entry from gas tables @M1\n",
+ "To1 = T1/t1 \t\t\t\t#Stagnation temperature at entry in K\n",
+ "p2 = 0.957 \t\t\t\t#Ratio of Static pressure to Stagnation pressure at entry from gas tables @M1\n",
+ "Po1 = P1/p2 \t\t\t\t#Stagnation pressure at entry in kPa\n",
+ "Po2 = Po1/p1 \t\t\t\t#Stagnation pressure at exit in kPa\n",
+ "a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
+ "p3 = 4.3615 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
+ "Pt = P1/p3 \t\t\t\t#Static critical pressure in kPa\n",
+ "t1 = 1.185 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "c1 = 0.272 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "p4 = 2.4065 \t\t\t\t#Pressure ratio at entry from gas tables @M1,k\n",
+ "Pot = Po1/p4 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
+ "X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k\n",
+ "p5 = Po2/Pot \t\t\t\t#Pressure ratio \n",
+ "M2 = 0.41 \t\t\t\t#Mach number at exit from gas tables @p5\n",
+ "p6 = 2.629 \t\t\t\t#Pressure ratio at exit from gas tables @p5\n",
+ "P2 = Pt*p6 \t\t\t\t#Exit pressure in kPa\n",
+ "t2 = 1.161 \t\t\t\t#Temperature ratio at exit from gas tables @p5\n",
+ "T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
+ "c2 = 0.4415 \t\t\t\t#Velocity ratio at exit from gas tables @p5\n",
+ "C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "X2 = 2.141 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Mach number at exitsection 2) is %3.2f \\\n",
+ "\\nB)Properties at exitsection 2): \\\n",
+ "\\nPressure is %3.2f kPa \\\n",
+ "\\nTemperature is %3i K \\\n",
+ "\\nVelocity is %3.3f m/s \\\n",
+ "\\nC)Length of the duct is %3.3f m'%(M2,P2,T2,C2,L)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Mach number at exitsection 2) is 0.41 \n",
+ "B)Properties at exitsection 2): \n",
+ "Pressure is 421.94 kPa \n",
+ "Temperature is 326 K \n",
+ "Velocity is 148.432 m/s \n",
+ "C)Length of the duct is 13.325 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.7 page : 17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.25 \t\t\t\t#Initial Mach number \n",
+ "M2 = 0.75 \t\t\t\t#Final mach number \n",
+ "P1 = 1.5 \t\t\t\t#Inlet pressure in bar\n",
+ "T1 = 300. \t\t\t\t#Inlet temperature in K\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
+ "p1 = 4.3615 \t\t\t\t#Pressure ratio at entry from gas tables @M1,k\n",
+ "Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
+ "c1 = 0.272 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M1)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "p2 = 1.385 \t\t\t\t#Pressure ratio at exit from gas tables @M2,k\n",
+ "P2 = Pt*p2 \t\t\t\t#Exit pressure in bar\n",
+ "c2 = 0.779 \t\t\t\t#Velocity ratio at exit from gas tables @M2,k\n",
+ "C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'Final pressure and velocity are %3.4f bar and %3.2f m/s'%(P2,C2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final pressure and velocity are 0.4763 bar and 248.58 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.8 page : 17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "T1 = 333. \t\t\t\t#Inlet temperature in K\n",
+ "D = 0.05 \t\t\t\t#inner duct diameter in m\n",
+ "f = 0.005/4 \t\t\t\t#frictional factor\n",
+ "L = 5. \t\t\t\t#Length of the pipe in m\n",
+ "Pt = 101. \t\t\t\t#Exit pressure in kPa, Pt = P2 Since flow is choked \n",
+ "M2 = 1. \t\t\t\t#Mach number at exit math.since pipe is choked \n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "X = (4*f*L)/D \t\t\t\t#frictional consmath.tant fanno parameter \n",
+ "M1 = 0.6 \t\t\t\t#Inlet mach number \n",
+ "t1 = 1.119 \t\t\t\t#Temperature ratio at entry from fanno flow gas tables @M1,k\n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "at = math.sqrt(k*R*10**3*Tt) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
+ "Ct = at \t\t\t\t#air velocity in m/s\n",
+ "d_t = Pt/(R*Tt) \t\t\t\t#Density at exit in kg/m**3\n",
+ "At = math.pi*D**2/4 \t\t\t\t#Critical area in m**2\n",
+ "m = d_t*At*Ct \t\t\t\t#Mass flow rate in kg/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Mach number at inlet is %3.1f \\\n",
+ "\\nB)Mass flow rate is %3.5f kg/s \\\n",
+ "\\nC)Exit temperature is %3.3f K'%(M1,m,Tt)\n",
+ "\n",
+ "# note : rouding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Mach number at inlet is 0.6 \n",
+ "B)Mass flow rate is 0.80291 kg/s \n",
+ "C)Exit temperature is 297.587 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.9 page : 18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "m = 8.25 \t\t\t\t#Mass flow rate in kg/s\n",
+ "M1 = 0.15 \t\t\t\t#Mach number at entrance\n",
+ "M2 = 0.5 \t\t\t\t#Mach number at exit\n",
+ "P1 = 345. \t\t\t\t#Static pressure at entrance in kPa\n",
+ "T1 = 38.+273 \t\t\t\t#Static temperature at entry in Kelvin\n",
+ "f = 0.005 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
+ "\n",
+ "#calculation\n",
+ "d1 = (P1*10**3)/(R*10**3*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
+ "a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
+ "A1 = m/(d1*C1) \t\t\t\t#Inlet area in m**2\n",
+ "D = (math.sqrt((4*A1)/(math.pi)))*10**3 \t\t\t\t#inner duct diameter in mm\n",
+ "p1 = 7.3195 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
+ "Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
+ "t1 = 1.1945 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "c1 = 0.164 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "p2 = 0.984 \t\t\t\t#Pressure ratio at entry from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
+ "Po1 = P1/p2 \t\t\t\t#Stagnation pressure at entry in kPa\n",
+ "p3 = 3.928 \t\t\t\t#Stagnation pressure ratio at entry from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
+ "Pot = Po1/p3 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
+ "X1 = 28.354 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k\n",
+ "p5 = 2.138 \t\t\t\t#Pressure ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
+ "P2 = Pt*p5 \t\t\t\t#Exit pressure in kPa\n",
+ "t2 = 1.143 \t\t\t\t#Temperature ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
+ "T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
+ "c2 = 0.534 \t\t\t\t#Velocity ratio at exit from gas tables (fanno flow tables,k = 1.4,M2) \n",
+ "C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "p6 = 1.34 \t\t\t\t#Stagnation pressure ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
+ "Po2 = Pot*p6 \t\t\t\t#Stagnation pressure at exit in kPa\n",
+ "SPL = Po1-Po2 \t\t\t\t#Stagnation Pressure lose in kPa\n",
+ "X2 = 1.069 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L = (X3*D*10**-3)/(4*f) \t\t\t\t#Length of the duct in m\n",
+ "\n",
+ "\t\t\t\t#verification\n",
+ "a2 = math.sqrt(k*R*10**3*T2) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
+ "M2_v = C2/a2 \t\t\t\t#air velocity in m/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the duct is %3.2f m \\\n",
+ "\\nB)Diameter of the duct is %3i mm \\\n",
+ "\\nC)Pressure and diameter at exit are %3.2f kPa, and %3i mm respectively \\\n",
+ "\\nD)Stagnation Pressure lose is %3i kPa \\\n",
+ "\\nE)using exit velocity %3.2f m/s, \\\n",
+ "\\ntemperature %3.2f K \\\n",
+ "\\nMach number is found to be %3.2f'%(L,D,P2,D,SPL,C2,T2,M2_v)\n",
+ "\n",
+ "# note : rouding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the duct is 308.85 m \n",
+ "B)Diameter of the duct is 226 mm \n",
+ "C)Pressure and diameter at exit are 100.77 kPa, and 226 mm respectively \n",
+ "D)Stagnation Pressure lose is 231 kPa \n",
+ "E)using exit velocity 172.65 m/s, \n",
+ "temperature 297.59 K \n",
+ "Mach number is found to be 0.50\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.10 page : 19"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
+ "f = 0.01/4 \t\t\t\t#frictional factor\n",
+ "D = 0.15 \t\t\t\t#inner pipe diameter in m\n",
+ "p1 = 0.8 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 20%\n",
+ "M3 = 0.8 \t\t\t\t#Mach number at a section\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "p2 = 2.4065 \t\t\t\t#Ratio of Stagnation pressure at entry from gas tables @M1,k = 1.4\n",
+ "X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1\n",
+ "p3 = p1*p2 \t\t\t\t#Ratio of Stagnation pressure at exit\n",
+ "M2 = 0.32 \t\t\t\t#Exit mach number at p1 = 0.8\n",
+ "X2 = 4.447 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2\n",
+ "L1 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "L2 = (X2*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "L = L1-L2 \t\t\t\t#Overall length of the duct in m\n",
+ "p4 = 1.038 \t\t\t\t#Stagnation pressure ratio from M = 1 to M3\n",
+ "PL = (1-(p4/p2))*100 \t\t\t\t#Percentage of stagnation pressure from inlet to section at which M3 in percent\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.2f m \\\n",
+ "\\nB)Mach number at this exit is %3.2f \\\n",
+ "\\nC)Percentage of stagnation pressure from inlet to section at which M = %3.1f is %3.2f percent \\\n",
+ "\\nD)Maximum length to reach choking condition is %3.3f m'%(L,M2,M3,PL,L1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 61.35 m \n",
+ "B)Mach number at this exit is 0.32 \n",
+ "C)Percentage of stagnation pressure from inlet to section at which M = 0.8 is 56.87 percent \n",
+ "D)Maximum length to reach choking condition is 128.055 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.11 page : 20"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D = 0.3 \t\t\t\t#inner duct diameter in m\n",
+ "P1 = 10. \t\t\t\t#Static pressure at entrance in bar\n",
+ "T1 = 400. \t\t\t\t#Static temperature at entry in Kelvin\n",
+ "M1 = 3. \t\t\t\t#Mach number at entrance\n",
+ "M2 = 1. \t\t\t\t#Mach number at exit\n",
+ "k = 1.3 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Specific Gas consmath.tant in J/kg-K, wrong printing in question\n",
+ "f = 0.002 \t\t\t\t#frictional factor\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "p1 = 0.233 \t\t\t\t#Pressure ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
+ "Pt = P1/p1 \t\t\t\t#Static pressure at entrance in bar\n",
+ "t1 = 0.489 \t\t\t\t#Temperature ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
+ "Tt = T1/t1 \t\t\t\t#Static temperature at entrance in K\n",
+ "X1 = 0.628 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.3\n",
+ "L1 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "d_t = (Pt*10**5)/(R*Tt) \t\t\t\t#Density at critical state in kg/m**3, Pt in Pa\n",
+ "at = math.sqrt(k*R*Tt) \t\t\t\t#Sound velocity in m/s, R in J/kg \n",
+ "Ct = at \t\t\t\t#air velocity in m/s\n",
+ "At = (math.pi*D**2)/4 \t\t\t\t#Critical area in m**2\n",
+ "m = d_t*At*Ct \t\t\t\t#Mass flow rate in kg/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.2f m \\\n",
+ "\\nB)Mass flow rate is %3.3f kg/s'%(L1,m)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 23.55 m \n",
+ "B)Mass flow rate is 713.891 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.12 page : 21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
+ "f = 0.04/4 \t\t\t\t#frictional factor\n",
+ "D = 0.15 \t\t\t\t#inner duct diameter in m\n",
+ "p1 = 0.9 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 10%\n",
+ "ds = 190 \t\t\t\t#/Change in entropy in J/kg-K\n",
+ "k = 1.3 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287 \t\t\t\t#Specific Gas consmath.tant in J/kg-K, wrong printing in question\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "p2 = 2.4064 \t\t\t\t#Ratio of stagnation pressures at inlet to critical state from gas tables fanno flow tables @M1,k = 1.3\n",
+ "X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.3\n",
+ "p3 = p1*p2 \t\t\t\t#Ratio of stagnation pressures at exit to critical state from gas tables fanno flow tables @M1,k = 1.3\n",
+ "M2 = 0.28 \t\t\t\t#Mach number at p1 = 0.9 from gas tables @p3\n",
+ "X2 = 6.357 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.3\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "p4 = math.exp(ds/R) \t\t\t\t#Ratio of Stagnation pressure at entry to Stagnation pressure where ds = 190 \n",
+ "p5 = p1/p4 \t\t\t\t#Ratio of Stagnation pressures where ds = 190 to critical state\n",
+ "M3 = 0.56 \t\t\t\t#Mach number where ds = 190\n",
+ "X4 = 0.674 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M3,k = 1.3\n",
+ "X5 = X1-X4 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L2 = (X5*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.3f m \\\n",
+ "\\nB)Length of the pipe would require to rise entropy by %3i J/kg-K is %3.5f m \\\n",
+ "\\nC)Mach number is %3.2f'%(L1,ds,L2,M3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 8.175 m \n",
+ "B)Length of the pipe would require to rise entropy by 190 J/kg-K is 29.48625 m \n",
+ "C)Mach number is 0.56\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.13 page : 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "Po1 = 200. \t\t\t\t#Stagantion pressure at inlet in kPa\n",
+ "To1 = 303. \t\t\t\t#Stagnation temperature at inlet in K\n",
+ "M1 = 0.2 \t\t\t\t#Inlet Mach number from diagram\n",
+ "D = 0.025 \t\t\t\t#inner tude diameter in m(mismath.sing data)\n",
+ "M2 = 0.8 \t\t\t\t#Outlet Mach number \n",
+ "f = 0.005/4 \t\t\t\t#frictional factor\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "t1 = 0.992 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "T1 = To1*t1 \t\t\t\t#Static temperature in K\n",
+ "p1 = 0.973 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "P1 = Po1*p1 \t\t\t\t#Static pressure in kPa\n",
+ "p2 = 2.964 \t\t\t\t#Stagnation pressure ratio at inlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
+ "Pot = Po1/p2 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
+ "X1 = 14.533 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "p3 = 1.038 \t\t\t\t#Stagnation pressure ratio at outlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
+ "Po2 = Pot*p3 \t\t\t\t#Stagnation pressure at exit in kPa\n",
+ "X2 = 0.073 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "SPL = (1-(p3/p2))*100 \t\t\t\t#Percentage decrease in stagnation pressure in percent\n",
+ "ds = R*math.log(Po1/Po2) \t\t\t\t#Change of entropy in kJ/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the pipe is %3.1f m \\\n",
+ "\\nB)Percentage decrease in stagnation pressure is %3.2f percent \\\n",
+ "\\nC)Change of entropy is %3.3f kJ/kg-K'%(L1,SPL,ds)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the pipe is 72.3 m \n",
+ "B)Percentage decrease in stagnation pressure is 64.98 percent \n",
+ "C)Change of entropy is 301.133 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.14 page : 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D1 = 0.03 \t\t\t\t#Inlet duct diameter in m\n",
+ "D2 = 0.015 \t\t\t\t#Throat diameter of duct in m \n",
+ "Po1 = 750. \t\t\t\t#Stagantion pressure at inlet in kPa\n",
+ "To1 = 450. \t\t\t\t#Stagnation temperature at inlet in K\n",
+ "f = 0.02/4 \t\t\t\t#frictional factor\n",
+ "L = 0.25 \t\t\t\t#Length of the duct in m\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "ar = (D1/D2)**2 \t\t\t\t#Ratio of areas\n",
+ "M1 = 2.94 \t\t\t\t#Mach number at inlet from gas tables (ar,k = 1.4,isentropic)\n",
+ "p1 = 0.0298 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "P1 = Po1*p1 \t\t\t\t#Static pressure at inlet in kPa\n",
+ "t1 = 0.367 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "T1 = To1*t1 \t\t\t\t#Static temperature at inlet in K\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
+ "C1 = a1*M1 \t\t\t\t#Air velocity at inlet in m/s\n",
+ "X1 = 0.513 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "p2 = 0.226 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "Pt = P1/p2 \t\t\t\t#Critical pressure in kPa\n",
+ "c1 = 1.949 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "t2 = 0.439 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "Tt = T1/t2 \t\t\t\t#Critical temperature in K\n",
+ "L1 = (X1*D1)/(4*f) \t\t\t\t#Length of the pipe from inlet to critical state in m\n",
+ "L2 = L1-L \t\t\t\t#Length of the pipe from required point to critical state in m\n",
+ "X2 = (4*f*L2)/D2 \t\t\t\t#frictional consmath.tant fanno parameter\n",
+ "M2 = 2.14 \t\t\t\t#Mach number at inlet from gas tables (X2,k = 1.4,fanno flow)\n",
+ "p3 = 0.369 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "P2 = Pt*p3 \t\t\t\t#Exit pressure in kPa\n",
+ "c2 = 1.694 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "t3 = 0.623 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "T2 = t3*Tt \t\t\t\t#Exit temperature in K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Maximum length of the pipe is %3.4f m \\\n",
+ "\\nB)Condition of air at exit: \\\n",
+ "\\nPressure is %3.2f kPa \\\n",
+ "\\nVelocity is %3.2f m/s \\\n",
+ "\\nTemperature is %3.2f K'%(L1,P2,C2,T2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Maximum length of the pipe is 0.7695 m \n",
+ "B)Condition of air at exit: \n",
+ "Pressure is 36.49 kPa \n",
+ "Velocity is 658.25 m/s \n",
+ "Temperature is 234.37 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.15 page : 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "f = 0.002 \t\t\t\t#frictional factor\n",
+ "C1 = 130. \t\t\t\t#Air velocity at inlet in m/s\n",
+ "T1 = 400. \t\t\t\t#Inlet temperature at inlet in K\n",
+ "P1 = 250. \t\t\t\t#Inlet pressure at inlet in kPa\n",
+ "D = 0.16 \t\t\t\t#Inlet duct diameter in m\n",
+ "p1 = 0.8 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 20%\n",
+ "L1 = 35. \t\t\t\t#Length of duct from inlet to required section\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
+ "M1 = C1/a1 \t\t\t\t#Mach number at inlet\n",
+ "p2 = 0.9295 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "Po1 = P1/p2 \t\t\t\t#Stagantion pressure at inlet in kPa\n",
+ "Po2 = 0.8*Po1 \t\t\t\t#Stagantion pressure at outlet in kPa\n",
+ "p3 = 1.89725 \t\t\t\t#Stagnation pressure ratio at inlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
+ "Pot = Po1/p3 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
+ "X1 = 4.273 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "p4 = 3.33725 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
+ "Pt = P1/p4 \t\t\t\t#Static critical pressure in kPa\n",
+ "t1 = 1.175 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5) \n",
+ "Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
+ "c1 = 0.347 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
+ "Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "p5 = Po2/Pot \t\t\t\t#Pressure ratio\n",
+ "M2 = 0.43 \t\t\t\t#Mach number at p1 = 0.8\n",
+ "X2 = 1.833 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L2 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m, (from required section to critical state) \n",
+ "L3 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m, (from required inlet to critical state) \n",
+ "L4 = L3-L1 \t\t\t\t#Length of the pipe in m\n",
+ "X4 = (4*f*L3)/D \t\t\t\t#frictional consmath.tant fanno parameter\n",
+ "M3 = 0.39 \t\t\t\t#Mach number at L1 = 35m\n",
+ "p6 = 2.767 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
+ "P2 = Pt*p6 \t\t\t\t#Exit pressure in kPa\n",
+ "t2 = 1.1645 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
+ "T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
+ "c2 = 0.42087 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
+ "C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of pipe required for p = %3.1f m is %3.3f m \\\n",
+ "\\nB)Properties of air at section %3i from inlet: \\\n",
+ "\\nTemperature is %3.3f K \\\n",
+ "\\nPressure is %3.2f kPa \\\n",
+ "\\nVelocity is %3.1f m/s \\\n",
+ "\\nC)Maximum length of the pipe is %3.2f m'%(p1,L2,L1,T2,P2,C2,L3)\n",
+ "\n",
+ "# rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of pipe required for p = 0.8 m is 48.800 m \n",
+ "B)Properties of air at section 35 from inlet: \n",
+ "Temperature is 396.426 K \n",
+ "Pressure is 207.28 kPa \n",
+ "Velocity is 157.7 m/s \n",
+ "C)Maximum length of the pipe is 85.46 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.16 page : 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D = 0.3 \t\t\t\t#inner pipe diameter in m\n",
+ "Q = 1000. \t\t\t\t#Discharge in m**3/min\n",
+ "P2 = 150. \t\t\t\t#Exit pressure in kPa\n",
+ "T2 = 293. \t\t\t\t#Exit temperature in K\n",
+ "L1 = 50. \t\t\t\t#Length of the pipe in m\n",
+ "f = 0.005 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "A = math.pi*D**2/4 \t\t\t\t#Area of duct in m**2 \n",
+ "C2 = Q/(A*60) \t\t\t\t#Exit air velocity in m/s\n",
+ "a2 = math.sqrt(k*R*T2) \t\t\t\t#Sound velocity in m/s\n",
+ "M2 = C2/a2 \t\t\t\t#Exit mach number \n",
+ "p1 = 1.54 \t\t\t\t#\t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "Pt = P2/p1 \t\t\t\t#Critical pressure in kPa\n",
+ "t1 = 1.10 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "Tt = T2/t1 \t\t\t\t#Critical temperature in K\n",
+ "X1 = 0.228 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "L2 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "L2 = L1+L2 \t\t\t\t#Overall length of pipe from inlet to critical state in m\n",
+ "X2 = (4*f*L2)/D \t\t\t\t#frictional consmath.tant fanno parameter for M1\n",
+ "M1 = 0.345 \t\t\t\t#Inlet Mach number from gas tables fanno flow tables @X2,k = 1.4\n",
+ "p2 = 3.14 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "P1 = Pt*p2 \t\t\t\t#Static pressure at inlet in kPa\n",
+ "t2 = 1.17 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "T1 = Tt*t2 \t\t\t\t#Static temperature at inlet in K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Mach number at the exit is %3.3f \\\n",
+ "\\nB)Inlet pressure and temperature are %3.3f kPa and %3.2f K'%(M2,P1,T1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Mach number at the exit is 0.687 \n",
+ "B)Inlet pressure and temperature are 305.844 kPa and 311.65 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.17 page : 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D = 0.0254 \t\t\t\t#inner pipe diameter in m\n",
+ "f = 0.003 \t\t\t\t#frictional factor\n",
+ "M1 = 2.5 \t\t\t\t#Inlet Mach number \n",
+ "To1 = 310. \t\t\t\t#Stagnation temperature at inlet in K\n",
+ "P1 = 0.507 \t\t\t\t#Static pressure at inlet in kPa\n",
+ "M2 = 1.2 \t\t\t\t#Exit mach number \n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "t1 = 0.4444 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "T1 = To1*t1 \t\t\t\t#Static temperature at inlet in K\n",
+ "p1 = 0.05853 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
+ "Po1 = P1/p1 \t\t\t\t#Stagantion pressure at inlet in kPa\n",
+ "a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity at inlet in m/s, R in J/kg\n",
+ "C1 = a1*M1 \t\t\t\t#air velocity at inlet in m/s\n",
+ "c1 = 2.95804 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,isothermal tables @M1,k = 1.4\n",
+ "Ctt = C1/c1 \t\t\t\t#Critical velocity at isothermal state in m/s\n",
+ "p2 = 0.33806 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,isothermal @M1,k = 1.4\n",
+ "Ptt = P1/p2 \t\t\t\t#Critical pressure at isothermal state in bar\n",
+ "p3 = 3.61691 \t\t\t\t#Stagnation pressure ratio at inlet to isothermal state from gas tables,isothermal tables @M1,k = 1.4\n",
+ "Pott = Po1/p3 \t\t\t\t#Critical pressure at isothermal state in K\n",
+ "t2 = 1.968748 \t\t\t\t#Stagnation temperature ratio at inlet to isothermal state from gas tables,isothermal tables @M1,k = 1.4\n",
+ "Tott = To1/t2 \t\t\t\t#Critical temperature at isothermal state in K\n",
+ "X1 = 1.28334 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "c2 = 1.4186 \t\t\t\t#Static to Critical velocity ratio at exit from gas tables,isothermal tables @M2,k = 1.4\n",
+ "C2 = Ctt*c2 \t\t\t\t#Exit velocity in m/s\n",
+ "p4 = 0.7043 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,isothermal @M2,k = 1.4\n",
+ "P2 = Ptt*p4 \t\t\t\t#Exit pressure in bar\n",
+ "p5 = 1.07026 \t\t\t\t#Stagnation pressure ratio at inlet to isothermal state from gas tables,isothermal tables @M2,k = 1.4\n",
+ "Po2 = Pott*p5 \t\t\t\t#Stagnation pressure at exit in bar \n",
+ "t3 = 1.127 \t\t\t\t#Stagnation temperature ratio at inlet to isothermal state from gas tables,isothermal tables @M2,k = 1.4\n",
+ "To2 = Tott*t3 \t\t\t\t#Stagnation temperature at exit in bar\n",
+ "T2 = T1 \t\t\t\t#Exit temperature in K, Since isothermal flow\n",
+ "X2 = 0.19715 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "X3 = X1-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter\n",
+ "L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "d1 = (P1*10**5)/(R*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
+ "A1 = (math.pi*D**2)/4 \t\t\t\t#Cross sectional area of pipe in m**2\n",
+ "m = d1*A1*C1 \t\t\t\t#Mass flow rate in kg/s\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'At M = %3.1f : A)Static pressure and static temperature are %3.5f bar and %3.3f K respectively \\\n",
+ "\\nB)Stagnation pressure and temperature are %3.4f bar and %3.3f K respectively \\\n",
+ "\\nC)Velocity of air is %3.3f m/s \\\n",
+ "\\nD)Distance of the section from innlet is %3.3f m \\\n",
+ "\\nE)Mass flow rate is %3.5f kg/s'%(M2,P2,T2,Po2,To2,C2,L1,m)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At M = 1.2 : A)Static pressure and static temperature are 1.05626 bar and 137.764 K respectively \n",
+ "B)Stagnation pressure and temperature are 2.5632 bar and 177.458 K respectively \n",
+ "C)Velocity of air is 282.078 m/s \n",
+ "D)Distance of the section from innlet is 2.299 m \n",
+ "E)Mass flow rate is 0.38217 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.18 page : 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D = 0.12 \t\t\t\t#inner duct diameter in m\n",
+ "f = 0.004 \t\t\t\t#frictional factor\n",
+ "M1 = 0.4 \t\t\t\t#Inlet Mach number \n",
+ "P1 = 300. \t\t\t\t#Static pressure at inlet in kPa\n",
+ "T1 = 310. \t\t\t\t#Static temperature at inlet in K\n",
+ "M2 = 0.6 \t\t\t\t#Exit mach number\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "p1 = 2.118 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "Pt = P1/p1 \t\t\t\t#Critical pressure in kPa\n",
+ "X1 = 1.968 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "p2 = 1.408 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "P2 = Pt*p2 \t\t\t\t#Exit pressure in kPa\n",
+ "X2 = 0.299 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "X3 = X1-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter\n",
+ "L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
+ "T2 = T1 \t\t\t\t#Exit temperature in K, Since isothermal flow\n",
+ "Ttt = T1 \t\t\t\t#Critical temperature at critical state, Since isothermal flow \n",
+ "Mtt = 1/math.sqrt(k) \t\t\t\t#Limiting Mach number\n",
+ "L2 = (X1*D)/(4*f) \t\t\t\t#Length of the duct required to attain limiting mach number in m\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Length of the duct required to chnage the mach number to %3.1f is %3.4f m \\\n",
+ "\\nB)Pressure and temperature at M = %3.1f is %.f kPa and %3i K respectively \\\n",
+ "\\nC)Length of the duct required to attain limiting mach number is %3.3f m \\\n",
+ "\\nD)State of air at limiting mach number %3.3f is subsonic'%(M2,L1,M2,P2,T2,L2,Mtt)\n",
+ "\n",
+ "# rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Length of the duct required to chnage the mach number to 0.6 is 12.5175 m \n",
+ "B)Pressure and temperature at M = 0.6 is 199 kPa and 310 K respectively \n",
+ "C)Length of the duct required to attain limiting mach number is 14.760 m \n",
+ "D)State of air at limiting mach number 0.845 is subsonic\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.19 page : 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from numpy import roots\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "m = 0.32 \t\t\t\t#Mass flow rate in kg/s\n",
+ "L = 140. \t\t\t\t#Length of the pipe in m\n",
+ "P1 = 800. \t\t\t\t#Inlet pressure in N/m**2, wrong units in textbook\n",
+ "T1 = 288. \t\t\t\t#Inlet temperature in K\n",
+ "P2 = 600. \t\t\t\t#Outlet pressure in N/m**2, wrong units in textbook\n",
+ "f = 0.006 \t\t\t\t#frictional factor\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "\t\t\t\t#Umath.sing Adiabatic Equation d = 1/((((((math.pi*(d/2)**2)**2)/(2*m**2*R*T))*(P1**2-P2**2))-(math.log(P1/P2)))/(2*f*L)) and converting into 5th degree polynomial of d\n",
+ "a = (math.pi**2*(P1**2-P2**2))/(32*m**2*R*T1) \t\t\t\t#Coefficient of power 5\n",
+ "b = math.log(P1/P2) \t\t\t\t#Coefficient of power 1\n",
+ "c = 2*f*L \t\t\t\t#Coefficient of consmath.tant\n",
+ "#p5 = poly([-c -b 0 0 0 a],'d','coeff') \t\t\t\t#Solving polynomial of degree 5\n",
+ "d = roots([a,0,0,0,-b, -c]) \t\t\t\t#Command to find roots\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print (\"Possible values for diameter of pipe are:\") \t\t\t\t#Displays whatever within paranthesis \n",
+ "print (d) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#To print lay roots\n",
+ "print 'Therefore Diameter of the pipe is : %.1f m'%d[0].real\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Possible values for diameter of pipe are:\n",
+ "[ 0.71338855+0.j 0.20228465+0.67301992j 0.20228465-0.67301992j\n",
+ " -0.55897893+0.39355091j -0.55897893-0.39355091j]\n",
+ "Therefore Diameter of the pipe is : 0.7 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.20 page: 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "Q = 225./60 \t\t\t\t#Discharge in m**3/s\n",
+ "T2 = 293. \t\t\t\t#Exit temperature in K\n",
+ "P2 = 1.25 \t\t\t\t#Exit pressure in bar\n",
+ "L1 = 30. \t\t\t\t#Length of the pipe in m\n",
+ "D = 0.15 \t\t\t\t#Duct diameter in m\n",
+ "f = 0.02/4 \t\t\t\t#frictional factor\n",
+ "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
+ "R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "A = math.pi*D**2/4 \t\t\t\t#area in m**2\n",
+ "C2 = Q/A \t\t\t\t#Exit air velocity in m/s\n",
+ "a2 = math.sqrt(k*R*T2) \t\t\t\t#Exit sound velocity in m/s \n",
+ "M2 = C2/a2 \t\t\t\t#Exit mach number \n",
+ "p1 = 1.703 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "Pt = P2/p1 \t\t\t\t#Critical pressure in bar\n",
+ "c1 = 0.654 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "Ct = C2/c1 \t\t\t\t#Critical velocity in m/s\n",
+ "t1 = 1.114 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "Tt = T2/t1 \t\t\t\t#Critical temperature in K\n",
+ "X1 = 0.417 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "X2 = (4*f*L1)/D \t\t\t\t#frictional consmath.tant fanno parameter\n",
+ "X3 = X1+X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "M1 = 0.32 \t\t\t\t#Mach number at entrance\n",
+ "p2 = 3.385 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "P1 = Pt*p2 \t\t\t\t#Static pressure at inlet in bar\n",
+ "c2 = 0.347 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "C1 = Ct*c2 \t\t\t\t#Air velocity at inlet in m/s\n",
+ "t2 = 1.176 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "T1 = Tt*t2 \t\t\t\t#Static temperature at inlet in K\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'Required Inlet Condition: \\\n",
+ "\\nPressure is %3.4f bar \\\n",
+ "\\nVelocity is %3.3f m/s \\\n",
+ "\\nTemperature is %3.1f K'%(P1,C1,T1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required Inlet Condition: \n",
+ "Pressure is 2.4846 bar \n",
+ "Velocity is 112.593 m/s \n",
+ "Temperature is 309.3 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.21 page : 31"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Input data\n",
+ "D1 = 0.134 \t\t\t\t#Inlet duct diameter in m\n",
+ "Po1 = 7 \t\t\t\t#Stagnation pressure at inlet in bar\n",
+ "P1 = 0.245 \t\t\t\t#Static pressure at 5*D1 i.e. L1 in bar\n",
+ "P2 = 0.5 \t\t\t\t#Static pressure at 33*D1 i.e. L2 in bar\n",
+ "D2 = 0.0646 \t\t\t\t#throat diameter in m \n",
+ "L1 = 5*D1 \t\t\t\t#Length of nozzle till section-1 in m\n",
+ "L2 = 33*D1 \t\t\t\t#Length of nozzle till section-2 in m \n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Calculation\n",
+ "ar = (D1/D2)**2 \t\t\t\t#Ratio of areas\n",
+ "p1 = P1/Po1 \t\t\t\t#Pressure ratio\n",
+ "APR1 = p1*ar \t\t\t\t#Area Pressure ratio i.e. (A1*P1)/(At*Po1)\n",
+ "M1 = 2.54 \t\t\t\t#Mach number at inlet from isentropic gas tables @APR1 \n",
+ "X1 = 0.44 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
+ "APR2 = 0.3073 \t\t\t\t#Area Pressure ratio i.e. (A2*P2)/(At*Po1)\n",
+ "M2 = 1.54 \t\t\t\t#Exit mach number\n",
+ "X2 = 0.151 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
+ "X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
+ "L3 = L2-L1 \t\t\t\t#Length of the nozzle (Section-1 to Section-2) in m \n",
+ "f = (X3*D1)/(4*L3) \t\t\t\t#frictional factor\n",
+ "\n",
+ "\t\t\t\t\n",
+ "#Output\n",
+ "print 'A)Mach number at %3.3f m and %3.3f m are %3.2f and %3.2f respectively \\\n",
+ "\\nB)Mean value of friction between two sections is %3.5f'%(L1,L2,M1,M2,f)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A)Mach number at 0.670 m and 4.422 m are 2.54 and 1.54 respectively \n",
+ "B)Mean value of friction between two sections is 0.00258\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file