{
 "metadata": {
  "name": "",
  "signature": "sha256:83b04c725ceaf9254a1b319f62cfdfa8f3ba518f51286a3d08dbbb299f685e47"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 : Thermodynamic Relations"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.17 Page no : 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "B = 5.*10**(-5); \t\t\t# /K\n",
      "K = 8.6*10**(-12); \t\t\t# m**2/N\n",
      "v = 0.114*10**(-3); \t\t\t#m**3/kg\n",
      "p2 = 800.*10**5; \t\t\t#Pa\n",
      "p1 = 20.*10**5; \t\t\t#Pa\n",
      "T = 288.; \t\t\t#K\n",
      "\n",
      "# Calculations and Results\n",
      "W = -v*K/2*(p2**2-p1**2);\n",
      "print (\"(i) Work done on the copper  =  %.3f\")%(W),(\"J/kg\")\n",
      "\n",
      "ds = -v*B*(p2-p1);\n",
      "print (\"(ii) Change in entropy  = %.3f\")% (ds), (\"J/kg K\")\n",
      "\n",
      "Q = T*ds;\n",
      "print (\"(iii) The heat transfer  = %.3f\")%(Q), (\"J/kg\")\n",
      "\n",
      "du = Q-W;\n",
      "print (\"(iv) Change in internal energy  = %.3f\")%(du),(\"J/kg\")\n",
      "\n",
      "R = B**2*T*v/K;\n",
      "print (\"(v) cp \u2013 cv  = %.3f\")%(R),(\"J/kg K\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Work done on the copper  =  -3.135 J/kg\n",
        "(ii) Change in entropy  = -0.445 J/kg K\n",
        "(iii) The heat transfer  = -128.045 J/kg\n",
        "(iv) Change in internal energy  = -124.909 J/kg\n",
        "(v) cp \u2013 cv  = 9.544 J/kg K\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.18 Page no : 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "vg = 0.1274; \t\t\t#m**3/kg\n",
      "vf = 0.001157; \t\t\t#m**3/kg\n",
      "# dp/dT = 32; \t\t\t#kPa/K\n",
      "T3 = 473; \t\t\t#K\n",
      "\n",
      "# Calculations\n",
      "h_fg = 32*10**3*T3*(vg-vf)/10**3;\n",
      "\n",
      "# Results\n",
      "print (\" enthalpy of vapourisation = %.3f\")%(h_fg),(\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " enthalpy of vapourisation = 1910.814 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.19 Page no : 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "# Variables\n",
      "h_fg = 334.; \t\t\t#kJ/kg\n",
      "v_liq = 1.; \t\t\t#m**3/kg\n",
      "v_ice = 1.01; \t\t\t#m**3/kg\n",
      "T1 = 273.; \t\t\t#K\n",
      "T2 = 263.; \t\t\t#K\n",
      "p1 = 1.013*10**5; \t\t\t#Pa\n",
      "\n",
      "# Calculations\n",
      "p2 = (p1+h_fg*10**3/(v_ice-v_liq)*math.log(T1/T2))/10**5;\n",
      "\n",
      "# Results\n",
      "print (\"pressure = %.3f\")%(p2),(\"bar\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pressure = 13.477 bar\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.20 Page no : 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "h_fg = 294.54; \t\t\t#kJ/kg\n",
      "p = 0.1; \t\t\t#bar\n",
      "T = 523; \t\t\t#K\n",
      "\n",
      "# Calculations\n",
      "vg = h_fg*10**3/T/(2.302*3276.6*p*10**5/T**2 - 0.652*p*10**5/T);\n",
      "\n",
      "# Results\n",
      "print (\"specific volume = %.3f\")%(vg),(\"m**3/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "specific volume = 2.139 m**3/kg\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}