{
 "metadata": {
  "name": "",
  "signature": "sha256:3a2694f8f0eab29c82f8ee266172c1c857b71aa63b1096f76897d1574494f3bb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter9-The Flow of an Inviscid Fluid"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg380"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate Mass flow rate\n",
      "import scipy\n",
      "from scipy import integrate\n",
      "## p_a-p_b=-1/2*rho*C^2*(1/R_A^2-1/R_B^2)\n",
      "\n",
      "rho_w=1000.; ## kg/m^3\n",
      "g=9.81; ## m/s^2\n",
      "h=0.0115; ## m\n",
      "rho=1.22; ## kg/m^3\n",
      "R_A=0.4; ## m\n",
      "R_B=0.2; ## m\n",
      "\n",
      "C=math.sqrt(rho_w*g*h*2./(rho*(1./R_B**2-1./R_A**2)));\n",
      "\n",
      "def function(R):\n",
      "\ty=1./R;\n",
      "\treturn y;\n",
      "\n",
      "new=scipy.integrate.quad(function, R_B, R_A);\n",
      "m=rho*C*R_B*new[0]\n",
      "print\"%s %.4f %s\"%(\"Mass flow rate =\",m,\"kg/s\")\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass flow rate = 0.5312 kg/s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg382"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#The maximum speed at which the paddles may rotate about their vertical axis\n",
      "## p=1/2*rho*w^2*R^2 + C\n",
      "\n",
      "\n",
      "## At z=0\n",
      "rho=900.; ## kg/m^3\n",
      "g=9.81; ## m/s^2\n",
      "h=0.6; ## m\n",
      "\n",
      "C=rho*g*h;\n",
      "\n",
      "## p = -rho*K^2/(2*R^2)+D\n",
      "## From this we get, D = 9*w^2 + C\n",
      "\n",
      "## At z = 0\n",
      "## p = D - rho*K^2/2/R^2;\n",
      "p_max=150000.; ## Pa\n",
      "\n",
      "## From the above equation we obtain,\n",
      "w=135.6; ## rad/s\n",
      "\n",
      "print'%s %.1f %s'%(\"The maximum speed at which the paddles may rotate about their vertical axis =\",w,\"rad/s\")\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum speed at which the paddles may rotate about their vertical axis = 135.6 rad/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg386"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate the strength of the line source and the distance s the line source is located behind the leading edge of the step and Horizontal component andVertical Component \n",
      "U=40; ## m/s\n",
      "h=0.01; ## m\n",
      "\n",
      "m=2*U*h;\n",
      "print'%s %.1f %s'%(\"the strength of the line source =\",m,\"m^2/s\")\n",
      "\n",
      "\n",
      "s = m/(2*math.pi*U);\n",
      "print'%s %.2f %s'%(\" the distance s the line source is located behind the leading edge of the step =\",s*1000,\"mm\")\n",
      "\n",
      "\n",
      "\n",
      "x=0; ## m\n",
      "y=0.005; ## m\n",
      "\n",
      "u=U + m/(2*math.pi)*(x/(x**2+y**2));\n",
      "v=m/(2*math.pi)*(y/(x**2+y**2));\n",
      "print'%s %.f %s'%(\"Horizontal component =\",u,\"m/s\")\n",
      "\n",
      "\n",
      "print'%s %.1f %s'%(\"Vertical Component =\",v,\"m/s\")\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the strength of the line source = 0.8 m^2/s\n",
        " the distance s the line source is located behind the leading edge of the step = 3.18 mm\n",
        "Horizontal component = 40 m/s\n",
        "Vertical Component = 25.5 m/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg389"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate length\n",
      "b=0.0375; ## m\n",
      "t=0.0625; ## m\n",
      "U=5.; ## m/s\n",
      "\n",
      "m=2*math.pi*U*t/math.atan(2*b*t/(t**2-b**2));\n",
      "\n",
      "L=2.*b*(1+m/(math.pi*U*b))**(1/2.);\n",
      "\n",
      "print'%s %.7f %s'%(\"L =\",L,\"m\")\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "L = 0.1515673 m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg409"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate Lift coefficient and Drag coefficient and Effective angle of attack\n",
      "l1=10.; ## m\n",
      "r1=2.; ## m\n",
      "C_D1=0.0588;\n",
      "theta1=6.5; ## degrees\n",
      "\n",
      "AR1=l1/r1; ## Aspect ratio\n",
      "\n",
      "C_L=0.914;\n",
      "\n",
      "C_D2=C_L**2./(math.pi*AR1);\n",
      "theta2=math.atan(C_L/(math.pi*AR1))*57.3\n",
      "\n",
      "C_D3=C_D1-C_D2;\n",
      "theta3=theta1-theta2;\n",
      "\n",
      "AR2=8.;\n",
      "\n",
      "C_Di=C_L**2./(math.pi*AR2);\n",
      "C_D=C_Di+C_D3;\n",
      "\n",
      "theta4=math.atan(C_L/(math.pi*AR2))*57.3;\n",
      "theta=theta4+theta3;\n",
      "\n",
      "print'%s %.3f %s'%(\"Lift coefficient =\",C_L,\"\")\n",
      "\n",
      "\n",
      "print'%s %.4f %s'%(\"Drag coefficient =\",C_D,\"\")\n",
      "\n",
      "\n",
      "print'%s %.3f %s'%(\"Effective angle of attack =\",theta,\"degrees\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lift coefficient = 0.914 \n",
        "Drag coefficient = 0.0389 \n",
        "Effective angle of attack = 5.253 degrees\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}