summaryrefslogtreecommitdiff
path: root/Thermodynamics_for_Engineers/Chapter_7.ipynb
blob: a780ec3620d80accddc602c802ac2b4a74b97c40 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:7cd10447df19fe2f7f7381338e86fa6208bc3c3a796f2e977240b17e164ee22b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 - Entropy"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate the change in entropy\n",
      "#Initialization of variables\n",
      "T2=920. #R\n",
      "T1=520. #R\n",
      "P1=14. #psia\n",
      "P2=84. #psia\n",
      "J=778.\n",
      "R=53.35\n",
      "cv=0.1715\n",
      "N=1\n",
      "#calculations\n",
      "k= math.log(T2/T1) /math.log(P2/P1)\n",
      "n=1/(1-k)\n",
      "cx=cv+R/(J*(1-n))\n",
      "dS=N*cx*math.log(T2/T1)\n",
      "#results\n",
      "print '%s %.5f %s' %(\"Change in entropy  =\",dS,\"unit of entropy\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropy  = 0.01411 unit of entropy\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}