summaryrefslogtreecommitdiff
path: root/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb')
-rwxr-xr-xTRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb1564
1 files changed, 1564 insertions, 0 deletions
diff --git a/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb b/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb
new file mode 100755
index 00000000..47b8388a
--- /dev/null
+++ b/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter02.ipynb
@@ -0,0 +1,1564 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2983d20baa7ffdc8f712c1d56291b4f0f9e932dcec505cf5db8d7f9e1f38e4b6"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2: Principles of Momentum Transfer and Overall Balances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2-1, Page number 32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Units and Dimensions of Force\n",
+ "# Variable declaration\n",
+ "m = 3. #Mass of the body (lbm)\n",
+ "g_fps = 32.174 #Acceleration due to gravity in fps units (ft/s2)\n",
+ "confaclbmtolbf = 32.174 #Conversion factor from lbm to lbf(lbm.ft/lbf.s2)\n",
+ "confaclbmtog = 453.59 #Conversion factor from lbm to gram (g/lbm)\n",
+ "g_mks = 980.665 #Acceleration due to gravity in mks units (cm/s2)\n",
+ "confaclbtokg = 2.2046 #Conversion factor from lbm to kg (kg/lbm)\n",
+ "g_SI = 9.80665 #Acceleration due to gravity in SI units (m/s2)\n",
+ " # Data SI Units \n",
+ "#Calculation\n",
+ "#(a)\n",
+ " #Fa = m*g_fps*ga\n",
+ "Fa = m*g_fps/confaclbmtolbf\n",
+ " #Fb = m*g_mks*mb\n",
+ "Fb = m*g_mks*confaclbmtog\n",
+ " #Fc = m*g_si*gc\n",
+ "Fc = m*g_SI/confaclbtokg\n",
+ "#Result\n",
+ "print \"(a) The force in lbf is \",round(Fa,4),\"lbf\"\n",
+ "print '(b) The force in dynes is %6.4e'%(Fb),\"dyne\"\n",
+ "print \"(c) The force in Newton is \",round(Fc,2),\"N\"\n",
+ "print 'The answers are correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) The force in lbf is 3.0 lbf\n",
+ "(b) The force in dynes is 1.3345e+06 dyne\n",
+ "(c) The force in Newton is 13.34 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2-2, Page number 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Pressure in Storage Tank\n",
+ "# Variable declaration\n",
+ "Ht = 3.66 #Height of the tank (m)\n",
+ "P = 1. #Pressure exerted (atm)\n",
+ "Hto = 3.05 #Height of tank filled with oil (m)\n",
+ "Htw = 0.61 #Height of tank filled with water (m)\n",
+ "Rho_oil = 917. #Density of oil (kg/m3)\n",
+ "Rho_H2O = 1000. #Density of H2O (kg/m3)\n",
+ "g = 9.8 #Gravitational acceleration (m/s2)\n",
+ " # Data \n",
+ "Patm_psia = 14.696 #Atmospheric pressure (psia)\n",
+ "P_pa = 101325. #Atmospheric pressure (pa)\n",
+ "Ht_ft = 12. #Height of the tank (ft)\n",
+ "Hto_ft = 10. #Height of tank filled with oil (ft)\n",
+ "Htw_ft = 2. #Height of tank filled with water (ft)\n",
+ "confacsitofps = 0.06243 #conversion factor for density(kg/m3) to (lbm/ft3)\n",
+ "confacft2toin2 = 1./144. #Conversion factor (ft2) to (in2) \n",
+ "# Calculation\n",
+ " #In fps units\n",
+ " #Pressure exerted by oil in fps units \n",
+ " #P1f = Hto_ft*Rho_oil*confacsitofps*confacft2toin2 + P_psia\n",
+ "P1f = (Hto_ft*Rho_oil*confacsitofps*confacft2toin2 + Patm_psia) \n",
+ " #P2f = Htw_ft*Rho_H2O*confacsitofps*confacft2toin2 + P1f\n",
+ "P2f= Htw_ft*Rho_H2O*confacsitofps*confacft2toin2 + P1f \n",
+ " #Pressure exerted in SI units\n",
+ "#Pressure exerted by oil in SI units \n",
+ "P1si = Hto*Rho_oil*g + P_pa\n",
+ "#Pressure exerted by water in SI\n",
+ "P2si = Htw*Rho_H2O*g + P1si\n",
+ "Pgage = P2f - Patm_psia\n",
+ "#Result\n",
+ "print \"Pressure exerted by oil in fps \",round(P1f,2),\"psia\"\n",
+ "print 'Pressure exerted by oil in SI %6.3e Pa'%(P1si)\n",
+ "print \"Pressure exerted by water in fps \",round(P2f,2),\"psia\"\n",
+ "print 'Pressure exerted by H2O in SI %6.3e Pa'%(P2si)\n",
+ "print 'Gage pressure at the bottom of tank %5.2f psig'%(Pgage)\n",
+ "print 'The answers are correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure exerted by oil in fps 18.67 psia\n",
+ "Pressure exerted by oil in SI 1.287e+05 Pa\n",
+ "Pressure exerted by water in fps 19.54 psia\n",
+ "Pressure exerted by H2O in SI 1.347e+05 Pa\n",
+ "Gage pressure at the bottom of tank 4.84 psig\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2-3, Page number 36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Conversion of a pressure to head of a fluid \n",
+ "\n",
+ "# Variable declaration\n",
+ "P = 101325. #Standard atmospheric pressure (kN/m2)\n",
+ "# Data \n",
+ "Rho_H2O = 1000. #Density of H2O at 4 deg C (kg/m3)\n",
+ "Rho_Hg = 13.5955 #Density of Hg at 0 deg C (g/cm3)\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "Rho_H2O_cgs = 1. #Density of H2O at 4 deg C (g/cm3)\n",
+ " \n",
+ " # Calculation\n",
+ "#Pressure head in terms of H2O\n",
+ " # H_H2O = Pressure/(density of H2O*Gravitational acceleration)\n",
+ "H_H2O = P/(Rho_H2O*g)\n",
+ " #H_Hg = Pressure/(density of Hg*Gravitational acceleration)\n",
+ "H_Hg = H_H2O*Rho_H2O_cgs/Rho_Hg\n",
+ "\n",
+ "#Result\n",
+ "print \"Pressure head of H2O \",round(H_H2O,2),\"m of water at 4\u00b0C\"\n",
+ "print \"Pressure head of Hg \",round(H_Hg,3),\"mmHg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure head of H2O 10.33 m of water at 4\u00b0C\n",
+ "Pressure head of Hg 0.76 mmHg\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2-4, Page number 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Pressure Difference in a Manometer\n",
+ "# Variable declaration\n",
+ "R_cgs = 32.7 #Reading of manometer (cm)\n",
+ "# Data \n",
+ "Rho_H2O = 1000. #Density of H2O (g/cm3)\n",
+ "Rho_Hg = 13600. #Density of Hg (g/cm3)\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "R_SI = 0.327 #Reading of manometer (m) \n",
+ " # Calculation\n",
+ "#Pressure difference in SI units\n",
+ " #delP = R_SI*(Rho_Hg-Rho_H2O)*g\n",
+ "delP = R_SI*(Rho_Hg-Rho_H2O)*g \n",
+ "#Result\n",
+ "print ' The pressure difference in SI units %10.3e'%(delP),\"N/m2\"\n",
+ "print 'The answer is correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The pressure difference in SI units 4.041e+04 N/m2\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3-1, Page number 41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Molecular Transport of a Property at Steady State \n",
+ "# Variable declaration\n",
+ "C1 = 0.0137 #Concentration at point 1 (property/m3)\n",
+ "C2 = 0.0072 #Concentration at point 2 (property/m3)\n",
+ "z1 = 0 #Distance at point 1 (m)\n",
+ "z2 = 0.4 #Distance at point 2 (m)\n",
+ "z = 0.2 #Midpoint (m)\n",
+ "delta = 0.013 #Diffusivty (m2/s)\n",
+ "# Calculation\n",
+ " #Calculation for part (a)\n",
+ " #Flux = delta*(C1-C2)/(z2-z1)\n",
+ "Flux = delta*(C1-C2)/(z2-z1)\n",
+ " #Calculation for part (c)\n",
+ "C = C1 + Flux*(z1-z)/delta \n",
+ "#Result\n",
+ "print '(a) The flux is %6.3e property/s.m2'%(Flux)\n",
+ "print '(c) The concentration at the midpoint is %6.3e property/m3'%(C)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) The flux is 2.113e-04 property/s.m2\n",
+ "(c) The concentration at the midpoint is 1.045e-02 property/m3\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.4-1, Page number 45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculation of Shear Stress in a Liquid\n",
+ "# Variable declaration\n",
+ "confaccgstofps = 0.0020875\n",
+ "confaccgstosi = 1/10.\n",
+ "dely = 0.5 #The distance between the two plates (cm)\n",
+ "delVz = 10. #The velocity change (cm/s)\n",
+ "u = 0.0177 #The viscosity of liquid (g/cm.s) \n",
+ "#Calculation\n",
+ " #Calculation for part (a)\n",
+ " #Calculation of shear stress \n",
+ " #Tyz = u(delVz)/(dely)\n",
+ "Tyz_cgs = u*(delVz)/(dely)\n",
+ " #Calculation of Shear Rate\n",
+ " #Shear Rate = delVz/dely\n",
+ "Vyz_cgs = delVz/dely\n",
+ " #Calculation for part (b)\n",
+ "Tyz_fps = Tyz_cgs*confaccgstofps\n",
+ " #Calculation for part (c)\n",
+ "Tyz_SI = Tyz_cgs*confaccgstosi\n",
+ "#Result\n",
+ "print \"(a)Shear stress in cgs is\",round(Tyz_cgs,4),\"dyne/cm2\"\n",
+ "print \" Shear Rate in cgs is\",round(Vyz_cgs,4),\"1/s\"\n",
+ "print '(b)Shear stress in fps %10.3e'%(Tyz_fps),\"lbf/ft2\"\n",
+ "print \" Shear Rate in fps is\",round(Vyz_cgs,4),\"1/s\"\n",
+ "print \"(c)Shear stress in SI is\",round(Tyz_SI,4),\"N/m2\"\n",
+ "print \" Shear Rate in SI is\",round(Vyz_cgs,4),\"1/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Shear stress in cgs is 0.354 dyne/cm2\n",
+ " Shear Rate in cgs is 20.0 1/s\n",
+ "(b)Shear stress in fps 7.390e-04 lbf/ft2\n",
+ " Shear Rate in fps is 20.0 1/s\n",
+ "(c)Shear stress in SI is 0.0354 N/m2\n",
+ " Shear Rate in SI is 20.0 1/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.5-1, Page number 49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Reynolds Number in a pipe \n",
+ "from math import pi\n",
+ "\n",
+ "# Variable declaration\n",
+ "F = 10. #The flowrate of water (gal/min)\n",
+ "d = 2.067 #The inner diameter of pipe (in)\n",
+ "spg = 0.996 #specific gravity,M/M\n",
+ "d_SI = 0.0525 #Diameter in SI units (m)\n",
+ "mu = 0.8007 #Viscosity, cp\n",
+ "\n",
+ "#Calculation English units\n",
+ "F_fps = F*(1./7.481)*(1./60)\n",
+ "d_fps = d/12\n",
+ "A = pi*d_fps**2/4\n",
+ "V = F_fps/A\n",
+ "mu_fps = mu*6.7197e-4 #convert in lbm/ft.s\n",
+ "rho = spg*62.43\n",
+ "Nre_fps = d_fps*V*rho/(mu_fps)\n",
+ "\n",
+ "#Calculation SIh units\n",
+ "\n",
+ "d_SI = d*2.54e-2\n",
+ "V_SI = V/3.2808\n",
+ "mu_SI = mu*1e-3 #convert in Pa.s\n",
+ "rho = spg*1000\n",
+ "Nre_SI = d_SI*V_SI*rho/(mu_SI)\n",
+ "\n",
+ "#Result \n",
+ "print 'The reynolds number in fps units is %6.3e'%(Nre_fps)\n",
+ "print 'The reynolds number in SI units is %6.3e'%(Nre_SI)\n",
+ "print 'The answers are correct because book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reynolds number in fps units is 1.903e+04\n",
+ "The reynolds number in SI units is 1.903e+04\n",
+ "The answers are correct because book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.6-1, Page number 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Flow of a Crude Oil and Mass Balance\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho = 892. #Density of Crude Oil kh/m3\n",
+ "F = 1.388e-3 #Total Volumetric flow rate m3/s\n",
+ "d1 = 2.067 #Diamete of pipe 1 in inches\n",
+ "d3 = 1.610 #Diamete of pipe 3 in inches\n",
+ "\n",
+ "#Calculations\n",
+ "intom = 0.0254 #conversion factor for in to meter\n",
+ "A1 = pi*(d1*intom)**2/4 #Area of pipe 1\n",
+ "A3 = pi*(d3*intom)**2/4 #Area of pipe 3\n",
+ "m1 = F*rho #Mass flow rate of Crude Oil through pipe 1\n",
+ "m3 = m1/2 #Mass flow rate of Crude Oil through pipe 3\n",
+ "v1 = m1/(rho*A1) #velocity of Crude Oil through pipe 1\n",
+ "v3 = m3/(rho*A3) #velocity of Crude Oil through pipe 3\n",
+ "G1 = m1/A1 #Mass flux of cride oil through pipe 1\n",
+ "\n",
+ "#Result\n",
+ "print \"(a) Mass flow rate of Crude Oil through pipe 1:\",round(m1,3), \"kg/s\"\n",
+ "print \" Mass flow rate through pipe 3:\",round(m3,3), \"kg/s\"\n",
+ "print \"(b) Velocity of Crude Oil through pipe 1:\",round(v1,3), \"m/s\"\n",
+ "print \" Velocity of Crude Oil through pipe 3:\",round(v3,3), \"m/s\"\n",
+ "print \"(c) Mass velocity of Crude Oil through pipe 1:\",round(G1), \"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Mass flow rate of Crude Oil through pipe 1: 1.238 kg/s\n",
+ " Mass flow rate through pipe 3: 0.619 kg/s\n",
+ "(b) Velocity of Crude Oil through pipe 1: 0.641 m/s\n",
+ " Velocity of Crude Oil through pipe 3: 0.528 m/s\n",
+ "(c) Mass velocity of Crude Oil through pipe 1: 572.0 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7-1, Page number 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Energy Balance on Steam boiler\n",
+ "\n",
+ "#Variable Declaration\n",
+ "Twin = 18.33 #Inlet temperature of water to boiler, degC\n",
+ "Pwin = 137.9 #Inlet pressure of water to boiler, kPa\n",
+ "Vwin = 1.52 #Inlet temperature of water to boiler, m/s\n",
+ "Hwin = 0. #Water Inlet height, m\n",
+ "Hsout = 15.2 #Height of steam outlet above water inlet, m \n",
+ "Psout = 137.9 #Outlet pressure of steam to boiler, kPa\n",
+ "Tsout = 148.9 #Inlet temperature of water to boiler, degC\n",
+ "Vsout = 9.14 #Inlet temperature of water to boiler, m/s\n",
+ "H1 = 76.97 #Entalpy of Incomming water to boiler, kJ/kg\n",
+ "H2 = 2771.4 #Entalpy of steam leaving boiler, kJ/kg\n",
+ "g = 9.80665 #Gravitational acceleration, m/s2\n",
+ "#Calcualtion\n",
+ "\n",
+ "# Heat Added = Del PE + Del KE + Del Enthalpy\n",
+ "Q = (Hsout-Hwin)*g + (Vsout**2-Vwin**2)/2 + (H2-H1)*1000\n",
+ "\n",
+ "#Result \n",
+ "print 'Heat Added per kg of water %5.4e'%(Q),\"J/kg\"\n",
+ "print 'The answers are correct because of book uses rounded of numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat Added per kg of water 2.6946e+06 J/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7-2, Page number 62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Energy Balance on a flow system with a Pump\n",
+ "\n",
+ "#Variable Declaration\n",
+ "F = 0.567 #Water pumped from the tank (m3/min.)\n",
+ "E1 = 7450. #Energy supplied by the pump (W)\n",
+ "E2 = 1408000 #Energy lost in heat exchanger (W)\n",
+ "Rho = 968.5 #Density of water at 85 deg C (kg/m3)\n",
+ "Z1 = 0. #Height of first second tank (m)\n",
+ "Z2 = 20. #Height of second tank (m)\n",
+ "H1 = 355900 #Enthalpy of steam (kJ/kg)\n",
+ "delV = 0. #The kintic energy changes\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "\n",
+ "#Calcualtion\n",
+ "m1 = F*Rho/60 #Water pumped from the tank (kg/s)\n",
+ "Ws = -E1/m1 \n",
+ "Q = -E2/m1 \n",
+ "\n",
+ " # H2 - H1 + 1/2*delV + g(Z2 - Z1) = Q - Ws\n",
+ " # H2 = Q - Ws + H1 - 1/2*delV - g(Z2 - Z1)\n",
+ "H2 = Q - Ws + H1 - 0.5*delV - g*(Z2 - Z1)\n",
+ "\n",
+ "#Result \n",
+ "print 'Heat Added per kg of water %5.3e'%(H2), \"J/kg\"\n",
+ "print \"The value of heat added corresponds to 48.41 \u00b0C\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat Added per kg of water 2.027e+05 J/kg\n",
+ "The value of heat added corresponds to 48.41 \u00b0C\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7-3, Page number 62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Energy Balance in flow Calorimeter \n",
+ "#Variable Declaration\n",
+ "F = 0.3964 #Flowrate of water entering the calorimeter (kg/min)\n",
+ "E1 = 19.630 #Heat added to the water for complete vaporization (kW)\n",
+ "Z1 = 0. #Height of first second tank (m)\n",
+ "Z2 = 0. #Height of second tank (m)\n",
+ "delV = 0. #The kintic energy changes\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "Ws = 0. #Shaft work\n",
+ "H1 = 0 #Initial Enthalpy\n",
+ "P1 = 150. #Pressure at point 2 (kPa)\n",
+ "#Calcualtion\n",
+ "M1 = F/60 #Flowrate of water entering the calorimeter (kg/s)\n",
+ " # Q = E1/M1\n",
+ "Q = E1/M1\n",
+ " # H2 - H1 + 0.5*delV + g(Z2 - Z1) = Q - Ws\n",
+ " # H2 = Q - Ws + H1 - 1/2*delV - g(Z2 - Z1)\n",
+ "H2 = Q - Ws + H1 - 0.5*delV - g*(Z2 - Z1)\n",
+ "#Result \n",
+ "print \"Heat Added per kg of water\",round(H2), \"J/kg\"\n",
+ "print \"The corresponding value of enthalpy from steam table is 2972.7 kJ/kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat Added per kg of water 2971.0 J/kg\n",
+ "The corresponding value of enthalpy from steam table is 2972.7 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7-4, Page number 64"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Mechanical-Energy Balance on Pumping System\n",
+ "\n",
+ "#Variable Declaration\n",
+ "P1 = 68900. #The entrance pressure of fluid (N/m2)\n",
+ "E = 155.4 #Energy supplied to the fluid (J/kg)\n",
+ "P2 = 137800. #The exit pressure of fluid (N/m2) \n",
+ "Nre = 4000 #Reynolds number \n",
+ "Rho_H2O = 998. #Density of water (kg/m3)\n",
+ "z1 = 0 #Height of entrance pipe (m)\n",
+ "z2 = 3.05 #Height of exit pipe (m)\n",
+ "alpha = 1 #For turbulent flow value of alpha\n",
+ "Ws = -155.4 #Mechanical energy added to the fluid (J/kg)\n",
+ "g = 9.806 #Gravitational accleration (m/s2)\n",
+ "#Calcualtion\n",
+ " #(V1 - V2)/2*alpha = 0\n",
+ " #F = -Ws + 0 + g*(z1-z2) + (P1 - P2)/Rho_H2O\n",
+ "F = -Ws + 0 + g*(z1-z2) + (P1 - P2)/Rho_H2O\n",
+ "#Result \n",
+ "print \"The frictional losses calculated are \",round(F,1), \"J/kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The frictional losses calculated are 56.5 J/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7-5, Page number 65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Pump Horsepower in Flow System\n",
+ "\n",
+ "#Variable Declaration\n",
+ "F = 69.1 #Volume of liquid drawn by the pump (gal/min)\n",
+ "F_fps = F/(60*7.481) #Volume of liquid drawn bby the pump (ft3/s)\n",
+ "Rho = 114.8 #Density of liquid (lbm/ft3)\n",
+ "A1 = 0.05134 #Cross sectional area of suction pipe (in2)\n",
+ "A2 = 0.0233 #Cross sectional area of discharge pipe (in2)\n",
+ "z1 = 0. #Height of suction line (m)\n",
+ "z2 = 50. #Height of discharge pipe (m)\n",
+ "f = 10.0 #Frictional losses (ft.lbf/lbm)\n",
+ "n = 0.65 #Efficiency of the pump \n",
+ "g = 32.174 #Gravitational accleration (m/s2)\n",
+ "gc = 32.174 #Conversion factor for mks to fps \n",
+ "v1 = 0. #Velocity of liquid in storage feed tank (m/s)\n",
+ "alpha = 1. #Since the flow is turbulent \n",
+ "fc = 550. #Conversion factor from fps to horse power\n",
+ "z3 = 0. \n",
+ "z4 = 0.\n",
+ "ga = 144. #Conversion factor for area from ft2 to in2\n",
+ "\n",
+ "#Calcualtion\n",
+ " #v2 = flowrate/cross sectional area\n",
+ "v2 = F_fps/A2\n",
+ " #(P1-P2)/Rho = 0 \n",
+ " #Ws = (z1-z2)*g/gc + (v1*v1 - v2*v2)/(2*gc) + 0 + f \n",
+ "Ws = (z1-z2)*g/gc + (v1*v1 - v2*v2)/(2*gc) + 0 - f\n",
+ "Wp = -Ws/n\n",
+ "m = F_fps*Rho \n",
+ "P = m*Wp/fc\n",
+ "v3 = F_fps/A1\n",
+ "v4 = F_fps/A2 \n",
+ " #delP = P4 - P3 \n",
+ "delP = Rho*((z4-z3)*g/gc +(v3*v3 - v4*v4)/(2*gc) - Ws - 0. )/ga\n",
+ "#Result \n",
+ "print \"Power required by the pump \",round(P,0), \"hp\"\n",
+ "print \"Pressure developed is \",round(delP,0),\"lbf/in2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power required by the pump 3.0 hp\n",
+ "Pressure developed is 48.0 lbf/in2\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8-2, Page number 73"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Momentum Balance for Horizontal Nozzle \n",
+ "from math import pi\n",
+ "#Variable Declaration\n",
+ "F = 0.03154 #Flowrate of water (m3/s)\n",
+ "d1 = 0.0635 #Dia of pipe at section 1 (m)\n",
+ "d2 = 0.0286 #Dia of pipe at section 2 (m)\n",
+ "Rho_H2O = 1000. #Density of water (kg/m3)\n",
+ "P2 = 0. #Pressure (N/m2)\n",
+ "#Calcualtion\n",
+ "m = F*Rho_H2O\n",
+ "A1 = pi*d1**2/4\n",
+ "A2 = pi*d2**2/4\n",
+ "v1 = F/A1\n",
+ "v2 = F/A2\n",
+ "P1 = Rho_H2O*((v2**2 - v1**2)/2 + P2/Rho_H2O)\n",
+ "Rx = m*(v2-v1) + P2*A2 - P1*A1\n",
+ "#Result\n",
+ "print \"The resultant force on the nozzle is\",round(Rx,1), \"N\"\n",
+ "print 'The answer is correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The resultant force on the nozzle is -2425.3 N\n",
+ "The answer is correct because of book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8-5, Page number 76"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Force of Free Jet on a Curved,Fixed Vane\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable Declaration\n",
+ "V = 30.5 #Velocity of jet stream of water (m/s)\n",
+ "Rho_H2O = 1000. #Density of water (kg/m3)\n",
+ "d = 2.54e-2 #Diameter of pipe, m\n",
+ "alpha = 60 #Angle made by exit stream, deg\n",
+ "\n",
+ "A = pi*d**2/4\n",
+ "m = V*A*Rho_H2O \n",
+ "#Calculation\n",
+ "#Rx is the x component of the force\n",
+ " #Rx = m*V*(cos60 - 1)\n",
+ "Rx = m*V*(cos(alpha*pi/180)-1)\n",
+ "#Ry is the y component of the force\n",
+ " #Ry = m*V*(sin60)\n",
+ "Ry = m*V*sin(alpha*pi/180)\n",
+ "#Result\n",
+ "print \"The force in x direction is \",round(-Rx,1),\"N\"\n",
+ "print \"The force in y direction is \",round(-Ry,1),\"N\"\n",
+ "print 'The answers are correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The force in x direction is 235.7 N\n",
+ "The force in y direction is -408.2 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.9-1, Page number 82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Falling Film Velocity and Thickness\n",
+ "#Variable Declaration\n",
+ "d = 0.0017 #Thickness of the film (m)\n",
+ "Rho_oil = 820 #Density of oil (kg/m3)\n",
+ "mu = 0.20 #Viscosity of oil (Pa.s)\n",
+ "g = 9.806 #Gravitational acceleration (m/s2)\n",
+ "\n",
+ "#Calculation\n",
+ "Gama = Rho_oil*Rho_oil*d**3*g/(3*mu)\n",
+ "Nre = 4*Gama/mu\n",
+ "Vz = Rho_oil*g*d**2/(3*mu)\n",
+ "\n",
+ "#Result\n",
+ "print \"The mass flowrate per unit width of the wall\",round(Gama,6),\"kg/s.m\"\n",
+ "print \"Reynolds number is\",round(Nre,3)\n",
+ "print \"The average velocity is\",round(Vz,6),\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass flowrate of the wall 0.05399 kg/s.m\n",
+ "Reynolds number is 1.08\n",
+ "The average velocity is 0.03873 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-1, Page number 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Metering of Small Liquid flows \n",
+ "from math import pi\n",
+ "#Variable Declaration\n",
+ "\n",
+ "d = 0.00222 #Diameter of capillary (m)\n",
+ "l = 0.317 #Length of capillary (m)\n",
+ "Rho = 875 #Density of liquid (kg/m3)\n",
+ "mu = 0.00113 #Viscosity of liquid (pa.s)\n",
+ "h = 0.0655 #Heightof water (m)\n",
+ "Rho_H2O = 996 #Density of water (kg/m3)\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "\n",
+ "#Calculation\n",
+ "delP = h*Rho_H2O*g\n",
+ " #v = delP*d*d/(32*mu*l)\n",
+ " #Flow assumed to be laminar\n",
+ "v = delP*d**2/(32*mu*l)\n",
+ "F = v*pi*d**2/(4)\n",
+ " #Checking whether the flow is laminar\n",
+ "Nre = d*v*Rho/(mu)\n",
+ "#Result\n",
+ "print 'The pressure drop over capillary is %3.0f N/m2'%(delP)\n",
+ "print 'The velocity through capillary is %4.3f m/s'%(v)\n",
+ "print 'The mass flowrate through the capillary is %5.3e m3/s'%(F)\n",
+ "print 'Reynolds number is %3.0f, Hence flow is laminar'%(Nre)\n",
+ "print 'The answers are correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop over capillary is 640 N/m2\n",
+ "The velocity through capillary is 0.275 m/s\n",
+ "The mass flowrate through the capillary is 1.065e-06 m3/s\n",
+ "Reynolds number is 473, Hence flow is laminar\n",
+ "The answers are correct because of book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-2, Page number 87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Use of Friction Factor in Laminar Flow \n",
+ " \n",
+ "#Variable Declaration\n",
+ "d = 0.00222 #Diameter of capillary (m)\n",
+ "l = 0.317 #Length of capillary (m)\n",
+ "V = 0.275 #Velocity of liquid (m/s)\n",
+ "Rho = 875 #Density of liquid (kg/m3)\n",
+ "mu = 0.00113 #Viscosity of liquid (pa.s)\n",
+ "h = 0.0655 #Heightof water (m)\n",
+ "Rho_H2O = 996 #Density of water (kg/m3)\n",
+ "g = 9.80665 #Gravitational acceleration (m/s2)\n",
+ "#Calculation\n",
+ "Nre = d*V*Rho/(mu)\n",
+ " #f = 16/Nre\n",
+ "f = 16/Nre\n",
+ " #delp = 4*f*Rho*l*V*V/(2*D)\n",
+ "delp = 4*f*Rho*l*V**2/(2*d)\n",
+ "#Result\n",
+ "print 'Reynolds number is %3.0f, Hence flow is laminar'%(Nre)\n",
+ "print 'friction factor is %0.4f'%(f)\n",
+ "print 'The pressure drop through capillary is %3.0f N/m2'%(delp)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reynolds number is 473, Hence flow is laminar\n",
+ "friction factor is 0.0338\n",
+ "The pressure drop through capillary is 640 N/m2\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-3, Page number 89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Use of Friction Factor in Turbulent Flow \n",
+ "\n",
+ "#Variable Declaration\n",
+ "d = 0.0525 #Diameter of capillary (m)\n",
+ "l = 36.6 #Length of capillary (m)\n",
+ "V = 4.57 #Velocity of liquid (m/s)\n",
+ "Rho = 801. #Density of liquid (kg/m3)\n",
+ "mu = 4.46 #Viscosity of liquid (cp)\n",
+ "g = 9.806 #Gravitational acceleration (m/s2)\n",
+ "e = 0.000046 #Equvivalent Roughness (m)\n",
+ "f = 0.0060 #Friction factor \n",
+ "#Calculation\n",
+ "mu = mu*1e-3 #Convert Viscosity to (kg/m.s)\n",
+ "Nre = d*V*Rho/(mu)\n",
+ " #delp = 4*f*Rho*l*V*V/(2*D)\n",
+ "delp = 4*f*Rho*l*V**2/(2*d)\n",
+ " #F = 4*f*l*V*V/(2*d)\n",
+ "F = 4*f*l*V**2/(2*d)\n",
+ "#Result\n",
+ "print 'Reynolds number is %3.0f, Hence flow is turbulent'%(Nre)\n",
+ "print 'friction factor from chart is %0.4f'%(f)\n",
+ "print \"The friction loss is %3.1f J/kg\" %(F)\n",
+ "print 'The answers are correct because of book uses rounded numbers, and varified using calculator'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reynolds number is 43090, Hence flow is turbulent\n",
+ "friction factor from chart is 0.0060\n",
+ "The friction loss is 174.7 J/kg\n",
+ "The answers are correct because of book uses rounded numbers, and varified using calculator\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-4, Page number 90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Trial and Error Solution to Calculate Pipe Diameter\n",
+ "from scipy.optimize import root\n",
+ "from sympy import *\n",
+ "from math import pi, log\n",
+ "\n",
+ "#Variable Declaration\n",
+ "l = 305. #Length of steel pipe (m)\n",
+ "mu = 1.55e-3 #Viscosity of fluid (kg/m.s)\n",
+ "Q = 150.0 #Rate of flow of fluid (gal/min)\n",
+ "g = 9.80665 #Gravitational acceleration, m/s2\n",
+ "ep = 4.6e-5 #Roughness of commercial steel pipe, m\n",
+ "rho = 1000. #Density of water, kg/m3\n",
+ "z = 6.1 #Head available, m\n",
+ "\n",
+ "#Calculation\n",
+ "Qsi = Q*(1./7.481)*(1./60)*0.02831 #Multipliers in equation are conversion factors for conversion to SI Units\n",
+ "Ff = z*g\n",
+ "er = 12.\n",
+ "x = Symbol('x')\n",
+ "D = 0.089\n",
+ "while er >= 0.01:\n",
+ " epbyd = ep/D\n",
+ " A = pi*D**2/4.\n",
+ " u = Qsi/A \n",
+ " Re = D*u*rho/mu\n",
+ " sol = solve(1/sqrt(x)+4*(log(epbyd/3.7,10)+1.255/(Re*sqrt(x))),x)\n",
+ " f = sol[0]\n",
+ " d = 4*f*l*u**2/(2*Ff)\n",
+ " er = abs((D-d)/D)\n",
+ " if er > 0.01:\n",
+ " print 'Error %6.5f and diameter calculated %6.5f'%(er, d)\n",
+ " D = float(raw_input(\"Not Converged...:Enter the value of guess diameter \"))\n",
+ "#Result\n",
+ "print '\\nConverged...Diameter of the pipe is %4.3f m or %4.3f in'%(D,D*12./0.3048)\n",
+ "print 'The value calculated is accurate than answer in book\\nbecause book reads the friction factor from chart whereas\\nequations for friction factor are used in this'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.11457 and diameter calculated 0.09920\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.092\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.06269 and diameter calculated 0.08623\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.093\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.11416 and diameter calculated 0.08238\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.094\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.16230 and diameter calculated 0.07874\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.094\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.16230 and diameter calculated 0.07874\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.098\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.32616 and diameter calculated 0.06604\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.099\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.36096 and diameter calculated 0.06327\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.1\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.39363 and diameter calculated 0.06064\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.14\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.89524 and diameter calculated 0.01467\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.15\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.92689 and diameter calculated 0.01097\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.16\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error 0.94777 and diameter calculated 0.00836\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Not Converged...:Enter the value of guess diameter 0.091\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Converged...Diameter of the pipe is 0.091 m or 3.583 in\n",
+ "The value calculated is accurate than answer in book\n",
+ "because book reads the friction factor from chart whereas\n",
+ "equations for friction factor are used in this\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-5, Page number 91 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Flow of Gas in Line and Pressure Drop \n",
+ "#Variable Declaration\n",
+ "d = 0.010 #Inside diameter of tube (m)\n",
+ "G = 9. #Rate of feed (kg/s.m2)\n",
+ "l = 200. #Length of Tube (m)\n",
+ "mu = 0.0000177 #Viscosity of liquid (Pa.s)\n",
+ "R = 8314.3 #Gas constant (J/kg.mol.K)\n",
+ "P1 = 202650. #Pressure at entrance (Pa)\n",
+ "f = 0.0090 #Friction factor \n",
+ "T1 = 25. #Temperature at inlet (degC)\n",
+ "T2 = 298.15 #Temperature at outlet (degC)\n",
+ "M = 28.02 #Molecular weight of 1 kmol N2 (kmol)\n",
+ "#Calculation\n",
+ "Nre = d*G/mu\n",
+ "f = 0.079*Nre**(-0.25) #for smooth pipes\n",
+ "P2 = sqrt(P1**(2) - 4*f*l*G**2*R*T2/(d*M))\n",
+ " \n",
+ "#Result\n",
+ "print \"for Reynolds Number \", round(Nre,2), \"friction factor for smooth pipe is\", round(f,6)\n",
+ "print 'The pressure at outlet %6.4e Pa, '%(P2)\n",
+ "print 'The answer is correct than the book because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for Reynolds Number 5084.75 friction factor for smooth pipe is 0.009355\n",
+ "The pressure at outlet 1.8895e+05 Pa, \n",
+ "The answer is correct than the book because of book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-6, Page number 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Friction Losses and mechanical energy balance\n",
+ "#Variable Declaration\n",
+ "Q = 0.223 #Desired flowrate of water (ft3/s)\n",
+ "Rho_fps = 60.52 #Density of water in fps units (lbm/m3)\n",
+ "u_fps = 0.000233 #Viscosity of water in fps units (lbm/ft.s)\n",
+ "D3 = 0.3353 #Diameter of the third pipe (ft)\n",
+ "D4 = 0.1722 #Diameter of the third pipe (ft)\n",
+ "A3 = 0.0884 #Area of third pipe (ft2)\n",
+ "A4 = 0.0233 #Area of third pipe (ft2)\n",
+ "g_fps = 32.174 #Gravitational acceleration in fps units (ft/s2)\n",
+ "e = 0.00015 #Roughness factor (ft)\n",
+ "f2 = 0.0047 #Fanning friction factor for 4-in pipe\n",
+ "f5 = 0.0048 #Fanning friction factor for 2-in pipe\n",
+ "delL_4 = 20. #Length of 4-in pipe (ft)\n",
+ "delL_2 = 185. #Length of 2-in pipe (ft)\n",
+ "delP = 0. #Since pressure at both end is atmspheric pressure \n",
+ "Kf = 0.75\n",
+ "alpha = 1.\n",
+ "Ws = 0. #Shaft work (j)\n",
+ "#Calculation\n",
+ "V1 = 0.\n",
+ "V3 = Q/A3\n",
+ "V4 = Q/A4\n",
+ " #\n",
+ " #(1) Contraction losses at tank exit\n",
+ "#Kc = 0.55*(1-A3/A1)\n",
+ "Kc1 = 0.55\n",
+ "hc1 = Kc1*V3**2/(2*g_fps)\n",
+ " #(2) Friction in 4-in pipe \n",
+ "Nre2 = D3*V3*Rho_fps/(u_fps)\n",
+ "F2 = 4*f2*delL_4*V3**2/(D3*2*g_fps)\n",
+ " #(3) Friction in 4-in elbow\n",
+ "hf = Kf*V3**2/(2*g_fps)\n",
+ " #(4) Contraction loss from 4-in to 2-in pipe \n",
+ "Kc4 = 0.55*(1-A4/A3)\n",
+ "hc4 = Kc4*V4**2/(2*g_fps)\n",
+ " #(5)Friction in 2-in pipe \n",
+ "Nre5 = D4*V4*Rho_fps/u_fps\n",
+ "F5 = 4*f5*delL_2*V4**2/(D4*2*g_fps)\n",
+ " #(6) Friction in 2-in elbows\n",
+ "hc6 = 2*Kf*V4**2/(2*g_fps)\n",
+ " #F = hc1 + F2 + hf + hc4 + F5 + hc6\n",
+ "F = hc1 + F2 + hf + hc4 + F5 + hc6\n",
+ " #delH*g_fps = delP/Rho_fps + (V4**2 - V1**2)/(2*alpha*g_fps) + Ws + F\n",
+ " #delH = (delP/Rho_fps + (V4**2 - V1**2)/(2*alpha*g_fps) + Ws + F)/g_fps\n",
+ "delH = (delP/Rho_fps + (V4**2 - V1**2)/(2*alpha*g_fps) + Ws + F) \n",
+ "#Result\n",
+ "print \"The height of water level above the discharge outlet \",round(delH,2),\"ft\"\n",
+ "print 'The answer is correct because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The height of water level above the discharge outlet 33.74 ft\n",
+ "The answer is correct because of book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-7, Page number 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Friction Losses with pump in mechanical energy balance\n",
+ "#Variable Declaration\n",
+ "Q = 0.005 #Desired flowrate of water (m3/s)\n",
+ "Rho = 998.2 #Density of water in fps units (kg/m3)\n",
+ "u = 0.001005 #Viscosity of water in fps units (Pa/s)\n",
+ "D1 = 0.1023 #Diameter of the third pipe (m)\n",
+ "A1 = 0.008291 #Area of pipe (m2)\n",
+ "g = 9.806 #Gravitational acceleration in fps units (ft/s2)\n",
+ "e = 0.000046 #Roughness factor (ft)\n",
+ "f2 = 0.0051 #Fanning friction factor for 4-in pipe\n",
+ "z1 = 0. #Height of storage tank (m)\n",
+ "z2 = 15. #Height of elevated tank (m)\n",
+ "delL = 170. #Length of 4-in pipe (ft)\n",
+ "delL_2 = 185. #Length of 2-in pipe (ft)\n",
+ "delP = 0. #Since pressure at both end is atmospheric pressure \n",
+ "delV2 = 0.\n",
+ "Kf = 0.75\n",
+ "Kex = 1. \n",
+ "alpha = 1.\n",
+ "n = .65 #Efficiency of the pump\n",
+ "#Calculation\n",
+ "V1 = Q/A1\n",
+ "Nre = D1*V1*Rho/(u)\n",
+ " \n",
+ " #(1) Contraction losses at tank exit\n",
+ "#Kc = 0.55*(1-A3/A1)\n",
+ "Kc1 = 0.55\n",
+ "hc1 = Kc1*V1**2/(2*alpha)\n",
+ " #(2) Friction in straight pipe \n",
+ "\n",
+ "F2 = 4*f2*delL*V1**2/(D1*2)\n",
+ " #(3) Friction in the two elbows\n",
+ "hf = 2*V1**2/(2)\n",
+ " #(4) Expansion loss at tank entrance\n",
+ "hc4 = Kex*V1**2/(2)\n",
+ " #F = hc1 + F2 + hf + hc4 \n",
+ "F = hc1 + F2 + hf + hc4\n",
+ " #1*(delV2)/(2*alpha) + g*(z2 - z1) +delP/Rho + F + Ws = 0.\n",
+ "Ws = -(1*(delV2)/(2*alpha) + g*(z2 - z1) +delP/Rho + F)\n",
+ " #m = Q*Rho\n",
+ "m = Q*Rho\n",
+ " #Ws = -n*Wp\n",
+ "Wp = Ws/-n\n",
+ " #P = m*Wp\n",
+ "P = m*Wp/1000\n",
+ "#Result\n",
+ "print \"The power required by the pump is \",round(P,3),\"kW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power required by the pump is 1.182 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10-8, Page number 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Entry Length for a Fluid in a Pipe \n",
+ "#Variable Declaration\n",
+ "d = 0.010 #Diameter of tube (m)\n",
+ "V = 0.10 #Velocity of water (m/s)\n",
+ "mu = 0.001005 #Viscosity of water (Pa.s)\n",
+ "Rho = 998.2 #Density of water (kg/m3)\n",
+ "#Calculation\n",
+ "Nre = d*V*Rho/mu\n",
+ " #For laminar flow \n",
+ " #Le = 0.0575*Nre\n",
+ "\n",
+ "Le_l = 0.0575*Nre*d\n",
+ "Le_t = 50*d \n",
+ "#Result\n",
+ "print \"Reynolds Number is\",round(Nre,1)\n",
+ "print \"For laminar flow the entry length is \",round(Le_l,3),\"m\"\n",
+ "print \"For turbulent flow the entry length is \",round(Le_t,4),\"m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reynolds Number is 993.2\n",
+ "For laminar flow the entry length is 0.571 m\n",
+ "For turbulent flow the entry length is 0.5 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.11-1, Page number 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Compressible Flow of a gas in a pipe line\n",
+ "from math import log, pi\n",
+ "#Variable Declaration\n",
+ "d = 1.016 #Diameter of pipe (m)\n",
+ "G = 2.077 #The molar flow rate of the gas (kg mol/s)\n",
+ "mu = 1.04e-5 #Viscosity of methane at 288.8 k (Pa.s) \n",
+ "p2 = 170.3e3 #The pressure at the outlet (Pa)\n",
+ "L = 1.609e5 #The length of the pipe (m) \n",
+ "R = 8314.34 #Gas constant (N.m/kg.mol.K)\n",
+ "T = 288.8 #Temperature of methane gas (K)\n",
+ "M = 16. #Molecular weight of methane \n",
+ "epsilon = 4.6e-5 #Pipe roughness\n",
+ "\n",
+ "#Calculation\n",
+ "A = pi*d**2/4\n",
+ "Gm = G*M/A\n",
+ "Nre = d*Gm/mu\n",
+ "f = 0.0027 #from friction factor chart\n",
+ " #P1**2 - P2**2 = (4*f*L*(G_mass**2)*R*T)/(D*M) + (2*(G**2)*R*T*log(p1/P2)/16)\n",
+ " #P1 = sqrt(P2**2 + (4*f*L*(G_mass**2)*R*T)/(D*M) + (2*(G**2)*R*T*log(p1/P2)/16))\n",
+ "er = 1.2\n",
+ "p1 = 500.e3\n",
+ "while er>0.001:\n",
+ " p1c = sqrt(p2**2 + 4*f*L*Gm**2*R*T/(d*M) + (2*Gm**2*R*T*log(p1/p2)/M))\n",
+ " er = abs(p1-p1c)/p1c\n",
+ " p1 = p1c\n",
+ "#Result\n",
+ "print 'The final pressure is %10.4e Pa.'%(p1)\n",
+ "print 'The answers are correct because of book uses rounded of numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The final pressure is 6.7895e+05 Pa.\n",
+ "The answers are correct because of book uses rounded of numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.11-2, Page number 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Maximum Flow for Compressible Flow of a Gas\n",
+ "#Variable Declaration\n",
+ "R = 8314. #Gas constant ()\n",
+ "T = 288.8 #Temperature of fluid (K)\n",
+ "M = 16.\n",
+ "P2 = 170300. #Pressure at discharge tube (Pa)\n",
+ "G = 41. \n",
+ "#Calculation\n",
+ "Vmax = sqrt(R*T/M)\n",
+ "V2 = R*T*G/(P2*M)\n",
+ "#Result\n",
+ "print \"The maximum velocity in the tube is \",round(Vmax,1),\"m/s\"\n",
+ "print \"The actual velocity is \",round(V2,2),\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum velocity in the tube is 387.4 m/s\n",
+ "The actual velocity is 36.13 m/s\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file