summaryrefslogtreecommitdiff
path: root/Concepts_of_Thermodynamics/Chapter7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Concepts_of_Thermodynamics/Chapter7.ipynb')
-rwxr-xr-xConcepts_of_Thermodynamics/Chapter7.ipynb204
1 files changed, 204 insertions, 0 deletions
diff --git a/Concepts_of_Thermodynamics/Chapter7.ipynb b/Concepts_of_Thermodynamics/Chapter7.ipynb
new file mode 100755
index 00000000..15a3011b
--- /dev/null
+++ b/Concepts_of_Thermodynamics/Chapter7.ipynb
@@ -0,0 +1,204 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7 - The second law"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - Pg 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the entropy in each part and efficiency of the cycle\n",
+ "import math\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*math.log(T2/T1)\n",
+ "sac=cp*math.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)*100\n",
+ "#results\n",
+ "print '%s %.4f %s' %(\"Entropy in ab part =\",sab,\" Btu/lbm R\")\n",
+ "print '%s %.4f %s' %(\"\\n Entropy in ac part =\",sac,\"Btu/lbm R\")\n",
+ "print '%s %.2f %s' %(\"\\n Efficiency =\",eta,\" percent\")\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": [
+ "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"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - Pg 137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the change in entropy of the process\n",
+ "#Initialization of variables\n",
+ "import math\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*math.log((460+t)/(460+tc))\n",
+ "dsice=ds1+ds2\n",
+ "dswater=mw*cp*math.log((t+460)/(460+th))\n",
+ "ds=dsice+dswater\n",
+ "#results\n",
+ "print '%s %.4f %s' %(\"Change in entropy of the process =\",ds,\"Btu/R\")\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 entropy of the process = 0.0192 Btu/R\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 4 - Pg 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculate the thermal efficiency of the process\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "cp=0.25 #Btu/lbm R\n",
+ "T2=520. #R\n",
+ "T1=3460. #R\n",
+ "#calculations\n",
+ "dq=cp*(T2-T1)\n",
+ "ds=cp*math.log(T2/T1)\n",
+ "dG=dq-T2*ds\n",
+ "eff=dG/dq*100\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Thermal efficiency =\",eff,\"percent\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Thermal efficiency = 66.5 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - Pg 142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the change in available energy and also the decrease in energy of isolated system\n",
+ "#Initialization of variables\n",
+ "import math\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*math.log((460+T2)/(460+T1))\n",
+ "dE=dq-ds*(ta+460)\n",
+ "dec=dq-dE\n",
+ "#results\n",
+ "print '%s %.1f %s' %(\"Change in available energy =\",dE,\" Btu/lbm\")\n",
+ "print '%s %.1f %s' %(\"\\n The available energy of the isolated system decreased in the amount of\",dec, \"Btu/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": [
+ "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"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file