{ "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": {} } ] }