{
 "metadata": {
  "name": "",
  "signature": "sha256:745d131b65427d77eef09608cde1afafe8a3c0b2b5d38233f35ec5b6ceb45ab5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4- The Momentum Equation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate The Hydrodynamic force on the vane and resultant force of  angle \n",
      "rho=1000.; ## kg/m^3\n",
      "u1=36.; ## m/s\n",
      "u2=30.; ## m/s\n",
      "d=0.05; ## m\n",
      "theta=60.; ## degrees\n",
      "\n",
      "A=math.pi/4.*d**2.;\n",
      "\n",
      "Q=A*u1;\n",
      "\n",
      "F_x=rho*Q*(u2*(math.cos(theta/57.3)) - u1);\n",
      "F_y=rho*Q*u2*math.sin(theta/57.3);\n",
      "\n",
      "F=math.sqrt(F_x**2+F_y**2);\n",
      "phi=math.atan((F_y/F_x));\n",
      "\n",
      "print'%s %.1f %s'%(\"The Hydrodynamic force on the vane =\",F,\"N\")\n",
      "\n",
      "\n",
      "print'%s %.1f %s'%(\"This resultant force acts at angle of\",phi*180/math.pi,\"to the x-direction\")\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Hydrodynamic force on the vane = 2361.2 N\n",
        "This resultant force acts at angle of -51.1 to the x-direction\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate The net horizontal force exerted by the water onthe bend and resultant force of  angle\n",
      "Q1=0.45; ## m**3/s\n",
      "Q2=0.425; ## m**3/s\n",
      "d1=0.6; ## m\n",
      "d2=0.3; ## m\n",
      "p1=1.4*10.**5.; ## Pa\n",
      "rho=1000.; ## kg/m**3\n",
      "theta=45/57.3; ## degrees\n",
      "\n",
      "A1=math.pi/4*d1**2;\n",
      "A2=math.pi/4*d2**2;\n",
      "\n",
      "u1=Q1/A1;\n",
      "u2=Q2/A2;\n",
      "\n",
      "p2=p1+rho/2.*(u1**2-u2**2.);\n",
      "\n",
      "F_x=rho*Q2*(u2*math.cos(theta)-u1)-p1*A1+p2*A2*math.cos(theta)\n",
      "F_y=rho*Q2*(u2*math.sin(theta)-0)+p2*A2*math.sin(theta);\n",
      "\n",
      "F=math.sqrt(F_x**2+F_y**2);\n",
      "phi=math.atan(F_y/F_x);\n",
      "\n",
      "print'%s %.1f %s'%(\"The net horizontal force exerted by the water onthe bend =\",F,\"N\")\n",
      "\n",
      "\n",
      "print'%s %.1f %s'%(\"This resultant force acts at angle of\",phi*57.3,\"to the x-direction\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The net horizontal force exerted by the water onthe bend = 33263.1 N\n",
        "This resultant force acts at angle of -13.9 to the x-direction\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate The thrust on the turbine and Power generated by the turbine\n",
      "rho=1.2; ## kg/m**3\n",
      "d=12.; ## m\n",
      "u1=20.; ## m/s\n",
      "u4=8.; ## m/s\n",
      "\n",
      "A=math.pi/4.*d**2\n",
      "F=rho*A*(u1+u4)/2.*(u1-u4);\n",
      "\n",
      "print'%s %.3f %s'%(\"The thrust on the turbine = \",F,\"N\")\n",
      "\n",
      "P=rho*A*(u1+u4)/2.*(u1**2/2.-u4**2/2.);\n",
      "print'%s %.2f %s'%(\"Power generated by the turbine =\",P,\"W\")\n",
      "#in book it is converted into kw\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thrust on the turbine =  22800.423 N\n",
        "Power generated by the turbine = 319205.92 W\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}