{
 "metadata": {
  "name": "",
  "signature": "sha256:af8a4c7e1aee0095ba7f54013d97317f8251c73de6783cf6d6c6f47de9fd5e14"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14 :\n",
      "direct energy conversion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.1 pg : 385"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "T = 25.+273 \t\t\t#K\n",
      "F = 23060.\n",
      "\t\t\t\n",
      "# Calculations\n",
      "H = -68317.\n",
      "G = -56690.\n",
      "Er = -G/(2*F)\n",
      "eta = G/H\n",
      "W = -G\n",
      "Q = H-G\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Voltage output of the cell  =  %.3f volts\"%(Er)\n",
      "print \" Efficiency  =  %d percent\"%(eta*100 +1)\n",
      "print \" Electrical Work output  =  %d cal/mol H2\"%(W)\n",
      "print \" Heat transfer to the surroundings  =  %d cal/mol H2\"%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage output of the cell  =  1.229 volts\n",
        " Efficiency  =  83 percent\n",
        " Electrical Work output  =  56690 cal/mol H2\n",
        " Heat transfer to the surroundings  =  -11627 cal/mol H2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.2 pg : 395"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "import math \n",
      "x1 = 0.75\n",
      "x2 = 0.25\n",
      "an = -190*10**-6 \t\t\t#volt/C\n",
      "rn = 1.45*10**-3 \t\t\t#ohm cm\n",
      "zn = 2*10**-3 \t\t\t#K**-1\n",
      "ap = 190*10**-6 \t\t\t#volt/C\n",
      "rp = 1.8*10**-3 \t\t\t#ohm cm\n",
      "zp = 1.7*10**-3 \t\t\t#K**-1\n",
      "T = 200.+273 \t\t\t#K\n",
      "Tc = 373. \t\t\t#K\n",
      "Th = 573. \t\t\t#K\n",
      "\t\t\t\n",
      "# Calculations\n",
      "Ktn = an**2/(rn*zn)\n",
      "Ktp = ap**2/(rp*zp)\n",
      "Z = (an-ap)**2 /(math.sqrt(rn*Ktn) + math.sqrt(rp*Ktp))**2\n",
      "Ap = math.sqrt(Ktn*rp/Ktp/rn)\n",
      "An = 1\n",
      "K = Ktn*An+ Ktp*Ap\n",
      "R = rn/An + rp/Ap\n",
      "mopt = math.sqrt(1+ Z*T)\n",
      "RL = mopt*R\n",
      "nopt = (T-273)*(mopt-1)/(Th*(mopt+ Tc/Th))\n",
      "nmax = T/(Th*(1+1- T/Th/2 + 4/Th/Z))\n",
      "nmax = 0.0624\n",
      "dT = T-273\n",
      "Popt = (an-ap)**2 *dT**2 /((1+mopt)**2 *RL)\n",
      "Pmax = (an-ap)**2 *dT**2 /((1+1)**2 *R)\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Optimum efficiency  =  %.2f percent\"%(nopt*100)\n",
      "print \" Max. efficiency  =  %.2f percent\"%(nmax*100)\n",
      "print \" Optimum power  =  %.3f Watt\"%(Popt)\n",
      "print \" Maximum power  =  %.3f Watt\"%(Pmax)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Optimum efficiency  =  6.36 percent\n",
        " Max. efficiency  =  6.24 percent\n",
        " Optimum power  =  0.249 Watt\n",
        " Maximum power  =  0.478 Watt\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.3 pg : 399"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "import math \n",
      "phic = 2.5 \t\t\t#V\n",
      "phia = 2. \t\t\t#V\n",
      "phip = 0.1\t\t\t#V\n",
      "Th = 2000. \t\t\t#K\n",
      "Tc = 1000. \t\t\t#K\n",
      "eff = 0.2\n",
      "k = 1.38*10**-23\n",
      "e = 1.6*10**-19\n",
      "sigma = 5.67*10**-12\n",
      "\t\t\t\n",
      "# Calculations\n",
      "V = phic-phia-phip\n",
      "Jc = 1.2*10**6 *Th**2 *math.exp(-e*phic/(k*Th))\n",
      "Ja = 1.2*10**6 *Tc**2 *math.exp(-e*phia/(k*Tc))\n",
      "J = Jc\n",
      "Qc1 = J*(phic + 2*k*Th/e) + eff*sigma*10**4 *(Th**4 - Tc**4)\n",
      "eta1 = J*0.4/Qc1\n",
      "eta2 = (Th-Tc)/Th\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Efficiency of the device  =  %.1f percent\"%(eta1*100)\n",
      "print \" Carnot efficiency  =  %d percent\"%(eta2*100)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of the device  =  13.7 percent\n",
        " Carnot efficiency  =  50 percent\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}