summaryrefslogtreecommitdiff
path: root/Mechanical_Engineering_Thermodynamics/Chapter_2.ipynb
blob: 97405b03b97a19962567f790f01775cce665bd6c (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 - Work"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the net work done\n",
      "#Initialization of variables\n",
      "from numpy import math\n",
      "g=1.4  #Gamma\n",
      "P=100. #psia\n",
      "V1=3. #cu ft\n",
      "Pf=20. #psia\n",
      "#calculations\n",
      "V2=V1*math.pow((P/Pf),(1/g))\n",
      "W=(Pf*V2-P*V1)*144./(1-g)\n",
      "#results\n",
      "print '%s %d %s' %(\"Net work done =\",W,\"ft lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net work done = 39810 ft lb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the net work done\n",
      "#Initialization of variables\n",
      "Wb=-33000. #ft-lb\n",
      "V2=3. #cu ft\n",
      "V1=1. #cu ft\n",
      "P=69.4 #psia\n",
      "#calculations\n",
      "Wa=P*(V2-V1)*144.\n",
      "W=Wa+Wb\n",
      "#results\n",
      "print '%s %d %s' %(\"Net work done =\",W,\"ft-lb\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net work done = -13012 ft-lb\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the net work done\n",
      "import math\n",
      "#Initialization of variables\n",
      "b=11. #in\n",
      "s=15. #in\n",
      "l=2.4 #in\n",
      "k=80. #psi per in\n",
      "#calculations\n",
      "a=math.pi*b*b /4\n",
      "L=s/12.\n",
      "Pm=1.6/l *k\n",
      "W=Pm*a*L\n",
      "#results\n",
      "print '%s %d %s' %(\"Net work done =\",W,\"ft lb\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net work done = 6335 ft lb\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}