{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 5 :  Fluid Momentum"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.1 Page no 192"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resultant force on the elbow =  9800.58 N\n",
      "Angle of resultant force =  34.8516 deg\n"
     ]
    }
   ],
   "source": [
    "# Resultant force on the elbow\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "Q = 0.3                 # Water flow rate in m**3/s\n",
    "\n",
    "d1 = 0.3                # diameter at inlet in meters\n",
    "\n",
    "A1 = pi*d1**2/4 # inlet area in m**2\n",
    "\n",
    "d2 = 0.15               # diameter at outlet in m\n",
    "\n",
    "A2 = pi*d2**2/4 # area at outlet in m**2\n",
    "\n",
    "P1 = 175*10**3          # inlet pressure in kN/m**2\n",
    "\n",
    "P2 = 160*10**3          # Pressure at outlet in kN/m**2\n",
    "\n",
    "F1 = P1*A1              # Force at inlet\n",
    "\n",
    "F2 = P2*A2              # Force at outlet\n",
    "\n",
    "rho = 1000              # density of water in kg/m**3\n",
    "\n",
    "V1 = Q/A1               # inlet velocity in m/s\n",
    "\n",
    "V2 = Q/A2               # Velocity at outlet in m/s\n",
    "\n",
    "theta = 45*pi/180  # angle in deg\n",
    "\n",
    "# Soultion\n",
    "\n",
    "# Applying the X momentum equation we get\n",
    "\n",
    "Rx = F1 - F2*cos(theta)-rho*Q*(V2*cos(theta)-V1)\n",
    "\n",
    "# Applying the Y momentum equation\n",
    "\n",
    "Ry = F2*sin(theta)+rho*Q*(V2*sin(theta)-0)\n",
    "\n",
    "R = sqrt(Rx**2+Ry**2)\n",
    "\n",
    "print \"Resultant force on the elbow = \",round(R,2),\"N\"\n",
    "\n",
    "a = atan(Ry/Rx)*180/pi\n",
    "\n",
    "print \"Angle of resultant force = \",round(a,4),\"deg\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.2 Page no 194"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resultant force =  1232.0 lbs\n",
      "Angle of resultant force =  59.2396 deg\n"
     ]
    }
   ],
   "source": [
    "# Force exerted by the jet on the vane\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "V1 = 80            # Velocity in ft/s\n",
    "\n",
    "A1 = 0.1            # area in ft**2\n",
    "\n",
    "g = 32.2           # Acceleration due to gravity in ft/s**2\n",
    "\n",
    "rho = 1.94         # density in lb/ft**3\n",
    "\n",
    "a = pi/3 # angle of pipe bend\n",
    "\n",
    "# Solution\n",
    "\n",
    "Q = A1*V1          # Total discharge in m**3\n",
    "\n",
    "# Applying bernoullis at point 1 and 2\n",
    "\n",
    "V2 = sqrt((2*g*V1**2/(2*32.2))-3*2*g)\n",
    "\n",
    "# Pressure at the end of the section are atmospheric and hence 0\n",
    "\n",
    "# momentum equation in X direction\n",
    "\n",
    "Rx = -(rho*Q*(V2*cos(a)-80))\n",
    "\n",
    "# momentum equation in Y direction\n",
    "\n",
    "Ry = (rho*Q*(V2*sin(a)-0))\n",
    "\n",
    "R = sqrt(Rx**2+Ry**2)\n",
    "\n",
    "print \"Resultant force = \",round(R,0),\"lbs\"\n",
    "\n",
    "ang = atan(Ry/Rx)*180/pi\n",
    "\n",
    "print \"Angle of resultant force = \",round(ang,4),\"deg\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example no 5.3 Page no 195 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resultant Force =  12489.0 N\n",
      "Angle with horizontal =  69.2 deg with horizontal\n"
     ]
    }
   ],
   "source": [
    "# Force  needed to hold the Y position \n",
    "\n",
    "# Given\n",
    "\n",
    "from __future__ import division\n",
    "\n",
    "from math import *\n",
    "\n",
    "Q1 = 0.5             # discharge from pipe 1 in m**3/s\n",
    "\n",
    "Q2 = 0.3             # discharge from pipe 2 in m**3/s\n",
    "\n",
    "Q3 = 0.2             # discharge from pipe 3 in m**3/s\n",
    "\n",
    "d1 = 0.45            # diameter of pipe 1 in m\n",
    "\n",
    "d2 = 0.3             # diameter of pipe 2 in m\n",
    "\n",
    "d3 = 0.15            # diameter of pipe 3 in m\n",
    "\n",
    "A1 = pi*d1**2/4  # area in m**2\n",
    "\n",
    "A2 = pi*d2**2/4  # area in m**2\n",
    "\n",
    "A3 = pi*d3**2/4  # area in m**2\n",
    "\n",
    "P1 = 60*10**3        # Pressure at point 1 in kPa\n",
    "\n",
    "gma = 9810\n",
    "\n",
    "g = 9.81             # acceleration due to gravity in m/s**2\n",
    "\n",
    "rho = 1000           # density in kg/m**3\n",
    "\n",
    "# Solution\n",
    "\n",
    "V1 = Q1/A1\n",
    "\n",
    "V2 = Q2/A2\n",
    "\n",
    "V3 = Q3/A3\n",
    "\n",
    "P2 = gma*((P1/gma) + V1**2/(2*g) - V2**2/(2*g))\n",
    "\n",
    "P3 = gma*((P1/gma) + V1**2/(2*g) - V3**2/(2*g))\n",
    "\n",
    "F1 = P1*A1\n",
    "\n",
    "F2 = P2*A2\n",
    "\n",
    "F3 = P3*A3\n",
    "\n",
    "Rx = rho*(Q2*V2*cos(pi/6)-Q3*V3*cos(pi/9)-0)+F3*cos(pi/9)-F2*cos(pi/6)\n",
    "\n",
    "Ry = rho*((Q2*V2*sin(pi/6)+Q3*V3*sin(pi/9)-Q1*V1))+F3*sin(pi/9)-F2*sin(pi/6)-F1\n",
    "\n",
    "R = sqrt(Rx**2+Ry**2)\n",
    "\n",
    "a = atan(Ry/Rx)*180/pi\n",
    "\n",
    "print \"Resultant Force = \",round(R,0),\"N\"\n",
    "\n",
    "print \"Angle with horizontal = \",round(a,1),\"deg with horizontal\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.4 Page no 199"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Normal force on the plate =  423.0 lbs\n"
     ]
    }
   ],
   "source": [
    "# Normal force on the plate\n",
    "\n",
    "# Given\n",
    "from math import *\n",
    "\n",
    "d = 2            # diameter in inches\n",
    "\n",
    "A = pi*d**2/(4*144)    # Area of jet\n",
    "\n",
    "V = 100          # velocity of jet in ft/s\n",
    "\n",
    "Q = A*V          # dischargge in ft**3/s\n",
    "\n",
    "gma = 62.4       # mass\n",
    "\n",
    "g = 32.2         # acceleration due to gravity in ft/s**2\n",
    "\n",
    "# Solution\n",
    "\n",
    "Rx = (gma*Q*V)/g   # horizontal force required to keep plate in position\n",
    "\n",
    "print \"Normal force on the plate = \",round(Rx,0),\"lbs\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.5 Page no 202"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Force on the plate =  331.34 N\n",
      "Work done per second =  3313.4 N.m/s\n",
      "Efficiency =  44.4 %\n"
     ]
    }
   ],
   "source": [
    "# Force on the plate ; work doen per second; efficiency\n",
    "\n",
    "# Given\n",
    "\n",
    "from math import *\n",
    "\n",
    "D = 0.075            # diameter in m\n",
    "\n",
    "A =pi*D**2/4         # area of jet\n",
    "\n",
    "V  =15               # velocity of jet in m/s\n",
    "\n",
    "w = 9810             # specific weight\n",
    "\n",
    "g = 9.81             # acceleration due to gravity in m/s^2\n",
    "\n",
    "# Solution\n",
    "\n",
    "Q =A*V              # Discharge in m**3/s\n",
    "\n",
    "Vp = 10             # velocity of plate in m/s\n",
    "\n",
    "Rx = w*Q*(V-Vp)/g   # force in X direction\n",
    "\n",
    "print \"Force on the plate = \",round(Rx,2),\"N\"\n",
    "\n",
    "W = Rx*Vp\n",
    "\n",
    "print \"Work done per second = \",round(W,1),\"N.m/s\"\n",
    "\n",
    "Eff = 2*(V-Vp)*Vp/V**2\n",
    "\n",
    "E = 100*Eff\n",
    "\n",
    "print \"Efficiency = \",round(E,1),\"%\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.6 Page no 204"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Force exerted in X direction =  273.8 lbs\n",
      "Force exerted in Y direction =  0.0 lbs\n"
     ]
    }
   ],
   "source": [
    "# Force exerted on the plate\n",
    "\n",
    "# Given\n",
    "from math import *\n",
    "\n",
    "d = 3            # diameter in inches\n",
    "\n",
    "A = pi*d**2/(4*144)    # Area of jet\n",
    "\n",
    "Q = 2           # discharge in ft**3/s\n",
    "\n",
    "rho = 1.94       # density in lbs/ft**3\n",
    "\n",
    "# Solution\n",
    "\n",
    "V = Q/A          # velocity in ft/s\n",
    "\n",
    "alpha = pi/6     # inlet vane angle\n",
    "\n",
    "bta = pi/6       # outlet vane angle\n",
    "\n",
    "Rx = rho*Q*(V*cos(bta)+V*cos(alpha))   # force in X direction\n",
    "\n",
    "Ry = rho*Q*(V*sin(bta)-V*sin(alpha))   # force in Y direction\n",
    "\n",
    "print \"Force exerted in X direction = \",round(Rx,1),\"lbs\"\n",
    "\n",
    "print \"Force exerted in Y direction = \",round(Ry,1),\"lbs\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.7 Page no 207"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a ) Angle of blade top at inlet and Outlet, Phi = 4 deg\n",
      "b ) Work done per N of fluid per second =   80.31 N.m\n",
      "c ) Efficiency =  98.4 %\n"
     ]
    }
   ],
   "source": [
    "# Angle of blade tips at inlet and exit ; work done on the vane; efficiency of the vane\n",
    "\n",
    "# Given\n",
    "\n",
    "from math import *\n",
    "\n",
    "V1 =40              # velocity in m/s\n",
    "\n",
    "Vp = 20             # velocity of the plate in m/s\n",
    "\n",
    "alpha = pi/6         # inlet vane angle\n",
    "\n",
    "bta = pi/9 # outlet vane angle\n",
    "\n",
    "g = 9.81\n",
    "\n",
    "# Solution\n",
    "\n",
    "V1x = V1*cos(alpha)\n",
    "\n",
    "Vw1 = V1x;\n",
    "\n",
    "V1y = V1*sin(alpha)\n",
    "\n",
    "dV = V1x - Vp\n",
    "\n",
    "theta = atan(V1y/dV)*180/pi\n",
    "\n",
    "Vr1 = V1y/sin(theta*pi/180)\n",
    "\n",
    "Vr2 = Vr1\n",
    "\n",
    "# from trial and error we get the blade tip angle at inlet and outlet\n",
    "\n",
    "print \"a ) Angle of blade top at inlet and Outlet, Phi = 4 deg\"\n",
    "\n",
    "phi = 4*pi/180 \n",
    "\n",
    "V2 = Vr2*sin(phi)/sin(bta)\n",
    "\n",
    "V2w = V2*cos(bta)\n",
    "\n",
    "W = (V2w+V1x)*Vp/g\n",
    "\n",
    "print \"b ) Work done per N of fluid per second =  \",round(W,2),\"N.m\"\n",
    "\n",
    "Eff = (1 - (V2/V1)**2)*100\n",
    "\n",
    "print \"c ) Efficiency = \",round(Eff,2),\"%\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 5.8 Page no 211"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a - Thrust on the plane =  5372.2 lbs\n",
      "b - Theoretical efficiency =  76.0 %\n",
      "c - Theoretical horsepower required =  4560.0 hp\n",
      "d - Pressure difference across blades =  190.0 lbs/ft**3\n"
     ]
    }
   ],
   "source": [
    "# Thrust on the plane; propeller efficiency ; theoretical horsepower ; pressure difference acros the blades\n",
    "\n",
    "# Given\n",
    "\n",
    "from math import *\n",
    "\n",
    "v = 220                     # velocity in ft/s\n",
    "\n",
    "d = 6                       # diameter of the propeller\n",
    "\n",
    "Q = 12000                   # discharge in ft**3/s\n",
    "\n",
    "mf = 0.0022                 # mass flow rate in slugs/ft**3\n",
    "\n",
    "# Solution\n",
    "\n",
    "V1 = v*5280/3600            # velocity in ft/s\n",
    "\n",
    "V = Q/(pi*d**2/4)           # velocity in ft/s\n",
    "\n",
    "V4 = 2*V-V1\n",
    "\n",
    "F = mf*Q*(V4-V1)              # thrust on the plane\n",
    "\n",
    "print \"a - Thrust on the plane = \",round(F,1),\"lbs\"\n",
    "\n",
    "Eff = V1/V                 # efficiency \n",
    "\n",
    "E = Eff*100\n",
    "\n",
    "print \"b - Theoretical efficiency = \",round(E,0),\"%\"\n",
    "\n",
    "Thp = F*V1/(500*Eff)\n",
    "\n",
    "print \"c - Theoretical horsepower required = \",round(Thp,0),\"hp\"\n",
    "\n",
    "dP = mf*(V4**2-V1**2)/2\n",
    "\n",
    "print \"d - Pressure difference across blades = \",round(dP,2),\"lbs/ft**3\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}