{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 11 - Properties of Gases" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1 - Pg 172" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the volume of the appratus\n", "#initialization of varaibles\n", "P1=15. #psia\n", "T1=80+460. #R\n", "dm=3. #lb\n", "T2=75+460. #R\n", "P2=25. #psia\n", "#calculations\n", "mratio=P1*T2/(P2*T1)\n", "m2=dm/(1-mratio)\n", "V2=m2*55.16*T2/(P2*144.)\n", "#results\n", "print '%s %.1f %s' %(\"Volume of the apparatus =\",V2,\"cu ft\")\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": [ "Volume of the apparatus = 60.6 cu ft\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 176" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the specific heats at constant pressure and volume\n", "#initialization of varaibles\n", "R=48.3 #ft lb/lb R\n", "k=1.4\n", "#calculations\n", "dc=R/778.\n", "cp=k*dc/(k-1)\n", "cv=cp/k\n", "#results\n", "print '%s %.3f %s' %(\"Specific heat at constant volume = \",cv,\"B/lb R\")\n", "print '%s %.3f %s' %(\"\\n Specific heat at constant pressure = \",cp,\"B/lb R\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Specific heat at constant volume = 0.155 B/lb R\n", "\n", " Specific heat at constant pressure = 0.217 B/lb R\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3 - Pg 177" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "This is a theoretical example." ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ " Example 4 - Pg 180" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the enthalpy generated\n", "#initialization of varaibles\n", "import math\n", "P1=100. #psia\n", "P2=10. #psia\n", "T1=140. +460 #R\n", "g=1.4\n", "cp=0.248\n", "#calculations\n", "dh=g*55.16*T1*(math.pow((P2/P1),((g-1)/g)) -1)/(g-1)*0.01286 #0.01286 is the conversion factor\n", "T2=T1*math.pow((P2/P1),((g-1)/g))\n", "dh2=cp*(T2-T1)\n", "#results\n", "print '%s %d %s' %(\"In method 1, Enthalpy = \",dh,\"Btu/lb\")\n", "print '%s %.1f %s' %(\"\\n In method 2, Enthalpy =\",dh2,\"ft lb/lb\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "In method 1, Enthalpy = -718 Btu/lb\n", "\n", " In method 2, Enthalpy = -71.7 ft lb/lb\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5a - Pg 186" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the changes in Enthalpy and Specific Volume\n", "#initialization of varaibles\n", "import math\n", "P1=100. #psia\n", "T1=2000.+460 #R\n", "P2=15. #psia\n", "g=1.4\n", "cp=0.24\n", "#calculations\n", "v1=53.34*T1/(P1*144.)\n", "v2=53.34*T1*math.pow((P1/P2),(1/g)) /(P1*144)\n", "T2=T1*P2*v2/(P1*v1)\n", "dh=cp*(T2-T1)\n", "dv=v2-v1\n", "#results\n", "print '%s %d %s' %(\"Change in enthalpy =\",dh,\"B/lb\")\n", "print '%s %.1f %s' %(\"\\n Specific volume change = \",dv,\"cu ft/lb\")\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": [ "Change in enthalpy = -247 B/lb\n", "\n", " Specific volume change = 26.2 cu ft/lb\n", "The answer is a bit different due to rounding off error in textbook\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5b - Pg 186" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the changes in Enthalpy and Specific Volume\n", "#initialization of varaibles\n", "import math\n", "P1=100. #psia\n", "T1=2000.+460 #R\n", "P2=15. #psia\n", "g=1.4\n", "cp=0.276\n", "cv=0.207\n", "T2=1520. #R\n", "#calculations\n", "k=cp/cv\n", "v1=53.34*T1/(P1*144)\n", "v2=v1*math.pow((P1/P2),(1/k))\n", "dh=cp*(T2-T1)\n", "dv=v2-v1\n", "#results\n", "print '%s %d %s' %(\"Enthalpy change =\",dh,\"B/lb\")\n", "print '%s %.1f %s' %(\"\\n Volume change =\",dv,\"cu t/lb\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Enthalpy change = -259 B/lb\n", "\n", " Volume change = 28.7 cu t/lb\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5c - Pg 186" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the changes in Enthalpy and Specific Volume\n", "#initialization of varaibles\n", "import math\n", "P1=100. #psia\n", "T1=2000.+460 #R\n", "P2=15. #psia\n", "g=1.4\n", "cp=0.276\n", "cv=0.207\n", "T2=1520. #R\n", "#calculations\n", "h1=634.4\n", "pr1=407.3\n", "pr2=pr1*P2/P1\n", "print '%s' %(\"From table 1,\")\n", "T2=1535. #R\n", "h2=378.44\n", "dh=h2-h1\n", "v1=53.34*T1/(P1*144)\n", "v2=53.34*T2/(P2*144.)\n", "dv=v2-v1\n", "#results\n", "print '%s %.2f %s' %(\"Enthalpy change = \",dh,\"B/lb\")\n", "print '%s %.1f %s' %(\"\\n Volume change =\",dv,\"cu ft/lb\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "From table 1,\n", "Enthalpy change = -255.96 B/lb\n", "\n", " Volume change = 28.8 cu ft/lb\n" ] } ], "prompt_number": 6 } ], "metadata": {} } ] }