{
 "metadata": {
  "name": "",
  "signature": "sha256:7dac7ff4d7c0b0efd562d141ece5753006bca27ad006e31a868bd655b584d707"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10-Chemical Energy Sources"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2.8.1-pg585"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex10.2.8.1;Find Reversible voltage for hydrogen oxygen fuel cell\n",
      "del_G=-237.3*10**3;##Joules/gm-mole of H2\n",
      "##Reversible voltafe E of a cell is given by =del_Wrev/nF=-del_G/nF\n",
      "##since 2 electrons are transferred per molecule of H2.thus\n",
      "n=2.;\n",
      "F=96500.;##Faraday's constant\n",
      "E=-del_G/(n*F);\n",
      "print'%s %.2f %s'%(\"Reversible voltage=\",E,\" volts\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reversible voltage= 1.23  volts\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2.8.2-pg585"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex10.2.8.2;calculate voltage output of cell,efficiency,electric work output,heat transfer to the surroundings\n",
      "import math\n",
      "##1] voltage output of cell\n",
      "del_G=-237.3*10**3;##Joules/gm-mole of H2\n",
      "n=2.;\n",
      "F=96500.;##Faraday's constant\n",
      "E=-del_G/(n*F);\n",
      "print'%s %.2f %s'%(\" E=\",E,\" volts\");\n",
      "##2] Efficiency\n",
      "##nmax=del_Wmax/-(del_H)25 degree celcuis = -(del_G)T/(-del_H)25\n",
      "del_G_at298k=-56690.;##unit=kcal/kg mole\n",
      "del_H_at298k=-68317.;##unit=kcal/kg mole\n",
      "nmax=del_G_at298k/del_H_at298k\n",
      "print'%s %.2f %s'%(\"\\n nmax=\",nmax,\"\")\n",
      "##3]Electric work output per mole\n",
      "F=(96500/4.184);\n",
      "del_Wrever=(n*F*E);\n",
      "print'%s %.2f %s'%(\"\\n Electric work output per mole=\",del_Wrever,\" kcal/kg mole\");\n",
      "##4] Heat transfer to the surroundings\n",
      "##the heat transfer is Q=T*del-s=del_H_at298k-del_G_at298k\n",
      "Q=del_H_at298k-del_G_at298k;\n",
      "print'%s %.2f %s'%(\"\\n The heat transfer is Q=\",Q,\" kcal/kg mole\");\n",
      "##The negative sign indicates that the heat is removed from the cell and transferred to the surrounding\n",
      "\n",
      "##value of \"Electric work output per mole\" is approximate in the text book to the real calculated value"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " E= 1.23  volts\n",
        "\n",
        " nmax= 0.83 \n",
        "\n",
        " Electric work output per mole= 56716.06  kcal/kg mole\n",
        "\n",
        " The heat transfer is Q= -11627.00  kcal/kg mole\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2.8.3-pg587"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex10.2.8.3;The heat transferred to the surrounding\n",
      "import math\n",
      "del_G_at298k=-237191.;##unit=kJ/kg mole\n",
      "del_H_at298k=-285838.;##unit=kJ/kg mole\n",
      "ne=2.;\n",
      "F=96500.;##Faraday's constant\n",
      "E=-del_G_at298k/(ne*F);\n",
      "print'%s %.2f %s'%(\" E=\",E,\" volts\");\n",
      "nmax=del_G_at298k/del_H_at298k\n",
      "print'%s %.2f %s'%(\"\\n nmax=\",nmax,\"\");\n",
      "nmax=nmax*100;\n",
      "print'%s %.2f %s'%(\"=0\",nmax,\" persent\");\n",
      "##Electric work output per mole of the fule is We=-del_G kJ/kg mole\n",
      "We=del_G_at298k##kJ/kg mole\n",
      "print'%s %.2f %s'%(\"\\n Electric work output per mole of the fule is We=\",We,\" kJ/kg mole\")\n",
      "##since there is 1 mol os H2O for each mole of fule,there is also a work output of 237191 kJ/kg mole\n",
      "##Heat transferred is Q=T*del-s=del_H_at298k-del_G_at298k\n",
      "Q=del_H_at298k-del_G_at298k;\n",
      "print'%s %.2f %s'%(\"\\n The heat transfer is Q=\",Q,\" kJ/kg mole\");\n",
      "##The negative sign indicates that the heat is removed from the cell and transferred to the surrounding\n",
      "\n",
      "##value of \"Electric work output per mole\" is misprinted in the text book.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " E= 1.23  volts\n",
        "\n",
        " nmax= 0.83 \n",
        "=0 82.98  persent\n",
        "\n",
        " Electric work output per mole of the fule is We= -237191.00  kJ/kg mole\n",
        "\n",
        " The heat transfer is Q= -48647.00  kJ/kg mole\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2.8.4-pg587"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex10.2.8.4;calculate del_G,del_S,del_H;\n",
      "import math\n",
      "##We have the relation del_G=-n*F*E\n",
      "##where,del_G=gibbs free energy of the system at 1 atm and temperature(T)\n",
      "n=1.;##numbers of electons transferred per molecule of reactant\n",
      "E=0.0455;##volts ;e.m.f. of the cell\n",
      "F=96500.;##Faraday's constant\n",
      "##let X=dE/dT\n",
      "X=0.000338;\n",
      "del_G=-n*F*E;\n",
      "print'%s %.2f %s'%(\" del_G=\",del_G,\" joules\");\n",
      "##del_S = Entropy change of the system at temperature T and press p=1 atm in the case\n",
      "del_S=n*F*(X);##del_S=n*F*(dE/dT)\n",
      "print'%s %.2f %s'%(\"\\n del_S=\",del_S,\" joules/deg.\");\n",
      "##And entropy change is given by the relation del_H=nF[T(dE/dT)-E]\n",
      "T=298;\n",
      "del_H=n*F*((T*X)-E);\n",
      "print'%s %.2f %s'%(\"\\n del_H=\",del_H,\" joule\");\n",
      "\n",
      "\n",
      "##value are taken approximate in the text book to the real calculated value\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " del_G= -4390.75  joules\n",
        "\n",
        " del_S= 32.62  joules/deg.\n",
        "\n",
        " del_H= 5329.12  joule\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2.8.5-pg588"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Ex10.2.8.5;heat transfer rate would be involved under these circumstances\n",
      "import math\n",
      "del_G_at25degree_celcius=-195500.;##unit=cal/gm mole\n",
      "del_H_at25degree_celcius=-212800.;##unit=cal/gm mole\n",
      "F=(96500/4.184);##since F=96500 coulombs/gm-mole\n",
      "n=8.\n",
      "E_at25degree_celcius=-del_G_at25degree_celcius/(n*F);##Joules/coulomb\n",
      "print'%s %.2f %s'%(\" E_at25degree_celcius=\",E_at25degree_celcius,\" volts=1.060 volts\");\n",
      "##Max. efficiency  nmax=del_Wmax/-(del_H)at25 degree celcuis = -(del_G)T/(-del_H)25\n",
      "nmax=del_G_at25degree_celcius/del_H_at25degree_celcius;\n",
      "print'%s %.2f %s'%(\"\\n nmax=\",nmax,\"\");\n",
      "##voltage efficiency nv=on load voltage/open circuit voltage=Operating voltage/Theoretical voltage\n",
      "Theoretical_voltage=1.060/0.92;\n",
      "print'%s %.2f %s'%(\"\\n Theoretical_voltage=\",Theoretical_voltage,\" volts\");\n",
      "##power developed=100 kW=100*10^3 W\n",
      "power_developed=(100*10**3)*0.86;##unit=kcal/hr; since 1 watt=1 joule/sec=0.86 kcal/hr\n",
      "print'%s %.2f %s'%(\"\\n power_developed=\",power_developed,\" kcal/hr\");\n",
      "del_G=-195500.;\n",
      "##Required flow rate of Methane\n",
      "R_F_R_O_M=(power_developed*16.)/del_G;##kg/hr;\n",
      "##(methane moles)=16\n",
      "print'%s %.2f %s'%(\"\\n flow rate of Methane=\",R_F_R_O_M,\" kg/hr\");\n",
      "##Heat transfer Q=T8del_s=del_H+del_w=del_H-del_G\n",
      "Q=del_H_at25degree_celcius-del_G_at25degree_celcius;\n",
      "print'%s %.2f %s'%(\"\\n The heat transfer is Q=\",Q,\" kcal/kg mole\");\n",
      "\n",
      "##The value are approximate in the text book to the real calculated value\n",
      "##value of \"Required flow rate of methane\" is wrong in the text book.\n",
      "##value of \"Heat transfer\" is wrong in the text book.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " E_at25degree_celcius= 1.06  volts=1.060 volts\n",
        "\n",
        " nmax= 0.92 \n",
        "\n",
        " Theoretical_voltage= 1.15  volts\n",
        "\n",
        " power_developed= 86000.00  kcal/hr\n",
        "\n",
        " flow rate of Methane= -7.04  kg/hr\n",
        "\n",
        " The heat transfer is Q= -17300.00  kcal/kg mole\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}