{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter No - 7 : Flow Process\n",
      "    "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.1 - Page No :  233"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "H1 = 2600 # in kJ/kg\n",
      "H2 = 1850 # in kJ/kg\n",
      "g = 9.81 \n",
      "C1 = 10 # in meter/second\n",
      "C2 = 20 # in meter/secon\n",
      "Q = 120 # in kJ/kg\n",
      "Z1 = 30 # in meter\n",
      "Z2 = 10 # in meter\n",
      "W = g*(Z1-Z2)/1000+H1-H2+(C1**2-C2**2)/(2*1000)+Q\n",
      "print \"The work done = %0.0f kJ/kg \" %W"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The work done = 870 kJ/kg \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.2 - Page No :  234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "H1 = 3100 # in kJ/kg\n",
      "H2 = 1950 # in kJ/kg\n",
      "C1 = 20 # in meter/second\n",
      "C2 = 30 # in meter/secon\n",
      "Q = 0 # in kJ/kg\n",
      "Q_desh= 20 # in kJ/kg\n",
      "Vs= 1.1 # in m**3/kg\n",
      "W = H1-H2+(C1**2-C2**2)/(2*1000)+Q-Q_desh # in kJ/kg\n",
      "m= 2 #mass flow rate in kg/sec\n",
      "Power= m*W # in kW\n",
      "print \"Power output of the turbine = %0.1f kW\" %Power\n",
      "Area= m*Vs/C2 # in m**2\n",
      "print \"Area of exhaust pipe = %0.3f m**2 \" %Area"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power output of the turbine = 2259.5 kW\n",
        "Area of exhaust pipe = 0.073 m**2 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.3 - Page No :  234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "H1 = 2940 # in kJ/kg\n",
      "H2 = 2630 # in kJ/kg\n",
      "C = sqrt((H1-H2)*1000*2) # in m/sec\n",
      "print \"Velocity of the steam leaving the nozzle = %0.1f m/sec \" %C"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of the steam leaving the nozzle = 787.4 m/sec \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.4 - Page No :  235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "H1 = 2800 # in kJ/kg\n",
      "H2 = 2600 # in kJ/kg\n",
      "C2 = sqrt(2*(H1-H2)*1000) # in m/s\n",
      "print \"Exit velocity = %0.0f m/s\" %C2\n",
      "m_f = 25 # mass flow rate in kg/sec\n",
      "V = 0.154 # in m**3/kg\n",
      "A = (m_f*V)/C2 # in m**2\n",
      "print \"Total exit area = %0.4f m**2\" %A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exit velocity = 632 m/s\n",
        "Total exit area = 0.0061 m**2\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.5 - Page No :  235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Q = 20 # in kJ/kg\n",
      "P = 10 # in MW\n",
      "P = P * 10**3 # in kW\n",
      "H1 = 3248 # in kJ/kg\n",
      "H2 = 2552 # in kJ/kg\n",
      "C1 = 20 # m/s\n",
      "C2 = 40 # m/s\n",
      "m = P/((H1-H2+(C1**2-C2**2)/(2*1000))-Q) # in kg/s\n",
      "print \"Mass = %0.3f kg \" %m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass = 14.806 kg \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  7.6 - Page No :  236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "h_f1 = 2584 # in kJ/kg\n",
      "h_fg1 = 2392 # in kJ/kg\n",
      "H2 = 192 # in kJ/kg\n",
      "x = 0.2 \n",
      "H1 = round(h_f1- (x*h_fg1)) # in kJ/kg\n",
      "x1 = 0.8 \n",
      "Vs = 14.67 # in m**3\n",
      "V1 = x1*Vs # in m**3/kg\n",
      "A = 0.45 # in m**2\n",
      "C1 = V1/A # in m/s\n",
      "Q = 5 # kJ/s\n",
      "C2 = 0 \n",
      "W = 0 \n",
      "Q_desh = W-H1 - C1**2/(2*1000)-Q+H2+C2**2/2 # in kJ/s\n",
      "print \"Rate of heat transfer = % 0.3f kJ/s \" %Q_desh\n",
      "# Note : The calculation in the book is not accurate"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat transfer = -1919.340 kJ/s \n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}