summaryrefslogtreecommitdiff
path: root/Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-03 15:27:17 +0530
committerhardythe12015-06-03 15:27:17 +0530
commit47d7279a724246ef7aa0f5359cf417992ed04449 (patch)
treec613e5e4813d846d24d67f46507a6a69d1a42d87 /Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb
parent435840cef00c596d9e608f9eb2d96f522ea8505a (diff)
downloadPython-Textbook-Companions-47d7279a724246ef7aa0f5359cf417992ed04449.tar.gz
Python-Textbook-Companions-47d7279a724246ef7aa0f5359cf417992ed04449.tar.bz2
Python-Textbook-Companions-47d7279a724246ef7aa0f5359cf417992ed04449.zip
add books
Diffstat (limited to 'Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb')
-rwxr-xr-xElements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb502
1 files changed, 502 insertions, 0 deletions
diff --git a/Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb b/Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb
new file mode 100755
index 00000000..b1a173c6
--- /dev/null
+++ b/Elements_of_Thermodynamics_and_heat_transfer/Chapter_13.ipynb
@@ -0,0 +1,502 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:34e2c9e74989754957ab71e3380ee9241975584f70767576f7f879e815515185"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13 - Fluid flow"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - Pg 223"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the velocity and area\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "h1=1329.1 #Btu/lbm\n",
+ "v1=6.218 #ft^3/lbm\n",
+ "J=778.\n",
+ "g=32.174\n",
+ "m=1.\n",
+ "#calculations\n",
+ "p=([80., 60., 54.6, 40., 20.])\n",
+ "h=([ 1304.1, 1273.8, 1265, 1234.2, 1174.8])\n",
+ "v=([ 7.384, 9.208, 9.844, 12.554, 21.279])\n",
+ "Fc=1.\n",
+ "b=len(p)\n",
+ "V2=numpy.zeros(b)\n",
+ "A=numpy.zeros(b)\n",
+ "for i in range (1,b):\n",
+ "\tV2[i]=round(Fc*math.sqrt(2*J*g*(h1-h[i])),2)\n",
+ "\tA[i]=round(m*v[i] /V2[i],5)\n",
+ "\n",
+ "V2 = 0+ V2\n",
+ "A =0+ A\n",
+ "#results\n",
+ "print '%s' %('velocity (ft/s)= ')\n",
+ "print(V2)\n",
+ "print '%s' %('Area (ft^2)= ')\n",
+ "print(A)\n",
+ "#The initial values of velocity and area are 0 and infinity respectively\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "velocity (ft/s)= \n",
+ "[ 0. 1663.87 1791.37 2179.67 2779.33]\n",
+ "Area (ft^2)= \n",
+ "[ 0. 0.00553 0.0055 0.00576 0.00766]\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - Pg 228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Area required in both cases\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "n=1.4\n",
+ "p1=50. #psia\n",
+ "J=778.\n",
+ "cp=0.24\n",
+ "T1=520. #R\n",
+ "k=n\n",
+ "R=1545/29.\n",
+ "m=1.\n",
+ "p2=10. #psia\n",
+ "#calculations\n",
+ "rpt=(2/(n+1))**(n/(n-1))\n",
+ "pt=p1*rpt\n",
+ "Vtrev=223.77*math.sqrt(cp*T1*(1- rpt**((k-1)/k)))\n",
+ "v1=R*T1/p1/144\n",
+ "vt=v1*(p1/pt)**(1./k)\n",
+ "At=m*vt/Vtrev\n",
+ "V2rev=223.77*math.sqrt(cp*T1*(1-(p2/p1)**((k-1)/k)))\n",
+ "v2=v1*(p1/p2)**(1/k)\n",
+ "A2=m*v2/V2rev\n",
+ "#results\n",
+ "print '%s %.5f %s' %(\"Area required =\",At,\" ft^2\")\n",
+ "print '%s %.5f %s' %(\"\\n Area in case 2 =\",A2,\" ft^2\")\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area required = 0.00595 ft^2\n",
+ "\n",
+ " Area in case 2 = 0.00800 ft^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - Pg 231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Throat area\n",
+ "#Initialization of variables\n",
+ "J=778.\n",
+ "g=32.2\n",
+ "pc=54.6 #psia\n",
+ "h1=1329.1 #Btu/lbm\n",
+ "h2=1265. #btu/lbm\n",
+ "V2rev=1790. #ft/s\n",
+ "cv=0.99\n",
+ "m=1 #lbm\n",
+ "cv2=0.96\n",
+ "#calculations\n",
+ "V2d=cv*V2rev\n",
+ "hd=cv**2 *(h1-h2)\n",
+ "h2d=h1-hd\n",
+ "v2d=9.946\n",
+ "A2d=m*v2d/V2d\n",
+ "#results\n",
+ "print '%s %.4f %s' %(\"Throat area in case 2 =\",A2d,\" ft^2\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Throat area in case 2 = 0.0056 ft^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - Pg 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the mass flow rate\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "p1=50. #psia\n",
+ "pr=0.58\n",
+ "#calculations\n",
+ "p=p1*pr\n",
+ "s1=1.6585\n",
+ "h1=1174.1 #Btu/lbm\n",
+ "sf=0.3680\n",
+ "sfg=1.3313\n",
+ "hfg=945.3\n",
+ "vg=13.746\n",
+ "hf=218.82\n",
+ "x= (s1-sf)/sfg\n",
+ "v2=vg*x\n",
+ "h2=hf+x*hfg\n",
+ "V2rev=223.77*math.sqrt(h1-h2)\n",
+ "m=math.pi/4 *1/144. *V2rev/v2\n",
+ "#results\n",
+ "print '%s %.3f %s' %(\"mass flow rate =\",m,\" lbm/sec\")\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mass flow rate = 0.572 lbm/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - Pg 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Mass flow rate and Meta stable under cooling\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "k=1.31\n",
+ "p1=7200. #lbf/ft**2\n",
+ "v1=8.515 #ft**3/lbm\n",
+ "pr=0.6\n",
+ "m1=0.574\n",
+ "T1=741. #R\n",
+ "#calculations\n",
+ "V2rev=8.02*math.sqrt(k/(k-1) *p1*v1*(1- (pr)**((k-1)/k)))\n",
+ "v2=v1*(1/pr)**(1/k)\n",
+ "m=math.pi/4 *1/144 *V2rev/v2\n",
+ "C=m/m1\n",
+ "T2=T1*(0.887)\n",
+ "t=250+460. #R\n",
+ "dt=t-T2\n",
+ "#results\n",
+ "print '%s %.3f %s' %(\"Mass flow rate =\",m,\" lbm/sec\")\n",
+ "print '%s %d %s' %(\"\\n Meta stable under cooling =\",dt,\"F\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass flow rate = 0.597 lbm/sec\n",
+ "\n",
+ " Meta stable under cooling = 52 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - Pg 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the average velocity and mass flow rate\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "zm=0.216\n",
+ "pm=62.3 #lbm/ft**2\n",
+ "p1=0.0736 #lbm/ft**2\n",
+ "g=32.2\n",
+ "d=4.\n",
+ "#calculations\n",
+ "H=zm*(pm-p1)/12/p1\n",
+ "V=math.sqrt(2*g*H)\n",
+ "m=math.pi/4 *d**2 *V*p1\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"average velocity =\",V,\" ft/sec\")\n",
+ "print '%s %.1f %s' %(\"\\n mass flow rate =\",m,\" lbm/sec\")\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "average velocity = 31.3 ft/sec\n",
+ "\n",
+ " mass flow rate = 29.0 lbm/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - Pg 244"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the area of throat and area of exit\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "p0=50. #psia\n",
+ "T0=520. #R\n",
+ "rho0=0.259 #lbm/ft^3\n",
+ "p2=10. #psia\n",
+ "mf=1. #lbm\n",
+ "#calculations\n",
+ "print '%s' %(\"From table B-17,\")\n",
+ "pr=0.528\n",
+ "Tr=0.833\n",
+ "rhor=0.634\n",
+ "ps=pr*p0\n",
+ "Ts=Tr*T0\n",
+ "rhos=rho0*rhor\n",
+ "Vs=49.1*math.sqrt(Ts)\n",
+ "As=mf/(Vs*rhos)\n",
+ "p2r=p2/p0\n",
+ "M2=1.71\n",
+ "V2=1.487*Vs\n",
+ "T2=0.632*Ts\n",
+ "A2=As*1.35\n",
+ "rho2=rhos*0.317\n",
+ "#results\n",
+ "print '%s %.5f %s' %(\"Area of throat =\",As,\"ft^2\")\n",
+ "print '%s %.5f %s' %(\"\\n Area of exit =\",A2,\"ft^2\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "From table B-17,\n",
+ "Area of throat = 0.00596 ft^2\n",
+ "\n",
+ " Area of exit = 0.00805 ft^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - Pg 247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Length of the pipe\n",
+ "#Initialization of variables\n",
+ "M1=0.2\n",
+ "M2=0.4\n",
+ "D=0.5 #ft\n",
+ "f=0.015\n",
+ "#calculations\n",
+ "f1=14.5\n",
+ "f2=2.31\n",
+ "dl=(f1-f2)*D/f\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Length of pipe =\",dl,\"ft\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Length of pipe = 406.3 ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - Pg 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the change in entropy\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "py=20. #psia\n",
+ "px=3.55 #psia\n",
+ "R=1.986/29\n",
+ "#calculations\n",
+ "pr=py/px\n",
+ "print '%s' %(\"from table B-19\")\n",
+ "Mx=2\n",
+ "My=0.577\n",
+ "pr2=0.721\n",
+ "ds=R*math.log(1./pr2)\n",
+ "#results\n",
+ "print '%s %.4f %s' %(\"Change in entropy =\",ds,\"Btu/lbm R\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "from table B-19\n",
+ "Change in entropy = 0.0224 Btu/lbm R\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - Pg 249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Internal and net thrust\n",
+ "#Initialization of variables\n",
+ "M1=0.5\n",
+ "M2=1.\n",
+ "A1=0.5 #ft^2\n",
+ "A2=1. #ft^2\n",
+ "p1=14.7 #psia\n",
+ "p2=14.7 #psia\n",
+ "k=1.4\n",
+ "#calculations\n",
+ "thru=p2*144*A2*(1+k*M2**2)-p1*144*A1*(1+k*M1**2)\n",
+ "net=thru-p1*144*(A2-A1)\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Internal thrust =\",thru,\"lbf\")\n",
+ "print '%s %d %s' %(\"\\n Net thrust =\",net,\" lbf\")\n",
+ "print '%s' %(\"The answers are a bit different due to rounding off error in textbook\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Internal thrust = 3651 lbf\n",
+ "\n",
+ " Net thrust = 2593 lbf\n",
+ "The answers are a bit different due to rounding off error in textbook\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file