{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 : The momentum balance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.2 page no : 248\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calulate the final velocity of duck after being hit by a bullet\n",
      "\n",
      "# Variables \n",
      "m_duck=3.                 #lbm\n",
      "v_duck=-15.               #ft/s due west\n",
      "m_bullet=0.05             #lbm\n",
      "v_bullet=1000.            #ft/s due east\n",
      "\n",
      "# Calculation \n",
      "#total initial momentum = final momentum\n",
      "v_sys=((m_duck*v_duck)+(m_bullet*v_bullet))/(m_duck+m_bullet)#ft/s\n",
      "\n",
      "# Result\n",
      "print \"The final velocity of the duck is %f ft/s\"%v_sys"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final velocity of the duck is 1.639344 ft/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.3 page no : 250\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the force required to hold of water from a hoze\n",
      "\n",
      "# Variables \n",
      "rho=998.2                #Kg/m^3\n",
      "q=0.01                   #m^3/s\n",
      "v_initial=30.            #m/s\n",
      "v_final=0.               #m/s\n",
      "\n",
      "# Calculation \n",
      "F=q*rho*(v_final-v_initial)       #N\n",
      "\n",
      "# Result\n",
      "print \"The force required to hold of water from a hoze %f N\"%F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force required to hold of water from a hoze -299.460000 N\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.4 page no : 251\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the force required to hold of water from a hoze\n",
      "\n",
      "# Variables \n",
      "rho=998.2                    #Kg/m^3\n",
      "q=0.01                       #m^3/s\n",
      "v_initial=30.                #m/s\n",
      "v_final=-15.                 #m/s\n",
      "\n",
      "# Calculation \n",
      "F=q*rho*(v_final-v_initial)  #N\n",
      "\n",
      "# Result\n",
      "print \"The force required to hold of water from a hoze %f N\"%F"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force required to hold of water from a hoze -449.190000 N\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.5 page no : 252\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the force exerted on the flange when the valve of the nozzle is closed\n",
      "\n",
      "# Variables \n",
      "#Let the gauge pressure be denoted by Pg\n",
      "Pg=100.                       #lbf/in^2\n",
      "A=10.                         #in^2\n",
      "\n",
      "# Calculation \n",
      "#F_bolts = -F_liq-F_atm\n",
      "#F_bolts = -(Pg + P_atm)A - (-P_atm.A)\n",
      "#F_bolts = -Pg.A\n",
      "F_bolts=-Pg*A\n",
      "\n",
      "# Result\n",
      "print \"The force exerted on the flange when the valve of the nozzle is closed is %d lbf\"%F_bolts"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force exerted on the flange when the valve of the nozzle is closed is -1000 lbf\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.6 page no : 254\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the force exerted on the flange\n",
      "\n",
      "# Variables \n",
      "dP=100.                           #lbf/in^2\n",
      "A_out=1.                          #in^2\n",
      "rho=62.3                          #lbm/ft^3\n",
      "ratio_A=0.1                       #dimentionless\n",
      "\n",
      "# Calculation \n",
      "#1 ft = 12 in\n",
      "#1 lbf.s^2 = 32.2 lbm.ft\n",
      "v_out=(2*dP/rho/(1-ratio_A**2)*32.2*144)**0.5            #ft/s\n",
      "v_in=12.3                        #ft/s\n",
      "\n",
      "m=rho*A_out*v_out/144.           #lbm/s\n",
      "F=m*(v_out-v_in)/32.2            #lbf\n",
      "\n",
      "# Result\n",
      "print \"The force exerted on the flange is %f lbf\"%F"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force exerted on the flange is 181.755634 lbf\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.7 page no : 255\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the support forces in x and y direction in a 90 degree bend tube\n",
      "\n",
      "# Variables \n",
      "p1=200.                     #KPa\n",
      "A=0.1                       #m^2\n",
      "m=500.                      #Kg/s\n",
      "rho=998.2                   #Kg/m^3\n",
      "q=m/rho                     #m^3/s\n",
      "v=q/A                       #m/s\n",
      "Vx_initial=v                #m/s\n",
      "Vx_final=0.                 #m/s\n",
      "Vy_initial=0.               #m/s\n",
      "Vy_final=-v                 #m/s\n",
      "\n",
      "# Calculation and   Result\n",
      "neg_Fx=m*(Vx_final-Vx_initial)-p1*1000*A           #N\n",
      "Fx = neg_Fx\n",
      "print \"The support force in the x direction is %f N\"%Fx\n",
      "neg_Fy=m*(Vy_final-Vy_initial)-p1*1000*A#N\n",
      "Fy = neg_Fy\n",
      "print \"The support force in the y direction is %f N\"%Fy"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The support force in the x direction is -22504.508115 N\n",
        "The support force in the y direction is -22504.508115 N\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.8 page no : 258\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the thrust on a rocket\n",
      "\n",
      "# Variables \n",
      "m=1000.                       #Kg/s\n",
      "v_out=-3000.                  #m/s its in the negative y direction\n",
      "v_in=0.                       #m/s\n",
      "A=7.                          #m^2\n",
      "P=35000.                      #Pa\n",
      "\n",
      "# Calculation \n",
      "F_thrust=(-m*(v_out-v_in)+P*A)/1000000.0          #MN\n",
      "\n",
      "# Result\n",
      "print \"The thrust on the rocket is %f MN\"%F_thrust"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thrust on the rocket is 3.245000 MN\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.9 page no : 258\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the specific impulse for a rocket\n",
      "\n",
      "# Variables \n",
      "Vy_exh=-3000.                       #m/s in negative y direction\n",
      "\n",
      "# Calculation \n",
      "Isp=-Vy_exh/1000.0                  #KN.s/Kg\n",
      "\n",
      "# Result\n",
      "print \"The specific impulse on the rocket is %d KN.s/Kg\"%Isp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The specific impulse on the rocket is 3 KN.s/Kg\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.10 page no : 259\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the Mass air flow rate required by a jet engine\n",
      "\n",
      "# Variables \n",
      "F_thrust=20000.                      #lbf\n",
      "Vx_out=1350.0                        #ft/s\n",
      "Vx_in=0.                             #ft/s\n",
      "\n",
      "# Calculation \n",
      "#1 lbf.s^2 = 32.2 lbm.ft\n",
      "m=F_thrust/(Vx_out-Vx_in)*32.2       #lbm/s\n",
      "\n",
      "# Result\n",
      "print \"The mass air flow rate required by a jet engine is %d lbm/s\"%m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass air flow rate required by a jet engine is 477 lbm/s\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.12 page no : 267\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the final velocity of a rocket after launch\n",
      "import math\n",
      "\n",
      "# Variables \n",
      "Isp=430.                    #lbf.s/lbm specific impulse\n",
      "#1 lbf.s^2 = 32.2 lbm.ft\n",
      "Vrel_out=-Isp*32.2          #ft/s\n",
      "ratio_m=0.1                 #dimentionless (ratio of final mass to initial mass)\n",
      "\n",
      "# Calculation \n",
      "v_final=Vrel_out*math.log(ratio_m)           #ft/s\n",
      "\n",
      "# Result\n",
      "print \"The velocity of the rocket after launch is %d ft/s\"%v_final"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of the rocket after launch is 31881 ft/s\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.15 page no : 278\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the velocity and height of flow in an open channel\n",
      "\n",
      "# Variables \n",
      "v1=4.                          #ft/s\n",
      "g=32.2                         #ft/s^2\n",
      "z1=0.0005                      #ft\n",
      "Fr=v1**2/(g*z1)                #dimentionless (Fraude number)\n",
      "ratio_z=-0.5+(0.25+2*Fr)**0.5  #dimentionless\n",
      "\n",
      "# Calculation \n",
      "#ratio_z = z2/z1\n",
      "z2=ratio_z*z1                  #ft\n",
      "#print \"The height of flow in open channel is %f ft\"%z2\n",
      "v2=v1/(ratio_z)                #ft/s\n",
      "\n",
      "# Result\n",
      "print \"The velocity of flow in open channel is %f ft/s\"%v2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of flow in open channel is 0.090734 ft/s\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.16 page no : 280\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the verticle downward velocity of air hitting an aircraft wing\n",
      "\n",
      "# Variables \n",
      "l=15.                         #m length of wing\n",
      "b=3.                          #m thickness of wing\n",
      "A=l*b                         #m^2 area of the colliding surface of the wing\n",
      "rho_air=1.21                  #Kg/m^3\n",
      "Vx=50.                        #m/s\n",
      "m=rho_air*A*Vx                #Kg/s\n",
      "Fy=9810.                      #N Weight of the aircraft\n",
      "\n",
      "# Calculation \n",
      "Vy=Fy/m                       #m/s\n",
      "\n",
      "# Result\n",
      "print \"The verticle downward velocity of air hitting the aircraft wing is %f m/s\"%Vy"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The verticle downward velocity of air hitting the aircraft wing is 3.603306 m/s\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.17 page no : 281\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the ratio of the total weight of the aircraft to the weight of engine\n",
      "\n",
      "# Variables \n",
      "#Let ratio of weight to thrust be denoted by r1\n",
      "#Let ratio of thrust to the engine weight be denoted by r2\n",
      "r1=10.                     #dimentionless\n",
      "r2=2.                      #dimentionless\n",
      "\n",
      "# Calculation \n",
      "#weight/engine wt = (weight/thrust)*(thrust/engine wt)\n",
      "#let ratio of total wt to engine wt be denoted by r3\n",
      "r3=r1*r2                   #dimentionless\n",
      "\n",
      "# Result\n",
      "print \"The ratio of the total weight of the aircraft to the weight of engine is %d\"%r3"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of the total weight of the aircraft to the weight of engine is 20\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.18 page no : 284\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the torque exerted on the rotor in a centrifugal pump\n",
      "import math\n",
      "\n",
      "# Variables \n",
      "q=100.                        #gal/min\n",
      "rho=8.33                      #lbm/gal\n",
      "m=rho*q                       #lbm/min\n",
      "f=1800.                       #rev/min frequency of impeller\n",
      "omega=2*(math.pi)*f           #rad/min\n",
      "r_in=1/12.0                   #ft\n",
      "r_out=6/12.0                  #ft\n",
      "\n",
      "# Calculation \n",
      "#1 min = 60 sec\n",
      "#1 lbf.s^2 = 32.2 lbm.ft\n",
      "tou=m*omega*(r_out**2-r_in**2)/32.2/3600.              #lbf.ft\n",
      "\n",
      "# Result\n",
      "print \"The torque exerted on the rotor is %f lbf.ft\"%tou"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The torque exerted on the rotor is 19.753523 lbf.ft\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}