{
 "metadata": {
  "name": "",
  "signature": "sha256:f1d828103bb270e68cac7fea789e3b42ea64320d86ed9fcc67d96c498216f06e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 : The first law of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 pg : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "P1 = 200. \t\t\t#psia\n",
      "P2 = 15. \t\t\t#psia\n",
      "V1 = 1. \t\t\t#ft**3\n",
      "g = 1.3\n",
      "\t\t\t\n",
      "# Calculations\n",
      "V2 = V1*(P1/P2)**(1/g)\n",
      "W = -(144*(P2*V2 - P1*V1)/(g-1))\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Work done  =  %.2e ft. lbf\"%(W)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done  =  4.32e+04 ft. lbf\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 pg : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "L = 0.305 \t\t\t#m\n",
      "v = 4.58 \t\t\t#m/s\n",
      "i = 10. \t\t\t#A\n",
      "B = 1.   \t\t\t#W/m**2\n",
      "\t\t\t\n",
      "# Calculations\n",
      "F = i*B*L\n",
      "W = F*v\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Force necessary  =  %.2f N\"%(F)\n",
      "print \" Work per unit time  =  %.2f W\"%(W)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force necessary  =  3.05 N\n",
        " Work per unit time  =  13.97 W\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 pg : 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "U = 2545. \t\t\t#B/hr\n",
      "m = 50. \t\t\t#lbm\n",
      "cv = 1.\n",
      "\t\t\t\n",
      "# Calculations\n",
      "dT = U/(m*cv)\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Change in temperature  =  %.1f F\"%(dT)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in temperature  =  50.9 F\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 pg : 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "P1 = 14.7  \t\t\t#psia\n",
      "V1 = 1. \t\t\t#ft**3\n",
      "P2 = 14.7 \t\t\t#psia\n",
      "M = 28.97\n",
      "T1 = 70.+460 \t\t\t#R\n",
      "T2 = 500.+460 \t\t\t#R\n",
      "cp = 0.24 \t\t\t#B/lbm F\n",
      "\t\t\t\n",
      "# Calculations\n",
      "m = P1*144*V1*M/(1545*T1)\n",
      "Qp = m*cp*(T2-T1)\n",
      "V2 = V1*P1*T2/(P2*T1)\n",
      "\n",
      "W = P1*144*(V2-V1)\n",
      "W = -W/778\n",
      "dU = Qp+W\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Work done  =  %.2f Btu\"%(W)\n",
      "print \" Heat added  =  %.2f Btu\"%(Qp)\n",
      "print \" Change in internal energy  =  %.2f Btu\"%(dU)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done  =  -2.21 Btu\n",
        " Heat added  =  7.73 Btu\n",
        " Change in internal energy  =  5.52 Btu\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5 pg : 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "l = 20. \n",
      "b = 25.\n",
      "h = 8.\n",
      "Vp = 2.5\n",
      "n = 20.\n",
      "P = 14.7    \t\t\t#psia\n",
      "T = 530. \t    \t\t#R\n",
      "t = 15. \t\t    \t#min\n",
      "Qp = 375. \t\t\t    #B/hr\n",
      "cv = 0.1715 \t\t\t#B/lbm F\n",
      "\t\t\t\n",
      "# Calculations\n",
      "Vroom = l*b*h\n",
      "Vair = Vroom-Vp*n\n",
      "m = P*Vair*144/(53.35*T)\n",
      "dU = n*Qp\n",
      "U = t*dU/60\n",
      "dT = U/(m*cv)\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Air temperature rise  =  %d F\"%(dT+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air temperature rise  =  37 F\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}