summaryrefslogtreecommitdiff
path: root/Concepts_of_Thermodynamics/Chapter10.ipynb
blob: b6abe8aa66dc002f14012aade752b2291267f8e4 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 - The pvT relationships"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "    Example 1 - Pg 230"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the pressure of the gas using both ideal and vanderwaals cases\n",
      "#Initialization of variables\n",
      "m=1 #lbm\n",
      "T1=212+460. #R\n",
      "sv=0.193 #ft^3/lbm\n",
      "M=44\n",
      "a=924.2 #atm ft^2 /mole^2\n",
      "b=0.685 #ft^3/mol\n",
      "R=0.73 #atm ft^3/R mol\n",
      "#calculations\n",
      "v=sv*M\n",
      "p=R*T1/v\n",
      "p2=R*T1/(v-b) -a/v/v\n",
      "#results\n",
      "print '%s %.1f %s' %(\"In ideal gas case, pressure =\",p,\"atm\")\n",
      "print '%s %.1f %s' %(\"\\n In vanderwaals equation, pressure =\",p2,\"atm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In ideal gas case, pressure = 57.8 atm\n",
        "\n",
        " In vanderwaals equation, pressure = 50.0 atm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the volume of the gas\n",
      "#Initialization of variables\n",
      "m=1 #lbm\n",
      "p=50.9 #atm\n",
      "t=212+460. #R\n",
      "R=0.73\n",
      "#calculations\n",
      "pc=72.9 #atm\n",
      "tc=87.9 +460 #R\n",
      "pr=p/pc\n",
      "Tr=t/tc\n",
      "z=0.88\n",
      "v=z*R*t/p\n",
      "#results\n",
      "print '%s %.3f %s' %(\"volume =\",v,\"ft^3/mole\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "volume = 8.481 ft^3/mole\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 233"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the pressure of the gas\n",
      "#Initialization of variables\n",
      "t=212+460. #R\n",
      "v=0.193 #ft^3/lbm\n",
      "M=44\n",
      "R=0.73\n",
      "#calculations\n",
      "tc=87.9+460. #F\n",
      "zc=0.275\n",
      "vc=1.51 #ft^3/mol\n",
      "tr=t/tc\n",
      "vr=v*M/vc\n",
      "vrd=vr*zc\n",
      "z=0.88\n",
      "p=z*R*t/(M*v)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Pressure =\",p,\"atm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure = 50.8 atm\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}