summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commit6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch)
tree22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Fluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb
parentd36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff)
downloadPython-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_14.ipynb')
-rwxr-xr-xFluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb365
1 files changed, 365 insertions, 0 deletions
diff --git a/Fluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb b/Fluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb
new file mode 100755
index 00000000..2e55c7c8
--- /dev/null
+++ b/Fluid_Mechanics_by_John_F._Douglas/Chapter_14.ipynb
@@ -0,0 +1,365 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:75785fe7e68940de5df81a115443b8d5c78793053ae837735e58f86a072c05cc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 14: Steady Incompressible Flow in Pipe and Duct System"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.1, Page 468"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ " #Initializing the variables\n",
+ "L1 = 5;\n",
+ "L2 = 10;\n",
+ "d = 0.1;\n",
+ "f = 0.08;\n",
+ "Za_Zc = 4; #difference in height between A and C \n",
+ "g = 9.81 ;\n",
+ "Pa = 0;\n",
+ "Va = 0; \n",
+ "Za_Zb = -1.5;\n",
+ "V = 1.26;\n",
+ "rho = 1000;\n",
+ "\n",
+ " #Calculations\n",
+ "D = 1.5 + 4*f*(L1+L2)/d ; # Denominator in case of v**2 \n",
+ "v = (2*g*Za_Zc/D)**0.5;\n",
+ "Pb = rho*g*Za_Zb - rho*V**2/2*(1.5+4*f*L1/d);\n",
+ "print \"Pressure in the pipe at B (kN/m2):\",round(Pb/1000,2)\n",
+ "print \"Mean Velocity at C (m/s) :\",round(v,2)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure in the pipe at B (kN/m2): -28.61\n",
+ "Mean Velocity at C (m/s) : 1.26\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.3, Page 473"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "from sympy import symbols,solve\n",
+ "import sympy\n",
+ "\n",
+ "\n",
+ " #Initializing the variables\n",
+ "Za_Zb = 10;\n",
+ "f = 0.008;\n",
+ "L = 100;\n",
+ "d1 = 0.05;\n",
+ "g = 9.81;\n",
+ "d2 = 0.1;\n",
+ "\n",
+ " #Calculations\n",
+ "\n",
+ "def flowRate(d):\n",
+ " D = 1.5 + 4*f*L/d ; # Denominator in case of v1**2\n",
+ " A = math.pi*d**2/4;\n",
+ " v = (2*g*Za_Zb/D)**0.5;\n",
+ " z = A*v;\n",
+ " return z \n",
+ "Q1 = flowRate(d1);\n",
+ "Q2 = flowRate(d2);\n",
+ "Q=round(Q1+Q2,4)\n",
+ "\n",
+ "\n",
+ "D=symbols('D')\n",
+ "roots=solve(241212*D**5 -3.2, D)\n",
+ "dia=roots[0]\n",
+ "\n",
+ "print \"Rate flow for pipe 1 (m^3/s) :\",round(Q1,4)\n",
+ "print \"Rate flow for pipe 2 (m^3/s) :\",round(Q2,4)\n",
+ "print \"Combined Rate flow (m^3/s) :\",round(Q,4)\n",
+ "print \"Diameter of single equivalent pipe (mm) :\",round(dia,3)*1000\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate flow for pipe 1 (m^3/s) : 0.0034\n",
+ "Rate flow for pipe 2 (m^3/s) : 0.019\n",
+ "Combined Rate flow (m^3/s) : 0.0224\n",
+ "Diameter of single equivalent pipe (mm) : 106.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.4, Page 476"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "import sympy\n",
+ "from sympy import solve,symbols\n",
+ "\n",
+ " #Initializing the variables\n",
+ "Za_Zb = 16;\n",
+ "Za_Zc = 24;\n",
+ "f = 0.01;\n",
+ "l1 = 120;\n",
+ "l2 = 60;\n",
+ "l3 = 40;\n",
+ "d1 = 0.12;\n",
+ "d2 = 0.075;\n",
+ "d3 = 0.060;\n",
+ "g = 9.81;\n",
+ " #Calculations\n",
+ "\n",
+ "v1=symbols('v1')\n",
+ "ash=solve(v1-0.3906*(g-1.25*v1**2)**0.5-0.25*(17.657-1.5*v1**2)**0.5,v1)\n",
+ "v1=round(abs(ash[0]),2)\n",
+ "Q1=math.pi/4*d1**2*v1\n",
+ "\n",
+ "v2=(g-1.25*v1**2)**0.5\n",
+ "Q2=math.pi/4*d2**2*v2\n",
+ "\n",
+ "v3=(17.657-1.5*v1**2)**0.5\n",
+ "Q3=math.pi/4*d3**2*v3\n",
+ "\n",
+ "print \"Flow rate in pipe 1 (m^3/s):\",round(Q1,4)\n",
+ "print \"Flow rate in pipe 2 (m^3/s):\",round(Q2,4)\n",
+ "print \"Flow rate in pipe 3 (m^3/s):\",round(Q3,4)\n",
+ "print \"continuity condition satisfied as Q1=Q2+Q3\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flow rate in pipe 1 (m^3/s): 0.0206\n",
+ "Flow rate in pipe 2 (m^3/s): 0.0105\n",
+ "Flow rate in pipe 3 (m^3/s): 0.0101\n",
+ "continuity condition satisfied as Q1=Q2+Q3\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.5, Page 480"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ " #Initializing the variables\n",
+ "D = 0.3;\n",
+ "Q = 0.8;\n",
+ "rho = 1.2;\n",
+ "f = 0.008;\n",
+ "L_entry = 10;\n",
+ "L_exit = 30;\n",
+ "Lt = 20*D #Transition may be represented by a separation loss equivalent length of 20 * the approach duct diameter\n",
+ "K_entry = 4;\n",
+ "K_exit = 10\n",
+ "l = 0.4; # length of cross section\n",
+ "b = 0.2; # width of cross section\n",
+ "\n",
+ " #Calculations\n",
+ "A = math.pi*D**2/4;\n",
+ "Dp1 = 0.5*rho*Q**2/A**2*(K_entry + 4*f*(L_entry+Lt)/D);\n",
+ "area = l*b;\n",
+ "perimeter =2*(l+b);\n",
+ "m = area/perimeter;\n",
+ "Dp2 = 0.5*rho*Q**2/area**2*(K_exit + f*L_exit/m);\n",
+ "Dfan = Dp1+Dp2;\n",
+ "\n",
+ "print \"fan Pressure input (N/m2) :\",round(Dfan,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "fan Pressure input (N/m2) : 1254.6\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.6, Page 482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "\n",
+ " #Initializing the variables\n",
+ "D = [0.15 , 0.3];\n",
+ "rho = 1.2;\n",
+ "f = 0.008;\n",
+ "L_entry = 10;\n",
+ "L_exit = 20;\n",
+ "Lt = 20*D[1] \n",
+ "K = 4;\n",
+ "Q1 = 0.2;\n",
+ "\n",
+ " #Calculations\n",
+ "Q2 = 4*Q1;\n",
+ "A=[0.0,0.0]\n",
+ "A[0] = math.pi*D[0]**2/4;\n",
+ "A[1] = math.pi*D[1]**2/4;\n",
+ "Dp1 = 0.5*rho*Q1**2/A[0]**2*(K + 4*f*L_entry/D[0]);\n",
+ "Dp2 = 0.5*rho*Q2**2/A[1]**2*(4*f*(L_exit + Lt)/D[1]);\n",
+ "Dfan = Dp1+Dp2;\n",
+ "\n",
+ "print \"fan Pressure input (N/m2) :\",round(Dfan,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "fan Pressure input (N/m2) : 684.51\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14.7, Page 487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "from scipy.optimize import fsolve\n",
+ " \n",
+ " \n",
+ " \n",
+ " #Initializing the variables\n",
+ "d = [0.1 , 0.125, 0.15, 0.1, 0.1 ]; # Corrosponding to AA1B AA2B BC CD CF\n",
+ "l = [30 , 30 , 60, 15, 30]; # Corrosponding to AA1B AA2B BC CD CF\n",
+ "rho = 1.2;\n",
+ "f = 0.006;\n",
+ "Ha = 100;\n",
+ "Hf = 60;\n",
+ "He = 40;\n",
+ "K = [0.0, 0.0, 0.0, 0.0, 0.0]\n",
+ " #Calculations\n",
+ "for i in range(0,len(l)):\n",
+ " K[i] = f*l[i]/(3*d[i]**5);\n",
+ "\n",
+ "\n",
+ "K_ab = K[0]*K[1]/((K[0])**0.5+(K[1])**0.5)**2;\n",
+ "K_ac = K_ab + K[2];\n",
+ "Hc = (K_ac*Hf +K[4]*Ha/4)/(K_ac+K[4]/4);\n",
+ "Q = ((Ha - Hc)/K_ac)**0.5;\n",
+ "\n",
+ "def f(n):\n",
+ " z = He - Hc + (0.5*Q)**2 *(K[3]+(4000/n)**2);\n",
+ " return z\n",
+ "\n",
+ "n = fsolve(f,1);\n",
+ "\n",
+ "print \"total Volume flow rate (m3/s):\",round(Q, 4)\n",
+ "print \"Head at C (m) :\",round(Hc,2) \n",
+ "print \"Percentage valve opening (%) :\",round(n,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "total Volume flow rate (m3/s): 0.1016\n",
+ "Head at C (m) : 75.48\n",
+ "Percentage valve opening (%) : 38.58\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file