summaryrefslogtreecommitdiff
path: root/Fluid_mechanics_by_Pao/Chapter_4.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-09-04 22:04:10 +0530
committerThomas Stephen Lee2015-09-04 22:04:10 +0530
commit41f1f72e9502f5c3de6ca16b303803dfcf1df594 (patch)
treef4bf726a3e3ce5d7d9ee3781cbacfe3116115a2c /Fluid_mechanics_by_Pao/Chapter_4.ipynb
parent9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e (diff)
downloadPython-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.tar.gz
Python-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.tar.bz2
Python-Textbook-Companions-41f1f72e9502f5c3de6ca16b303803dfcf1df594.zip
add/remove/update books
Diffstat (limited to 'Fluid_mechanics_by_Pao/Chapter_4.ipynb')
-rwxr-xr-xFluid_mechanics_by_Pao/Chapter_4.ipynb777
1 files changed, 777 insertions, 0 deletions
diff --git a/Fluid_mechanics_by_Pao/Chapter_4.ipynb b/Fluid_mechanics_by_Pao/Chapter_4.ipynb
new file mode 100755
index 00000000..49f2ce7e
--- /dev/null
+++ b/Fluid_mechanics_by_Pao/Chapter_4.ipynb
@@ -0,0 +1,777 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:bf4ed226827aaf378bd6d43d8ae5845adf36d75f20c124d2087db252462cf40c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 - Fluid Dynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - Pg 79"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate dp/ds at both upper and lower ends\n",
+ "#Initialization of variables\n",
+ "rho=1.5 #g/cc\n",
+ "g=32.2 #ft/s^2\n",
+ "dzds=-0.5\n",
+ "x1=0\n",
+ "x2=3\n",
+ "#calculations\n",
+ "def func(s):\n",
+ " dpds=-rho*g*dzds - rho*(3+9*s)*9\n",
+ " return dpds\n",
+ "\n",
+ "r1=func(x1)\n",
+ "r2=func(x2)\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"At the upper end, dp/ds =\",r1,\"lb/ft^2 per foot\")\n",
+ "print '%s %.1f %s' %(\"\\n At the lower end, dp/ds =\",r2,\"lb/ft^2 per foot\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At the upper end, dp/ds = -16.3 lb/ft^2 per foot\n",
+ "\n",
+ " At the lower end, dp/ds = -380.9 lb/ft^2 per foot\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - Pg 80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the pressure difference between the two points\n",
+ "#Initialization of variables\n",
+ "g=32.2 #ft/s^2\n",
+ "v1=3. #ft/s\n",
+ "z1=1.5 #ft\n",
+ "rho=1.5 #g/cc\n",
+ "z2=0\n",
+ "v2=30. #ft/s\n",
+ "#calculations\n",
+ "dp= rho*(v2*v2 /2. - g*z1 +g*z2 - v1*v1 /2.)\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"pressure difference =\",dp,\"lb/ft^2\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "pressure difference = 595.8 lb/ft^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - Pg 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the net power transferred\n",
+ "#Initialization of variables\n",
+ "pd=15. #psia\n",
+ "rhod=0.005#slug/ft^3\n",
+ "pi=150. #psia\n",
+ "rhoi=0.03 #slug/ft^3\n",
+ "dz=-25. #ft\n",
+ "vd=1000. #ft/s\n",
+ "vi=100. #ft/s\n",
+ "ud=200. #Btu/slug\n",
+ "ui=250. #Btu/slug\n",
+ "g=32.2 #ft/s^2\n",
+ "J=778.\n",
+ "uff=5. #ft/s\n",
+ "Q=50. #Btu/sec\n",
+ "#calculations\n",
+ "pr=pd/rhod*144. - pi/rhoi *144.\n",
+ "zr=g*(dz)\n",
+ "vr=(vd*vd -vi*vi)/2.\n",
+ "ur=(ud-ui)*J\n",
+ "jeh=J*Q*g/uff\n",
+ "gem=pr+zr+vr+ur+jeh\n",
+ "power=gem*uff/g\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Power transferred =\",power,\"ft-lb/sec\")\n",
+ "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power transferred = 64877 ft-lb/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - Pg 89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the kinetic energy correction factor\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import scipy\n",
+ "from scipy import integrate\n",
+ "r0=1. \n",
+ "ri=0.\n",
+ "#calculations\n",
+ "def func1(y):\n",
+ " v= 2*math.pow(y,(1./7.)) *(y-1)\n",
+ " return v\n",
+ "\n",
+ "V,err=scipy.integrate.quad(func1,ri,r0)\n",
+ "def func2(y):\n",
+ " alpha= 1/ (math.pi*V*V*V) *2*math.pi *math.pow((y),(3./7.)) *(y-1) \n",
+ " return alpha\n",
+ "\n",
+ "a2,err2=scipy.integrate.quad(func2,ri,r0)\n",
+ "#results\n",
+ "print '%s %.2f' %(\"Kinetic energy correction factor = \",a2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Kinetic energy correction factor = 1.06\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5a - Pg 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the pressure at the lower end if friction is neglected\n",
+ "#Initialization of variables\n",
+ "gam=62.4\n",
+ "pu=40. #psia\n",
+ "zu=25. #ft\n",
+ "vu=8. #ft/s\n",
+ "g=32.2 #ft/s^2\n",
+ "vl=8. #ft/s\n",
+ "zl=0 #ft\n",
+ "#calculations\n",
+ "pl= gam*(pu*144. /gam +zu-zl+ (vu*vu -vl*vl)/(2*g))/144.\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Pressure at the lower end if friction is neglected =\",pl,\"psig\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure at the lower end if friction is neglected = 50.83 psig\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5b - Pg 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the pressure at the lower end if friction is not neglected\n",
+ "#Initialization of variables\n",
+ "hl=5.\n",
+ "gam=62.4\n",
+ "pu=40. #psia\n",
+ "zu=25. #ft\n",
+ "vu=8. #ft/s\n",
+ "g=32.2 #ft/s^2\n",
+ "vl=8. #ft/s\n",
+ "zl=0 #ft\n",
+ "#calculations\n",
+ "pl= gam*(pu*144. /gam +zu-zl-hl+ (vu*vu -vl*vl)/(2*g))/144.\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Pressure at the lower end if friction is neglected =\",pl,\"psig\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure at the lower end if friction is neglected = 48.67 psig\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6a - Pg 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the discharge flow rate.\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "gam=62.4\n",
+ "pa=0\n",
+ "za=15. #ft\n",
+ "va=0\n",
+ "pg=0\n",
+ "zg=0\n",
+ "g=32.2 #ft/s^2\n",
+ "dg=2. #in\n",
+ "#calculations\n",
+ "vg= math.sqrt(2*g*(pa/gam +za+va*va /(2*g) -pg/gam - zg))\n",
+ "Ag=math.pi/4. *(dg/12.)*(dg/12.)\n",
+ "Q=Ag*vg\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"discharge =\",Q,\"ft^3/sec\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "discharge = 0.68 ft^3/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6b - Pg 95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the pressure at the points C,D,E and F\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "gam=62.4\n",
+ "pa=0\n",
+ "za=15. #ft\n",
+ "va=0\n",
+ "pg=0\n",
+ "zg=0\n",
+ "g=32.2 #ft/s^2\n",
+ "d=4. #in\n",
+ "dg=2. #in\n",
+ "zd=25. #ft\n",
+ "#calculations\n",
+ "vg= math.sqrt(2*g*(pa/gam +za+va*va /(2*g) -pg/gam - zg))\n",
+ "Ag=math.pi/4. *(dg/12.)*(dg/12.)\n",
+ "Q=Ag*vg\n",
+ "A=math.pi/4. *(d/12.)*(d/12.)\n",
+ "v4=Q/A\n",
+ "pc=-v4*v4 *gam/(2*g*144.)\n",
+ "pgd= za-zd - v4*v4 /(2*g)\n",
+ "pd=pgd*gam/144.\n",
+ "pe=-v4*v4 *gam/(2*g*144.)\n",
+ "pfg= za- v4*v4 /(2*g)\n",
+ "pf=pfg*gam/144.\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Pressure at C =\",pc,\" psig\")\n",
+ "print '%s %.2f %s' %(\"\\n Pressure at D =\",pd,\" psig\")\n",
+ "print '%s %.2f %s' %(\"\\n Pressure at E =\",pe,\" psig\")\n",
+ "print '%s %.2f %s' %(\"\\n Pressure at F =\",pf,\" psig\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure at C = -0.41 psig\n",
+ "\n",
+ " Pressure at D = -4.74 psig\n",
+ "\n",
+ " Pressure at E = -0.41 psig\n",
+ "\n",
+ " Pressure at F = 6.09 psig\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - Pg 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the time required\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import scipy\n",
+ "from scipy import integrate\n",
+ "d1=6. #ft\n",
+ "d2=3. #in\n",
+ "pa=2. #ft\n",
+ "d=13.6 \n",
+ "sg=0.75\n",
+ "h1=5. #sec\n",
+ "h2=3. #sec\n",
+ "g=32.2 #ft/s^2\n",
+ "#calculations\n",
+ "pag=pa/12. *d/sg\n",
+ "def func(h):\n",
+ " time= -d1*d1 /(d2/12.)/(d2/12.) /(math.sqrt(2*g)) *math.pow((pag+h),(-0.5))\n",
+ " return time\n",
+ "ti,err=scipy.integrate.quad(func,h1,h2)\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Time required =\",ti,\" sec\")\n",
+ "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required = 54.3 sec\n",
+ "The answers are a bit different from textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - Pg 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the rate of flow \n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "x=12. #ft\n",
+ "angle=30.*math.pi/180. #degrees\n",
+ "g=32.2 #ft/s^2\n",
+ "z=-2. #ft\n",
+ "d=2. #in\n",
+ "#calculations\n",
+ "vj= x/math.cos(angle) *math.sqrt(g/(2*(x*math.tan(angle) -z)))\n",
+ "Q=math.pi/4. *(d/12.)*(d/12.) *vj\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Rate of flow =\",Q,\" ft^3/s\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of flow = 0.41 ft^3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - Pg 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the net discharge\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "x=10. #in of mercury\n",
+ "sg=13.6 #g/cc\n",
+ "d1=8. #in\n",
+ "d2=4. #in\n",
+ "g=32.2 #ft/s^2\n",
+ "#calculations\n",
+ "vdiff=x/12. *sg- x/12.\n",
+ "Vts=vdiff/(1-math.pow((d2/d1),4))\n",
+ "Vt=math.sqrt(2*g*Vts)\n",
+ "Q=Vt*math.pi/4. *(d2/12.)*(d2/12.)\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Discharge =\",Q,\"ft^3/s\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Discharge = 2.34 ft^3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11 - Pg 107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the horsepower input of the test pump\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "gam=62.4\n",
+ "ds=12. #in\n",
+ "dd=10. #in\n",
+ "Q=4. #ft^3/s\n",
+ "pd=40. #psia\n",
+ "ps=-6. #psia\n",
+ "zd=5. #ft\n",
+ "zs=0\n",
+ "g=32.2 #ft/s^2\n",
+ "#calculations\n",
+ "vs=Q/(math.pi/4. *math.pow((ds/12.),2))\n",
+ "vd=Q/(math.pi/4. *math.pow((dd/12.),2))\n",
+ "emp = (pd-ps)*144./gam + zd-zs + (vd*vd - vs*vs)/(2*g)\n",
+ "hpp=emp*Q*gam/550.\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Horsepower input of the test pump =\",hpp,\"hp\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Horsepower input of the test pump = 50.6 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12 - Pg 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the horizontal and vertical components of force\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "d1=12. #in\n",
+ "d2=8. #in\n",
+ "v1=15. #ft/s\n",
+ "p1=12. #psig\n",
+ "p2=5.85 #psig\n",
+ "rho=1.94 #ft^3/slug\n",
+ "angle=60.*math.pi/180. #degrees\n",
+ "#calculations\n",
+ "Q=math.pi/4. *(d1/12.)*(d1/12.) *v1\n",
+ "v2=Q/(math.pi/4. *(d2/12.)*(d2/12.))\n",
+ "pa1=p1*math.pi/4. *(d1)*(d1)\n",
+ "pa2=p2*math.pi/4. *(d2)*(d2)\n",
+ "qv1=rho*Q*v1\n",
+ "qv2=rho*Q*v2\n",
+ "Fx=pa1+qv1+ math.cos(angle)*(pa2+qv2)\n",
+ "Fy=math.sin(angle)*(pa2+qv2)\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Horizontal component of force =\",Fx,\"lb\")\n",
+ "print '%s %d %s' %(\"\\n Vertical component of force =\",Fy,\"lb\")\n",
+ "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Horizontal component of force = 2232 lb\n",
+ "\n",
+ " Vertical component of force = 922 lb\n",
+ "The answers are a bit different from textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14a - Pg 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the exit velocity of the pump\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "de=4. #in\n",
+ "T=1000. #lb\n",
+ "g=32.2 #ft/s^2\n",
+ "vele=8.5 #lb/s\n",
+ "pe=16.5 #psia\n",
+ "pa=14.7 #psia\n",
+ "#calculations\n",
+ "Ae=math.pi/4. *de*de\n",
+ "Ve= (T-(pe-pa)*Ae)*g/vele\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Exit velocity =\",Ve,\"ft/s\")\n",
+ "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Exit velocity = 3702 ft/s\n",
+ "The answers are a bit different from textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14b - Pg 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the thrust in the pipe\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "de=4. #in\n",
+ "T=1000. #lb\n",
+ "g=32.2 #ft/s^2\n",
+ "vele=8.5 #lb/s\n",
+ "pe=16.5 #psia\n",
+ "pa=14.7 #psia\n",
+ "pa2=1 #psia\n",
+ "#calculations\n",
+ "Ae=math.pi/4 *de*de\n",
+ "Ve= (T-(pe-pa)*Ae)*g/vele\n",
+ "T2=vele/g *Ve + (pe-pa2)*Ae\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Thrust =\",T2,\"lb\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Thrust = 1172 lb\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - Pg 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the downstream depth and horsepower dissipation\n",
+ "#Initialization of variables\n",
+ "q=240. #ft^3/sec/ft\n",
+ "v1=60. #ft/s\n",
+ "gam=62.4 \n",
+ "rho=1.94 #slug/ft^3\n",
+ "g=32.2 #ft/s^2\n",
+ "#calculations\n",
+ "y1=q/v1\n",
+ "v2=8.6 #ft/s\n",
+ "y2=28. #ft\n",
+ "hl= (y1+ v1*v1 /(2*g)) - (y2+ v2*v2 /(2*g))\n",
+ "hpp=hl*q*gam/550.\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Downstream depth =\",y2,\"ft\")\n",
+ "print '%s %d %s' %(\"\\n Horsepower dissipation =\",hpp,\"hp per foot width\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Downstream depth = 28.0 ft\n",
+ "\n",
+ " Horsepower dissipation = 837 hp per foot width\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - Pg 137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the acceleration required\n",
+ "#Initialization of variables\n",
+ "dh=3. #in\n",
+ "L=12. #in\n",
+ "g=32.2 #ft/s^2\n",
+ "#calculations\n",
+ "a=dh/L *g\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Acceleration =\",a,\" ft/s^2\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Acceleration = 8.05 ft/s^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file