summaryrefslogtreecommitdiff
path: root/Elements_of_Thermodynamics_and_heat_transfer/Chapter_8_1.ipynb
blob: d35614c292dd54e731edb04ee8375f06cc825a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
 "metadata": {
  "name": "",
  "signature": "sha256:efb3cb597d2918b83a867fe2c379b3952acba398aec14a9edf762b5c40043583"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 - Second and third law topics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the value of dp/ds at constant volume\n",
      "#Initialization of variables\n",
      "P=500 #psia\n",
      "T=700. #F\n",
      "J=778.\n",
      "#calculations\n",
      "dpds=1490 *144/J\n",
      "#results\n",
      "print '%s %d %s' %(\"dp by ds at constant volume =\",dpds,\" F/ft^3/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": [
        "dp by ds at constant volume = 275  F/ft^3/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 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the thermal efficiency\n",
      "#Initialization of variables\n",
      "import math\n",
      "cp=0.25 #Btu/lbm R\n",
      "T0=520. #R\n",
      "T1=3460. #R\n",
      "#calculations\n",
      "dq=cp*(T0-T1)\n",
      "ds=cp*math.log(T0/T1)\n",
      "dE=dq-T0*ds\n",
      "eta=dE/dq*100.\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Thermal efficiency =\",eta,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal efficiency = 66.5 percent\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Loss of available energy\n",
      "#Initialization of variables\n",
      "import math\n",
      "cp=0.25 #Btu/lbm R\n",
      "T0=520. #R\n",
      "T1=3460. #R\n",
      "dG=21069. #Btu/lbm\n",
      "dH=21502. #Btu/lbm\n",
      "#calculations\n",
      "dq=cp*(T0-T1)\n",
      "ds=cp*math.log(T0/T1)\n",
      "dE=dq-T0*ds\n",
      "eta=dE/dq\n",
      "dw=eta*dH\n",
      "de=-dG+dw\n",
      "#results\n",
      "print '%s %d %s' %(\"Loss of available energy =\",de,\"Btu/lbm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Loss of available energy = -6774 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}