summaryrefslogtreecommitdiff
path: root/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter1_2.ipynb
blob: 68c668615b9acc9898dc696e30d9070887ce3c78 (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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{
 "metadata": {
  "name": "",
  "signature": "sha256:2622b864e241f67942d9af83d84aabbbf519132ac138f1180d8869df35c708b4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 1 : Basic Principles"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1.2 : PG-9 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "m=10 # mass in Kg\n",
      "V=5 # velocity in m/s\n",
      "\n",
      "KE=m*V**2/2 # kinetic energy in N-m \n",
      "print \"The Kinetic Energy is \",round(KE),\" N.m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Kinetic Energy is  125.0  N.m\n"
       ]
      }
     ],
     "prompt_number": 77
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1.3 : PG-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "V= 3*5*20; # Volume of air in m^3 from dimensions\n",
      "m= 350.0; # mass in kg\n",
      "g= 9.81; # gavitational acceleration in m/s^2\n",
      "\n",
      "rho=m/V;# density\n",
      "print \" The Density is \",round(rho,3),\"kg/m^3 \\n\"\n",
      "\n",
      "v= 1/rho # specific volume of air\n",
      "print \" The specific volume  is\", round(v,3),\"m^3/kg \\n\"\n",
      "\n",
      "gama= rho*g # specific weight of air\n",
      "print \" The specific weight is\", round(gama,2),\" N/m^3\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Density is  1.167 kg/m^3 \n",
        "\n",
        " The specific volume  is 0.857 m^3/kg \n",
        "\n",
        " The specific weight is 11.45  N/m^3\n"
       ]
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1.4 : PG-13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "h=0.020 # height of mercury in m\n",
      "gammawater=9810 # specific weight of water in N/m^3\n",
      "Patm=0.7846*101.3 # atmospheric pressure in kPa from table B.1\n",
      "\n",
      "Pgauge=13.6*gammawater*h/1000 # pressure in Pascal from condition gammaHg=13.6*gammawater\n",
      "\n",
      "P=(Pgauge+Patm)# absolute pressure in KPa\n",
      "#result\n",
      "print \"The Pressure is\",round(P,2),\" kPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Pressure is 82.15  kPa\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1.5 : PG-13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# initialization of variables\n",
      "d=10.0/100 # diameter of cylinder in 'm'\n",
      "P=600 # pressure in KPa\n",
      "Patm=100 # atmospheric pressure in Kpa\n",
      "K=4.8*1000 # spring constant in N/m \n",
      "\n",
      "deltax=(P-Patm)*(math.pi*1000*d**2)/(4*K) # by balancing forces on piston\n",
      "#result\n",
      "print \"The Compression in spring is\",round(deltax,3),\" m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Compression in spring is 0.818  m\n"
       ]
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1.6 : PG-16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "ma=2200 # mass of Automobile 'a' in kg\n",
      "va=25 #velocity of Automobile 'a' in m/s before collision\n",
      "va1=13.89 # velocity of Automobile 'a' after collision in m/s\n",
      "mb=1000 # mass of Automobile 'b' in kg\n",
      "vb=24.44 #velocity of Automobile 'b' after collision in m/s\n",
      "\n",
      "KE1=(ma*va**2)/2 # kinetic energy before collision\n",
      "KE2=(ma*va1**2)/2+(mb*vb**2)/2 # kinetic energy after collision\n",
      "U=(KE1-KE2)/1000 # internal energy from conservation of energy principle in kJ\n",
      "#result\n",
      "print \"The increase in kinetic energy is of\",round(U,1),\" kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The increase in kinetic energy is of 176.6  kJ\n"
       ]
      }
     ],
     "prompt_number": 81
    }
   ],
   "metadata": {}
  }
 ]
}