diff options
author | hardythe1 | 2015-04-07 15:58:05 +0530 |
---|---|---|
committer | hardythe1 | 2015-04-07 15:58:05 +0530 |
commit | c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131 (patch) | |
tree | 725a7d43dc1687edf95bc36d39bebc3000f1de8f /Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb | |
parent | 62aa228e2519ac7b7f1aef53001f2f2e988a6eb1 (diff) | |
download | Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.tar.gz Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.tar.bz2 Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.zip |
added books
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb')
-rwxr-xr-x | Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb | 472 |
1 files changed, 472 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb new file mode 100755 index 00000000..fd5d0f72 --- /dev/null +++ b/Thermodynamics:_From_concepts_to_applications/Chapter19_2.ipynb @@ -0,0 +1,472 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:62da0bbd390eac5357f5f997103c8800ba34f828bad9afe3f011ec1444ac1334"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter19-Chemical reactions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Example1-pg 404"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#caluclate fuel ratio and excess air and emass air-fuel ratio\n",
+ "##initialisation of variables\n",
+ "pN2= 79. ##percent\n",
+ "VN2= 82.3 ##m^3\n",
+ "VCO2= 8. ##m^3\n",
+ "VCO= 0.9 ##m^3\n",
+ "M= 32. ##gms\n",
+ "M1= 28. ##gms\n",
+ "##CALCULATIONS\n",
+ "P= (pN2/(100-pN2))\n",
+ "z= VN2/P\n",
+ "x= VCO2+VCO\n",
+ "w= VCO2+(VCO/2)+(VCO2/10)\n",
+ "y= 2*w\n",
+ "r= y/x\n",
+ "TO= x+(y/4)\n",
+ "X= (z/TO)-1\n",
+ "AF= z*(M+P*M1)/(12*x+y)\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%('fuel ratio=',r,'')\n",
+ "print'%s %.3f %s'%('excess air=',X,'')\n",
+ "print'%s %.2f %s'%('emass air-fuel ratio=',AF,'')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "fuel ratio= 2.079 \n",
+ "excess air= 0.618 \n",
+ "emass air-fuel ratio= 23.98 \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg 410"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate heat interaction\n",
+ "##initialisation of variables\n",
+ "m1= 24. ##kg\n",
+ "M1= 32. ##kg\n",
+ "m2= 28. ##kg\n",
+ "M2= 28. ##kg\n",
+ "e= 0.5\n",
+ "T3= 1800. ##C\n",
+ "T0= 25. ##C\n",
+ "T1= 25. ##C\n",
+ "T2= 100. ##C\n",
+ "R= 8.314 ##Jmol K\n",
+ "cp= 4.57 ##J/mol K\n",
+ "cp1= 3.5 ##J/mol K\n",
+ "cp2= 3.5 ##J/mol K\n",
+ "hCO2= -393522. ##J\n",
+ "hCO= -110529. ##J\n",
+ "##CALCULATIONS\n",
+ "n1= m1/M1\n",
+ "n2= m2/M2\n",
+ "N= n1-0.5*e\n",
+ "N1= n2-e\n",
+ "N2= e\n",
+ "N3= N+N1+N2\n",
+ "y1= N/N3\n",
+ "Q= ((N*cp+N1*cp1+N2*cp2)*R*(T3-T0)-(n1*cp*(T1-T0)+n2*cp2*(T2-T1))+N*(hCO2-hCO))/60.\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%(' Heat interaction=',Q,'kW ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Heat interaction= -940 kW \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg 412"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate adiabatic flame temperature\n",
+ "##initialisation of variables\n",
+ "T0= 25. ##C\n",
+ "T1= 220. ##C\n",
+ "hCO2= -393520 ##kJ/kg\n",
+ "hH2O= -241830 ##kJ/kg\n",
+ "hC3H8= -103850 ##kJ/kg= 1.4\n",
+ "R= 8.314 ##Jmol K\n",
+ "k= 1.4\n",
+ "k1= 1.29\n",
+ "##CALCULATIONS\n",
+ "T= T0+((15*(R*(k/(k-1)))*4.762*(T1-T0)-(3*hCO2+4*hH2O-hC3H8))/(R*((3+4)*(k1/(k1-1))+(10+56.43)*(k/(k-1)))))\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('adiabatic flame temperature=',T,'C ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "adiabatic flame temperature= 1142.4 C \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5-pg 415"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy formation\n",
+ "##initialisation of variables\n",
+ "T= 25. ##C\n",
+ "hfT= -241820 ##kJ/kmol\n",
+ "R= 8.314 ##J/mol K\n",
+ "k= 1.4\n",
+ "cpH2O= 4.45\n",
+ "cpO2= 3.5\n",
+ "T1= 1000. ##C\n",
+ "##CALCULATIONS\n",
+ "S= (cpH2O-k*cpO2)\n",
+ "hfT1= hfT+S*(T1-T)\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%('enthalpy formation=',hfT1,'kJ/kmol ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy formation= -242259 kJ/kmol \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6-pg 418"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate equlibrium constant at K and KT1\n",
+ "##initialisation of variables\n",
+ "R= 8.314 ##J/mol K\n",
+ "T= 25. ##C\n",
+ "gf= 16590. ##kJ/kmol\n",
+ "T1= 500. ##C\n",
+ "Cp= 4.157 ##J/mol K\n",
+ "hf= -46190 ##kJ/kmol\n",
+ "e=0.5\n",
+ "##CALCULATIONS\n",
+ "K=math.pow(math.e,gf/(R*(273.15+T)))\n",
+ "r= (1-((273.15+T)/(273.15+T1)))*((hf/(R*(273.15+T)))+(R/Cp))-2*math.log((273.15+T1)/(273.15+T))+0.6\n",
+ "KT1= K*math.pow(math.e,r)\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('equilibrium constant=',K,'bar^-1 ')\n",
+ "print'%s %.5f %s'%('equilibrium constant=',KT1,'bar^-1 ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "equilibrium constant= 806.5 bar^-1 \n",
+ "equilibrium constant= 0.00797 bar^-1 \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7-pg 419"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#what equilibrium constant at T1 and T2\n",
+ "##initialisation of variables\n",
+ "uCO2= -394374 ##J/mol\n",
+ "uCO= -137150 ##J/mol\n",
+ "uO2= 0.\n",
+ "R= 8.314 ##J/mol K\n",
+ "T= 25. ##C\n",
+ "cpCO2= 4.57 ##J/mol K\n",
+ "cpCO= 3.5 ##J/mol K\n",
+ "cpO2= 3.5 ##J/mol K\n",
+ "T1= 1500. ##C\n",
+ "hf= -393522 ##kJ/kmol\n",
+ "gf= -110529 ##kJ/kmol\n",
+ "T2= 2500. ##C\n",
+ "##CALCULATIONS\n",
+ "r= -(uCO2-uCO-0.5*uO2)/(R*(273.15+T))\n",
+ "s= (cpCO2-cpCO-0.5*cpO2)\n",
+ "r1= (1-((273.15+T)/(273.15+T1)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T1)/(273.15+T))\n",
+ "KT1= math.pow(math.e,r+r1)\n",
+ "r2= (1-((273.15+T)/(273.15+T2)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T2)/(273.15+T))\n",
+ "KT2= math.pow(math.e,r+r2)\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%('equilibrium constant at T1=',KT1,'C ')\n",
+ "print'%s %.3f %s'%('equilibrium constant at T2=',KT2,'C ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "equilibrium constant at T1= 3477 C \n",
+ "equilibrium constant at T2= 2.635 C \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8-pg422"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#what is maximum work of given variable \n",
+ "##initialisation of variables\n",
+ "Wc= 12. ##kg\n",
+ "hf= -393520 ##kJ/kmol\n",
+ "gf= -394360 ##kJ/kmol\n",
+ "##CALCULATIONS\n",
+ "Wmax= -gf/Wc\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%('maximum work=',Wmax,'kJ/kg of carbon ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum work= 32863 kJ/kg of carbon \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example9-pg423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate the outlet temperature and energy of formation and energy out let and energy of the products\n",
+ "##initialisation of variables\n",
+ "T= 25 ##C\n",
+ "R= 8.314 ##Jmol K\n",
+ "k= 1.27\n",
+ "k1= 1.34\n",
+ "hf= -393520 ##kJ/kmol\n",
+ "M= 28 ##gms\n",
+ "gf= -394360 ##kJ/kmol\n",
+ "M= 12 ##gms\n",
+ "##CALCULATIONS\n",
+ "T1= T+(-hf/((R)*((k/(k-1))+(0.2+4.5144)*(k1/(k1-1)))))\n",
+ "Bin= 0\n",
+ "dh= (k1*R/(k1-1))*(T1-T)\n",
+ "dh1= (k1*R/(k1-1))*math.log((273.15+T1)/(273.15+T))\n",
+ "H= dh-(273.15+T)*dh1\n",
+ "h= (k*R/(k-1))*(T1-T)+hf\n",
+ "h1= (k*R/(k-1))*math.log((273.15+T1)/(273.15+T))+((hf-gf)/(273.15+T))\n",
+ "h2= h-(273.15+T)*h1\n",
+ "Bout= (h2+(0.2+4.5144)*H)/M\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'%('outlet temperature=',T1,'C')\n",
+ "print'%s %.f %s'%('energy of formation=',Bin,'J')\n",
+ "print'%s %.f %s'%('energy at outlet=',H,'kJ/kmol')\n",
+ "print'%s %.f %s'%('energy of the products=',Bout,'k')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "outlet temperature= 2057.82 C\n",
+ "energy of formation= 0 J\n",
+ "energy at outlet= 46519 kJ/kmol\n",
+ "energy of the products= -9961 k\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example10-pg427"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate the change in energy and amount of air and gas and netchange in energy and percent change in energy\n",
+ "##initialisation of variables\n",
+ "b= 1475.30 ##kJ/kg\n",
+ "b0= 144.44 ##kJ/kg\n",
+ "h2= 3448.6 ##kJkg\n",
+ "h1= 860.5 ##kJ/kg\n",
+ "k= 1.27 \n",
+ "k1= 1.34\n",
+ "R= 8.314 ##J/mol K\n",
+ "hf= -393520 ##kJ/kmol\n",
+ "hg= 72596 ##kJ/kmol\n",
+ "Mc= 12 ##kg\n",
+ "n= 1.2 ##moles\n",
+ "n1= 3.76 ##moles\n",
+ "M= 32. ##gms\n",
+ "M1= 28. ##gms\n",
+ "M2= 44. ##gms\n",
+ "n2= 0.2 ##moles\n",
+ "n3= 4.512 ##moles\n",
+ "B1= 25592. ##kJ/kmol C\n",
+ "B2= 394360. ##kJ/kmol C\n",
+ "e= 0.008065\n",
+ "##CALCULATIONS\n",
+ "B= b-b0\n",
+ "Q= h2-h1\n",
+ "CpCO2= k*R/(k-1)\n",
+ "CpO2= k1*R/(k1-1)\n",
+ "Qcoal= (hg+hf)/Mc\n",
+ "mcoal= Q/(-Qcoal)\n",
+ "ncoal= mcoal/Mc\n",
+ "r= (n*M+n1*M1)/Mc\n",
+ "r1= (M2+n2*M+n3*M1)/Mc\n",
+ "mair= r*mcoal\n",
+ "mgas= r1*mcoal\n",
+ "Bfuel= (B1-B2)*e\n",
+ "Bnet= Bfuel+B\n",
+ "p= B*100/(-Bfuel)\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'% ('change in energy=',B,'kJ/kg ')\n",
+ "print'%s %.3f %s'%('amount of air=',mair,'kg/kg ')\n",
+ "print'%s %.3f %s'%('amount of gas=',mgas,'kg/kg ')\n",
+ "print'%s %.3f %s'%('net change in energy=',Bnet,'kg/kg steam ')\n",
+ "print'%s %.2f %s'%('percent energy in original fuel=',p,'percent ')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in energy= 1330.86 kJ/kg \n",
+ "amount of air= 1.159 kg/kg \n",
+ "amount of gas= 1.425 kg/kg \n",
+ "net change in energy= -1643.254 kg/kg steam \n",
+ "percent energy in original fuel= 44.75 percent \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |