summaryrefslogtreecommitdiff
path: root/Elements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Elements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb')
-rwxr-xr-xElements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb696
1 files changed, 0 insertions, 696 deletions
diff --git a/Elements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb b/Elements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb
deleted file mode 100755
index 4aed469b..00000000
--- a/Elements_of_Thermodynamics_and_heat_transfer/Chapter_11.ipynb
+++ /dev/null
@@ -1,696 +0,0 @@
-{
- "metadata": {
- "name": "",
- "signature": "sha256:37c7e0de5d214bd8e1262734b18b139b442cc87b722d8f6c3ad97dd3d8903ad3"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 11 - The ideal gas and mixture relationships"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1 - Pg 184"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the work done\n",
- "#Initialization of variables\n",
- "n=1.3\n",
- "T1=460+60. #R\n",
- "P1=14.7 #psia\n",
- "P2=125. #psia\n",
- "R=1545.\n",
- "M=29.\n",
- "#calculations\n",
- "T2=T1*(P2/P1)**((n-1)/n)\n",
- "wrev=R/M *(T2-T1)/(1-n)\n",
- "#results\n",
- "print '%s %d %s' %(\"Work done =\",wrev,\"ft-lbf/lbm\")\n",
- "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Work done = -58988 ft-lbf/lbm\n",
- "The answer is a bit different due to rounding off error in textbook\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2 - Pg 184"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Change in kinetic energy\n",
- "#Initialization of variables\n",
- "P2=10 #psia\n",
- "P1=100 #psia\n",
- "T1=900 #R\n",
- "w=50 #Btu/lbm\n",
- "k=1.39\n",
- "cp=0.2418\n",
- "#calculations\n",
- "T2=T1*(P2/P1)**((k-1)/k)\n",
- "T2=477\n",
- "KE=-w-cp*(T2-T1)\n",
- "#results\n",
- "print '%s %.1f %s' %(\"Change in kinetic energy =\",KE,\"Btu/lbm\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in kinetic energy = 52.3 Btu/lbm\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 3 - Pg 190"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Final temperature\n",
- "#Initialization of variables\n",
- "T1=900 #R\n",
- "P1=100 #psia\n",
- "P2=10 #psia\n",
- "#calculations\n",
- "print '%s' %(\"From table B-9\")\n",
- "pr1=8.411\n",
- "pr2=pr1*P2/P1\n",
- "T2=468 #R\n",
- "#results\n",
- "print '%s %.1f %s' %(\"Final temperature =\",T2,\"R \")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "From table B-9\n",
- "Final temperature = 468.0 R \n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4 - Pg 190"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the final temperature and pressure, work done and enthalpy\n",
- "#Initialization of variables\n",
- "cr=6\n",
- "p1=14.7 #psia\n",
- "t1=60.3 #F\n",
- "M=29\n",
- "R=1.986\n",
- "#calculations\n",
- "print '%s' %(\"from table b-9\")\n",
- "vr1=158.58 \n",
- "u1=88.62 #Btu/lbm\n",
- "pr1=1.2147\n",
- "vr2=vr1/cr\n",
- "T2=1050 #R\n",
- "u2=181.47 #Btu/lbm\n",
- "pr2=14.686\n",
- "p2=p1*(pr2/pr1)\n",
- "dw=u1-u2\n",
- "h2=u2+T2*R/M\n",
- "#results\n",
- "print '%s %d %s' %(\"final temperature =\",T2,\"R\")\n",
- "print '%s %.1f %s' %(\"\\n final pressure =\",p2,\" psia\")\n",
- "print '%s %.2f %s' %(\"\\n work done =\",dw,\" Btu/lbm\")\n",
- "print '%s %.1f %s' %(\"\\n final enthalpy =\",h2,\" Btu/lbm\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "from table b-9\n",
- "final temperature = 1050 R\n",
- "\n",
- " final pressure = 177.7 psia\n",
- "\n",
- " work done = -92.85 Btu/lbm\n",
- "\n",
- " final enthalpy = 253.4 Btu/lbm\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 5 - Pg 193"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the mole fractions of oxygen and nitrogen, Average molecular weight and partial pressures, densities, volumes\n",
- "#Initialization of variables\n",
- "m1=10. #lbm\n",
- "m2=15. #lnm\n",
- "p=50. #psia\n",
- "t=60.+460 #R\n",
- "M1=32.\n",
- "M2=28.02\n",
- "R0=10.73 \n",
- "#calculations\n",
- "n1=m1/M1\n",
- "n2=m2/M2\n",
- "x1=n1/(n1+n2)\n",
- "x2=n2/(n1+n2)\n",
- "M=x1*M1+x2*M2\n",
- "R=1545/M\n",
- "V=(n1+n2)*R0*t/p\n",
- "rho=p/(R0*t)\n",
- "rho2=M*rho\n",
- "p1=x1*p\n",
- "p2=x2*p\n",
- "v1=x1*V\n",
- "v2=x2*V\n",
- "#results\n",
- "print '%s' %(\"part a\")\n",
- "print '%s %.3f %s %.3f %s' %(\"Mole fractions of oxygen and nitrogen are\",x1,\" and\",x2,\" respectively\")\n",
- "print '%s' %(\"part b\")\n",
- "print '%s %.1f' %(\"Average molecular weight = \",M)\n",
- "print '%s' %(\"part c\")\n",
- "print '%s %.2f %s' %(\"specific gas constant =\",R,\"psia ft^3/lbm R\")\n",
- "print '%s' %(\"part d\")\n",
- "print '%s %.1f %s' %(\"volume of mixture =\",V,\"ft^3\")\n",
- "print '%s %.5f %s %.3f %s' %(\"density of mixture is\",rho, \"mole/ft^3 and\",rho2, \"lbm/ft^3\")\n",
- "print '%s' %(\"part e\")\n",
- "print '%s %.2f %s %.2f %s' %(\"partial pressures of oxygen and nitrogen are\",p1,\"psia and\",p2,\"psia respectively\")\n",
- "print '%s %.2f %s %.2f %s' %(\"partial volumes of oxygen and nitrogen are\",v1,\"ft^3 and\",v2,\"ft^3 respectively\")"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "part a\n",
- "Mole fractions of oxygen and nitrogen are 0.369 and 0.631 respectively\n",
- "part b\n",
- "Average molecular weight = 29.5\n",
- "part c\n",
- "specific gas constant = 52.40 psia ft^3/lbm R\n",
- "part d\n",
- "volume of mixture = 94.6 ft^3\n",
- "density of mixture is 0.00896 mole/ft^3 and 0.264 lbm/ft^3\n",
- "part e\n",
- "partial pressures of oxygen and nitrogen are 18.43 psia and 31.57 psia respectively\n",
- "partial volumes of oxygen and nitrogen are 34.87 ft^3 and 59.74 ft^3 respectively\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6 - Pg 195"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the gravimetric and ultimate analysis\n",
- "#Initialization of variables\n",
- "m1=5.28\n",
- "m2=1.28\n",
- "m3=23.52\n",
- "#calculations\n",
- "m=m1+m2+m3\n",
- "x1=m1/m*100\n",
- "x2=m2/m*100\n",
- "x3=m3/m*100\n",
- "C=12./44 *m1/ m*100\n",
- "O=(32./44 *m1 + m2)/m*100\n",
- "N=m3/m*100\n",
- "#results\n",
- "print '%s %.1f %s %.1f %s %.1f %s' %(\"From gravimetric analysis, co2 =\",x1,\"percent , o2 =\",x2,\"percent and n2 =\",x3,\"percent\")\n",
- "print '%s %.2f %s %.2f %s %.2f %s' %(\"\\n From ultimate analysis, co2 =\",C,\"percent , o2 =\",O,\" percent and n2 =\",N,\" percent\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "From gravimetric analysis, co2 = 17.6 percent , o2 = 4.3 percent and n2 = 78.2 percent\n",
- "\n",
- " From ultimate analysis, co2 = 4.79 percent , o2 = 17.02 percent and n2 = 78.19 percent\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 7 - Pg 197"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Entropy of the mixture\n",
- "#Initialization of variables\n",
- "import math\n",
- "x1=1/3.\n",
- "n1=1.\n",
- "n2=2.\n",
- "x2=2/3.\n",
- "p=12.7 #psia\n",
- "cp1=7.01 #Btu/mole R\n",
- "cp2=6.94 #Btu/mole R\n",
- "R0=1.986\n",
- "T2=460+86.6 #R\n",
- "T1=460. #R\n",
- "p0=14.7 #psia\n",
- "#calculations\n",
- "p1=x1*p\n",
- "p2=x2*p\n",
- "ds1= cp1*math.log(T2/T1) - R0*math.log(p1/p0)\n",
- "ds2= cp2*math.log(T2/T1) - R0*math.log(p2/p0)\n",
- "S=n1*ds1+n2*ds2\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Entropy of mixture =\",S,\"Btu/R\")\n",
- "print '%s' %(\"\\n the answer given in textbook is wrong. please check using a calculator\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Entropy of mixture = 8.27 Btu/R\n",
- "\n",
- " the answer given in textbook is wrong. please check using a calculator\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 8 - Pg 198"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the change in internal energy and entropy\n",
- "#Initialization of variables\n",
- "import math\n",
- "c1=4.97 #Btu/mol R\n",
- "c2=5.02 #Btu/mol R\n",
- "n1=2\n",
- "n2=1\n",
- "T1=86.6+460 #R\n",
- "T2=50.+460 #R\n",
- "#calculations\n",
- "du=(n1*c1+n2*c2)*(T2-T1)\n",
- "ds=(n1*c1+n2*c2)*math.log(T2/T1)\n",
- "#results\n",
- "print '%s %d %s' %(\"Change in internal energy =\",du,\" Btu\")\n",
- "print '%s %.3f %s' %(\"\\n Change in entropy =\",ds,\"Btu/R\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in internal energy = -547 Btu\n",
- "\n",
- " Change in entropy = -1.037 Btu/R\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 9 - Pg 198"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Pressure of the mixture\n",
- "#Initialization of variables\n",
- "n1=1\n",
- "n2=2\n",
- "c1=5.02\n",
- "c2=4.97\n",
- "t1=60. #F\n",
- "t2=100. #F\n",
- "R0=10.73\n",
- "p1=30. #psia\n",
- "p2=10. #psia\n",
- "#calcualtions\n",
- "t=(n1*c1*t1+n2*c2*t2)/(n1*c1+n2*c2)\n",
- "V1= n1*R0*(t1+460)/p1\n",
- "V2=n2*R0*(t2+460)/p2\n",
- "V=V1+V2\n",
- "pm=(n1+n2)*R0*(t+460)/V\n",
- "#results\n",
- "print '%s %.1f %s' %(\"Pressure of mixture =\",pm,\" psia\")\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Pressure of mixture = 12.7 psia\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 10 - Pg 199"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the change in entropy of gas \n",
- "#Initialization of variables\n",
- "import math\n",
- "T2=546.6 #R\n",
- "T1=520 #R\n",
- "T3=560 #R\n",
- "v2=1389.2\n",
- "v1=186.2\n",
- "R0=1.986\n",
- "c1=5.02\n",
- "c2=4.97\n",
- "n1=1\n",
- "n2=2\n",
- "v3=1203\n",
- "#calculations\n",
- "ds1=n1*c1*math.log(T2/T1) + n1*R0*math.log(v2/v1)\n",
- "ds2=n2*c2*math.log(T2/T3)+n2*R0*math.log(v2/v3)\n",
- "ds=ds1+ds2\n",
- "#results\n",
- "print '%s %.3f %s' %(\"Change in entropy for gas 1 =\",ds1,\" Btu/R\")\n",
- "print '%s %.3f %s' %(\"\\n Change in entropy for gas 1 =\",ds2,\"Btu/R\")\n",
- "print '%s %.3f %s' %(\"\\n Net change in entropy =\",ds,\"Btu/R\")\n",
- "print '%s' %(\"The answer is a bit different due to rounding off error in the textbook\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in entropy for gas 1 = 4.242 Btu/R\n",
- "\n",
- " Change in entropy for gas 1 = 0.331 Btu/R\n",
- "\n",
- " Net change in entropy = 4.572 Btu/R\n",
- "The answer is a bit different due to rounding off error in the textbook\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11 - Pg 200"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Final temperature and change in entropy of air and water.\n",
- "#Initialization of variables\n",
- "import math\n",
- "m1=1. #lbm\n",
- "m2=0.94 #lbm\n",
- "M1=29.\n",
- "M2=18.\n",
- "p1=50. #psia\n",
- "p2=100. #psia\n",
- "t1=250 +460. #R\n",
- "R0=1.986\n",
- "cpa=6.96\n",
- "cpb=8.01\n",
- "#calculations\n",
- "xa = (m1/M1)/((m1/M1)+ m2/M2)\n",
- "xb=1-xa\n",
- "t2=t1*(p2/p1)**(R0/(xa*cpa+xb*cpb))\n",
- "d=R0/(xa*cpa+xb*cpb)\n",
- "k=1/(1.-d)\n",
- "dsa=cpa*math.log(t2/t1) -R0*math.log(p2/p1)\n",
- "dSa=(m1/M1)*dsa\n",
- "dSw=-dSa\n",
- "dsw=dSw*M2/m2\n",
- "#results\n",
- "print '%s %d %s' %(\"Final temperature =\",t2,\" R\")\n",
- "print '%s %.3f %s %.5f %s' %(\"\\n Change in entropy of air =\",dsa,\" btu/mole R and\",dSa, \"Btu/R\")\n",
- "print '%s %.4f %s %.5f %s' %(\"\\n Change in entropy of water =\",dsw,\"btu/mole R and\",dSw,\" Btu/R\")\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": [
- "Final temperature = 851 R\n",
- "\n",
- " Change in entropy of air = -0.115 btu/mole R and -0.00395 Btu/R\n",
- "\n",
- " Change in entropy of water = 0.0757 btu/mole R and 0.00395 Btu/R\n",
- "The answers are a bit different due to rounding off error in textbook\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 12 - Pg 202"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the volume occupied and mass of steam\n",
- "#Initialization of variables\n",
- "T=250. + 460 #R\n",
- "p=29.825 #psia\n",
- "pt=50 #psia\n",
- "vg=13.821 #ft^3/lbm\n",
- "M=29.\n",
- "R=10.73\n",
- "#calculations\n",
- "pa=pt-p\n",
- "V=1/M *R*T/pa\n",
- "ma=V/vg\n",
- "xa=p/pt\n",
- "mb=xa/M *18./(1.-xa)\n",
- "#results\n",
- "print '%s %.2f %s' %(\"In case 1, volume occupied =\",V,\" ft^3\")\n",
- "print '%s %.2f %s' %(\"\\n In case 1, mass of steam =\",ma,\" lbm steam\")\n",
- "print '%s %.3f %s' %(\"\\n In case 2, mass of steam =\",mb,\" lbm steam\")\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "In case 1, volume occupied = 13.02 ft^3\n",
- "\n",
- " In case 1, mass of steam = 0.94 lbm steam\n",
- "\n",
- " In case 2, mass of steam = 0.918 lbm steam\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 13 - Pg 203"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calcualte the percentage\n",
- "#Initialization of variables\n",
- "ps=0.64 #psia\n",
- "p=14.7 #psia\n",
- "M=29.\n",
- "M2=46.\n",
- "#calculations\n",
- "xa=ps/p\n",
- "mb=xa*9./M *M2/(1-xa)*100\n",
- "#results\n",
- "print '%s %.1f %s' %(\"percentage =\",mb,\"percent\")\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "percentage = 65.0 percent\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 14 - Pg 203"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the partial pressure of water vapor\n",
- "#Initialization of variables\n",
- "ps=0.5069 #psia\n",
- "p=20 #psia\n",
- "m1=0.01\n",
- "m2=1\n",
- "M1=18.\n",
- "M2=29.\n",
- "#calculations\n",
- "xw= (m1/M1)/(m1/M1+m2/M2)\n",
- "pw=xw*p\n",
- "#results\n",
- "print '%s %.3f %s' %(\"partial pressure of water vapor =\",pw,\"psia\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "partial pressure of water vapor = 0.317 psia\n"
- ]
- }
- ],
- "prompt_number": 14
- }
- ],
- "metadata": {}
- }
- ]
-} \ No newline at end of file