summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Fluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb')
-rwxr-xr-xFluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb558
1 files changed, 558 insertions, 0 deletions
diff --git a/Fluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb b/Fluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb
new file mode 100755
index 00000000..5a1c879b
--- /dev/null
+++ b/Fluid_Mechanics_by_Irfan_A_Khan/Chapter4.ipynb
@@ -0,0 +1,558 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Chapter 4 : Fluid Dynamics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.1 Page no 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Difference in pressure in section 1 and 2 = 1157.0 kN/m**2\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Difference in pressure at top and bottom\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d1 = 0.1 # diameter in m\n",
+ "\n",
+ "d2 = 0.05 # diameter in m\n",
+ "\n",
+ "Q = 0.1 # discharge in m**3/s\n",
+ "\n",
+ "A1 = pi*d1**2/4\n",
+ "\n",
+ "A2 = pi*d2**2/4\n",
+ "\n",
+ "gma =9810 # specific weight\n",
+ "\n",
+ "z= 6 # difference in the height\n",
+ "\n",
+ "g = 9.81\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V1 = Q/A1 # velocity at section 1\n",
+ "\n",
+ "V2 = Q/A2 # velocity at section 2\n",
+ "\n",
+ "dP = gma*((V2**2/(2*g))-(V1**2/(2*g))-z)/1000\n",
+ "\n",
+ "print \"Difference in pressure in section 1 and 2 = \",round(dP,1),\"kN/m**2\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.2 Page no 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Actual discharge = 2.0 l/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Actual discharge\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d = 2.5 # diameter in cm\n",
+ "\n",
+ "h =200 # head in cm\n",
+ "\n",
+ "Cd = 0.65 # coefficient of discharge\n",
+ "\n",
+ "A =pi*d**2/4\n",
+ "\n",
+ "g = 9.81 # acceleration due to gravity in m/s**2 \n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "Q = Cd*A*sqrt(2*g*h)/100\n",
+ "\n",
+ "print \"Actual discharge =\",round(Q,2),\"l/s\"\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.3 Page no 162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Discharge through the orifice = 2.69 m**3/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Discharge through the orifice\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from scipy import integrate\n",
+ "\n",
+ "import numpy as np\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "H1 = 3 # height in m\n",
+ "\n",
+ "H2 = 4 # height in m\n",
+ "\n",
+ "b = 0.5 # width in m\n",
+ "\n",
+ "Cd = 0.65 # co-efficient of discharge \n",
+ "\n",
+ "g = 9.81 # acceleration due to grvity in m/s**2\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "q = lambda h: h**(1/2)\n",
+ " \n",
+ "Q,err = integrate.quad(q, H1, H2)\n",
+ "\n",
+ "Qt = Cd*b*sqrt(2*g)*Q\n",
+ "\n",
+ "print \"Discharge through the orifice =\",round(Qt,2),\"m**3/s\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.4 Page no 163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Total Discharge = 1.95 m**3/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# discharge through orifice\n",
+ " \n",
+ "from math import *\n",
+ "\n",
+ "from scipy import integrate\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "import numpy as np\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "b = 1 # bredth of the tank\n",
+ "\n",
+ "d = 0.5 # depth of the tank\n",
+ "\n",
+ "h1 = 0.2 # height of the orifice in m\n",
+ "\n",
+ "Cd = 0.6 # coefficient of discharge\n",
+ "\n",
+ "H1 = 2 # height in m\n",
+ "\n",
+ "H2 = 2+h1 # height in m\n",
+ "\n",
+ "g = 9.81 # acceleration due to gravity in m/s**2\n",
+ "\n",
+ "A = 1*0.3 # area of submerged section in m**2\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "q = lambda h: h**(1/2)\n",
+ " \n",
+ "Q,err = integrate.quad(q, H1, H2)\n",
+ "\n",
+ "Q1 = Cd*b*sqrt(2*g)*(Q) # Flow through area 1\n",
+ "\n",
+ "Q2 = Cd*sqrt(2*g*H2)*A\n",
+ "\n",
+ "Td = Q1+Q2\n",
+ "\n",
+ "print \"Total Discharge =\",round(Td,2),\"m**3/s\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.5 Page no 165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Actual discharge = 0.000454 m**3/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Determine flow rate of water\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "d1 = 2 # radius of pipe\n",
+ "\n",
+ "d2 = 1 # radius of throat\n",
+ "\n",
+ "D1 = 40\n",
+ "\n",
+ "D2 = 20\n",
+ "\n",
+ "A1 = pi*D1**2/4\n",
+ "\n",
+ "A2 = pi*D2**2/4\n",
+ "\n",
+ "Cd = 0.95\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V2 = sqrt(21582/0.9375)\n",
+ "\n",
+ "Q = 1.52*pi*(d1/100)**2/4\n",
+ "\n",
+ "Qa = Q*Cd\n",
+ "\n",
+ "print \"Actual discharge =\",round(Qa,6),\"m**3/s\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.6 Page no 166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "velocity at the dept of 1 ft = 5.67 ft/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Velocity of stream point at the point of insertion\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "dx = 0.5 # in ft\n",
+ "\n",
+ "K = 1 # constant\n",
+ "\n",
+ "g = 32.2 # acceleration due to gravity in ft/s**2\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "V = sqrt(2*g*dx)\n",
+ "\n",
+ "print \"velocity at the dept of 1 ft =\",round(V,2),\"ft/s\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example no 4.7 Page no 172"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Discharge throught the system = 190.0 l/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Discharge throught the system\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "gma= 0.8 # specific weight\n",
+ "\n",
+ "V2 = 40 # velocity in m/s\n",
+ "\n",
+ "z1 =25 # height at point 1\n",
+ "\n",
+ "g = 9.81 # acceleration due to gravity in m/s**2\n",
+ "\n",
+ "d = 15 # diameter of the nozzle in cm\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V2 = sqrt(2*g*z1/4.25)\n",
+ "\n",
+ "A = pi*(d/100)**2/4\n",
+ "\n",
+ "Q = A*V2*1000\n",
+ "\n",
+ "print \"Discharge throught the system =\",round(Q,0),\"l/s\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.8 Page no 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Power input = 32.5 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Power input to the pump\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "Eff = 0.8 # pump efficiency\n",
+ "\n",
+ "Hl = 30 # head loss in m\n",
+ "\n",
+ "D1 =6 # diameter in cm\n",
+ "\n",
+ "D2 = 2 # diameter in cm\n",
+ "\n",
+ "gma = 9810 # specific weight in N/m**3\n",
+ "\n",
+ "V2 = 40 # velocity in m/s\n",
+ "\n",
+ "P1 = -50 # pressure at point 1 in N/m**2\n",
+ "\n",
+ "z2 = 100 # height at point 2\n",
+ "\n",
+ "g = 9.8 # acceleration due to gravity in m/s**2\n",
+ "\n",
+ "z1 = 30 # height in m\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V1=(2/6)**2*V2\n",
+ "\n",
+ "Q = (pi*6**2/4)*V1*10**-4\n",
+ "\n",
+ "Hs = z2 + (V2**2/(2*g)) + z1 + (50/gma) -(V1**2/(2*g))\n",
+ "\n",
+ "P = gma*Q*Hs\n",
+ "\n",
+ "Pi = (P/Eff)/1000\n",
+ "\n",
+ "print \"Power input = \",round(Pi,1),\"kW\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 4.9 Page no 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Elevation at height A = 492.39 m\n",
+ "Elevation at height B = 576.23 m\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Pressure head at A and B\n",
+ "\n",
+ "from math import *\n",
+ "\n",
+ "# Given\n",
+ "\n",
+ "Q = 0.2 # discharge in m**3/s\n",
+ "\n",
+ "d1 = 0.25 # diameter of the pipe in m\n",
+ "\n",
+ "A = pi*d1**2/4 # area of the pipe\n",
+ "\n",
+ "za = 480 # height in m\n",
+ "\n",
+ "z1 = 500 # height in m\n",
+ "\n",
+ "z3 = 550 # elevation in m\n",
+ "\n",
+ "gma =9810 # specific weight in N/m**2\n",
+ "\n",
+ "g =9.81 # acceleration due to gravity in m/s**2\n",
+ "\n",
+ "# Solution\n",
+ "\n",
+ "V=Q/A # Velocity of in m/s\n",
+ "\n",
+ "Hl1 = (0.02*100*V**2/(0.25*2*9.81))\n",
+ "\n",
+ "# pressure head at A\n",
+ "\n",
+ "Pa =(z1-za-(V**2/(2*g))-Hl1)\n",
+ "\n",
+ "El = za+Pa\n",
+ "\n",
+ "print \"Elevation at height A =\",round(El,2),\"m\"\n",
+ "\n",
+ "# pressure head at B\n",
+ "\n",
+ "hs = z3 - z1 + (0.02*(500/0.25)*(V**2/(2*g))) \n",
+ "\n",
+ "El2 = El+hs\n",
+ "\n",
+ "print \"Elevation at height B =\",round(El2,2),\"m\"\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}