summaryrefslogtreecommitdiff
path: root/Thermodynamics:_From_concepts_to_applications/Chapter10_2.ipynb
blob: b5e1628e0639747d2bb546a515e3bf0d94ca8d6d (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
 "metadata": {
  "name": "",
  "signature": "sha256:2af45763cdabb4c15384bcd3c0f85ef0384f4698a0a51376cf62b1a662fc76dc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10-Availbility,exergy and irreversibilitiy"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example1-pg 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate work of the water and heat interaction of the water and aximum work done\n",
      "##initialisation of variables\n",
      "m= 2 ##kg\n",
      "p= 200 ##kPa\n",
      "v2= 0.9596 ##m^3/kg\n",
      "v1= 0.001 ##m^3/kg\n",
      "u2= 2768.8 ##kJ/kg\n",
      "u1= 83.96 ##kJ/kg\n",
      "T= 20 ##C\n",
      "u3= 2576.9 ##kJ/kg\n",
      "s2= 7.2795 ##kJ/kg K\n",
      "s1= 0.2966 ##kJ/kg K\n",
      "Tr= 150 ##C\n",
      "##CALCULATIONS\n",
      "W= m*p*(v2-v1)\n",
      "Q= m*(u2-u1)\n",
      "A= m*((u3-u1)-(273.15+T)*(s2-s1))\n",
      "Ar= -Q*(1-((273.15+T)/(273.15+Tr)))\n",
      "Wrep= -(A+Ar)\n",
      "##RESULTS\n",
      "print'%s %.1f %s'%('work of the water =',W,'kJ')\n",
      "print'%s %.1f %s'% ('Heat interaction of the water =',Q,'kJ')\n",
      "print'%s %.1f %s'%('maximum work done =',Wrep,'kJ')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "work of the water = 383.4 kJ\n",
        "Heat interaction of the water = 5369.7 kJ\n",
        "maximum work done = 757.9 kJ\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example2-pg 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate irreversibility of the processes\n",
      "##initialisation of variables\n",
      "Wrev= 757.8 ##kJ\n",
      "W= 383.4 ##kJ\n",
      "m= 2 ##kg\n",
      "s2= 7.2795 ##kJ/kg K\n",
      "s1= 0.2966  ##kJ/kg K\n",
      "Qr= 5369.7 ##kJ\n",
      "T= 150 ##C\n",
      "T0= 20 ##C\n",
      "##CALCULATIONS\n",
      "I= Wrev-W\n",
      "dS= m*(s2-s1)\n",
      "Sr= -Qr/(273.15+T)\n",
      "I1= (273.15+T0)*(dS+Sr)\n",
      "##RESULTS\n",
      "print'%s %.1f %s'%('Irreversibility of the process=',I1,'kJ')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Irreversibility of the process= 374.1 kJ\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example7-pg192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate mass flow rates and wmax and irreversibility\n",
      "import math\n",
      "##initialisation of variables\n",
      "h3= 2793.2 ##kJ/kg\n",
      "h2= 1342.3 ##kJ/kg\n",
      "h1= 2993.5 ##kJ/kg\n",
      "m3= 2.5 ##kg/s\n",
      "b1= 1043.9 ##kJ/kg\n",
      "b2= 374.24 ##kJ/kg\n",
      "b3= 875.41 ##kJ/kg\n",
      "##CALCULATIONS\n",
      "m1= m3*((h3-h2)/(h1-h2))\n",
      "m2= m3*((h3-h1)/(h2-h1))\n",
      "Bin= (m1*b1+m2*b2)\n",
      "Bout= m3*b3\n",
      "B= Bin-Bout\n",
      "Wmax= B\n",
      "I= B\n",
      "##RESULTS\n",
      "print'%s %.3f %s'%('mass flow rate=',m1,'kg/s')\n",
      "print'%s %.3f %s'%('mass flow rate=',m2,'kg/s')\n",
      "print'%s %.3f %s'%('Wmax=',Wmax,'kg/s')\n",
      "print'%s %.1f %s'%('Irreversibility=',Wmax,'kW')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mass flow rate= 2.197 kg/s\n",
        "mass flow rate= 0.303 kg/s\n",
        "Wmax= 218.141 kg/s\n",
        "Irreversibility= 218.1 kW\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}