{ "metadata": { "name": "", "signature": "sha256:48c3c13129b0ce3ee083feadd095d84beabf52cb58d3a61a7cd29360c1b4aee6" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5 : Normal and Oblique Shock" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.1 page : 18" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "#Input data\n", "Px = 150. \t\t\t\t#Pressure before the shock in kPa\n", "Tx = 25.+273 \t\t\t\t#Temperature before the shock in K\n", "Py = 350. \t\t\t\t#Pressure just after the shock in kPa\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculations\n", "p1 = Py/Px \t\t\t\t#Pressure ratio \n", "Mx = 1.4638 \t\t\t\t#Mach number before the shock\n", "My = 0.716 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "t1 = 1.294 \t\t\t\t#Temperature ratio after and before the shock from gas tables @p1\n", "Ty = t1*Tx \t\t\t\t#Temperature ratio after the shock in K\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Cx = ax*Mx \t\t\t\t#Velocity of gas before the shock in m/s\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = ay*My \t\t\t\t#Velocity of gas after the shock in m/s\n", "p2 = 0.942 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @p1\n", "ds = R*math.log(1/p2) \t\t\t\t#Change in entropy in J/kg-K\n", "p3 = 3.265 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @p1\n", "Poy = p3*Px \t\t\t\t#Stagnation pressure after shock in kPa\n", "Pox = Poy/p2 \t\t\t\t#Stagnation pressure before shock in kPa\n", "pr_loss = Pox-Poy \t\t\t\t#Loss of stagnation pressure of air in kPa\n", "dd = (1000/R)*((Py/Ty)-(Px/Tx)) \t\t\t\t#Increase in density of air in kg/m**3\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Mach number before shock is %3.4f \\\n", "\\nB)After shock: \\\n", "\\nMach number is %3.3f \\\n", "\\nStatic temperature is %3.3f K \\\n", "\\nVelocity is %3.2f m/s \\\n", "\\nC)Increase in density of air is %3.2f kg/m**3 \\\n", "\\nD)Loss of stagnation pressure of air is %3.2f kPa \\\n", "\\nE)Change in entropy is %3.3f J/kg-K'%(Mx,My,Ty,Cy,dd,pr_loss,ds)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Mach number before shock is 1.4638 \n", "B)After shock: \n", "Mach number is 0.716 \n", "Static temperature is 385.612 K \n", "Velocity is 281.83 m/s \n", "C)Increase in density of air is 1.41 kg/m**3 \n", "D)Loss of stagnation pressure of air is 30.15 kPa \n", "E)Change in entropy is 17.148 J/kg-K\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.2 page : 19" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\t\n", "#Input data\n", "Tx = 350. \t\t\t\t#Temperature before the shock in K\n", "Px = 137.8 \t\t\t\t#Pressure before the shock in kPa\n", "Cx = 750. \t\t\t\t#Velocity before the shock in m/s\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Mx = Cx/ax \t\t\t\t#Mach number before the shock\n", "My = 0.577 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 4.5 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p1 \t\t\t\t#Static pressure after shock in kPa\n", "t1 = 1.687 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "p2 = 5.641 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = Px*p2 \t\t\t\t#Stagnation pressure after shock in kPa\n", "p3 = 0.721 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Pox = Poy/p3 \t\t\t\t#Stagnation pressure before shock in kPa\n", "ds = R*math.log(1/p3) \t\t\t\t#Change in entropy in J/kg-K\n", "t2 = 0.555 \t\t\t\t#Static to Stagnation temperature ratio before shock from isentropic gas tables @Mx,k = 1.4\n", "Tox = Tx/t2 \t\t\t\t#Stagnation temperature before shock in K\n", "p4 = 0.128 \t\t\t\t#Static to Stagnation pressure ratio from isentropic gas tables @Mx,k = 1.4\n", "Pox = Px/p4 \t\t\t\t#Stagnation pressure in kPa\n", "t4 = 0.937 \t\t\t\t#Static to Stagnation temperature ratio before shock from normal shock gas tables @Mx,k = 1.4 (Tox = Toy CheckenD)\n", "Toy = Ty/t4 \t\t\t\t#Stagnation temperature after shock in K\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = (My*ay) \t\t\t\t#Velocity of gas after the shock in m/s\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)At inlet to shock: \\\n", "\\nStagnation pressure is %3.1f kPa \\\n", "\\nStagnation temperature is %3.2f K \\\n", "\\nMach number is %3.0f \\\n", "\\nB)After shock: \\\n", "\\nStagnation pressure is %3.2f kPa \\\n", "\\nStagnation temperature is %3.2f K \\\n", "\\nStatic pressure is %3.1f kPa \\\n", "\\nStatic temperature is %3.2f K \\\n", "\\nMach number is %3.3f \\\n", "\\nVelocity is %3.2f m/s \\\n", "\\nC)Change in entropy across the shock is %3.2f J/kg-K'%(Pox,Tox,Mx,Poy,Toy,Py,Ty,My,Cy,ds)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)At inlet to shock: \n", "Stagnation pressure is 1076.6 kPa \n", "Stagnation temperature is 630.63 K \n", "Mach number is 2 \n", "B)After shock: \n", "Stagnation pressure is 777.33 kPa \n", "Stagnation temperature is 630.15 K \n", "Static pressure is 620.1 kPa \n", "Static temperature is 590.45 K \n", "Mach number is 0.577 \n", "Velocity is 281.04 m/s \n", "C)Change in entropy across the shock is 93.88 J/kg-K\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.3 page: 20" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\t\n", "#Input data\n", "Tx = 0+273 \t\t\t\t#Temperature before the shock in K\n", "Px = 60. \t\t\t\t#Pressure before the shock in kPa\n", "Cx = 497. \t\t\t\t#Air Velocity before the shock in m/s\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Mx = Cx/ax \t\t\t\t#Mach number before the shock\n", "My = 0.70109 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 2.45833 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = p1*Px \t\t\t\t#Static pressure after shock in kPa\n", "t1 = 1.32022 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "p2 = 3.41327 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = p2*Px \t\t\t\t#Stagnation pressure after shock in kPa\n", "p3 = 0.92979 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Pox = Poy/p3 \t\t\t\t#Stagnation pressure before shock in kPa\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = ay*My \t\t\t\t#Velocity of air after the shock in m/s\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'After shock: A)Mach number is %3.5f \\\n", "\\nB)Velocity is %3.3f m/s \\\n", "\\nC)Stagnation pressure is %3.3f kPa'%(My,Cy,Poy)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "After shock: A)Mach number is 0.70109 \n", "B)Velocity is 266.798 m/s \n", "C)Stagnation pressure is 204.796 kPa\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.4 page : 21" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Px = 30. \t\t\t\t#Pressure before the shock in kPa\n", "Tx = -30+273 \t\t\t\t#Temperature before the shock in K\n", "pr = 2.6 \t\t\t\t#Pressure ratio across the shock wave\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "Mx = 1.54 \t\t\t\t#Mach number before the shock from gas tables @pr\n", "My = 0.687 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "t1 = 1.347 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = t1*Tx \t\t\t\t#Temperature ratio after the shock in K\n", "p1 = 3.567 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = p1*Px \t\t\t\t#Stagnation pressure after shock in kPa\n", "p2 = 0.917 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Pox = Poy/p2 \t\t\t\t#Stagnation pressure before shock in kPa\n", "dP = Pox-Poy \t\t\t\t#Change in stagnation pressure in kPa\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Cx = (Mx*ax) \t\t\t\t#Air Velocity before the shock in m/s\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = (My*ay) \t\t\t\t#Velocity of air after the shock in m/s\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Velocities upstream and downstream of shock wave are %3.2f m/s and %3.2f m/s respectively \\\n", "\\nB)Change in stagnation pressure is %3.3f kPa'%(Cx,Cy,dP)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Velocities upstream and downstream of shock wave are 481.20 m/s and 249.14 m/s respectively \n", "B)Change in stagnation pressure is 9.686 kPa\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.5 page : 22" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Mol = 39.9 \t\t\t\t#Molar mass of a gas in kg/mol\n", "k = 1.67 \t\t\t\t#Specific heat ratio \n", "Mx = 2.5 \t\t\t\t#Mach number before the shock \n", "Px = 40 \t\t\t\t#Pressure before the shock in kPa \n", "Tx = -20+273 \t\t\t\t#Temperature before the shock in K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "My = 0.554 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 7.567 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = p1*Px \t\t\t\t#Static pressure after shock in kPa\n", "t1 = 2.805 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'Downstream the normal shock: \\\n", "\\nMach number is %3.3f \\\n", "\\nPressure is %3.2f kPa \\\n", "\\nTemperature is %3.3f K'%(My,Py,Ty)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Downstream the normal shock: \n", "Mach number is 0.554 \n", "Pressure is 302.68 kPa \n", "Temperature is 709.665 K\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.6 page : 22" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Mx = 2 \t\t\t\t#Mach number before the shock \n", "Px = 50 \t\t\t\t#Pressure before the shock in kPa \n", "\n", "\t\t\t\t\n", "#Calculation\n", "p1 = 6.335 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @Mx\n", "Poy = p1*Px \t\t\t\t#Stagnation pressure after shock in kPa\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'Pressure acting on the front of the body is %3.2f kPa'%Poy\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure acting on the front of the body is 316.75 kPa\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.7 page : 23" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Po = 800. \t\t\t\t#Pressure in reservoir in kPa\n", "To = 40.+273 \t\t\t\t#Temperature in reservoir in K\n", "M2a = 2.5 \t\t\t\t#Mach number at exit from diagram\n", "At = 25. \t\t\t\t#Throat Area in cm**2 \n", "Ax = 40. \t\t\t\t#Area just before the shock in cm**2\n", "Ay = 40. \t\t\t\t#Area just after the shock in cm**2\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "t1 = 0.834 \t\t\t\t#Ratio of critical temperature and stagnation temperature from gas tables @M = 1\n", "Tt = To*t1 \t\t\t\t#Critical temperature in K\n", "p1 = 0.528 \t\t\t\t#Ratio of critical pressure and stagnation pressure from gas tables @M = 1\n", "Pt = Po*p1 \t\t\t\t#Critical pressure in kPa\n", "dt = Pt*10**3/(R*Tt) \t\t\t\t#Density in kg/m**3, Pt in Pa\n", "at = math.sqrt(k*R*Tt) \t\t\t\t#Velocity of sound at throat in m/s\n", "Ct = at \t\t\t\t#Air Velocity of sound at throat in m/s\n", "m = dt*At*10**-4*Ct \t\t\t\t#Mass flow rate in kg/s\n", "p2 = 0.0585 \t\t\t\t#Ratio of exit to stagnation pressure from isentropic gas tables @M2 = 2.5\n", "a1 = 2.637 \t\t\t\t#Ratio of exit to critical area from isentropic gas tables @M2 = 2.5\n", "A2 = a1*At \t\t\t\t#Exit area in cm**2\n", "a2 = Ax/At \t\t\t\t#Area ratio\n", "M = 1.94 \t\t\t\t#Mach number upstream of shock from gas tables @a2\n", "p3 = 0.140 \t\t\t\t#Ratio of upstram of shock to stagnation pressures from isentropic gas tables @M\n", "Px = p3*Po \t\t\t\t#Pressure upstram of shock in kPa\n", "t2 = 0.570 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables @M\n", "Tx = t2*To \t\t\t\t#Temperature upstram of shock in K\n", "My = 0.588 \t\t\t\t#Mach number downstream of shock from normal shock gas tables @M\n", "p4 = 4.225 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p4 \t\t\t\t#Static pressure after shock in kPa\n", "t3 = 1.639 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t3 \t\t\t\t#Temperature ratio after the shock in K\n", "p5 = 2.338 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = p5*Px \t\t\t\t#Stagnation pressure after shock in kPa\n", "p6 = 0.749 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Pox = Poy/p6 \t\t\t\t#Stagnation pressure before shock in kPa \n", "#Here At2 = Aty, Po2 = Poy, Toy = To2 = To1 = To\n", "p7 = 0.79 \t\t\t\t#Static to stagnation pressure ratio after shock from isentropic gas tables @My\n", "Po2 = Py/p7 \t\t\t\t#Stagnation pressure at exit in kPa\n", "t4 = 0.935 \t\t\t\t#Static to stagnation temperature ratio after shock from isentropic gas tables @My\n", "To2 = Ty/t4 \t\t\t\t#Stagnation temperature in K (checkeD)\n", "a3 = 1.2 \t\t\t\t#Ratio of areas after shock i.e. (Ay/At2)\n", "At2 = Ay/a3 \t\t\t\t#Critical area after shock in cm**2\n", "a4 = A2/At2 \t\t\t\t#Ratio of areas \n", "M2b = 0.31 \t\t\t\t#Mach number at exit from gas tables @a4(as per sectionB)\n", "p8 = 0.936 \t\t\t\t#Static to stagnation pressure ratio at exit from isentropic gas tables @M2b\n", "P2 = Po2*p8 \t\t\t\t#Exit pressure in kPa\n", "t5 = 0.981 \t\t\t\t#Static to stagnation temperature ratio after shock from isentropic gas tables @M2b\n", "T2 = To2*t5 \t\t\t\t#Exit temperature in K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'CASE-I: A)Mass flow rate is %3.2f kg/s \\\n", "\\nB)Exit area is %3.1f cm**2 CASE-II: \\\n", "\\nA)Temperature is %3.3f K \\\n", "\\nB)Pressure is %3.1f kPa'%(m,A2,T2,P2)\n", "\n", "# note : rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "CASE-I: A)Mass flow rate is 4.56 kg/s \n", "B)Exit area is 65.9 cm**2 CASE-II: \n", "A)Temperature is 306.800 K \n", "B)Pressure is 560.7 kPa\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.8 page : 24" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "#Input data\n", "Px = 1. \t\t\t\t#Pressure before the shock in bar\n", "Tx = 17.+273 \t\t\t\t#Temperature before the shock in K\n", "Cx = 500. \t\t\t\t#Air Velocity before the shock in m/s\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Mx = Cx/ax \t\t\t\t#Mach number before the shock \n", "My = 0.715 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 2.335 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = p1*Px \t\t\t\t#Static pressure after shock in bar\n", "t1 = 1.297 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = ay*My \t\t\t\t#Velocity of air after the shock in m/s\n", "C_y = Cx-Cy \t\t\t\t#Velocity of air in m/s\n", "M_y = C_y/ay \t\t\t\t#Mach number impared upstream of the wave front\n", "t2 = 0.939 \t\t\t\t#Static to stagnation temperature ratio after shock from isentropic gas tables @M_y\n", "T_oy = Ty/t2 \t\t\t\t#Stagnation temperature of air in K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Pressure is %3.3f bar \\\n", "\\nB)Temperature is %3.2f K \\\n", "\\nC)Velocity of air is %3.2f m/s \\\n", "\\nD)Stagnation temperature is %3.2f K \\\n", "\\nE)Mach number is %3.3f'%(Py,Ty,C_y,T_oy,M_y)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Pressure is 2.335 bar \n", "B)Temperature is 376.13 K \n", "C)Velocity of air is 222.04 m/s \n", "D)Stagnation temperature is 400.56 K \n", "E)Mach number is 0.571\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.9 page : 25" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\t\n", "#Input data\n", "Mx = 3. \t\t\t\t#Mach number before the shock \n", "Tx = 27.+273 \t\t\t\t#Temperature before the shock in K\n", "Px = 1. \t\t\t\t#Pressure before the shock in bar\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", " \n", "\t\t\t\t\n", "#Calculation\n", "My = 0.475 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 10.333 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = p1*Px \t\t\t\t#Static pressure after shock in bar\n", "t1 = 2.679 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "p2 = 12.061 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = p2*Px \t\t\t\t#Stagnation pressure after shock in bar\n", "p3 = 0.328 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Pox = Poy/p3 \t\t\t\t#Stagnation pressure before shock in kPa\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = ay*My \t\t\t\t#Velocity of air after the shock in m/s\n", "ds = R*math.log(1/p3) \t\t\t\t#Change in entropy in J/kg-K\n", "e = (Py-Px)/Px \t\t\t\t#Strength of shock\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'I)Downstream of the shock: \\\n", "\\nA)Pressure is %3.3f bar \\\n", "\\nB)Temperature is %3.1f K \\\n", "\\nC)Gas velocity is %3.2f m/s \\\n", "\\nD)Mach number is %3.3f \\nII)Total head pressure ratio is %3.3f \\nIII)Entropy change across the shock is %3.3f J/kg-K \\\n", "\\nIV)Strength of the shock is %3.3f'%(Py,Ty,Cy,My,p3,ds,e) \n", "\n", "# rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "I)Downstream of the shock: \n", "A)Pressure is 10.333 bar \n", "B)Temperature is 803.7 K \n", "C)Gas velocity is 269.93 m/s \n", "D)Mach number is 0.475 \n", "II)Total head pressure ratio is 0.328 \n", "III)Entropy change across the shock is 319.931 J/kg-K \n", "IV)Strength of the shock is 9.333\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.10 page : 26" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "a1 = 0.4 \t\t\t\t#Ratio of throat area to exit area \n", "p1 = 0.8 \t\t\t\t#Ratio of static pressure to Stagnation pressure at inlet\n", "At = 1. \t\t\t\t#Throat area in m**2\n", "\n", "\t\t\t\t\n", "#Calculation\n", "a2 = 1/a1 \t\t\t\t#reciprocal of a1 to find in gas tables\n", "\t\t\t\t#Pox = Po1 = Po, Poy = Po2\n", "a2p2 = a2*p1 \t\t\t\t#Area pressure ratio i.e. (A2*P2)/(At2*Po2)\n", "M2 = 0.28 \t\t\t\t#Exit mach number from gas tables @a2p2\n", "a3 = 2.166 \t\t\t\t#Ratio of exit area to throat area after shock from gas tables @a2p2 \n", "p2 = 0.947 \t\t\t\t#Static to stagnation pressure ratio at exit from gas tables @a2p2\n", "p3 = a2/a3 \t\t\t\t#Stagnation pressure ratio after and before shock \n", "Mx = 1.675 \t\t\t\t#Mach number before the shock @p3\n", "My = 0.647 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "a4 = 1.14 \t\t\t\t#Ratio of area after shock to throat area after shock from isentropic gas tables @My\n", "a5 = 1.315 \t\t\t\t#Ratio of area before shock to throat area before shock from isentropic gas tables @My\n", "Ax = a5*At \t\t\t\t#Area at shock in m**2\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'A)Mach number across the shock: Mx = %3.3f My = %3.3f) \\\n", "\\nB)Area at shock is %3.3f m**2'%(Mx,My,Ax)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Mach number across the shock: Mx = 1.675 My = 0.647) \n", "B)Area at shock is 1.315 m**2\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.11 page : 27" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\t\n", "#Input data\n", "a1 = 1./3 \t\t\t\t#Ratio of throat area to exit area \n", "p1 = 0.4 \t\t\t\t#Ratio of static pressure to Stagnation pressure at inlet\n", "\n", "\t\t\t\t\n", "#Calculation\n", "a2 = 1/a1 \t\t\t\t#reciprocal of a1 to find in gas tables\n", "\t\t\t\t#we know Pox = Po1 = Po, Poy = Po2, At = Atx and Aty = At2\n", "a2p2 = a2*p1 \t\t\t\t#Area pressure ratio i.e. (A2*P2)/(At2*Po2)\n", "M2 = 0.472 \t\t\t\t#Exit mach number from gas tables @a2p2\n", "a3 = 1.397 \t\t\t\t#Ratio of exit area to throat area after shock from gas tables @a2p2 \n", "p2 = 0.858 \t\t\t\t#Static to stagnation pressure ratio at exit from gas tables @a2p2\n", "p3 = a3/a2 \t\t\t\t#Stagnation pressure ratio after and before shock \n", "Mx = 2.58 \t\t\t\t#Mach number before the shock @p3\n", "My = 0.506 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p4 = 9.145 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "a4 = 2.842 \t\t\t\t#Ratio of area before shock to throat area \n", "p5 = 0.051 \t\t\t\t#Ratio of Pressure before shock to Stagnation pressure at entry\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'At section where shock occurs: \\\n", "\\nA)Mach number Mx = %3.2f and My = %3.3f \\\n", "\\nB)Static Pressure is %3.3f*Po1 units depend on Po1) \\\n", "\\nC)Area of cross section is %3.3f*At units depend on At)'%(Mx,My,p5,a4)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "At section where shock occurs: \n", "A)Mach number Mx = 2.58 and My = 0.506 \n", "B)Static Pressure is 0.051*Po1 units depend on Po1) \n", "C)Area of cross section is 2.842*At units depend on At)\n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.12 page : 28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Po = 300. \t\t\t\t#Pressure in reservoir in kPa\n", "To = 500. \t\t\t\t#Temperature in reservoir in K\n", "At = 1. \t\t\t\t#Throat area in m**2\n", "Ax = 2. \t\t\t\t#Area just before the shock in m**2\n", "Ay = 2. \t\t\t\t#Area just after the shock in m**2\n", "A2 = 3. \t\t\t\t#Exit area in m**2\n", "\n", "\t\t\t\t\n", "#Calculation\n", "a1 = Ax/At \t\t\t\t#Area ratio \n", "Mx = 2.2 \t\t\t\t#Mach number upstream of shock\n", "p1 = 0.0935 \t\t\t\t#Ratio of pressure before shock to stagnation pressure before shock from gas tables @Mx\n", "Px = p1*Po \t\t\t\t#pressure before shock in kPa\n", "t1 = 0.50 \t\t\t\t#Ratio of temperature before shock to stagnation pressure before shock from gas tables @Mx\n", "Tx = t1*To \t\t\t\t#temperature before shock in K\n", "My = 0.547 \t\t\t\t#Mach number downstream of shock \n", "p2 = 5.480 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p2 \t\t\t\t#Static pressure after shock in kPa\n", "t2 = 1.857 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = t2*Tx \t\t\t\t#Temperature ratio after the shock in K\n", "p3 = 6.716 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy = Px*p3 \t\t\t\t#Stagnation pressure after shock in kPa\n", "Po2 = Poy \t\t\t\t#Exit stagnation pressure in kPa, Since total pressure remains same after shock\n", "t3 = 0.943 \t\t\t\t#Static to stagnation pressure after shock from isentropic gas tables @My\n", "Toy = Ty/t3 \t\t\t\t#Stagnation pressure after shock in K\n", "To2 = Toy \t\t\t\t#Exit stagnation temperature in K, Since temperature remains after shock\n", "a2 = 1.255 \t\t\t\t#Ratio of area after shock to throat area after shock from isentropic gas tables @My\n", "Aty = Ay/a2 \t\t\t\t#Throat area after shock in m**2\n", "At2 = Aty \t\t\t\t#Throat area at exit in m**2\n", "a3 = A2/At2 \t\t\t\t#Areas ratio\n", "M2 = 0.33 \t\t\t\t#Exit mach number from gas tables @a3\n", "p4 = 0.927 \t\t\t\t#Static to Stagnation pressure at exit from gas isentropic gas tables @a3\n", "P2 = Po2*p4 \t\t\t\t#Exit pressure in kPa\n", "t4 = 0.978 \t\t\t\t#Static to Stagnation temperature at exit from gas isentropic gas tables @a3\n", "T2 = To2*t4 \t\t\t\t#Exit temperature in K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Pressure at section x) Px = %3.2f kPa \\\n", "\\nB)Pressure at section y) Px = %3.3f kPa \\\n", "\\nC)Stagnation pressure at section y) Poy = %3.2f kPa \\\n", "\\nD)Throat area of cross section at section y) Aty = %3.4f m**2 \\\n", "\\nE)Stagnation pressure at exit Po2 = %3.2f kPa \\\n", "\\nF)Throat area of cross section at exit At2 = %3.4f m**2 \\\n", "\\nG)Static Pressure at exit P2 = %3.2f kPa \\\n", "\\nH)Stagantion temperature at exit To2 = %3i K \\\n", "\\nI)Temperature at exit T2 = %3i k'%(Px,Py,Poy,Aty,Po2,At2,P2,To2,T2)\n", "\n", "# rounding off error. " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Pressure at section x) Px = 28.05 kPa \n", "B)Pressure at section y) Px = 153.714 kPa \n", "C)Stagnation pressure at section y) Poy = 188.38 kPa \n", "D)Throat area of cross section at section y) Aty = 1.5936 m**2 \n", "E)Stagnation pressure at exit Po2 = 188.38 kPa \n", "F)Throat area of cross section at exit At2 = 1.5936 m**2 \n", "G)Static Pressure at exit P2 = 174.63 kPa \n", "H)Stagantion temperature at exit To2 = 492 K \n", "I)Temperature at exit T2 = 481 k\n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.13 page : 29" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Input data\n", "Po1 = 500. \t\t\t\t#Stagnation pressure in kPa\n", "To1 = 600. \t\t\t\t#Stagnation temperature in K\n", "C1 = 100. \t\t\t\t#inlet velocity in m/s\n", "A1 = 0.01 \t\t\t\t#Inlet Area in m**2\n", "A2 = 0.01 \t\t\t\t#Exit Area in m**2\n", "Mx = 1.2 \t\t\t\t#Mach number before the shock\n", "Ax = 37.6 \t\t\t\t#Area just before the shock in cm**2\n", "Ay = 37.6 \t\t\t\t#Area just after the shock in cm**2\n", "Px = 109.9 \t\t\t\t#Pressure before the shock in kPa\n", "Poy = 350. \t\t\t\t#Stagnation pressure after shock in kPa\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "Cp = 1005. \t\t\t\t#Specific heat capacity at consmath.tant volume in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "T1 = To1+(C1**2/(2*Cp)) \t\t\t\t#Inlet static temperature in K\n", "ai_1 = math.sqrt(k*R*T1) \t\t\t\t#Velocity of sound at inlet in m/s\n", "M1 = C1/ai_1 \t\t\t\t#Inlet Mach number \n", "p1 = 0.973 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables @M1 \n", "P1 = Po1*p1 \t\t\t\t#Inlet static pressure in kPa\n", "d1 = P1*10**3/(R*T1) \t\t\t\t#Density at inlet in kg/m**3, P1 in Pa\n", "m = d1*A1*C1 \t\t\t\t#Mass flow rate at inlet in kg/s\n", "p2 = 0.528 \t\t\t\t#Ratio of critical pressure to stagnation pressure from gas tables @M = 1\n", "Pt = Po1*p2 \t\t\t\t#Critical pressure in kPa\n", "t1 = 0.834 \t\t\t\t#Ratio of critical temperature to stagnation temperature from gas tables @M = 1\n", "Tt = t1*To1 \t\t\t\t#critical temperature in K\n", "ai_t = math.sqrt(k*R*Tt) \t\t\t\t#Velocity of sound at critical state in m/s\n", "Ct = ai_t \t\t\t\t#Velocity of air at critical state in m/s\n", "a1 = 2.964 \t\t\t\t#Ratio of inlet area to critical area from gas tables @M = 1\n", "At = A1/a1 \t\t\t\t#critical area in m**2\n", "dt = Pt/(R*Tt) \t\t\t\t#Density at critical state in kg/m**3\n", "mt = dt*At*Ct \t\t\t\t#Mass flow rate at critical satate in kg/s\n", "\t\t\t\t#Sub-division (a)\n", "a2 = 1.030 \t\t\t\t#Ratio of area after shock to critical area from gas tables @Mx\n", "Ay_a = At*a2 \t\t\t\t#Area after shock in cm**2\n", "p3 = 0.412 \t\t\t\t#Ratio of upstram of shock to stagnation pressures from isentropic gas tables @Mx\n", "Px_a = Po1*p3 \t\t\t\t#Pressure upstram of shock in kPa\n", "t2 = 0.776 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables @Mx\n", "Tx_a = To1*t2 \t\t\t\t#Temperature upstram of shock in K\n", "My_a = 0.84 \t\t\t\t#Mach number downstream of shock from normal shock gas tables @Mx\n", "p4 = 1.497 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py_a = Px_a*p4 \t\t\t\t#Static pressure after shock in kPa\n", "t3 = 1.099 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty_a = Tx_a*t3 \t\t\t\t#Temperature ratio after the shock in K\n", "p5 = 2.407 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @My\n", "Poy_a = Px_a*p5 \t\t\t\t#Stagnation pressure after shock in kPa\n", "a3 = 1.204 \t\t\t\t#Ratio of area after shock to throat area after shock from isentropic gas tables @My\n", "At2_a = (Ay_a/a3)*10**4 \t\t\t\t#Throat area at exit in m**2, calculation mistake in textbook\n", "a4 = A2/At2_a \t\t\t\t#Ratio of areas to find gas tables \n", "M2_a = 0.2 \t\t\t\t#Exit mach number at section-A from gas tables @a4\n", "p5 = 0.973 \t\t\t\t#ratio of exit pressure to stagnation pressure after shock from gas tables\n", "P2_a = p5*Poy_a \t\t\t\t#exit pressure in kPa\n", "#Sub-division (B)\n", "a5 = Ax/At \t\t\t\t#Ratio of area before shock to critical area\n", "Mx_b = 1.4 \t\t\t\t#Mach number at section-B from gas tables @a5\n", "p6 = 0.314 \t\t\t\t#Ratio of upstram of shock to stagnation pressures from isentropic gas tables @Mx_b\n", "Px_b = Po1*p6 \t\t\t\t#Pressure upstram of shock in kPa\n", "t4 = 0.718 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables @Mx_b\n", "Tx_b = To1*t4 \t\t\t\t#Temperature upstram of shock in K\n", "p20 = 3.049 \t\t\t\t#Stagnation pressure ratio after shock to Static pressure before shock from gas tables \n", "Poy_b = Px_b*p20 \t\t\t\t#Stagnation pressure after shock in kPa\n", "My_b = 0.735 \t\t\t\t#Mach number downstream of shock from normal shock gas tables @Mx_b\n", "p7 = 2.085 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My_b\n", "Py_b = Px_b*p7 \t\t\t\t#Static pressure after shock in kPa\n", "t5 = 1.260 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My_b\n", "Ty_b = Tx_b*t5 \t\t\t\t#Temperature after the shock in K\n", "a6 = 1.071 \t\t\t\t#Ratio of area after shock to throat area after shock from isentropic gas tables My_b = 0.735\n", "At2_b = Ay/a6 \t\t\t\t#Throat area at exit in m**2\n", "a7 = A2/At2_b \t\t\t\t#Ratio of areas\n", "M2_b = 0.21 \t\t\t\t#Exit mach number at section-B from gas tables @a7\n", "p8 = 0.9697 \t\t\t\t#ratio of exit pressure to stagnation pressure after shock from gas tables\n", "P2_b = p8*Poy_b \t\t\t\t#exit pressure in kPa\n", "\t\t\t\t#Sub-division (C)\n", "p9 = Px/Po1 \t\t\t\t#Ratio of upstram of shock to stagnation pressures \n", "Mx_c = 1.65 \t\t\t\t#Mach number at section-B from gas tables @p9\n", "a8 = 1.292 \t\t\t\t#Ratio of area before shock to critical area from gas tables @p9\n", "Ax_c = At*a8*10**4 \t\t\t\t#Area before shock in cm**2\n", "t6 = 0.647 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables @p9\n", "Tx_c = To1*t6 \t\t\t\t#Temperature upstram of shock in K\n", "My_c = 0.654 \t\t\t\t#Mach number downstream of shock from normal shock gas tables @Mx_c\n", "p10 = 3.0095 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My_c\n", "Py_c = Px*p10 \t\t\t\t#Pressure downstram of shock in kPa\n", "t7 = 1.423 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My_c\n", "Ty_c = Tx_c*t7 \t\t\t\t#Temperature after the shock in K\n", "p12 = 4 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @Mx_c\n", "Poy_c = Px*p12 \t\t\t\t#Stagnation pressure after shock in kPa\n", "a9 = 1.136 \t\t\t\t#Ratio of area after shock to throat area after shock from gas tables My_c = 0.654\n", "At2_c = Ax_c/a9 \t\t\t\t#Throat area at exit in m**2\n", "a8 = A2/At2_c \t\t\t\t#Ratio of areas\n", "M2_c = 0.23 \t\t\t\t#Exit mach number at section-B from gas tables @a8\n", "p11 = 0.964 \t\t\t\t#ratio of exit pressure to stagnation pressure after shock from gas tables\n", "P2_c = p11*Poy_c \t\t\t\t#exit pressure in kPa\n", "\t\t\t\t#Sub-division (D)\n", "p13 = Poy/Po1 \t\t\t\t#Pressure ratio, Since Pox = Po1\n", "Mx_d = 2.04 \t\t\t\t#Mach number upstream of shock from gas tables @p13\n", "My_d = 0.571 \t\t\t\t#Mach number downstream of shock from gas tables @p13\n", "p14 = 4.688 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My_d\n", "t8 = 1.72 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My_d\n", "p15 = 5.847 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @Mx_d\n", "p16 = 0.120 \t\t\t\t#Ratio of upstram of shock to stagnation pressures from isentropic tables @Mx_d\n", "Px_d = Po1*p16 \t\t\t\t#Pressure upstram of shock in kPa\n", "t9 = 0.546 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables @Mx_d\n", "Tx_d = To1*t9 \t\t\t\t#Temperature upstram of shock in K\n", "p21 = 4.688 \t\t\t\t#Static pressure ratio after and before the shock from gas tables \n", "Py_d = Px_d*p21 \t\t\t\t#Pressure downstram of shock in kPa\n", "t12 = 1.72 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables \n", "Ty_d = Tx_d*t12 \t\t\t\t#Temperature after the shock in K\n", "a9 = 1.745 \t\t\t\t#Ratio of area before shock to throat area from isentropic gas tables \n", "Ax_d = At*a9*10**4 \t\t\t\t#Area before shock in cm**2\n", "a10 = 1.226 \t\t\t\t#Ratio of area after shock to throat area after shock from isentropic tables @My_d\n", "At2_d = (Ax_d/a10) \t\t\t\t#Throat area at exit in cm**2\n", "a11 = A2/At2_d \t\t\t\t#Ratio of areas\n", "M2_d = 0.29 \t\t\t\t#Exit mach number at section-B from gas tables @a11\n", "p17 = 0.943 \t\t\t\t#ratio of exit pressure to stagnation pressure after shock from gas tables\n", "P2_d = p17*Poy \t\t\t\t#exit pressure in kPa\n", "#Sub-division (E)\n", "a12 = Ax/At \t\t\t\t#Ratio of areas\n", "Mx_e = 2.62 \t\t\t\t#Mach number upstream of shock from gas tables @a12\n", "t10 = 0.421 \t\t\t\t#Ratio of upstram of shock to stagnation temperature from isentropic gas tables \n", "Tx_e = To1*t10 \t\t\t\t#Temperature upstram of shock in K\n", "p18 = 0.0486 \t\t\t\t#Ratio of upstram of shock to stagnation pressures from isentropic tables @Mx_e\n", "Px_e = p18*Po1 \t\t\t\t#Pressure upstram of shock in kPa\n", "My_e = 0.502 \t\t\t\t#Mach number downstream of shock from gas tables @Mx_e\n", "p19 = 7.842 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My_e\n", "Py_e = Px_e*p19 \t\t\t\t#Pressure downstram of shock in kPa\n", "P2_e = Py_e \t\t\t\t#Exit pressure in kPa\n", "t11 = 2.259 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My_d\n", "Ty_e = Tx_e*t11 \t\t\t\t#Temperaure downstram of shock in K\n", "T2_e = Ty_e \t\t\t\t#Exit temperature in K\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'At throat: \\\n", "\\nMass flow rate is %3.2f kg/s \\\n", "\\nArea at throat is %3.5f m**2 \\\n", "\\nPressure is %3i kPa \\\n", "\\nTemperature is %3.1f K \\\n", "\\nVelocity is %3.1f m/s \\\n", "\\na)At section \\\n", "\\nA): Pressure upstream is %3i kPa \\\n", "\\nTemperature upstream is %3.1f K \\\n", "\\nMack number downstream is %3.2f \\\n", "\\nPressure downstream is %3.3f kPa \\\n", "\\nTemperature downstream is %3.3f K \\\n", "\\nStagnation pressure downstream is %3.1f kPa \\\n", "\\nArea is %3.3f cm**2 \\\n", "\\nAt exit: Mach number is %3.1f \\\n", "\\nPressure is %3.1f kPa \\\n", "\\nB)At section \\\n", "\\nB): Pressure upstream is %3i kPa \\\n", "\\nTemperature upstream is %3.1f K \\\n", "\\nMack number upstream is %3.1f \\\n", "\\nMack number downstream is %3.3f \\\n", "\\nPressure downstream is %3.2f kPa \\\n", "\\nTemperature downstream is %3.2f K \\\n", "\\nStagnation pressure downstream is %3.1f kPa \\\n", "\\nArea is %3.3f cm**2 At exit: \\\n", "\\nMach number is %3.2f Pressure is %3.1f kPa \\\n", "\\nC)At section \\\n", "\\nC): Area upstream is %3.2f cm**2 \\\n", "\\nTemperature upstream is %3.1f K \\\n", "\\nMack number upstream is %3.2f \\\n", "\\nMack number downstream is %3.3f \\\n", "\\nPressure downstream is %3.2f kPa \\\n", "\\nTemperature downstream is %3.2f K \\\n", "\\nStagnation pressure downstream is %3i kPa \\\n", "\\nArea is %3.4f cm**2 At exit: \\\n", "\\nMach number is %3.2f \\\n", "\\nPressure is %3.1f kPa \\\n", "\\nD)At section \\\n", "\\nD): Pressure upstream is %3i kPa \\\n", "\\nTemperature upstream is %3.1f K \\\n", "\\nArea upstream is %3.3f cm**2 \\\n", "\\nMack number upstream is %3.2f \\\n", "\\nMack number downstream is %3.2f \\\n", "\\nPressure downstream is %3.2f kPa \\\n", "\\nTemperature downstream is %3.2f K \\\n", "\\nArea is %3.3f cm**2 \\\n", "\\nAt exit: Mach number is %3.2f \\\n", "\\nPressure is %3.2f kPa \\\n", "\\nE)At section \\\n", "\\nE): Pressure upstream is %3.1f kPa \\\n", "\\nTemperature upstream is %3.1f K \\\n", "\\nMack number upstream is %3.2f \\\n", "\\nMack number downstream is %3.3f \\\n", "\\nPressure downstream is %3.1f kPa \\\n", "\\nTemperature downstream is %3.2f K \\\n", "\\nAt exit: Temperature is %3.2f K \\\n", "\\nPressure is %3.1f kPa'%(m,At,Pt,Tt,Ct,Px_a,Tx_a,My_a,Py_a,Ty_a,Poy_a,At2_a,M2_a,P2_a,Px_b,Tx_b,Mx_b,My_b,Py_b,Ty_b,Poy_b,At2_b,M2_b,P2_b,Ax_c,Tx_c,Mx_c,My_c,Py_c,Ty_c,Poy_c,At2_c,M2_c,P2_c,Px_d,Tx_d,Ax_d,Mx_d,My_d,Py_d,Ty_d,At2_d,M2_d,P2_d,Px_e,Tx_e,Mx_e,My_e,Py_e,Ty_e,T2_e,P2_e)\n", "\n", "# note : rounding off error. kindly check using calculator." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "At throat: \n", "Mass flow rate is 2.80 kg/s \n", "Area at throat is 0.00337 m**2 \n", "Pressure is 264 kPa \n", "Temperature is 500.4 K \n", "Velocity is 448.4 m/s \n", "a)At section \n", "A): Pressure upstream is 206 kPa \n", "Temperature upstream is 465.6 K \n", "Mack number downstream is 0.84 \n", "Pressure downstream is 308.382 kPa \n", "Temperature downstream is 511.694 K \n", "Stagnation pressure downstream is 495.8 kPa \n", "Area is 28.862 cm**2 \n", "At exit: Mach number is 0.2 \n", "Pressure is 482.5 kPa \n", "B)At section \n", "B): Pressure upstream is 157 kPa \n", "Temperature upstream is 430.8 K \n", "Mack number upstream is 1.4 \n", "Mack number downstream is 0.735 \n", "Pressure downstream is 327.34 kPa \n", "Temperature downstream is 542.81 K \n", "Stagnation pressure downstream is 478.7 kPa \n", "Area is 35.107 cm**2 At exit: \n", "Mach number is 0.21 Pressure is 464.2 kPa \n", "C)At section \n", "C): Area upstream is 43.59 cm**2 \n", "Temperature upstream is 388.2 K \n", "Mack number upstream is 1.65 \n", "Mack number downstream is 0.654 \n", "Pressure downstream is 330.74 kPa \n", "Temperature downstream is 552.41 K \n", "Stagnation pressure downstream is 439 kPa \n", "Area is 38.3713 cm**2 At exit: \n", "Mach number is 0.23 \n", "Pressure is 423.8 kPa \n", "D)At section \n", "D): Pressure upstream is 60 kPa \n", "Temperature upstream is 327.6 K \n", "Area upstream is 58.873 cm**2 \n", "Mack number upstream is 2.04 \n", "Mack number downstream is 0.57 \n", "Pressure downstream is 281.28 kPa \n", "Temperature downstream is 563.47 K \n", "Area is 48.021 cm**2 \n", "At exit: Mach number is 0.29 \n", "Pressure is 330.05 kPa \n", "E)At section \n", "E): Pressure upstream is 24.3 kPa \n", "Temperature upstream is 252.6 K \n", "Mack number upstream is 2.62 \n", "Mack number downstream is 0.502 \n", "Pressure downstream is 190.6 kPa \n", "Temperature downstream is 570.62 K \n", "At exit: Temperature is 570.62 K \n", "Pressure is 190.6 kPa\n" ] } ], "prompt_number": 25 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.14 page : 33" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "T = 300. \t\t\t\t#Temperature in K\n", "P = 1.01325*10**5 \t\t\t\t#Absolute pressure in Pa\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "C_1 = 60. \t\t\t\t#Velocity of air in m/s\n", "C_2 = 200. \t\t\t\t#Velocity of air in m/s\n", "C_3 = 500. \t\t\t\t#Velocity of air in m/s\n", "d_hg = 13600. \t\t\t\t#Density of mercury in kg/m**3\n", "g = 9.81 \t\t\t\t#Acceleration due to gravity in m/s**2\n", "\n", "\t\t\t\t\n", "#Calculation\n", "a = math.sqrt(k*R*T) \t\t\t\t#Sound velocity in m/s\n", "M_1 = C_1/a \t\t\t\t#Mach number \n", "dP1 = (P*C_1**2)/(2*R*T) \t\t\t\t#Difference in mercury levels in Pa\n", "dP1_hg = (dP1/(d_hg*g))*1000 \t\t\t\t#Difference in mercury levels in mm of Hg\n", "M_2 = C_2/a \t\t\t\t#Mach number \n", "p1 = (1+((k-1)/2)*M_2**2)**(k/(k-1)) \t\t\t\t#Stagnation to static pressure ratio \n", "Po = p1*P \t\t\t\t#Stagnation pressure in Pa\n", "dP2 = abs(Po-P) \t\t\t\t#Difference in mercury levels in Pa\n", "dP2_hg = (dP2/(d_hg*g))*1000 \t\t\t\t#Difference in mercury levels in mm of Hg\n", "M_3 = C_3/a \t\t\t\t#Mach number & M_3 = Mach number just before shock\n", "My = 0.723 \t\t\t\t#Mach number just after shock\n", "p1 = 2.2530 \t\t\t\t#Ratio of pressure after shock to before shock from gas tables @My\n", "Py = p1*P \t\t\t\t#Pressure after shock in Pa\n", "p2 = 0.706 \t\t\t\t#Ratio of pressure after shock to Stagnation pressure from gas tables @My\n", "Po = Py/p2 \t\t\t\t#Stagnation pressure in Pa\n", "dP3 = Po-Py \t\t\t\t#Difference in mercury levels in Pa\n", "dP3_hg = (dP3/(d_hg*g))*1000 \t\t\t\t#Difference in mercury levels in mm of Hg\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'Difference in mercury levels at velocity equal to: \\\n", "\\nA)%2i m/s is %3.3f mm of Hg \\\n", "\\nB)%3i m/s is %3.1f mm of Hg \\\n", "\\nC)%3i m/s is %3i mm of Hg'%(C_1,dP1_hg,C_2,dP2_hg,C_3,dP3_hg)\n", "\n", "# note : rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Difference in mercury levels at velocity equal to: \n", "A)60 m/s is 15.877 mm of Hg \n", "B)200 m/s is 191.5 mm of Hg \n", "C)500 m/s is 712 mm of Hg\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.15 page : 35" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Px = 16. \t\t\t\t#Pressure before the shock in kPa\n", "Poy = 70. \t\t\t\t#Stagnation pressure after shock in kPa\n", "To = 300.+273 \t\t\t\t#Stagnation temperature in K\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "\n", "\t\t\t\t\n", "#Calculation\n", "p1 = Poy/Px \t\t\t\t#Pressure ratio \n", "Mx = 1.735 \t\t\t\t#Mach number upstream of shock \n", "My = 0.631 \t\t\t\t#Mach number downstream of shock \n", "p2 = 0.84 \t\t\t\t#Ratio of stagnation pressures after and before shock from gas tables\n", "t1 = 1.483 \t\t\t\t#Temperature ratio after and before shock from gas tables\n", "Tx = To/(1+((k-1)/2)*Mx**2) \t\t\t\t#Temperature upstream of shock in K\n", "Ty = Tx*t1 \t\t\t\t#Temperature downstream of shock in K\n", "Pox = Poy/p2 \t\t\t\t#Stagnation pressure before shock in kPa\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Mach number of the tunnal is Mx = %3.3f My = %3.3f) \\\n", "\\nB)Upstream of the tube: \\\n", "\\nStatic temperature is %3i K \\\n", "\\nTotal pressure is %3.1f kPa \\\n", "\\nC)Downstream of the tube: \\\n", "\\nStatic temperature is %3i K \\\n", "\\nTotal pressure is %3i kPa'%(Mx,My,Tx,Pox,Ty,Poy)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Mach number of the tunnal is Mx = 1.735 My = 0.631) \n", "B)Upstream of the tube: \n", "Static temperature is 357 K \n", "Total pressure is 83.3 kPa \n", "C)Downstream of the tube: \n", "Static temperature is 530 K \n", "Total pressure is 70 kPa\n" ] } ], "prompt_number": 30 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.16 page : 35" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Py = 455. \t\t\t\t#Pressure downstream of shock in kPa\n", "Ty = 65.+273 \t\t\t\t#Temperature downstream of shock in K\n", "dP = 65. \t\t\t\t#Difference between dynamic and static pressure in kPa\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "Poy = dP+Py \t\t\t\t#Stagnation pressure after shock in kPa\n", "p1 = Py/Poy \t\t\t\t#Pressure ratio \n", "My = 0.44 \t\t\t\t#Mach number downstream of shock from isentropic gas tables @p1\n", "Mx = 3.8 \t\t\t\t#Mach number upstream of shock from normal shock gas tables @My\n", "t1 = 3.743 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Tx = Ty/t1 \t\t\t\t#Temperature before the shock in K\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Cx = Mx*ax \t\t\t\t#Air Velocity before the shock in m/s\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'A)Mach number is Mx = %3.1f My = %3.2f) \\\n", "\\nB)Velocity is %3.2f m/s'%(Mx,My,Cx)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Mach number is Mx = 3.8 My = 0.44) \n", "B)Velocity is 723.83 m/s\n" ] } ], "prompt_number": 31 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.17 page : 36" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "Px = 1.01325 \t\t\t\t#Pressure before the shock in bar\n", "Tx = 15+273 \t\t\t\t#Temperature before the shock in K\n", "Py = 13.789 \t\t\t\t#Pressure just after the shock in bar\n", "R = 287 \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "p1 = Py/Px \t\t\t\t#Pressure ratio \n", "Mx = 3.47 \t\t\t\t#Mach number upstream of shock from normal shock gas tables @p1\n", "My = 0.454 \t\t\t\t#Mach number downstream of shock from isentropic gas tables @p1\n", "t1 = 3.213 \t\t\t\t#Temperature ratio after and before the shock from gas tables @Mx\n", "Ty = Tx*t1 \t\t\t\t#Temperature downstream of shock in K\n", "p2 = 15.574 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @Mx\n", "Poy = Px*p2 \t\t\t\t#Stagnation pressure after shock in bar\n", "ax = math.sqrt(k*R*Tx) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Cx = Mx*ax \t\t\t\t#Velocity of air before the shock in m/s \n", "Csh = Cx \t\t\t\t#Since Csh = Cx, see dig.\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Cy = My*ay \t\t\t\t#Velocity of air after the shock in m/s\n", "C_y = Cx-Cy \t\t\t\t#Air velocity just inside the shock in m/s\n", "P_y = Py \t\t\t\t#Pressure of air in bar, Since a powerful explosion creates a brief but intense blast wind as it passes\n", "a_y = math.sqrt(k*R*Ty) \t\t\t\t#\t\t\t\t#Velocity of sound after the shock in m/s\n", "M_y = C_y/a_y \t\t\t\t#Mach number\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Shock speed is %3.2f m/s \\\n", "\\nB)Air velocity just inside the shock is %3.2f m/s'%(Cx,C_y)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Shock speed is 1180.40 m/s \n", "B)Air velocity just inside the shock is 903.57 m/s\n" ] } ], "prompt_number": 32 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.18 page : 37" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "T = 300. \t\t\t\t#Temperature in K\n", "P = 1.5 \t\t\t\t#Pressure in bar\n", "C_y = 150. \t\t\t\t#Air velocity just inside the shock in m/s\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", " \n", "\t\t\t\t\n", "#Calculation\n", "ax = math.sqrt(k*R*T) \t\t\t\t#Velocity of sound before the shock in m/s\n", "Mx = math.sqrt(((C_y*(k+1))/(2*ax))+1) \t\t\t\t#Mach number before the shock\n", "My = 0.79 \t\t\t\t#\t\t\t\t#Mach number after the shock from normal shock gas tables \n", "Cx = Mx*ax \t\t\t\t#Velocity of gas before the shock in m/s\n", "p1 = 1.775 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Py = P*p1 \t\t\t\t#Pressure just after the shock in bar\n", "t1 = 1.1845 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = T*t1 \t\t\t\t#Temperature ratio after the shock in K\n", "ay = math.sqrt(k*R*Ty) \t\t\t\t#Velocity of sound after the shock in m/s\n", "Csh = My*ay \t\t\t\t#Speed of the wave in m/s\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'A)Speed of the wave is %3.1f m/s \\\n", "\\nB)At rest condition: \\\n", "\\nPressure is %3.4f bar \\\n", "\\nTemperature is %3.2f K'%(Csh,Py,Ty)\n", "\n", "# note : rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Speed of the wave is 298.5 m/s \n", "B)At rest condition: \n", "Pressure is 2.6625 bar \n", "Temperature is 355.35 K\n" ] } ], "prompt_number": 35 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.19 page : 38" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Mx = 2. \t\t\t\t#Mach number before the shock\n", "a1 = 3. \t\t\t\t#Diffuser area ratio\n", "Pox = 0.1 \t\t\t\t#Stagnation pressure before shock in bar\n", "Tx = 300. \t\t\t\t#Temperature before the shock in K\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "\n", "\t\t\t\t\n", "#Calculation\n", "t1 = 0.555 \t\t\t\t#Static to stagnation temperature ratio before shock from isentropic gas tables @Mx,k = 1.4\n", "Tox = Tx/t1 \t\t\t\t#Stagnation temperature before shock in K\n", "p1 = 0.128 \t\t\t\t#Static to stagnation pressure ratio before shock from isentropic gas tables @Mx,k = 1.4\n", "Px = Pox*p1 \t\t\t\t#Pressure before the shock in bar\n", "My = 0.577 \t\t\t\t#Mach number after the shock\n", "p2 = 4.5 \t\t\t\t#Pressure ratio after and before the shock from gas tables @Mx\n", "Py = Px*p2 \t\t\t\t#Pressure just after the shock in bar\n", "t2 = 1.687 \t\t\t\t#Temperature ratio after and before the shock from gas tables @Mx\n", "Ty = Tx*t2 \t\t\t\t#Temperature ratio after the shock in K\n", "p3 = 0.721 \t\t\t\t#Stagnation pressure ratio after and before shock from gas tables @Mx\n", "Poy = Pox*p3 \t\t\t\t#Stagnation pressure after shock in kPa\n", "a2 = 1.2195 \t\t\t\t#Ratio of area after shock to throat area after shock from gas tables @My\n", "a3 = a2*a1 \t\t\t\t#Ratio of exit area to throat area at exit \n", "M2 = 0.16 \t\t\t\t#Exit mach number from gas tables @a3\n", "t3 = 0.9946 \t\t\t\t#Static to stagnation temperature ratio at exit from isentropic gas tables @Mx\n", "T2 = Tox*t3 \t\t\t\t#Exit Temperature in K, Since Tox = Toy = T02 in case of diffuser\n", "p4 = 0.982 \t\t\t\t#Static to stagnation pressure ratio at exit from isentropic gas tables @Mx\n", "P2 = Poy*p4 \t\t\t\t#Exit pressure in bar, Calculation mistake in textbook\n", "eff = ((((Tox/Tx)*(Poy/Pox)**((k-1)/k))-1)/(((k-1)/2)*Mx**2))*100 \t\t\t\t#Diffuser efficiency including shock in percent\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'A)At the diffuser exit: \\\n", "\\nMach number is %3.2f \\\n", "\\nPressure is %3.3f bar \\\n", "\\nTemperature is %3.2f K \\\n", "\\nB)Diffuser efficiency including shock is %3.3f percent'%(M2,P2,T2,eff)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)At the diffuser exit: \n", "Mach number is 0.16 \n", "Pressure is 0.071 bar \n", "Temperature is 537.62 K \n", "B)Diffuser efficiency including shock is 80.129 percent\n" ] } ], "prompt_number": 37 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.20 page : 39" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\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\n", "P1 = 1. \t\t\t\t#Inlet pressure in bar\n", "T1 = 400. \t\t\t\t#Inlet temperature in K\n", "D = 0.3 \t\t\t\t#Duct diameter in m\n", "M1 = 2. \t\t\t\t#Mach number at entry\n", "Mx = 1.5 \t\t\t\t#Mach number upstream of shock \n", "M2 = 1. \t\t\t\t#Mach number at outlet\n", "f = 0.003 \t\t\t\t#Friction factor\n", "\n", "\t\t\t\t\n", "#Calculation\n", "d1 = P1*10**5/(R*T1) \t\t\t\t#Density at inlet in kg/m**3\n", "a1 = math.sqrt(k*R*T1) \t\t\t\t#Velocity of sound at inlet in m/s \n", "C1 = M1*a1 \t\t\t\t#Gas velocity at inlet in m/s\n", "A1 = math.pi*D**2/4 \t\t\t\t#Inlet Area of the duct in m**2\n", "m = d1*C1*A1 \t\t\t\t#Mass flow rate in kg/s\n", "p1 = 0.131 \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 bar\n", "t1 = 0.625 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropiC)\n", "To1 = T1/t1 \t\t\t\t#Stagnation temperature at inlet in K\n", "p2 = 0.424 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n", "Pt1 = P1/p2 \t\t\t\t#Critical pressure in bar\n", "p3 = 1.773 \t\t\t\t#Stagnation pressure ratio at entry to critical state from gas tables,fanno flow tables @M1,k = 1.4\n", "Pto1 = Po1/p3 \t\t\t\t#Stagnation pressure at critical state in bar \n", "t2 = 0.719 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n", "Tt1 = T1/t2 \t\t\t\t#Critical temperature in K\n", "X1 = 0.357 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n", "p4 = 0.618 \t\t\t\t#Ratio of Static pressure before shock to critical pressure at entry from gas tables (fanno flow,Mx,k = 1.4) \n", "Px = Pt1*p4 \t\t\t\t#pressure before shock in bar\n", "t3 = 0.860 \t\t\t\t#Ratio of Static temperature before shock to critical temperature at entry from gas tables (fanno flow,Mx,k = 1.4) \n", "Tx = Tt1*t3 \t\t\t\t#Temperature before shock in K\n", "p5 = 1.189 \t\t\t\t#Ratio of Stagnation pressure before shock to Stagnation pressure at critical state at entry from gas tables (fanno flow,Mx,k = 1.4) \n", "Pox = Pto1*p5 \t\t\t\t#Stagnation pressure at critical state in bar\n", "Xx = 0.156 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @Mx,k = 1.4\n", "X3 = X1-Xx \t\t\t\t#Overall frictional consmath.tant fanno parameter upstream of duct\n", "L1 = (X3*D)/(4*f) \t\t\t\t#Length upstream of duct in m\n", "My = 0.7 \t\t\t\t#Mach number downstream of shock from gas tables @Mx\n", "p6 = 2.413 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p6 \t\t\t\t#Pressure after shock in bar\n", "t4 = 1.247 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t4 \t\t\t\t#temperature after shock in K\n", "p7 = 0.926 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @My\n", "Poy = Pox*p7 \t\t\t\t#Stagnation pressure after shock in bar\n", "p8 = 1.479 \t\t\t\t#Ratio of pressure after shock to pressure at critical state from gas tables @My\n", "Pt = Py/p8 \t\t\t\t#Critical pressure in bar\n", "p9 = 1.097 \t\t\t\t#Ratio of Stagnation pressure after shock to Stagnation pressure at critical state from gas tables @My\n", "Pot = Poy/p9 \t\t\t\t#Stagnation pressure at critical state in bar\n", "t5 = 1.071 \t\t\t\t#Ratio of temperature after shock to temperature at critical state from gas tables @My\n", "Tt = Ty/t5 \t\t\t\t#Critical temperature in K\n", "Xy = 0.231 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @My,k = 1.4\n", "X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M = 1,k = 1.4\n", "X4 = Xy-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter downstream of duct\n", "L2 = (X4*D)/(4*f) \t\t\t\t#Length downstream of duct in m\n", "ds1 = R*math.log(Po1/Pox) \t\t\t\t#Change of entropy upstream of the shock in J/kg-K\n", "ds2 = R*math.log(Pox/Poy) \t\t\t\t#Change of entropy across the shock in J/kg-K\n", "ds3 = R*math.log(Poy/Pot) \t\t\t\t#Change of entropy downstream of the shock in J/kg-K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Length of the duct upstream and downstream of the duct is %3.3f m and %3.3f m respectively \\\n", "\\nB)Mass flow rate of the gas is %3.3f kg/s \\\n", "\\nC)Change of entropy: \\\n", "\\nUpstream of the shock is %3.2f J/kg-K \\\n", "\\nAcross the shock is %3.3f J/kg-K \\\n", "\\nDownstream of the shock is %3.4f J/kg-K'%(L1,L2,m,ds1,ds2,ds3)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Length of the duct upstream and downstream of the duct is 5.025 m and 5.775 m respectively \n", "B)Mass flow rate of the gas is 47.573 kg/s \n", "C)Change of entropy: \n", "Upstream of the shock is 114.67 J/kg-K \n", "Across the shock is 22.065 J/kg-K \n", "Downstream of the shock is 26.5702 J/kg-K\n" ] } ], "prompt_number": 39 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.21 page : 41" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "P1 = 0.685 \t\t\t\t#Inlet pressure in bar\n", "T1 = 310. \t\t\t\t#Inlet temperature in K\n", "D = 0.6 \t\t\t\t#Duct diameter in m\n", "M1 = 3. \t\t\t\t#Mach number at entry\n", "Mx = 2.5 \t\t\t\t#Mach number upstream of shock \n", "M2 = 0.8 \t\t\t\t#Mach number at outlet\n", "f = 0.005 \t\t\t\t#Friction factor\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "R = 287. \t\t\t\t#Specific gas consmath.tant in J/kg-K\n", "\n", "\t\t\t\t\n", "#Calculation\n", "d1 = P1*10**5/(R*T1) \t\t\t\t#Density at inlet in kg/m**3\n", "a1 = math.sqrt(k*R*T1) \t\t\t\t#Velocity of sound at inlet in m/s \n", "C1 = M1*a1 \t\t\t\t#Air velocity at inlet in m/s\n", "A1 = math.pi*D**2/4 \t\t\t\t#Inlet Area of the duct in m**2\n", "m = d1*C1*A1 \t\t\t\t#Mass flow rate in kg/s\n", "p1 = 0.218 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n", "Pt1 = P1/p1 \t\t\t\t#Critical pressure in bar \n", "t1 = 0.428 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n", "Tt1 = T1/t1 \t\t\t\t#Critical temperature in K\n", "X1 = 0.522 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n", "p2 = 0.292 \t\t\t\t#Ratio of Static pressure before shock to critical pressure at entry from gas tables (fanno flow,Mx,k = 1.4)\n", "Px = Pt1*p2 \t\t\t\t#pressure before shock in bar\n", "t2 = 0.533 \t\t\t\t#Ratio of Static temperature before shock to critical temperature at entry from gas tables (fanno flow,Mx,k = 1.4) \n", "Tx = Tt1*t2 \t\t\t\t#Temperature before shock in K\n", "Xx = 0.432 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @Mx,k = 1.4\n", "X3 = X1-Xx \t\t\t\t#Overall frictional consmath.tant fanno parameter upstream of duct\n", "L1 = (X3*D)/(4*f) \t\t\t\t#Length upstream of duct in m\n", "My = 0.513 \t\t\t\t#Mach number downstream of shock from gas tables @Mx\n", "p3 = 7.125 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p3 \t\t\t\t#Pressure after shock in bar\n", "t3 = 2.138 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t3 \t\t\t\t#temperature after shock in K\n", "p4 = 2.138 \t\t\t\t#Ratio of pressure after shock to pressure at critical state from gas tables @My\n", "Pt = Py/p4 \t\t\t\t#Critical pressure in bar\n", "t4 = 1.143 \t\t\t\t#Ratio of temperature after shock to temperature at critical state from gas tables @My\n", "Tt = Ty/t4 \t\t\t\t#Critical temperature in K\n", "p5 = 1.289 \t\t\t\t#Ratio of pressure at exit to pressure at critical state from gas tables @M2\n", "P2 = Pt*p5 \t\t\t\t#Exit pressure in bar \n", "t5 = 1.064 \t\t\t\t#Ratio of temperature at exit to temperature at critical state from gas tables @M2 \n", "T2 = Tt*t5 \t\t\t\t#Exit temperature in K\n", "Xy = 1.069 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @My,k = 1.4\n", "X2 = 0.073 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n", "X4 = Xy-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter downstream of duct\n", "L2 = (X4*D)/(4*f) \t\t\t\t#Length downstream of duct in m\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Length L1 and L2 are %3.1f m and %3.2f m respectively \\\n", "\\nB)State of air at exit: Pressure is %3.3f bar Temperature is %3.1f K \\\n", "\\nC)Mass flow rate through the duct is %3.2f kg/s'%(L1,L2,P2,T2,m)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Length L1 and L2 are 2.7 m and 29.88 m respectively \n", "B)State of air at exit: Pressure is 3.941 bar Temperature is 768.3 K \n", "C)Mass flow rate through the duct is 230.49 kg/s\n" ] } ], "prompt_number": 40 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.22 page : 42" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "At = 24. \t\t\t\t#Throat area in cm**2\n", "A2 = 50. \t\t\t\t#Exit area in cm**2\n", "Po = 700. \t\t\t\t#Stagnation pressure in kPa\n", "To = 100.+273 \t\t\t\t#Stagnation temperature in K\n", "Ax = 34. \t\t\t\t#Area before the shock in cm**2\n", "Ay = 34. \t\t\t\t#Area after the shock in cm**2\n", "\n", "\t\t\t\t\n", "#Calculation\n", "a1 = Ax/At \t\t\t\t#Ratio of areas\n", "Mx = 1.78 \t\t\t\t#Mach number upstream of shock from gas tables @a1\n", "t1 = 0.61212 \t\t\t\t#Ratio of temperature before shock to critical state from isentropic gas tables @Mx\n", "Tx = To*t1 \t\t\t\t#temperature before shock in K\n", "p1 = 0.179 \t\t\t\t#Ratio of pressure before shock to critical state from isentropic gas tables @Mx\n", "Px = Po*p1 \t\t\t\t#pressure before shock in kPa\n", "My = 0.621 \t\t\t\t#Mach number downstream of shock from gas tables @Mx\n", "p2 = 3.5298 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p2 \t\t\t\t#Pressure after shock in kPa\n", "t2 = 1.51669 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t2 \t\t\t\t#temperature after shock in K\n", "p3 = 4.578 \t\t\t\t#Ratio of Stagnation pressure after the shock to static pressure before shock from gas tables @My\n", "Po2 = Px*p3 \t\t\t\t#Stagnation pressure at exit in bar\n", "a2 = 1.16565 \t\t\t\t#Ratio of area after shock to critical area across shock from isentropic gas tables @My\n", "At2 = Ay/a2 \t\t\t\t#critical area at exit in cm**2\n", "a3 = A2/At2 \t\t\t\t#Ratio of areas \n", "M2 = 0.36 \t\t\t\t#Exit mach number from gas tables (a3,k = 1.4,isentropiC)\n", "p4 = 0.914 \t\t\t\t#Static to Stagnation pressure ratio at exit from gas tables (a3,k = 1.4,isentropiC) \n", "P2 = Po2*p4 \t\t\t\t#Stagnation pressure ratio at exit in kPa\n", "t3 = 0.975 \t\t\t\t#Static to Stagnation temperature ratio at exit from gas tables (a3,k = 1.4,isentropiC)\n", "T2 = To*t3 \t\t\t\t#Stagnation temperature at exit in K\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Properties of fluid just after shock: \\\n", "\\nMach number My = %3.3f \\\n", "\\nTemperature is %3.2f K \\\n", "\\nPressure is %3.2f kPa \\\n", "\\nB)Exit mach number is %3.2f \\\n", "\\nC)Properties of fluid at exit: \\\n", "\\nPressure is %3i kPa \\\n", "\\nTemperature is %3.3f K'%(My,Ty,Py,M2,P2,T2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Properties of fluid just after shock: \n", "Mach number My = 0.621 \n", "Temperature is 346.29 K \n", "Pressure is 442.28 kPa \n", "B)Exit mach number is 0.36 \n", "C)Properties of fluid at exit: \n", "Pressure is 524 kPa \n", "Temperature is 363.675 K\n" ] } ], "prompt_number": 42 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.23 page : 44" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "D = 0.4 \t\t\t\t#Duct diameter in m\n", "Po = 12. \t\t\t\t#Stagnation pressure in kPa\n", "To = 600. \t\t\t\t#Stagnation temperature in K\n", "f = 0.0025 \t\t\t\t#Friction factor\n", "M1 = 1.8 \t\t\t\t#Mach number at entry\n", "M2 = 1. \t\t\t\t#Mach number at outlet\n", "Mx = 1.22 \t\t\t\t#Mach number upstream of shock \n", "\n", "\t\t\t\t\n", "#Calculations\n", "A2 = math.pi*D**2/4 \t\t\t\t#Exit area in cm**2\n", "p1 = 0.174 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropiC)\n", "P1 = Po*p1 \t\t\t\t#Inlet pressure in bar\n", "t1 = 0.607 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropiC)\n", "T1 = To*t1 \t\t\t\t#Inlet temperature in K\n", "a1 = 1.094 \t\t\t\t#Ratio of area at exit to critical area across shock from isentropic gas tables @M1,k = 1.4\n", "Ax = A2/a1 \t\t\t\t#Area before the shock in cm**2\n", "Dt = math.sqrt((Ax*4)/(math.pi))*10**2 \t\t\t\t#Duct diameter at throat in cm\n", "p2 = 0.474 \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 bar \n", "t2 = 0.728 \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", "X1 = 0.242 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n", "p3 = 0.788 \t\t\t\t#Ratio of Static pressure before shock to critical pressure at entry from gas tables (fanno flow,Mx,k = 1.4)\n", "Px = Pt*p3 \t\t\t\t#pressure before shock in bar\n", "t3 = 0.925 \t\t\t\t#Ratio of Static temperature before shock to critical temperature at entry from gas tables (fanno flow,Mx,k = 1.4)\n", "Tx = Tt*t3 \t\t\t\t#Temperature before shock in K\n", "Xx = 0.039 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @Mx,k = 1.4\n", "X3 = X1-Xx \t\t\t\t#Overall frictional consmath.tant fanno parameter upstream of duct\n", "L1 = (X3*D)/(4*f) \t\t\t\t#Length upstream of duct in m\n", "My = 0.83 \t\t\t\t#Mach number downstream of shock from gas tables @Mx\n", "p4 = 1.57 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @My\n", "Py = Px*p4 \t\t\t\t#Pressure after shock in bar\n", "t4 = 1.141 \t\t\t\t#Temperature ratio after and before the shock from gas tables @My\n", "Ty = Tx*t4 \t\t\t\t#temperature after shock in K\n", "p5 = 1.2375 \t\t\t\t#Ratio of pressure after shock to pressure at critical state from gas tables @My\n", "Pt = Py/p5 \t\t\t\t#Critical pressure in bar\n", "t5 = 1.055 \t\t\t\t#Ratio of temperature after shock to temperature at critical state from gas tables @My\n", "Tt = Ty/t5 \t\t\t\t#Critical temperature in K\n", "Xy = 0.049 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @My,k = 1.4\n", "X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M = 1,k = 1.4\n", "X4 = Xy-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter downstream of duct\n", "L2 = (X4*D)/(4*f) \t\t\t\t#Length downstream of duct in m\n", "L = L1+L2 \t\t\t\t#Length of duct in m\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Length of the pipe is %3.2f m \\\n", "\\nB)Diameter of the nozzle throat is %3.3f cm \\\n", "\\nC)At the pipe exit: \\\n", "\\nPressure is %3.3f bar \\\n", "\\nTemperature is %3.2f K'%(L,Dt,Pt,Tt)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Length of the pipe is 10.08 m \n", "B)Diameter of the nozzle throat is 38.243 cm \n", "C)At the pipe exit: \n", "Pressure is 4.404 bar \n", "Temperature is 500.48 K\n" ] } ], "prompt_number": 43 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.24 page : 45" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "Po = 700. \t\t\t\t#Stagnation pressure in kPa\n", "To = 500.+273 \t\t\t\t#Stagnation temperature in K\n", "a1 = 3.5 \t\t\t\t#Ratio of exit area to throat area\n", "m = 5.5 \t\t\t\t#Mass flow rate in kg/s\n", "Cp = 1.005 \t\t\t\t#Specific heat capacity at consmath.tant pressure in kJ/kg-K\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n", "\n", "\t\t\t\t\n", "#Calculation\n", "My = 1/math.sqrt(k) \t\t\t\t#Mach number downstream of shock\n", "M2 = 2.8 \t\t\t\t#Mach number at outlet from gas tables @a1 \n", "t1 = 0.389 \t\t\t\t#Static to Stagnation temperature ratio at exit from gas tables (M1,k = 1.4,isentropiC)\n", "T2 = To*t1 \t\t\t\t#Exit temperature in K\n", "p1 = 0.0369 \t\t\t\t#Static to Stagnation pressure ratio at exit from gas tables (M1,k = 1.4,isentropiC)\n", "P2 = Po*p1 \t\t\t\t#exit pressure in kPa\n", "p2 = 0.2 \t\t\t\t#Ratio of pressure at exit to pressure at critical state at exit from Rayleigh flow gas tables @M2\n", "Pt2 = P2/p2 \t\t\t\t#Exit pressure at critical state in kPa\n", "t2 = 0.315 \t\t\t\t#Ratio of temperature at exit to temperature at critical state at exit from Rayleigh flow gas tables @M2\n", "Tt2 = T2/t2 \t\t\t\t#Exit temperature at critical state in K\n", "t3 = 0.674 \t\t\t\t#Ratio of Stagnation temperature at exit to stagnation temperature at critical state at exit from Rayleigh flow gas tables @M2\n", "Tto2 = To/t3 \t\t\t\t#Exit stagnation temperature at critical state in K\n", "Mx = 1.2 \t\t\t\t#Mach number upstream of shock from gas tables @My\n", "p3 = 0.796 \t\t\t\t#Ratio of Static pressure before shock to critical pressure at exit from gas tables (Rayleigh flow,Mx,k = 1.4)\n", "Px = Pt2*p3 \t\t\t\t#Static pressure before shock in kPa\n", "t4 = 0.912 \t\t\t\t#Ratio of Static temperature before shock to critical temperature at exit from gas tables (Rayleigh flow,Mx,k = 1.4)\n", "Tx = Tt2*t4 \t\t\t\t#Static temperature before shock in K\n", "t5 = 0.978 \t\t\t\t#Ratio of Stagnation temperature before shock to critical Stagnation temperature at exit from gas tables (Rayleigh flow,Mx,k = 1.4)\n", "Tox = Tto2*t5 \t\t\t\t#Stagnation temperature before shock in K\n", "p4 = 1.513 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @Mx \n", "Py = Px*p4 \t\t\t\t#Pressure after shock in kPa\n", "t6 = 1.128 \t\t\t\t#Temperature ratio after and before the shock from gas tables @Mx\n", "Ty = Tx*t6 \t\t\t\t#temperature after shock in K\n", "t7 = 0.875 \t\t\t\t#Ratio of Temperature after the shock to Stagnation temperature after shock from gas tables @Mx \n", "Toy = Ty/t7 \t\t\t\t#Stagnation temperature after shock in K,\n", "p5 = 1.207 \t\t\t\t#Ratio of pressure after shock to pressure at critical state from gas tables @My\n", "Pt = Py/p5 \t\t\t\t#Critical pressure in kPa\n", "t8 = 1.028 \t\t\t\t#Ratio of temperature after shock to temperature at critical state from gas tables @My\n", "Tt = Ty/t8 \t\t\t\t#Critical temperature in K\n", "t9 = 0.978 \t\t\t\t#Ratio of Stagnation temperature after shock to Stagnation temperature at critical state from gas tables @My\n", "Tot = Toy/t9 \t\t\t\t#Stagnation temperature at critical state in K, calculation mistake in textbbok \n", "q1 = Cp*(Tox-To) \t\t\t\t#Amount of heat added in upstream of shock in kJ/s\n", "q2 = Cp*(Tot-Toy) \t\t\t\t#Amount of heat added in downstream of shock in kJ/s\n", "Q = m*(q1+q2) \t\t\t\t#Amount of heat added in two pipe section in kJ/s\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Amount of heat added in two pipe section is %3.2f kJ/s \\\n", "\\nB)Properties: Upstream of shock: \\\n", "\\nPressure is %3.1f kPa \\\n", "\\nTemperature is %3.3f K \\\n", "\\nStagnation temperature is %3.2f K \\\n", "\\nMach number is %3.1f \\\n", "\\nDownstream of shock: Pressure is %3.3f kPa \\\n", "\\nTemperature is %3.3f K \\\n", "\\nStagnation temperature is %3.1f K \\\n", "\\nMach number is %3.3f \\\n", "\\nAt the throat: Pressure is %3.2f kPa \\\n", "\\nTemperature is %3.3f K \\\n", "\\nStagnation temperature is %3.2f K \\\n", "\\nAt the exit: Pressure is %3.2f kPa \\\n", "\\nTemperature is %3.2f K \\\n", "\\nMach number is %3.2f'%(Q,Px,Tx,Tox,Mx,Py,Ty,Toy,My,Pt,Tt,Tot,P2,T2,M2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Amount of heat added in two pipe section is 2066.73 kJ/s \n", "B)Properties: Upstream of shock: \n", "Pressure is 102.8 kPa \n", "Temperature is 870.589 K \n", "Stagnation temperature is 1121.65 K \n", "Mach number is 1.2 \n", "Downstream of shock: Pressure is 155.542 kPa \n", "Temperature is 982.025 K \n", "Stagnation temperature is 1122.3 K \n", "Mach number is 0.845 \n", "At the throat: Pressure is 128.87 kPa \n", "Temperature is 955.277 K \n", "Stagnation temperature is 1147.56 K \n", "At the exit: Pressure is 25.83 kPa \n", "Temperature is 300.70 K \n", "Mach number is 2.80\n" ] } ], "prompt_number": 45 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.25 page : 47" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "M1 = 2.8 \t\t\t\t#Inlet mach number \n", "sig = 42. \t\t\t\t#Shock wave angle in degree\n", "Px = 1. \t\t\t\t#Pressure upstream of shock in bar(Assuming)\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "\n", "\t\t\t\t\n", "#Calculations\n", "Mx = M1*math.sin(math.radians(sig)) \t\t\t\t#Mach number before the shock\n", "My = 0.601 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 3.98 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @Mx \n", "Py = Px*p1 \t\t\t\t#Pressure after shock in bar\n", "p2 = 4.994 \t\t\t\t#Stagnation pressure after shock to Static pressure before shock from gas tables @Mx\n", "Poy = Px*p2 \t\t\t\t#Stagnation pressure after shock in bar\n", "p3 = 0.788 \t\t\t\t#Stagnation pressure ratio after and before the shock from gas tables @Mx\n", "Pox = Poy/p3 \t\t\t\t#Stagnation pressure before shock in kPa\n", "dPl = Pox-Poy \t\t\t\t#Total pressure loss in bar\n", "#disp(((M1^2*sind(2*sig))-(2/tand(sig)))/(2+(M1^2*(k+cosd(2*sig)))))\n", "#def=atand(((M1^2*sind(2*sig))-(2/tand(sig)))/(2+(M1^2*(k+cosd(2*sig))))) //Deflection angle in degree\n", "def1 = (M1**2*math.sin(math.radians(2*sig)) - (2/math.tan(math.radians(sig))))/(2 + M1**2*(k+math.cos(math.radians(2*sig))))\n", "def1 = math.degrees(math.atan(def1))\n", "M2 = My/(math.sin(math.radians(sig-def1))) \t\t\t\t#Downstream mach number\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'A)Deflection angle is %3i degree \\\n", "\\nB)Downstream mach number is %3.3f \\\n", "\\nC)Static pressure is %3.3f bar \\\n", "\\nD)Total pressure loss is %3.3f bar'%(def1,M2,Py,dPl)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Deflection angle is 22 degree \n", "B)Downstream mach number is 1.758 \n", "C)Static pressure is 3.980 bar \n", "D)Total pressure loss is 1.344 bar\n" ] } ], "prompt_number": 46 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.26 page : 47" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "\t\t\t\t\n", "#Input data\n", "M1 = 2. \t\t\t\t#Inlet mach number \n", "sig = 40. \t\t\t\t#Shock wave angle in degree\n", "Px = 0.5 \t\t\t\t#Pressure upstream of shock in bar\n", "Tx = 273. \t\t\t\t#Temperature upstream of shock in K\n", "k = 1.4 \t\t\t\t#Adiabatic consmath.tant \n", "\n", "\t\t\t\t\n", "#Calculation\n", "Mx = M1*math.sin(math.radians(sig)) \t\t\t\t#Mach number before the shock\n", "My = 0.796 \t\t\t\t#Mach number after the shock from gas tables @Mx\n", "p1 = 1.745 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @Mx \n", "Py = p1*Px \t\t\t\t#Pressure after shock in bar\n", "t1 = 1.178 \t\t\t\t#Static temperature ratio after and before the shock from gas tables @Mx \n", "Ty = Tx*t1 \t\t\t\t#Temperature after shock in K\n", "Ws = math.degrees(math.atan(((M1**2*math.sin(math.radians(2*sig))) - (2/math.tan(math.radians(sig)))) / (2+ (M1**2*(k+math.cos(math.radians(2*sig)))))))\n", "W = 2*Ws \t\t\t\t#Wedge angle in degree\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Static pressure is %3.4f bar \\\n", "\\nB)Temperature behind the wave is %3.2f K \\\n", "\\nC)Mach number of flow pasmath.sing over wedge is %3.3f \\\n", "\\nD)Wedge angle is %3.2f degree'%(Py,Ty,Mx,W)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Static pressure is 0.8725 bar \n", "B)Temperature behind the wave is 321.59 K \n", "C)Mach number of flow pasmath.sing over wedge is 1.286 \n", "D)Wedge angle is 21.25 degree\n" ] } ], "prompt_number": 47 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.27 page : 48" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "from numpy import roots\n", "\n", "\t\t\t\t\n", "#Input data\n", "def1 = 15.\n", "M1 = 2\n", "k = 1.4\n", "\n", "\t\t\t\t\n", "#Calculation\n", "#Umath.sing relation def = math.radians(math.tan((((M1**2*math.sin(math.radians(2*sig))-(2/math.radians(math.tan((sig)))/(2+(M1**2*(k+math.cos(math.radians(2*sig))))) and converting into 6th degree polynomial of math.sin(math.radians(sig) = x\n", "#C=((2*tand(def))+((M1^2)*k*tand(def))+((M1^2)*tand(def))) \n", "C = ((2*math.tan(math.radians(def1))) + ((M1**2)*k*math.tan(math.radians(def1))) + ((M1**2)*math.tan(math.radians(def1))))\n", "#C = ((2*math.radians(math.tan((def1))+((M1**2)*k*math.radians(math.tan((def1))+((M1**2)*math.radians(math.tan((def1))) \t\t\t\t#Consmath.tant value for convenience\n", "D = (2*M1**2*math.tan(math.radians(def1))) \t\t\t\t#Consmath.tant value for convenience\n", "a = 4 \t\t\t\t#Value of consmath.tant in polynomial \n", "b = 0 \t\t\t\t#Coefficient of power 1 i.e. x**1\n", "c = (4+C**2+(8*M1**2)) \t\t\t\t#Coefficient of power 2 i.e. x**2\n", "d = 0 \t\t\t\t#Coefficient of power 3 i.e. x**3\n", "e = (4*(M1**4))+(2*C*D)+(8*M1**2) \t\t\t\t#Coefficient of power 4 i.e. x**4\n", "f = 0 \t\t\t\t#Coefficient of power 5 i.e. x**5\n", "g = (4*M1**4)+D**2 \t\t\t\t#Coefficient of power 6 i.e. x**6\n", "#p4 = poly([a b -c -d e f -g],'x','c') \t\t\t\t#Expression for solving 6th degree polynomial\n", "print ('Values for sine of wave angle are:')\n", "print (roots([-g,f,e,-d,-c,b,a]))\n", "sig1 = math.degrees(math.asin(0.9842)) \t\t\t\t#Strong shock wave angle in degree, nearer to 90 degree\n", "sig2 = math.degrees(math.asin(0.7113)) \t\t\t\t#Weak shock wave angle in degree, nearer to 45 degree\n", "\n", "#(a)Strong Shock Wave\n", "Mx_1 = M1*math.sin(math.radians(sig1)) \t\t\t\t#Mach number before the shock of stong shock wave\n", "My_1 = 0.584 \t\t\t\t#Mach number after the shock from gas tables @Mx_1\n", "p1 = 4.315 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @Mx_1\n", "t1 = 1.656 \t\t\t\t#Static temperature ratio after and before the shock from gas tables @Mx_1\n", "d1 = p1/t1 \t\t\t\t#Density ratio after and before the shock of stong shock wave\n", "M2_1 = My_1/(math.sin(math.radians(sig1-def1))) \t\t\t\t#Exit mach number of stong shock wave\n", "Mx_2 = M1*math.sin(math.radians(sig2)) \t\t\t\t#Mach number before the shock of weak shock wave\n", "My_2 = 0.731 \t\t\t\t#Mach number after the shock from gas tables @Mx_2\n", "p2 = 2.186 \t\t\t\t#Static pressure ratio after and before the shock from gas tables @Mx_2\n", "t2 = 1.267 \t\t\t\t#Static temperature ratio after and before the shock from gas tables @Mx_2\n", "d2 = p2/t2 \t\t\t\t#Density ratio after and before the shock of weak shock wave\n", "M2_2 = My_2/(math.sin(math.radians(sig2-def1))) \t\t\t\t#Exit mach number of weak shock wave\n", "\n", "\t\t\t\t\n", "#Output \n", "print 'Strong Shock Wave: A)Wave angle is %3.1f degree \\\n", "\\nB)Pressure ratio is %3.3f \\\n", "\\nC)Density ratio is %3.3f \\\n", "\\nD)Temperature ratio is %3.3f \\\n", "\\nE)Downstream Mach number is %3.3f \\\n", "\\nWeak Shock Wave: A)Wave angle is %3.1f degree \\\n", "\\nB)Pressure ratio is %3.3f \\\n", "\\nC)Density ratio is %3.3f \\\n", "\\nD)Temperature ratio is %3.3f \\\n", "\\nE)Downstream Mach number is %3.3f'%(sig1,p1,d1,t1,M2_1,sig2,p2,d2,t2,M2_2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Values for sine of wave angle are:\n", "[ 0.98429339 -0.98429339 0.71133473 -0.71133473 -0.34489365 0.34489365]\n", "Strong Shock Wave: A)Wave angle is 79.8 degree \n", "B)Pressure ratio is 4.315 \n", "C)Density ratio is 2.606 \n", "D)Temperature ratio is 1.656 \n", "E)Downstream Mach number is 0.645 \n", "Weak Shock Wave: A)Wave angle is 45.3 degree \n", "B)Pressure ratio is 2.186 \n", "C)Density ratio is 1.725 \n", "D)Temperature ratio is 1.267 \n", "E)Downstream Mach number is 1.447\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5.28 page : 49" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\t\n", "#Input data\n", "k = 1.3 \t\t\t\t#Adiabatic consmath.tant \n", "P1 = 0.345 \t\t\t\t#Inlet pressure in bar\n", "T1 = 350. \t\t\t\t#Inlet temperature in K\n", "M1 = 1.5 \t\t\t\t#Inlet mach number \n", "P2 = 0.138 \t\t\t\t#Exit pressure in bar\n", "\n", "\t\t\t\t\n", "#Calculation\n", "p1 = 0.284 \t\t\t\t#Pressure ratio at entry from gas tables @M1,k = 1.3\n", "Po = P1/p1 \t\t\t\t#Stagnation Pressure in bar\n", "t1 = 0.748 \t\t\t\t#Temperature ratio at entry from gas tables @M1,k = 1.3\n", "To = T1/t1 \t\t\t\t#Stagnation temperature in K\n", "p2 = P2/Po \t\t\t\t#Pressure ratio\n", "M2 = 2.08 \t\t\t\t#Final Mach number from isentropic gas tables @p2\n", "t2 = 0.606 \t\t\t\t#Temperature ratio at exit from gas tables @M2,k = 1.3\n", "T2 = To*t2 \t\t\t\t#The temperature of the gas in K\n", "w1 = 12.693 \t\t\t\t#Prandtl Merger function at M1 \n", "w2 = 31.12 \t\t\t\t#Prandtl Merger function at M2\n", "def1 = w2-w1 \t\t\t\t#Deflection Angle in degree\n", "\n", "\t\t\t\t\n", "#Output\n", "print 'A)Deflection Angle is %3.3f degree \\\n", "\\nB)Final Mach number is %3.2f \\\n", "\\nC)The temperature of the gas is %3.3f K'%(def1,M2,T2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A)Deflection Angle is 18.427 degree \n", "B)Final Mach number is 2.08 \n", "C)The temperature of the gas is 283.556 K\n" ] } ], "prompt_number": 49 } ], "metadata": {} } ] }