{
 "metadata": {
  "name": "",
  "signature": "sha256:82135d7c3c860b18d45a6212b67de54362fa2b4454d970c3f68f6f27e472d43e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 06:Momentum Analysis of Flow Systems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-1, Page No:248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import scipy.integrate\n",
      "\n",
      "#Variable Decleration\n",
      "a=1 #Lower limit of the intergral to be carried out\n",
      "b=0 #Upper limit of the intergral to be carried out\n",
      "\n",
      "#Intergration\n",
      "\n",
      "func = lambda y:-4*y**2 #Decleration of the variable and the function to be integrated\n",
      "X=scipy.integrate.quadrature(func, a,b)\n",
      "\n",
      "#Result\n",
      "\n",
      "print \"The Momentum Flux correction factor becomes\",round(X[0],2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Momentum Flux correction factor becomes 1.33\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-2, Page No:251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "m_dot=14 #Mass flow rate in kg/s\n",
      "rho=1000 #Density of water in kg/m^3\n",
      "theta=pi/6 #Angle at which the pipe is deflected w.r.t the horizontal\n",
      "A1=0.0113 #Cross-sectional Area at the inlet of the elbow in m^2\n",
      "A2=7*10**-4 #Cross-sectional Area at the outlet of the elbow in m^2\n",
      "C=10**-3 #Conversion factor\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "z2=0.3 #Elevational difference betweem inlet and outlet in m\n",
      "z1=0 #Considering Datum in m\n",
      "beta=1.03 #Momentum correction factor \n",
      "\n",
      "#Calculations\n",
      "V1=m_dot/(rho*A1) #Velocity at the inlet of the elbow in m/s\n",
      "V2=m_dot/(rho*A2) #Velocity at the outlet of the elbow in m/s\n",
      "\n",
      "#Part(a)\n",
      "#Applying the Bernoulli Principle\n",
      "#Simplfying the calculations in two steps\n",
      "a=(V2**2-V1**2)/(2*g)\n",
      "P1_gauge=(a+z2-z1)*g*rho*C #Gauge pressure at inlet in kPa\n",
      "\n",
      "#Part(b)\n",
      "#Applying the momentum equation\n",
      "#Anchoring forces required\n",
      "F_rx=-(P1_gauge*1000*A1)+(beta*m_dot*((V2*cos(theta))-V1)) #N\n",
      "F_rz=beta*m_dot*V2*sin(theta) #N\n",
      "\n",
      "#Result\n",
      "print \"The gauge pressure at the inlet is\",round(P1_gauge,1),\"kPa\"\n",
      "print \"The anchoring forces required to hold it in place are\",round(F_rx,),\"N and\",round(F_rz),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gauge pressure at the inlet is 202.2 kPa\n",
        "The anchoring forces required to hold it in place are -2053.0 N and 144.0 N\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-3, Page No:253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable decleration\n",
      "beta=1.03 #Momentum Correction factor\n",
      "m_dot=14 #mass flow rate in kg/s\n",
      "V2=20 #Velocity at outlet in m/s\n",
      "V1=1.24 #Velocity at inlet in m/s\n",
      "P1_gauge=202200 #gauge pressure at inlet in N/m^2\n",
      "A1=0.0113 #Area at the inlet in m^2\n",
      "\n",
      "#Calculations\n",
      "#Applying the momentum equation\n",
      "F_rx=-beta*m_dot*(V2+V1)-P1_gauge*A1 #Horiznotal force in N\n",
      "\n",
      "#Result\n",
      "print \"The horizontal force is\",round(F_rx),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The horizontal force is -2591.0 N\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-4, Page No:253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "beta=1 #Momentum correction factor\n",
      "m_dot=10 #Mass flow rate in kg/s\n",
      "V1=20 #Velocity of flow of water in m/s\n",
      "\n",
      "#Calculations\n",
      "#Applying the momentum equation\n",
      "F_r=beta*m_dot*V1 #The force exerted in N\n",
      "\n",
      "#Result\n",
      "print \"The force exerted is\",round(F_r),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force exerted is 200.0 N\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-5, Page No:254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable decleration\n",
      "W_s=11 #Wind speed in km/h\n",
      "C=3.6**-1 #Conversion from km/h  to m/s\n",
      "D=9 #Diameter of the blade in m\n",
      "rho1=1.22 #Density of air in kg/m^3\n",
      "W_actual=0.4 #Actual power generated in kW\n",
      "\n",
      "#Calculations\n",
      "#Part(a)\n",
      "V1=W_s*C #Velocity in m/s\n",
      "m_dot=(rho*V1*pi*D**2)/4 #Mass flow rate of air in kg/s\n",
      "W_dot_max=0.5*m_dot*V1**2*10**-3 #Work done in kW\n",
      "n_windturbine=W_actual/W_dot_max #Efficiency of the turbine-generator \n",
      "\n",
      "#Part(b)\n",
      "V2=V1*((1-n_windturbine)**0.5) #Exit velocity in m/s\n",
      "\n",
      "#Applying momentun equation\n",
      "F_r=m_dot*(V2-V1) #Force exerted in N\n",
      "\n",
      "#Result\n",
      "print \"The efficiency of the turbine is\",round(n_windturbine,3)\n",
      "print \"The horizontal force exerted is\",round(F_r,1),\"N\"\n",
      "#Answer differs by 0.5 due to floating point accuracy in second part"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The efficiency of the turbine is 0.361\n",
        "The horizontal force exerted is -145.5 N\n"
       ]
      }
     ],
     "prompt_number": 59
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-6, Page No:256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "V_gas=3000 #Velocity of the gas exiting in m/s\n",
      "m_dot_gas=80 #mass flow rate of gas escaping in kg/s\n",
      "m_spacecraft=12000 #mass of the spacecraft in kg\n",
      "delta_t=5 #Time in s\n",
      "#Calculations\n",
      "#Part(a)\n",
      "a_spacecraft=-(m_dot_gas*V_gas)/m_spacecraft #Acceleration of the spacecraft in m/s^2\n",
      "\n",
      "#Part(b)\n",
      "dV=a_spacecraft*delta_t #Change in velocity of the spacecraft in m/s\n",
      "\n",
      "#PArt(c)\n",
      "F_thrust=-(m_dot_gas*V_gas)/1000 #Thrust force exerted in kN\n",
      "\n",
      "#Result\n",
      "print \"The acceleration of the spacecraft is\",round(a_spacecraft),\"m/s^2\"\n",
      "print \"The change in velocity is\",round(dV),\"m/s\"\n",
      "print \"The thrust force exerted is\",round(F_thrust),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The acceleration of the spacecraft is -20.0 m/s^2\n",
        "The change in velocity is -100.0 m/s\n",
        "The thrust force exerted is -240.0 kN\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 6,
     "metadata": {},
     "source": [
      "Example 6.6-7, Page No:257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "V_dot=70 #Volumertic Flow rate in L/min\n",
      "D=0.02 #Inner diameter of the pipe in m\n",
      "C=60*10**3 #Conversion factor\n",
      "rho=997 #Density of water in kg/m^3\n",
      "P1_gauge=90000 #Pressure at location in Pa\n",
      "X=57 #Total weight of faucet in N\n",
      "\n",
      "#Calculations\n",
      "V=((V_dot*4)/(pi*D**2))/C #Velocity of flow in m/s\n",
      "m_dot=(rho*V_dot)/C #mass flow rate in kg/s\n",
      "\n",
      "#Applying the Momentum equation\n",
      "F_rx=-(m_dot*V)-((P1_gauge*pi*D**2)/4) #X-component of force in N\n",
      "F_rz=-m_dot*V+X #z-Component of force in N\n",
      "\n",
      "#Result\n",
      "print \"The net force exerted on the flange in vector notation is Fr\",round(F_rx,2),\"i+\",round(F_rz,2),\"k  N\"\n",
      "#NOTE:The answer in the textbook differs due to decimal point accuracy difference in computation"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The net force exerted on the flange in vector notation is Fr -31.99 i+ 53.29 k  N\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-9, Page NO:266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "rho=1000 #Denisty of water in kg/m^3\n",
      "D=0.10 #Diameter of the pipe in m\n",
      "V=3 #Average velocity of water in m/s\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "m=12 #Mass of horizontal pipe section when filled with water in kg\n",
      "r1=0.5 #Moment arm 1 in m\n",
      "r2=2 #Moment arm 2 in m\n",
      "\n",
      "#Calculation\n",
      "m_dot=rho*((pi*D**2)/4)*V #Mass flow rate in kg/s\n",
      "W=m*g #Weight in N\n",
      "\n",
      "#Applying the momentum equation\n",
      "M_A=r1*W-(r2*m_dot*V) #Momentum about point A in N.m\n",
      "\n",
      "#Setting M as zero and using the momentum equation\n",
      "L=((2*r2*m_dot*V)/W)**0.5 #Length in m\n",
      "\n",
      "#Result\n",
      "print \"The bending Moment at A is\",round(M_A,1),\"N.m and the length required is\",round(L,1),\"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The bending Moment at A is -82.5 N.m and the length required is 1.5 m\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-9, Page No:267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "V_dot_nozzle=5 #Volumertic flow rate in L/s\n",
      "D_jet=0.01 #Diameter of the jet in m\n",
      "C=10**-3 #Conversion Factor\n",
      "n_dot=300 #R.P.M of the nozzle\n",
      "r=0.6 #Radial arm in m\n",
      "m_dot=20 #Mass flow rate in kg/s\n",
      "s=60**-1 #Conversion factor\n",
      "#Calculations\n",
      "V_jet_r=(V_dot_nozzle*4)/(pi*D_jet**2)*C #Velocity relative to the rotating nozzle in m/s\n",
      "w=(2*pi*n_dot)*s #Angular speed in rad/s\n",
      "V_nozzle=r*w #Tangential Velocity in m/s\n",
      "\n",
      "#Applying thr relative velocity principle\n",
      "V_jet=V_jet_r-V_nozzle #Velocity of the jet in m/s\n",
      "\n",
      "#Applying the momentum Equation and using the torque concept\n",
      "T_shaft=r*m_dot*V_jet #Torque transmitted through the shaft in N.m\n",
      "W_dot=w*T_shaft*C #Power generated in kW\n",
      "\n",
      "#Result\n",
      "print \"The sprinkler-type turbine has the potential to produce\",round(W_dot,1),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The sprinkler-type turbine has the potential to produce 16.9 kW\n"
       ]
      }
     ],
     "prompt_number": 33
    }
   ],
   "metadata": {}
  }
 ]
}