{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 - Flow processes : First law analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the power output of the machine\n",
      "#initialization of varaibles\n",
      "import math\n",
      "u1=1111.9 #Btu/lb\n",
      "P1=170. #psia\n",
      "v1=2.675 #cu ft/lb\n",
      "v2=100.9 #cu ft/lb\n",
      "z1=10. #ft\n",
      "V1=6000./60. #ft/sec\n",
      "Q=-1000.\n",
      "u2=914.6 #B/lb\n",
      "P2=3. #psia\n",
      "V2=300. #ft/sec\n",
      "rate=2500.  #lb/hr\n",
      "#calculations\n",
      "Wx=rate*(u1-u2 + (P1*v1-P2*v2)*144/778 +(V1*V1 -V2*V2)/(2*32.2*778.) +z1/778. +Q/rate)\n",
      "f=3.92*math.pow(10,-4)\n",
      "power = Wx*f\n",
      "#results\n",
      "print '%s %d %s' %(\"Power output of turbine = \",Wx,\"B/hr\")\n",
      "print '%s %.1f %s' %(\"\\n Power output in hp =\",power,\"hp\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power output of turbine =  558647 B/hr\n",
        "\n",
        " Power output in hp = 219.0 hp\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the flow rate\n",
      "#initialization of varaibles\n",
      "w1=500.              #lb/min\n",
      "h1=132.9             #lb/min\n",
      "h2=1150.             #B/lb\n",
      "h3=180.              #B/lb\n",
      "#calculations\n",
      "w2=(w1*h1-w1*h3)/(h3-h2)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Flow rate =\",w2,\"lb/min\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate = 24.3 lb/min\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 79"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the average velocity and rate of flow\n",
      "#initialization of varaibles\n",
      "import math\n",
      "v2=5.434        #cu ft/lb\n",
      "v1=4.937        #cu ft/lb\n",
      "h1=1227.6\n",
      "h2=1223.9\n",
      "A1=math.pi/144\n",
      "#calculations\n",
      "Vratio=v2/v1\n",
      "V1=math.sqrt(64.4*(h1-h2)*778./(Vratio*Vratio -1))\n",
      "V2=V1*Vratio\n",
      "w=A1*V1/v1\n",
      "#results\n",
      "print '%s %d %s' %(\"Average velocity at 1 =\",V1,\"fps\")\n",
      "print '%s %d %s' %(\"\\n Average velocity at 2 =\",V2,\"fps\")\n",
      "print '%s %.2f %s' %(\"\\n Rate of flow = \",w,\"lb/sec\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average velocity at 1 = 936 fps\n",
        "\n",
        " Average velocity at 2 = 1030 fps\n",
        "\n",
        " Rate of flow =  4.14 lb/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}