{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 7 The second law" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:7.2 Pg:192" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Entropy in ab part = 0.1213 Btu/lbm R\n", "\n", " Entropy in ac part = 0.1688 Btu/lbm R\n", "\n", " Efficiency = 9.80 percent\n", "The answers are a bit different due to rounding off error in textbook\n" ] } ], "source": [ "from math import log\n", "#Initialization of variables\n", "cv=0.175 #Btu/lbm R\n", "R0=1.986\n", "M=29\n", "T2=1040 #R\n", "T1=520 #R\n", "#calculations\n", "cp=cv+R0/M\n", "sab=cv*log(T2/T1)\n", "sac=cp*log(T2/T1)\n", "dqab=cv*(T2-T1)\n", "dqca=cp*(T1-T2)\n", "dqrev=T2*(sac-sab)\n", "eta=(dqab+dqrev+dqca)/(dqab+dqrev)\n", "#results\n", "print \"Entropy in ab part = %.4f Btu/lbm R\"%(sab)\n", "print \"\\n Entropy in ac part = %.4f Btu/lbm R\"%(sac)\n", "print \"\\n Efficiency = %.2f percent\"%(eta*100)\n", "print \"The answers are a bit different due to rounding off error in textbook\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:7.3 Pg:193" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change in entropy of the process = 0.0192 Btu/R\n", "The answer is a bit different due to rounding off error in textbook\n" ] } ], "source": [ "from __future__ import division\n", "from math import log\n", "#Initialization of variables\n", "tc=32 #F\n", "th=80 #F\n", "mw=5 #lbm\n", "mi=1 #lbm\n", "P=14.7 #psia\n", "cp=1\n", "#calculations\n", "t= (-144*mi+tc*mi+th*mw)/(mw+mi)\n", "ds1=144/(tc+460)\n", "ds2=cp*log((460+t)/(460+tc))\n", "dsice=ds1+ds2\n", "dswater=mw*cp*log((t+460)/(460+th))\n", "ds=dsice+dswater\n", "#results\n", "print \"Change in entropy of the process = %.4f Btu/R\"%(ds)\n", "print \"The answer is a bit different due to rounding off error in textbook\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:7.4 Pg:194" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change in available energy = -3.5 Btu/lbm\n", "\n", " The available energy of the isolated system decreased in the amount of -36.5 Btu/lbm\n", "The answer is a bit different due to rounding off error in textbook\n" ] } ], "source": [ "from __future__ import division\n", "from math import log\n", "\n", "#Initialization of variables\n", "cp=1\n", "T2=60 #F\n", "T1=100 #F\n", "ta=32 #F\n", "#calculations\n", "dq=cp*(T2-T1)\n", "ds=cp*log((460+T2)/(460+T1))\n", "dE=dq-ds*(ta+460)\n", "dec=dq-dE\n", "#results\n", "print \"Change in available energy = %.1f Btu/lbm\"%(dE)\n", "print \"\\n The available energy of the isolated system decreased in the amount of %.1f Btu/lbm\"%(dec)\n", "print \"The answer is a bit different due to rounding off error in textbook\"" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }