summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commit6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch)
tree22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb
parentd36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff)
downloadPython-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip
Removed duplicates
Diffstat (limited to 'Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb')
-rwxr-xr-xFluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb517
1 files changed, 517 insertions, 0 deletions
diff --git a/Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb b/Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb
new file mode 100755
index 00000000..b12249f7
--- /dev/null
+++ b/Fluid_Mechanics_by_John_F._Douglas/Chapter_5.ipynb
@@ -0,0 +1,517 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:04c1d9ce4358772aaf36727d98b4d1c000b18de791fe80fc4e6e1ac3cabc0050"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: The Momentum Equation and its Applications"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.1, Page 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ " #Initializing the variables \n",
+ "\n",
+ "l = 60 ; #Length of pipeline\n",
+ "rho = 1000; # Density of liquid\n",
+ "a = 0.02; #Acceleration of fluid\n",
+ "\n",
+ " #Calculations\n",
+ "delP = rho*l*a; #Change in pressure\n",
+ "print \"Increase of pressure difference required (kN/m2):\",delP/1000"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Increase of pressure difference required (kN/m2): 1.2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.2, Page 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ " #Initializing the variables \n",
+ "v = 5; #Velocity of jet \n",
+ "rho = 1000; #density of water\n",
+ "d = 0.025; #Diameter of fixed nozzle\n",
+ "\n",
+ " #Calculations\n",
+ " #--Part(a) Variation of force exerted normal to the plate with plate angle--//\n",
+ "header = \"Theta\\t vcos(x)\\t pAv\\t Force\"\n",
+ "unit = \"deg\\t m/s\\t kg/s\\t N\"\n",
+ "\n",
+ "A = math.pi*d**2/4;\n",
+ "x = range(0,91,15);\n",
+ "for c in range(len(x)):\n",
+ " x[c]=1.0*x[c]\n",
+ "m = round(rho*A*v,2);\n",
+ "ma = [m,m,m,m,m,m,m];\n",
+ "vcomp=[]\n",
+ "force=[]\n",
+ "for c in x:\n",
+ " vcomp.append(round(v*math.cos(math.radians(c)),2))\n",
+ " force.append(round((rho*A*v**2)*math.cos(math.radians(c)),2))\n",
+ "\n",
+ "print header\n",
+ "print unit\n",
+ "for c in range(len(x)):\n",
+ " mm=str(x[c])+' \\t '+str(vcomp[c])+' \\t'+str(ma[c])+' \\t'+str(force[c])\n",
+ " print mm\n",
+ "##value = [x,vcomp,ma,force]\n",
+ "##print value,unit, header\n",
+ "\n",
+ " #--Part(b) Variation of force exerted normal to the plate with plate velocity--// \n",
+ "header =\"Theta\\t v\\t u\\t v-u\\t pA(v-u)\\t Force\\t\"\n",
+ "unit =\"deg\\t m/s\\t m/s\\t m/s\\t kg/s\\t N\\t\"\n",
+ "x = [0,0,0,0,0]\n",
+ "v = [5,5,5,5,5]\n",
+ "u = range(2,-3,-1);\n",
+ "D=[]\n",
+ "Prod=[]\n",
+ "Force=[]\n",
+ "for c in range(5):\n",
+ " D.append(v[c]-u[c])\n",
+ " Prod.append(round((rho*A*D[c]),2))\n",
+ " Force.append(round((rho*A*D[c]**2),2))\n",
+ " \n",
+ "print '\\n',\"(b)\",\"\\n\",header\n",
+ "print unit\n",
+ "for c in range(len(x)):\n",
+ " mm=str(x[c])+' \\t '+str(v[c])+' \\t '+str(u[c])+' \\t '+str(D[c])+' \\t '+str(Prod[c])+' \\t '+str(Force[c])\n",
+ " print mm\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theta\t vcos(x)\t pAv\t Force\n",
+ "deg\t m/s\t kg/s\t N\n",
+ "0.0 \t 5.0 \t2.45 \t12.27\n",
+ "15.0 \t 4.83 \t2.45 \t11.85\n",
+ "30.0 \t 4.33 \t2.45 \t10.63\n",
+ "45.0 \t 3.54 \t2.45 \t8.68\n",
+ "60.0 \t 2.5 \t2.45 \t6.14\n",
+ "75.0 \t 1.29 \t2.45 \t3.18\n",
+ "90.0 \t 0.0 \t2.45 \t0.0\n",
+ "\n",
+ "(b) \n",
+ "Theta\t v\t u\t v-u\t pA(v-u)\t Force\t\n",
+ "deg\t m/s\t m/s\t m/s\t kg/s\t N\t\n",
+ "0 \t 5 \t 2 \t 3 \t 1.47 \t 4.42\n",
+ "0 \t 5 \t 1 \t 4 \t 1.96 \t 7.85\n",
+ "0 \t 5 \t 0 \t 5 \t 2.45 \t 12.27\n",
+ "0 \t 5 \t -1 \t 6 \t 2.95 \t 17.67\n",
+ "0 \t 5 \t -2 \t 7 \t 3.44 \t 24.05\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.3, Page 123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ " \n",
+ "\n",
+ " #Initializing the variables \n",
+ "x = 60; #Angle of deflection theta\n",
+ "rho = 1000; # Density of liquid\n",
+ "V1 = 30; #Acceleration of fluid\n",
+ "V2 = 25;\n",
+ "m = .8; #Discharge through A\n",
+ "\n",
+ " #Calculations\n",
+ "def Reaction(Vin , Vout):\n",
+ " R = m*(Vin -Vout) ;\n",
+ " return R\n",
+ "Rx = Reaction(V1,V2*math.cos(math.radians(x)));\n",
+ "Ry = -Reaction(0,V2*math.sin(math.radians(x)));\n",
+ "print \"Reaction in X-direction (N) :\",Rx\n",
+ "print \"Reaction in Y-direction (N) :\",round(Ry,2)\n",
+ "print \"Net Reaction (N) :\",round((Rx**2 +Ry**2)**0.5,2)\n",
+ "print \"Inclination of Resultant Force with x-direction (Degrees):\",round(180/math.pi*math.atan(Ry/Rx),2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reaction in X-direction (N) : 14.0\n",
+ "Reaction in Y-direction (N) : 17.32\n",
+ "Net Reaction (N) : 22.27\n",
+ "Inclination of Resultant Force with x-direction (Degrees): 51.05\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.4, Page 125"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "\n",
+ " #Initializing the variables \n",
+ "v1 = 36 ; #Exit velocity\n",
+ "u = 15; #Velocity of vane\\\n",
+ "x = 30; # Angle between vanes and flow\n",
+ "rho = 1000; # Density of water\n",
+ "d = .1; # Diameter of jet\n",
+ "\n",
+ " #Calculations\n",
+ "alp = (180/math.pi)*math.atan((v1*math.sin(math.radians(x))/(v1*math.cos(math.radians(x))-u)));\n",
+ "v2 = 0.85*v1*math.sin(math.radians(x));\n",
+ "bta = (180/math.pi)*math.acos((u*math.sin(math.radians(alp))/v2));\n",
+ "m = (rho*math.pi*v1*d**2)/4;\n",
+ "Vin = v1*math.cos(math.radians(x));\n",
+ "Vout = v2*math.cos(math.radians(90));\n",
+ "Rx = m*(Vin-Vout);\n",
+ "\n",
+ "\n",
+ "print \"Inlet Angle (Degrees) :\", round(alp,2)\n",
+ "print \"Outlet Angle (Degrees) :\", round(bta,2)\n",
+ "print \"Force exerted by vanes (N) :\", round(Rx) \n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inlet Angle (Degrees) : 48.05\n",
+ "Outlet Angle (Degrees) : 43.18\n",
+ "Force exerted by vanes (N) : 8815.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.5, Page 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "\n",
+ " #Initializing the variables \n",
+ "rho = 850 ; # Density of liquid\n",
+ "a = 0.02 #Acceleration of fluid\n",
+ "x = 45 ;\n",
+ "d1 = .5 ;\n",
+ "d2 = .25;\n",
+ "p1 = 40*10**3;\n",
+ "p2 = 23*10**3;\n",
+ "Q = .45;\n",
+ " \n",
+ " #Calculations\n",
+ "A1 = (math.pi*d1**2)/4;\n",
+ "A2 = (math.pi*d2**2)/4;\n",
+ "v1 = Q/A1;\n",
+ "v2 = Q/A2;\n",
+ "\n",
+ "Rx = p1*A1 - p2*A2*math.cos(math.radians(x)) - rho*Q*(v2*math.cos(math.radians(x))-v1);\n",
+ "Ry = p2*A2*math.sin(math.radians(x)) + rho*Q*v2*math.sin(math.radians(x));\n",
+ "\n",
+ "print \"Resultant force on the bend (kN) :\",round((Rx**2 +Ry**2)**0.5/1000,3)\n",
+ "print \"Inclination of Resultant Force with x-direction (Degrees):\",round(math.atan(Ry/Rx)*180/math.pi)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resultant force on the bend (kN) : 6.362\n",
+ "Inclination of Resultant Force with x-direction (Degrees): 31.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.6, Page 129"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "\n",
+ " #Initializing the variables \n",
+ "v = 4.9; #Velocity of Jet\n",
+ "rho = 1000; # Density of water\n",
+ "d = 0.05;\n",
+ "u = 1.2 # Velocity of tank\n",
+ " #Calculations\n",
+ "Vout = v;\n",
+ "Vin = 0;\n",
+ "m = rho*math.pi*d**2*v/4;\n",
+ "R = m*(Vout-Vin);\n",
+ "print \"Reaction of jet on tank (N) :\",round(R,2)\n",
+ "print \"Work done per second (W) :\",round(R*u,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reaction of jet on tank (N) : 47.14\n",
+ "Work done per second (W) : 56.57\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.7, Page 130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "from scipy import integrate\n",
+ " \n",
+ " \n",
+ "\n",
+ " #Initializing the variables \n",
+ "Vj = 5*10**6; # Velocity of Jet\n",
+ "Mr = 150000; # Mass of Rocket\n",
+ "Mf0 = 300000; # Mass of initial fuel\n",
+ "Vr = 3000; # Velocity of jet relative to rocket\n",
+ "g = 9.81; # Acceleration due to gravity\n",
+ "\n",
+ " #Calculations\n",
+ "m = Vj/Vr; #Rate of fuel consumption\n",
+ "T = Mf0/m; # Burning time\n",
+ "\n",
+ "def f(t,m,Vr,Mr,Mf0,g):\n",
+ " return m*Vr /(Mr + Mf0 - m*t) - g;\n",
+ " \n",
+ "args = (5000/3,3000,150000,300000,9.81)\n",
+ "Vt = integrate.quad(f, 0.0, 180, args)\n",
+ "\n",
+ "def h(t,Vr,g):\n",
+ " return -g*t - Vr*math.log(1 - t/269.95);\n",
+ " \n",
+ "args = (3000,9.81)\n",
+ "Z1 = integrate.quad(h, 0.0, 180, args)\n",
+ "Z2 = Vt[0]**2/(2*g);\n",
+ "\n",
+ "print \"(a)Burning time (s) :\",T\n",
+ "print \"(b)Speed of rocket when all fuel is burned (m/s):\",round(Vt[0],2)\n",
+ "print \"(c)Maximum height reached (km) :\",round((Z2+Z1[0])/1000,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Burning time (s) : 180.0\n",
+ "(b)Speed of rocket when all fuel is burned (m/s): 1530.04\n",
+ "(c)Maximum height reached (km) : 203.8\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.8, Page 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ " #Initializing the variables \n",
+ "V = 200; #Velocity in still air\n",
+ "Vr = 700; #velocity of gas relative to engine\n",
+ "mf = 1.1; # Fuel Consumption\n",
+ "r = 1/40 ; \n",
+ "P1 =0;\n",
+ "P2 = 0;\n",
+ "\n",
+ " #Calculations\n",
+ "m1 = mf/r;\n",
+ "T = m1*((1+r)*Vr -V);\n",
+ "print \"(a)Thrust (kN) :\",T/1000\n",
+ "\n",
+ "W = T*V;\n",
+ "print \"(b)Work done per second (kW) :\",W/1000\n",
+ "\n",
+ "Loss = 0.5*m1*(1+r)*(Vr-V)**2;\n",
+ "print \"(c)Efficiency (%) :\",round(W/(W+Loss)*100,1) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Thrust (kN) : 22.77\n",
+ "(b)Work done per second (kW) : 4554.0\n",
+ "(c)Efficiency (%) : 44.7\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.10, Page 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ " #Initializing the variables \n",
+ "rho = 1000; # Density of water\n",
+ "Q = 10; #Acceleration of fluid\n",
+ "r2 = 1.6;\n",
+ "r1 = 1.2;\n",
+ "V1 = 2.3;\n",
+ "V2 = 0.2;\n",
+ "rot = 240; \n",
+ "\n",
+ " #Calculations\n",
+ "Tf = rho*Q*(V2*r2 - V1*r1);\n",
+ "T = -Tf;\n",
+ "n = rot / 60;\n",
+ "P = 2*round(math.pi,3)*n*T;\n",
+ "\n",
+ "print \"Torque exerted by fluid (N.m):\",T\n",
+ "print \"Theoretical power output (kW) :\",round(P/1000,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Torque exerted by fluid (N.m): 24400.0\n",
+ "Theoretical power output (kW) : 613.32\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file