{ "metadata": { "name": "", "signature": "sha256:58b7373e6785b57ec4db0eaf49754884e3dad15de9e9489fc1c2bb500d413f82" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 7: Two-Dimentional Idea Flow" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.2, Page 235" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import math\n", "\n", "\n", " #Initializing the variables \n", "x = 120; #Theta\n", "r = 1;\n", "v0 = 0.5;\n", "q = 2;\n", "theta =120;\n", "\n", " #Calculations\n", "Vr = v0*r*math.cos(math.radians(theta)) +q/(2*math.pi)\n", "Vth = -v0*math.sin(math.radians(theta))\n", "V = (Vr**2+Vth**2)**0.5;\n", "alpha = math.atan(abs(Vth/Vr));\n", "bet = x-alpha*180/math.pi;\n", "\n", "\n", "print \"Fluid Velocity(m/s) :\",round(V,3)\n", "print \"Beta (Degree) :\",round(bet,2)\n", "print \"Alpha (Degree) :\",round(alpha*180/math.pi,2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Fluid Velocity(m/s) : 0.438\n", "Beta (Degree) : 38.96\n", "Alpha (Degree) : 81.04\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.3, Page 239" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import math\n", "from scipy.optimize import fsolve\n", "import sympy\n", "from sympy import RootOf, I, Symbol\n", " #Initializing the variables \n", "q = 10;\n", "def shi(x,y):\n", " Z = (q/2/math.pi)*(math.atan(y/(x-1))-math.atan(y/(x+1))) - 25*y;\n", " return Z\n", "h = 0.0000001;\n", "Vinf = 25;\n", "x=Symbol('x')\n", " #Calculations\n", "#f = lambda x : x**2 - 2/(5*math.pi) -1\n", "result = [RootOf(x**2- 2/(5*math.pi) -1,i) for i in (0,1)] \n", "\n", "root1=round(result[0],3)\n", "root2=round(result[1],3)\n", "l = abs(abs(root1)+abs(root2));\n", "Ymax = 0.047;\n", "width = 2*Ymax;\n", "Vx = (shi(1-h,1)-shi(1-h,1-h))/h; # At x=1 the function atan is not defined hence taking x a little smaller.\n", "Vy = -1*(shi(1-2*h,1)-shi(1-h,1))/h; # At x=1 the function atan is not defined hence taking x a little smaller.\n", "\n", "V = (Vx**2+Vy**2)**0.5;\n", "rho = Symbol('rho')\n", "dP = rho/2*round((V**2 - Vinf**2),2); #difference in pressure\n", "\n", "print \"Pressure Difference (N/m2) :\",dP\n", "print \"Velocity (m/s) :\",round(V,2)\n", "print \"Length of Rankine Body(m) :\",l\n", "print \"Width of Rankine Body (m) :\",width" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure Difference (N/m2) : 16.93*rho\n", "Velocity (m/s) : 25.67\n", "Length of Rankine Body(m) : 2.124\n", "Width of Rankine Body (m) : 0.094\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.4, Page 242" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import math #Example 7.4\n", "\n", " #Initializing the variables\n", "a = 0.02;\n", "r = 0.05;\n", "V0 = 1;\n", "x = 135; # Theta\n", "def shi(r,x):\n", " Z = V0*math.sin(math.radians(x))*(r-((a**2)/r));\n", " return Z\n", "h = 0.0001;\n", "\n", " #Calculations\n", "Vr = 57*(shi(r,x+h)-shi(r,x))/(r*h);\n", "Vx = -1*(shi(r+h,x)-shi(r,x))/h;\n", "\n", "print \"Radial Velocity (m/s) :\",round(Vr,3)\n", "print \"Normal component of velocity (m/s):\",round(Vx,3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Radial Velocity (m/s) : -0.591\n", "Normal component of velocity (m/s): -0.82\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.5, Page 246" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import math\n", "\n", "\n", " #Initializing the variables\n", "rho = 1000;\n", "r = 2;\n", "psi = 2*math.log(r);\n", "\n", " #Calculations\n", "y = psi/math.log(r); # y = GammaC / 2*pi\n", "v = y/r;\n", "dPbydr = rho*v**2/r;\n", "print \"Pressuer Gradient (N/m3 ) :\",dPbydr" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressuer Gradient (N/m3 ) : 500.0\n" ] } ], "prompt_number": 5 } ], "metadata": {} } ] }