{
 "metadata": {
  "name": "",
  "signature": "sha256:daee8dea306dcf3f243bce271ea4da56ca30a788427b14afefd3a09c75dc55c1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER07:COMPRESSIBLE FLOW SOME PRELIMINARY ASPECTS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E01 : Pg 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "import math \n",
      "l = 5.;                # dimensions of the room\n",
      "b = 7.;\n",
      "h = 3.3;\n",
      "V = l*b*h;            # volume of the room\n",
      "p = 101000.;           # ambient pressure\n",
      "T = 273. + 25.;         # ambient temperature\n",
      "R = 287.;              # gas constant\n",
      "gam = 1.4;            # ratio of specific heats\n",
      "cv = R/(gam-1.);\n",
      "cp = gam*R/(gam-1.);\n",
      "\n",
      "# the density can by calculaled by the ideal gas law\n",
      "rho = p/R/T;\n",
      "\n",
      "# thus the mass is given by\n",
      "M = rho*V;\n",
      "\n",
      "# from eq.(7.6a), the internal energy per unit mass is\n",
      "e = cv*T;\n",
      "\n",
      "# thus internal energy in the room is\n",
      "E = e*M;\n",
      "\n",
      "# from eq.(7.6b), the enthalpy per unit mass is given by\n",
      "h = cp*T;\n",
      "\n",
      "# Thus the enthalpy in the room is\n",
      "H = M*h;\n",
      "\n",
      "print\"The internal energy in the room is: E =\", E/10**7\n",
      "print\"The Enthalpy in the room is: H = \",H/10**7"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The internal energy in the room is: E = 2.916375\n",
        "The Enthalpy in the room is: H =  4.082925\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E02 : Pg 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "p_inf = 22790.9;            # ambient pressure at 36000 ft\n",
      "T_inf = 217.2;              # ambient temperature at 36000 ft\n",
      "p = 19152;                  # pressure at the given point\n",
      "gam = 1.4;\n",
      "\n",
      "# thus the temperature at the given point can be calculated by eq.(7.32) as\n",
      "T = T_inf*((p/p_inf)**((gam-1)/gam));\n",
      "\n",
      "print\"The temperature at the given point is: T =\",T,\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature at the given point is: T = 206.668775312 K\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E03 : Pg 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# All the quantities are expressed in SI units\n",
      "\n",
      "p =101000;                # static pressure\n",
      "T = 320;                  # static temperature\n",
      "v = 1000;                 # velocity\n",
      "gam = 1.4;                # ratio of specific heats\n",
      "R = 287;                  # universal gas constant\n",
      "cp = gam*R/(gam-1);       # specific heat at constant pressure\n",
      "\n",
      "# from eq.(7.54), the total temperature is given by\n",
      "T0 = T + (v**2)/2/cp;\n",
      "\n",
      "# from eq.(7.32),the total pressure is given by\n",
      "p0 = p*((T0/T)**(gam/(gam-1)));\n",
      "\n",
      "p0_atm = p0/101000;\n",
      "\n",
      "\n",
      "print\"The total temperature and pressure are given by: T0 =\",T0,\"K\"\n",
      "print\"P0 =\",p0_atm,\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total temperature and pressure are given by: T0 = 817.760079642 K\n",
        "P0 = 26.678766535 atm\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}