summaryrefslogtreecommitdiff
path: root/Thermodynamics,_Statistical_Thermodynamics,_&_Kinetics/Chapter01.ipynb
blob: 1b47a56ac7d7e83b69c696d57700aaf86a2e2f51 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:973d427aa265e6008d444ff4e5a0026589bdadc695d5f549c16acb669fdf56e2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1. Fundamental Concepts of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 1.1, Page Number 7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "Pi = 3.21e5             #Recommended tyre pressure, Pa\n",
      "Ti = -5.00              #Initial Tyre temperature, \u00b0C\n",
      "Tf = 28.00              #Final Tyre temperature, \u00b0C\n",
      "\n",
      "#Calculations\n",
      "Ti = 273.16 + Ti\n",
      "Tf = 273.16 + Tf\n",
      "pf = Pi*Tf/Ti           #Final tyre pressure, Pa\n",
      "\n",
      "#Results\n",
      "print 'Final Tyre pressure is %6.2e Pa'%pf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Final Tyre pressure is 3.61e+05 Pa\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2, Page Number 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "phe = 1.5          #Pressure in Helium chamber, bar\n",
      "vhe = 2.0          #Volume of Helium chamber, L\n",
      "pne = 2.5          #Pressure in Neon chamber, bar\n",
      "vne = 3.0          #Volume of Neon chamber, L\n",
      "pxe = 1.0          #Pressure in Xenon chamber, bar\n",
      "vxe = 1.0          #Volume of Xenon chamber, L\n",
      "R = 8.314e-2       #Ideal Gas Constant, L.bar/(mol.K)\n",
      "T = 298            #Temperature of Gas, K\n",
      "#Calculations\n",
      "\n",
      "nhe = phe*vhe/(R*T)            #Number of moles of Helium, mol\n",
      "nne = pne*vne/(R*T)            #Number of moles of Neon, mol\n",
      "nxe = pxe*vxe/(R*T)            #Number of moles of Xenon, mol\n",
      "n = nhe + nne + nxe            #Total number of moles, mol\n",
      "V = vhe + vne + vxe            #Total volume of system, L\n",
      "xhe = nhe/n\n",
      "xne = nne/n\n",
      "xxe = nxe/n\n",
      "P = n*R*T/(V)\n",
      "phe = P*xhe              #Partial pressure of Helium, bar\n",
      "pne = P*xne              #Partial pressure of Neon, bar\n",
      "pxe = P*xxe              #Partial pressure of Xenon, bar\n",
      "\n",
      "#Results\n",
      "print 'Moles of He=%4.3f, Ne=%4.3f and, Xe=%4.3f in mol'%(nhe,nne,nxe) \n",
      "print 'Mole fraction of xHe=%4.3f, xNe=%4.3f and, xXe=%4.3f'%(xhe,xne,xxe)\n",
      "print 'Final pressure is %4.3f bar'%P\n",
      "print 'Partial pressure of pHe=%4.3f, pNe=%4.3f and, pXe=%4.3f in bar'%(phe,pne,pxe)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moles of He=0.121, Ne=0.303 and, Xe=0.040 in mol\n",
        "Mole fraction of xHe=0.261, xNe=0.652 and, xXe=0.087\n",
        "Final pressure is 1.917 bar\n",
        "Partial pressure of pHe=0.500, pNe=1.250 and, pXe=0.167 in bar\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4, Page Number 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable Declaration\n",
      "T = 300.0               #Nitrogen temperature, K\n",
      "v1 = 250.00             #Molar volume, L\n",
      "v2 = 0.1                #Molar volume, L\n",
      "a = 1.37                #Van der Waals parameter a, bar.dm6/mol2 \n",
      "b = 0.0387              #Van der Waals parameter b, dm3/mol\n",
      "R = 8.314e-2            #Ideal Gas Constant, L.bar/(mol.K)\n",
      "n = 1.\n",
      "#Calculations\n",
      "\n",
      "p1 = n*R*T/v1           \n",
      "p2 = n*R*T/v2\n",
      "pv1 = n*R*T/(v1-n*b)- n**2*a/v1**2\n",
      "pv2 = n*R*T/(v2-n*b)- n**2*a/v2**2\n",
      "\n",
      "#Results\n",
      "print 'Pressure from ideal gas law = %4.2e bar nad from Van der Waals equation = %4.2e bar '%(p1, pv1)\n",
      "print 'Pressure from ideal gas law = %4.1f bar nad from Van der Waals equation = %4.1f bar '%(p2, pv2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure from ideal gas law = 9.98e-02 bar nad from Van der Waals equation = 9.98e-02 bar \n",
        "Pressure from ideal gas law = 249.4 bar nad from Van der Waals equation = 269.9 bar \n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}