{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Chapter 16: Fluid Flow Nozzles and Turbines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 16.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exit area (sq. ft) =  0.01190\n",
      "\n",
      " Exit area in case 2 (sq. ft) =  0.00521\n"
     ]
    }
   ],
   "source": [
    "#(a)Find the exit area of a reversible nozzle to pass 1 lb/sec of steam if the\n",
    "#inlet state of steam is 100 psia, 500F and 100 fps velocity and the exit pressure\n",
    "#is 10 psia. (b) Will the nozzle be convering or divering and if the latter, what\n",
    "#will be the throat area?\n",
    "import math\n",
    "#initialisation of variables\n",
    "h1=1279.1 \t\t\t\t\t\t\t\t\t\t\t#Btu/lb\n",
    "s1=1.7085 \t\t\t\t\t\t\t\t\t\t\t#Btu/lb R\n",
    "p1= 100 \t\t\t\t\t\t\t\t\t\t\t#psia\n",
    "p2=10 \t\t\t\t\t\t\t\t\t\t\t\t#psia\n",
    "h2=1091.7 \t\t\t\t\t\t\t\t\t\t\t#Btu/lb\n",
    "s2=s1\n",
    "V1=100 \t\t\t\t\t\t\t\t\t\t\t\t#fps\n",
    "v2=36.41 \t\t\t\t\t\t\t\t\t\t\t#cu ft/lb\n",
    "w=1 \t\t\t\t\t\t\t\t\t\t\t\t#lb/sec\n",
    "#Calculations\n",
    "a2=w*v2/(math.sqrt(V1*V1 + 2*24956.243*(h1-h2)))\t#Exit area\n",
    "print '%s %.5f' %('Exit area (sq. ft) = ',a2)\n",
    "pt=0.55*p1 \t\t\t\t\t\t\t\t\t\t\t#Thorat pressure\n",
    "ht=1221.5  \t\t\t\t\t\t\t\t\t\t\t#Btu/lb \n",
    "vt=8.841 \t\t\t\t\t\t\t\t\t\t\t#cu ft/lb\n",
    "at=w*vt/(math.sqrt(V1*V1 + 2*24956.243*(h1-ht))) \t#Exit area in case 2\n",
    "print '%s %.5f' %('\\n Exit area in case 2 (sq. ft) = ',at)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 16.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "from tables\n",
      "Throat area (ft^2) =  0.00571\n",
      "\n",
      " Exit area (ft^2) =  0.17756\n",
      "\n",
      " Final throat area (ft^2)=  0.00582\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Find the throat and exit areas for a nozzle to pass 10000 of steam from an initial\n",
    "#state of 250 psia, 500F to a final pressure 1 psia, vel coeff. 0.949 and the \n",
    "#discharge coeff. is unity. Find the exit jet velocity\n",
    "#initialisation of variables\n",
    "import math\n",
    "w=10000. \t\t\t\t\t\t\t\t\t#lb/hr\n",
    "p0=250. \t\t\t\t\t\t\t\t\t#psia\n",
    "T1=500. \t\t\t\t\t\t\t\t\t#F\n",
    "Pf=1. \t\t\t\t\t\t\t\t\t\t#psia\n",
    "vc=0.949\n",
    "dc=1\n",
    "h0=1263.4 \t\t\t\t\t\t\t\t\t#btu/lb\n",
    "s0=1.5949 \t\t\t\t\t\t\t\t\t#btu/lb R\n",
    "v2=276.\t\t\t\t\t\t\t\t\t\t#cu ft/lb\n",
    "#Calculations\n",
    "pt=0.55*p0\t\t\t\t\t\t\t\t\t#Throat pressure\n",
    "print '%s' %('from tables')\n",
    "hts=1208.2 \t\t\t\t\t\t\t\t\t#btu/lb\n",
    "vts=3.415 \t\t\t\t\t\t\t\t\t#cu ft/lb\n",
    "h2s=891. \t\t\t\t\t\t\t\t\t#btu/lb\n",
    "Vts=math.sqrt(2*32.174*778*(h0-hts))\t\t#Throat velocity\n",
    "w=w/3600. \t\t\t\t\t\t\t\t\t#lb/sec \n",
    "cw=1\n",
    "at=w*vts/(cw*Vts)\t\t\t\t\t\t\t#Throat area\n",
    "print '%s %.5f' %('Throat area (ft^2) = ',at)\n",
    "V2=math.sqrt(2*32.174*778*(h0-h2s)) \t\t#Exit velocity\n",
    "eta=0.9\n",
    "h2=h0-eta*(h0-h2s) \t\t\t\t\t\t\t#Enthalpy\n",
    "a2s=w*v2/(cw*V2)  \t\t\t\t\t\t\t#Exit area\n",
    "print '%s %.5f' %('\\n Exit area (ft^2) = ',a2s)\n",
    "at=at/0.98\n",
    "print '%s %.5f' %('\\n Final throat area (ft^2)= ',at)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 16.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exit velocity case 1 (fps) =  1262.76\n",
      "\n",
      " Throat Area (ft^2) =  0.00246\n",
      "\n",
      " Exit velocity (fps) =  2029.48\n",
      "\n",
      " Exit area (ft^2) =  0.00562\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Find the exit velocity and the throat and exit areas for a nozzle to pass\n",
    "#1 lb/sec of air from an inlet state of 150 psia, 340 F, negligible velocity, \n",
    "#to an exhaust pressure of 15 psia if the nozzle efficiency is 88% and Cd=1?\n",
    "import math\n",
    "#initialisation of variables\n",
    "k=1.4\n",
    "ptbyp0=0.53\n",
    "T0=800.\t\t\t\t\t\t\t\t\t\t#R\n",
    "cp=778. \n",
    "R=0.0425864\n",
    "P0=150.\t\t\t\t\t\t\t\t\t\t#psia\n",
    "Pt=15. \t\t\t\t\t\t\t\t\t\t#psia\n",
    "w=1. \t\t\t\t\t\t\t\t\t\t#lb/sec\n",
    "cw=1.0043782\n",
    "#Calculations\n",
    "Pt2=ptbyp0*Pt \t\t\t\t\t\t\t\t#Pressure\n",
    "Tts=T0*math.pow((ptbyp0),((k-1)/k)) \t\t#Temperature\n",
    "Vts=math.sqrt(2*32.174*cp*0.24*(T0-Tts)) \t#exit velocity\n",
    "print '%s %.2f' %('Exit velocity case 1 (fps) = ',Vts)\n",
    "vts=3.12 \t\t\t\t\t\t\t\t\t#cu ft/lb\n",
    "at=w*vts/(cw*Vts)\t\t\t\t\t\t\t#Throat area\n",
    "print '%s %.5f' %('\\n Throat Area (ft^2) = ', at)\n",
    "T2s=T0*math.pow((Pt/P0),((k-1)/k)) \t\t\t#Final temperature\n",
    "eta=0.88 \n",
    "T2=T0-eta*(T0-T2s) \t\t\t\t\t\t\t#Temperature\n",
    "V2=math.sqrt(2*32.5*cp*0.24*(T0-T2)) \t\t#Exit velocity\n",
    "print '%s %.2f' %('\\n Exit velocity (fps) = ', V2)\n",
    "v2=11.4 \t\t\t\t\t\t\t\t\t#cu ft/lb \n",
    "a2=w*v2/V2\n",
    "print '%s %.5f' %('\\n Exit area (ft^2) = ',a2)\n",
    "raw_input('press enter key to exit')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
