{
 "metadata": {
  "name": "",
  "signature": "sha256:f23f3b5a4a7805425d91a3e612fb93280cd65df2c8a0f91d708a7c96bb4ea6b7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter6-Combustion Chambers and Afterburners"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg309"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine number of mole of hydrogen and oxygen\n",
      "nH2=12/2. ##molecular mass og hydrogen =2kg/kmol\n",
      "nO2=8/32. ##Molecular mass of O2=32kg/kmol\n",
      "print'%s %.f %s'%(\"No. of kilomoles of H2\",nH2,\"\")\n",
      "print'%s %.2f %s'%(\"No. of kilomoles of O2\",nO2,\"\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "No. of kilomoles of H2 6 \n",
        "No. of kilomoles of O2 0.25 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ex3-pg317"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate lower and higher heating values of hydrogen\n",
      "T=298.16 ##in K\n",
      "dhf=-241827. ##heat of formation of H2O(g in kJ.\n",
      "n=1 ##kmol\n",
      "Qr=n*dhf ##kJ/kmol\n",
      "LHV=(-1.)*Qr/2.\n",
      "print'%s %.1f %s'%(\"LHV in\",LHV,\"kJ/kg\")\n",
      "HHV=LHV+9*2443\n",
      "print'%s %.1f %s'%(\"HHV in \",HHV,\"kJ/kg\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "LHV in 120913.5 kJ/kg\n",
        "HHV in  142900.5 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ex5-pg320"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calcualte the ratio Nh2/no2 of the reactants and fuel oxdizer and adiabatic flame temperature\n",
      "##from equation CH4+2.4(O2+3.76N2)-->CO2+2H2O+0.4O2+9.02N2\n",
      "f=(12+4.)/(2.4*(32.+3.76*28.)) ##fuel to air ratio based on mass.\n",
      "fs=(12+4.)/(2.*(32.+3.76*28.)) ##fuel to air ratio based on stoichometric condition.\n",
      "feq=f/fs\n",
      "print'%s %.7f %s'%(\"fuel to air ratio based on mass\",f,\"\")\n",
      "print'%s %.7f %s'%(\"fuel to air ratio based on stoichometric condition\",fs,\"\")\n",
      "print'%s %.7f %s'%(\"Equivalent ratio\",feq,\"\")\n",
      "dH=-802303 ##kJ\n",
      "dC=484.7 ##kJ\n",
      "Dt=(-1)*dH/dC ##Dt=T2-Tf\n",
      "Tf=25+273\n",
      "T2=Dt+Tf\n",
      "print'%s %.4f %s'%(\"The diabatic flame temperature in\",T2,\" K\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fuel to air ratio based on mass 0.0485625 \n",
        "fuel to air ratio based on stoichometric condition 0.0582751 \n",
        "Equivalent ratio 0.8333333 \n",
        "The diabatic flame temperature in 1953.2569  K\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy\n",
      "#calculate mole fraction of N2 at equlibrium when pm is 1 atm and 10 atms\n",
      "print(\"Example 6.6\")\n",
      "Kp=0.1\n",
      "\n",
      "pm=1.\n",
      "y=2\n",
      "d=numpy.roots(y)\n",
      "x=0.1561738 \n",
      "print'%s %.2f %s '%(\"(a)Mole fraction of N2 at equilibrium when pm is 1 atm:\",x,\"\")\n",
      "#part (b)\n",
      "Kp=0.1\n",
      "\n",
      "pm=10.\n",
      "x=0.0499376\n",
      "y=- 0.1 + 40.1*x\n",
      "d=numpy.roots(y)\n",
      "i=numpy.linspace(1,2,num=1);\n",
      "print'%s %.2f %s '%(\"(b)Mole fraction of N2 at equilibrium when pm is 10 atm:\",x,\"\")\n",
      "    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Example 6.6\n",
        "(a)Mole fraction of N2 at equilibrium when pm is 1 atm: 0.16  \n",
        "(b)Mole fraction of N2 at equilibrium when pm is 10 atm: 0.05  \n"
       ]
      }
     ],
     "prompt_number": 26
    }
   ],
   "metadata": {}
  }
 ]
}