{ "metadata": { "name": "", "signature": "sha256:a6ceb1d5d0407522d73c0769aac7029af109171f45086c52eac4f70c895f07f9" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 4 : Flow of an Incompressible Ideal Fluid" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.1 Page No : 103" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables\n", "d = 4.;\t\t #feet\n", "theta = 30.;\t\t# degrees\n", "p_C = 5. \t\t# psi\n", "\n", "# calculations \n", "p_A = p_C-(62.4/144)*math.cos(theta*math.pi/180) *2;\n", "p_B = p_C+(62.4/144)*math.cos(theta*math.pi/180) *2;\n", "h = p_C*144/62.4;\n", "\n", "# results \n", "print 'The static pressures at A and B are %.2f psi and %.2f psi respectively.'%(p_A,p_B);\n", "print 'The hydraulic grade line is %.2f ft vertically above C'%(h);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The static pressures at A and B are 4.25 psi and 5.75 psi respectively.\n", "The hydraulic grade line is 11.54 ft vertically above C\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.2 Page No : 105" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables \n", "h = 100.;\t\t#ft\n", "d1 = 5.;\t\t#in\n", "d2 = 8.;\t\t#in\n", "h1 = 60.;\t\t# ft\n", "h2 = 10.;\t\t#ft\n", "h3 = 40.;\t\t#ft\n", "h4 = 102.;\t\t#ft\n", "H = 300.;\t\t#ft\n", "theta = 30.;\t\t#degrees\n", "gam = 0.43;\n", "\n", "# calculations \n", "V5 = math.sqrt(h*2*32.2);\n", "Q = V5*0.25*math.pi*(d1/12)**2;\n", "V1 = (d1/12)**4 *h;\n", "V2 = h*(d1/d2)**4;\n", "p1 = (h1-V1)*gam;\n", "p2 = -(h2-V2)*2.04*gam;\n", "p3 = (h3-V1)*gam;\n", "p4 = (h4-V1)*gam;\n", "V6 = V5*math.cos(theta*math.pi/180);\n", "e = H - (V6**2)/(2*32.2);\n", "\n", "# results \n", "print 'p1 = %.1f psi, p2 = %.1f in. of Hg vacuum, p3 = %.f psi and p4 = %.1f psi'%(p1,p2,p3,p4);\n", "print 'elevation = %.1f ft'%(e);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "p1 = 24.5 psi, p2 = 4.6 in. of Hg vacuum, p3 = 16 psi and p4 = 42.6 psi\n", "elevation = 225.0 ft\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.3 Page No : 107" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables \n", "p = 14.;\t\t#psia\n", "gam = 62.;\t\t#lb/cuft\n", "l1 = 35.;\t\t# ft\n", "l2 = 10.;\t\t# ft\n", "d = 6.; \t\t#in\n", "\n", "# calculations \n", "p_v = 2.2*gam;\n", "p_B = p*144;\n", "k_c = l1-l2+(p_B/gam)-(p_v/gam);\n", "K6 = l1;\n", "d_c = d*(K6/k_c)**0.25;\n", "\n", "# results \n", "print 'd = %.2f in'%(d_c);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "d = 5.35 in\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.4 Page No : 108" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "# variables\n", "rho = 0.00238;\t\t#slug/cuft\n", "h = 6. \t\t#in\n", "\n", "# calculations \n", "V_0 = math.sqrt(2*(h/12)*(62.4 - rho*32.2)/rho);\n", "\n", "# results \n", "print 'The velocity of the air stream = %.f fps'%(V_0);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The velocity of the air stream = 162 fps\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.5 Page No : 110" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables\n", "sg = 0.82;\n", "p1 = 20.;\t\t#psia\n", "p2 = 10.;\t\t#psia\n", "d1 = 6.;\t\t#in\n", "d2 = 12.;\t\t#in\n", "del_z = 4.;\t\t#ft\n", "d = 18.7;\t\t#in\n", "\n", "# calculations \n", "h1 = (p1-p2)*144/(sg*62.4) - del_z;\n", "A1 = 0.25*math.pi*(d1/12)**2;\n", "A2 = 0.25*math.pi*(d2/12)**2;\n", "V2 = math.sqrt(-2*h1*32.2/(1-(A2/A1)**2));\n", "V1 = (A2/A1)*V2;\n", "Q = A1*V1;\n", "\n", "# results \n", "print 'Flow rate = %.2f cfs'%(Q);\n", "\n", "#there is a small error in the answer given in textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Flow rate = 8.00 cfs\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.6 Page No : 112" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "# variables\n", "e1 = 100.; \t\t#ft\n", "theta = 60.;\t\t#degrees\n", "e2 = 98.5;\t \t#ft\n", "V_s2 = 20.;\t \t#fps\n", "e3 = 95.;\t \t#ft\n", "\n", "# calculations \n", "t2 = (e1-e2)/math.cos(theta*math.pi/180);\n", "p2 = 3*62.4*math.cos(theta*math.pi/180);\n", "V_F2 = math.sqrt((e1 + (V_s2**2 /(2*32.2)) - p2/62.4 -e2)*2*32.2);\n", "q = 3*1*V_s2;\n", "y = 11.22;\t\t#ft\n", "y1 = 10.74;\t\t#ft\n", "V1 = math.sqrt((y-y1)*2*32.2);\n", "\n", "# results \n", "print 'On spillway: Pressure = %.1f psf , velocity = %d fps' %(p2,V_F2);\n", "print 'In the approach channel: Depth = %.2f ft, V1 = %.1f fps'%(y1,V1);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "On spillway: Pressure = 93.6 psf , velocity = 20 fps\n", "In the approach channel: Depth = 10.74 ft, V1 = 5.6 fps\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.7 Page No : 113" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables\n", "d = 10.;\t\t# in\n", "p = 40.;\t\t#psi\n", "G = 5.;\t\t#cfs\n", "y1 = 92.4;\t\t#ft\n", "k1 = -11.3;\t\t#ft\n", "k2 = 92.4;\t\t#ft\n", "k3 = 3.2;\t\t#ft\n", "k4 = 10.1;\t\t#ft\n", "\n", "# calculations \n", "E_p = k4+y1+d-k1-k3;\n", "hp = G*62.4*E_p/550;\n", "\n", "# results \n", "print 'Pump horsepower = %.1f hp'%(hp);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pump horsepower = 68.4 hp\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.9 Page No : 122" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "# variables\n", "sw = 20.;\t\t# specific weight in lb/cuft\n", "p_B = 6.;\t\t#psi\n", "p_A = 2.;\t\t#psi\n", "L = 17.28;\t\t#ft\n", "l = 10.;\t\t#ft\n", "\n", "# calculations \n", "V_A = math.sqrt(2*32.2*((p_B-p_A)*144/50 - l));\n", "\n", "# results \n", "print 'The mean velocity = %.2f fps'%(V_A);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The mean velocity = 9.89 fps\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.11 Page No : 126" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "# variables\n", "D = 6.;\t\t#in\n", "v = 100.;\t#fps\n", "p = 0.;\t\t#psi\n", "gam = 0.08;\t#specific weight in lb/cuft\n", "R = 6.;\t\t#in\n", "theta = 60.;\t\t#degrees\n", "\n", "# calculations \n", "v_r = v*(1-(0.5*D/R)**2)*math.cos(theta*math.pi/180);\n", "v_t = -v*(1+(0.5*D/R)**2)*math.sin(theta*math.pi/180);\n", "V = math.sqrt(v_r**2 + v_t**2);\n", "p = ((v**2 /(2*32.2)) - (V**2 /(2*32.2)) - (math.cos(theta*math.pi/180)*math.sin(theta*math.pi/180)))*gam;\n", "\n", "# results \n", "print 'Velocity = %.1f fps Pressure = %.2f psf'%(V,p);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Velocity = 114.6 fps Pressure = -3.92 psf\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.12 Page No : 127" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "from scipy.integrate import quad \n", "\t\t\n", "# variables\n", "p_A = 0;\n", "p_B = 0;\n", "p_C = 0;\n", "p_D = 0;\n", "#velocity heads\n", "V1 = 15.28;\t\t#fps\n", "V2 = 16.78;\t\t#fps\n", "V3 = 15.50;\t\t#fps\n", "V4 = 16.50;\t\t#fps\n", "\n", "# calculations \n", "def f0(h): \n", "\t return h**(1./2)\n", "\n", "\n", "q = math.sqrt(2*32.2)* quad(f0,3.771,4.229)[0]\n", "\n", "# results \n", "print 'V_A = %.2f fps, V_B = %.2f fps, V_C = %.2f fps, V_D = %.2f fps'%(V1,V2,V3,V4);\n", "print 'Flow rate = %.2f cfs/ft'%(q);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "V_A = 15.28 fps, V_B = 16.78 fps, V_C = 15.50 fps, V_D = 16.50 fps\n", "Flow rate = 7.35 cfs/ft\n" ] } ], "prompt_number": 4 } ], "metadata": {} } ] }