summaryrefslogtreecommitdiff
path: root/Thermodynamics/Chapter2.ipynb
blob: 9380b1f099e3b75f2e20b8deb03287aba70c34cc (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:918b48292f00614bbba5ee6b8d2f7b2b929a3939332547fe2fb6585d1e0c7729"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2:THERMODYNAMIC CONCEPTS AND THE ZEROTH LAW"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page No:33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "patm = 14.5 ;                                   # atmospheric pressure in psia\n",
      "pgauge = 2.5;                                   # gauge pressure in psia\n",
      "A = 10;                                         # Area of the piston in in^2\n",
      "g=9.80665;                                      # Acceleration due to gravity in m/s^2\n",
      "#Calculation for (a)\n",
      "p = patm + pgauge;                              #total pressure of gas\n",
      "m=(p-patm)*A ;                                  # mass of the piston\n",
      "#Result for (a)\n",
      "print \"In English units\"\n",
      "print \"Mass of the piston =\",m,\"lbm\"\n",
      "#Calculation for (b)\n",
      "p=(p*0.454*g)/(0.0254**2);                      # conversion of English unit to SI units\n",
      "patm=(patm*0.454*g)/(0.0254**2);                # conversion of English unit to SI units\n",
      "m = ((p-patm)*(A*2.54**2*10**-4))/g;            # Mass of the piston\n",
      "#Result for (b)\n",
      "print \"\\nIn SI units \\n\",\"Mass of the piston =\",m,\"kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In English units\n",
        "Mass of the piston = 25.0 lbm\n",
        "\n",
        "In SI units \n",
        "Mass of the piston = 11.35 kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page No:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable declaration\n",
      "d_r = 13600;                                   # Density of manometric fluid (mercury) in kg/m^*3\n",
      "g = 8.92;                                      # Gravitational acceleration in m/s^2\n",
      "#Variable declaration\n",
      "z1=0.589*math.sin(math.radians(60));           # vertical height of fluid at section 1\n",
      "z2=2*math.sin(math.radians(30));               # vertical height of fluid at section 2\n",
      "z=z2-z1;                                       # Difference in vertical heights of fluid\n",
      "patm = 14.7;                                   # Atmospheric pressure in lbf/in^2\n",
      "patm=(patm*4.44822*144/0.3048**2);             # conversion of lbf/in^2 unit to N/m^2 unit\n",
      "p=patm + (d_r*g*(z2-z1));                      # Balance of force at A\n",
      "#Result\n",
      "print \"Difference in vertical heights of fluid = \",round(z,2),\"m\"\n",
      "print \"\\nThe pressure of fluid in the vessel = \",round(p/1000,0),\"kPa\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Difference in vertical heights of fluid =  0.49 m\n",
        "\n",
        "The pressure of fluid in the vessel =  161.0 kPa\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}