diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb')
-rwxr-xr-x | Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb | 493 |
1 files changed, 493 insertions, 0 deletions
diff --git a/Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb b/Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb new file mode 100755 index 00000000..835909e1 --- /dev/null +++ b/Fluid_Mechanics_by_John_F._Douglas/Chapter_2.ipynb @@ -0,0 +1,493 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:56204579c9dff23fd133fce17f3b8e6b8ac01dae9f7f133693b953a21d5ed34c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2: Pressure and Head" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1, Page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + " #Initializing the variables\n", + "z1 = 0; #Taking Ground as reference\n", + "z2 = -30 #Depth\n", + "rho = 1025 #Density\n", + "g = 9.81 #Acceleration due to gravity\n", + "\n", + " #Calculation\n", + "pressureIncrease = -rho*g*(z2-z1);\n", + "\n", + "print \"Increase in Pressure (KN/m2):\",round(pressureIncrease/1000,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in Pressure (KN/m2): 301.7\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2, Page 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + "\n", + " #Initializing the variables\n", + "p1 = 22.4*10**3 #Initial Pressure\n", + "z1 = 11000 #Initial Height\n", + "z2 = 15000 #final Height\n", + "g = 9.81 #Acceleration due to gravity\n", + "R = 287; #Gas Constant\n", + "T = 273-56.6 #Temperature \n", + "\n", + " #Calculations\n", + "p2 = p1*math.exp(-g*(z2-z1)/(R*T));\n", + "rho2=p2/(R*T);\n", + " \n", + "print \"Final Pressure (kN/m2):\",round(p2/1000,2)\n", + "print \"Final Density (kg/m3):\",round(rho2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final Pressure (kN/m2): 11.91\n", + "Final Density (kg/m3): 0.192\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3, Page 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + " #Initializing the variables\n", + "p1 = 101*10**3 #Initial Pressure\n", + "z1 = 0 #Initial Height\n", + "z2 = 1200 #Final Height\n", + "T1 = 15+273 #Initial Temperature\n", + "g = 9.81 #Acceleration due to gravity\n", + "gamma = 1.4 #Heat capacity ratio\n", + "R = 287 #Gas Constant\n", + "\n", + " #Calculations\n", + "p2 = p1*(1-g*(z2-z1)*(gamma-1)/(gamma*R*T1))**(gamma/(gamma-1));\n", + "dT_dZ = -(g/R)*((gamma-1)/gamma);\n", + "T2 = T1 + dT_dZ*(z2-z1);\n", + "rho2 = p2/(R*T2);\n", + "\n", + "print \"Final Pressure (kN/m2) :\",round(p2/1000,2)\n", + "print \"Temprature (in degree celcius):\",round(T2-273,1)\n", + "print \"Density (kg/m^3) :\",round(rho2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final Pressure (kN/m2) : 87.33\n", + "Temprature (in degree celcius): 3.3\n", + "Density (kg/m^3) : 1.101\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4, Page 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + "\n", + " #Initializing the variables\n", + "p1 = 101*10**3 #Initial Pressure\n", + "z1 = 0 #Initial Height\n", + "z2 = 7000 #Final Height\n", + "T1 = 15+273 #Initial Temperature\n", + "g = 9.81 #Acceleration due to gravity\n", + "R = 287 #Gas Constant\n", + "dT = 6.5/1000 #Rate of Variation of Temperature\n", + "\n", + " #Calculations\n", + "p2 = p1*(1-dT*(z2-z1)/T1)**(g/(R*dT));\n", + "T2 = T1 - dT*(z2-z1);\n", + "rho2 = p2/(R*T2);\n", + "\n", + "\n", + "print \"Final Pressure (kN/m^2) :\",round(p2/1000,2)\n", + "print \"Final Density (kg/m^3 ):\",round(rho2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final Pressure (kN/m^2) : 40.89\n", + "Final Density (kg/m^3 ): 0.588\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5, Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + " #Initializing the variables\n", + "p = 350*10**3; #Gauge Pressure\n", + "pAtm = 101.3*10**3; #Atmospheric Pressure \n", + "rhoW = 1000; #Density of Water\n", + "sigma = 13.6; #Relative Density of Mercury\n", + "g = 9.81 #Acceleration due to gravity\n", + "\n", + " #Calculations\n", + "def Head(rho):\n", + " head = p/(rho*g);\n", + " return head\n", + "rhoM = sigma*rhoW;\n", + "pAbs = p + pAtm;\n", + "\n", + "print \"\\nPart(a)- Equivalent head of water (m) :\",round(Head(rhoW),2)\n", + "print \"\\nPart(b)- Equivalent head of water (m) :\",round(Head(rhoM),2)\n", + "print \"\\nAbsolute pressure (kN/m^2) :\",pAbs/1000" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Part(a)- Equivalent head of water (m) : 35.68\n", + "\n", + "Part(b)- Equivalent head of water (m) : 2.62\n", + "\n", + "Absolute pressure (kN/m^2) : 451.3\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6, Page 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + " \n", + "\n", + " #Initializing the variables\n", + "rho = 10**3; #Density of water\n", + "h = 2; #Height\n", + "g = 9.81; #Acceleration due to gravity\n", + "\n", + " #Calculations\n", + "p=rho*h*g; \n", + "\n", + "print \"Gauge pressure (k/m2) :\",p/1000" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gauge pressure (k/m2) : 19.62\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7, Page 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + "\n", + " #Initializing the variables\n", + "rho = 0.8*10**3; #Density of fluid\n", + "rhoM = 13.6*10**3; #Density of manometer liquid\n", + "g = 9.81 #Acceleration due to gravity\n", + "\n", + " #Calculations\n", + "def fluidPressure(h1,h2):\n", + " P = rhoM*g*h2-rho*g*h1;\n", + " return P\n", + "\n", + "p1=fluidPressure(0.5,0.9)/1000\n", + "p2=fluidPressure(0.1,-0.2)/1000\n", + "\n", + "print \"!-----Part (a)-----! \\nGauge pressure (kN/m2) :\",round(p1,2)\n", + "print \"\\n!-----Part (b)-----! \\nGauge pressure (kN/m2) :\",round(p2,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "!-----Part (a)-----! \n", + "Gauge pressure (kN/m2) : 116.15\n", + "\n", + "!-----Part (b)-----! \n", + "Gauge pressure (kN/m2) : -27.47\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8, Page 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + "\n", + " #Initializing the variables\n", + "rho = 10**3; #Density of fluid\n", + "rhoM = 13.6*10**3; #Density of manometer liquid\n", + "g = 9.81; #Acceleration due to gravity\n", + "H = 0.3; # Differnce in height = b-a as in text\n", + "h = 0.7;\n", + "\n", + " #Calculations\n", + "result = rho*g*H + h*g*(rhoM-rho);\n", + "\n", + "print \"Pressure difference (kN/m^2):\", round(result/1000,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure difference (kN/m^2): 89.467\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9, Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + "\n", + "\n", + " #Initializing the variables\n", + "rho = 10**3; #Density of fluid\n", + "rhoM = 0.8*10**3; #Density of manometer liquid\n", + "g = 9.81; #Acceleration due to gravity\n", + "a = 0.25;\n", + "b = 0.15;\n", + "h = 0.3;\n", + " #Calculations\n", + "def PressureDiff(a,b,h,rho,rhoM):\n", + " P = rho*g*(b-a) + h*g*(rho-rhoM);\n", + " return P\n", + "print \"The presure difference,if the top of the manometer is filled with\"\n", + "print \"(a) air :\",PressureDiff(a,b,h,rho,0)/1000, \" N/m^2\"\n", + "print \"(b) oil of relative density 0.8. :\",PressureDiff(a,b,h,rho,rhoM), \"N/m^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The presure difference,if the top of the manometer is filled with\n", + "(a) air : 1.962 N/m^2\n", + "(b) oil of relative density 0.8. : -392.4 N/m^2\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10, Page 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "import math\n", + "\n", + " #Initializing the variables\n", + "phi = 30; #30 degree\n", + "h = 1.2 ; # Height of tank\n", + "l = 2; # Length of tank\n", + "\n", + " #Calculations\n", + "def SurfaceAngle(a,phi):\n", + " g=9.81; # m/s**2 \n", + " Theta = math.atan(-a*math.cos(math.radians(phi))/(g+a*math.sin(math.radians(phi)))); \n", + " return Theta\n", + "\n", + " #case (a) a = 4\n", + "\n", + "print \"ThetaA (degree) :\",round(180 + 180/math.pi*SurfaceAngle(4,phi),2)\n", + "\n", + " #Case (b) a = - 4.5\n", + "tanThetaR = math.tan((SurfaceAngle(-4.5,phi)));\n", + "\n", + "print \"\\nThetaR (degree) :\",round(SurfaceAngle(-4.5,phi)*180/math.pi,2)\n", + "\n", + "Depth = h - l*tanThetaR/2;\n", + "print \"\\nMaximum Depth of tank (m) :\",round(Depth,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ThetaA (degree) : 163.65\n", + "\n", + "ThetaR (degree) : 27.27\n", + "\n", + "Maximum Depth of tank (m) : 0.6845\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |