summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_With_Engineering_Applications/ch13.ipynb
blob: c094073c4797db9a1ec9c0e5581bddd0e6330e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
{
 "metadata": {
  "name": "",
  "signature": "sha256:57afc22e72f8124575cf49b21448070d3e8a0ab91ff492996411fc02ec3e922d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Unsteady-Flow Problems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1 Page No : 449"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "ken = 0.5\n",
      "kex = 0.2\n",
      "f = 0.0018\n",
      "l = 10. \t#ft\n",
      "dia = 3. \t#in\n",
      "z1 = 8.\n",
      "z2 = 5.\n",
      "\t\n",
      "#calculations\n",
      "x1 = ken+kex+f*l*12/dia\n",
      "t = 35.5*2/3 *(z1**(3./2) - z2**(3./2))\n",
      "\t\n",
      "#Results\n",
      "print \"Time reqired  =  %.f s\"%(t)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time reqired  =  271 s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2 Page No : 451"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "print (\"For steady state, dV/dt  = 0\")\n",
      "Q = 1600./449  #steady flow rate\n",
      "A2 = 0.1963\n",
      "g = 32.2\n",
      "rp2 = 2000.  #speed of rotation - rpm\n",
      "\t\n",
      "#calculations\n",
      "V2 = Q/A2\n",
      "hp1 = 32*V2**2 /(2*g) -50\n",
      "hp2 = hp1*(rp2/1650)**2\n",
      "hpf = 169. \t#ft\n",
      "Q = 4.1 \t#cfs\n",
      "\t\n",
      "#Results\n",
      "print \"Steady state flow rate  =  %.2f cfs\"%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For steady state, dV/dt  = 0\n",
        "Steady state flow rate  =  4.10 cfs\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3 Page No : 455"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import *\n",
      "\t\n",
      "#Initialization of variables\n",
      "kl = 0.5\n",
      "f = 0.02\n",
      "L = 15. \t#length - m\n",
      "D = 0.1 \t#ft\n",
      "k = 3.5\n",
      "g = 9.81\n",
      "H = 2.\t#ft\n",
      "\t\n",
      "#calculations\n",
      "k = kl+f*L/D\n",
      "V0 = math.sqrt(2*g*H/(1+k))\n",
      "Q = array([0.25, 0.5, 0.75])\n",
      "V = V0*Q\n",
      "Vfun = (2.95+V)/(2.95-V)\n",
      "lnVfun = log(Vfun)\n",
      "t = 1.129*lnVfun\n",
      "\n",
      "print \"ln        t,s\"\n",
      "#Results\n",
      "for i in range(len(t)):\n",
      "    print \"%.3f     %.3f\"%(lnVfun[i],t[i])\n",
      "\n",
      "print (\"Similarly, it can be calculated for L = 150,1500 ft\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ln        t,s\n",
        "0.511     0.577\n",
        "1.100     1.242\n",
        "1.949     2.201\n",
        "Similarly, it can be calculated for L = 150,1500 ft\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4 Page No : 462"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "Q = 30. \t#cfs\n",
      "r = 2.  \t#ft\n",
      "cp = 3200.\n",
      "rho = 1.94\n",
      "Q2 = 10. \t#cfs\n",
      "z = 300. \t#ft\n",
      "\t\n",
      "#calculations\n",
      "V = Q/(math.pi*r**2)\n",
      "ph = rho*cp*V/144\n",
      "phd = 4000/cp /(2*r) *ph\n",
      "dV = (Q2-Q)/(math.pi*r**2)\n",
      "dph = -rho*cp*dV/144\n",
      "ph3 = rho*cp*V/3 /144\n",
      "ph4 = ph3*z*2/cp\n",
      "\t\n",
      "#Results\n",
      "print \"Water hammer pressure =  %.1f psi\"%(ph)\n",
      "print \" Water hammer pressure in case 2 =  %.1f psi\"%(phd)\n",
      "print \" Water hammer pressure in case 3 =  %.1f psi\"%(dph)\n",
      "print \" Pressure at valve in case 4  =  %.1f psi\"%(ph3)\n",
      "print \" Pressure at 300 ft from reservoir  =  %.2f psi\"%(ph4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Water hammer pressure =  102.9 psi\n",
        " Water hammer pressure in case 2 =  32.2 psi\n",
        " Water hammer pressure in case 3 =  68.6 psi\n",
        " Pressure at valve in case 4  =  34.3 psi\n",
        " Pressure at 300 ft from reservoir  =  6.43 psi\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}