summaryrefslogtreecommitdiff
path: root/mechanics_of_fluid/Chapter12-_1.ipynb
blob: 2905ba7e8ec0291f13dec7c85aa750dba5401a13 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:1f6973f8c8d9996abb4c23a2c5352b16bfcd60086af954d2e49808504d3171d0"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHapter12-Unsteady Flow"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg557"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate Time for which flow into the tank continues after the power failure \n",
      "import scipy\n",
      "from scipy import integrate\n",
      "Q=0.05; ## m^3/s\n",
      "d=0.15; ## m^2\n",
      "h=8.; ## m\n",
      "g=9.81; ## m/s^2\n",
      "l=90.; ## m\n",
      "f=0.007;\n",
      "\n",
      "u1=Q/(math.pi/4.*d**2.);\n",
      "\n",
      "def function(u):\n",
      "\tfun=(1./((h*g/l)+(2.*f/d)*u**2))\n",
      "\treturn fun\n",
      "\n",
      "t=scipy.integrate.quad(function,u1,0)\n",
      "\n",
      "\n",
      "print(\"Time for which flow into the tank continues after the power failure is\" )\n",
      "print'%s %.1f %s'%(\" \",-t[0],\"s\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time for which flow into the tank continues after the power failure is\n",
        "  2.6 s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg588"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate Estimate the height of tank required\n",
      "\n",
      "print(\"Estimate the height of tank required\")\n",
      "\n",
      "f=0.006;\n",
      "l=1400.; ## m\n",
      "g=9.81; ## m/s^2\n",
      "d1=0.75; ## m\n",
      "d2=3.; ## m\n",
      "Q=1.2; ## m^3/s\n",
      "a=20.; ## m\n",
      "\n",
      "K=4*f*l/(2*g*d1);\n",
      "\n",
      "## 2*K*Y = l*a/(g*A) = 8.919 s^2\n",
      "\n",
      "## Y=2*K*Y/2*K\n",
      "\n",
      "Y=8.919/(2*K);\n",
      "## When t=0\n",
      "\n",
      "u0=Q/(math.pi/4*d1**2);\n",
      "\n",
      "y0=K*u0**2;\n",
      "\n",
      "C=-Y/K/math.exp(y0/Y);\n",
      "\n",
      "## To determine the height of the surge tank, we consider the condition y = y_max when u = 0. \n",
      "\n",
      "## 0 = 1/K*(y_max+Y) + C*exp(y_max/Y)\n",
      "\n",
      "## From the above eqn we get\n",
      "\n",
      "y_max=-Y;\n",
      "\n",
      "H=a-y_max;\n",
      "print'%s %.1f %s'%(\"The minimum height of the surge tank =\",H,\"m\")\n",
      "\n",
      "\n",
      "print(\"The actual design height should exceed the minimum required, say 23 m\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Estimate the height of tank required\n",
        "The minimum height of the surge tank = 22.0 m\n",
        "The actual design height should exceed the minimum required, say 23 m\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}