summaryrefslogtreecommitdiff
path: root/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Thermodynamics_An_Engineering_Approach/Chapter16.ipynb')
-rwxr-xr-xThermodynamics_An_Engineering_Approach/Chapter16.ipynb378
1 files changed, 378 insertions, 0 deletions
diff --git a/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb
new file mode 100755
index 00000000..4326dc6f
--- /dev/null
+++ b/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb
@@ -0,0 +1,378 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Chapter 16: Chemical and Phase Equilibrium"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-1 ,Page No.798"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import exp\n",
+ "\n",
+ "#given data\n",
+ "T=298.15;#reaction temperature in K\n",
+ "\n",
+ "#from Table A-26\n",
+ "g=455510;\n",
+ "\n",
+ "#constants used\n",
+ "R=8.314;#in kJ/kmol K\n",
+ "\n",
+ "#calculations\n",
+ "# N2 = 2N\n",
+ "dG=2*g;\n",
+ "logKp=-dG/(R*T);\n",
+ "Kp=exp(logKp);\n",
+ "print('Kp = ',Kp)\n",
+ "print'in comparison to Table A-28 ln Kp value of -367.5 our result is %i'%logKp;\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "('Kp = ', 2.4396097259977668e-160)\n",
+ "in comparison to Table A-28 ln Kp value of -367.5 our result is -367\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-2 ,Page No.798"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P=10;#pressure in atm\n",
+ "\n",
+ "#constants\n",
+ "vH2=1;\n",
+ "vH=2;\n",
+ "\n",
+ "#calculations\n",
+ "# H2 = 0.9H2 + 0.2H\n",
+ "NH=0.2;\n",
+ "NH2=0.9;\n",
+ "Nt=NH+NH2;\n",
+ "#from Eq. 16-15\n",
+ "Kp=((NH**vH)/(NH2**vH2))*(P/Nt)**(vH-vH2);\n",
+ "#at this value of Kp from Table A-28\n",
+ "T=3535;\n",
+ "print'temperature %i K is'%T;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "temperature 3535 K is\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-6 ,Page No.807"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#reaction\n",
+ "# H2 + 0.5O2 = H2O\n",
+ "#enthalpy datas in kJ/kmol \n",
+ "#of H2\n",
+ "hfH=-241820;\n",
+ "h2000H=82593;\n",
+ "h298H=9904;\n",
+ "#of O2\n",
+ "hfO=0;\n",
+ "h2000O=61400;\n",
+ "h298O=8468;\n",
+ "#of H2O\n",
+ "hfw=0;\n",
+ "h2000w=67881;\n",
+ "h298w=8682;\n",
+ "#Kp data from A-28\n",
+ "Kp2=869.6;\n",
+ "Kp1=18509;\n",
+ "T1=1800;\n",
+ "T2=2200;\n",
+ "\n",
+ "#constants used\n",
+ "Ru=8.314;#in kJ/kmol K\n",
+ "\n",
+ "#calculations\n",
+ "#part - a\n",
+ "hR=1*(hfH+h2000H-h298H)-1*(hfO+h2000O-h298O)-0.5*(hfw+h2000w-h298w);\n",
+ "print'enthalpy of the reaction %i kJ/kmol using enthalpy data'%round(hR);\n",
+ "#part - b\n",
+ "hR=Ru*(T1*T2)/(T2-T1)*log(Kp2/Kp1);\n",
+ "print'enthalpy of the reaction %i kJ/kmol using enthalpy data'%round(hR);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy of the reaction -251663 kJ/kmol using enthalpy data\n",
+ "enthalpy of the reaction -251698 kJ/kmol using enthalpy data\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-7 ,Page No.809"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=120+273.15;#temperature of saturated water in K\n",
+ "\n",
+ "#from Table A-4\n",
+ "hf=503.81;\n",
+ "hg=2706;\n",
+ "sf=1.5279;\n",
+ "sg=7.1292;\n",
+ "\n",
+ "#calculations\n",
+ "print('liquid phase');\n",
+ "gf=hf-T*sf;\n",
+ "print'gf value %f kJ/kg'%round(gf,1);\n",
+ "print('vapour phase');\n",
+ "gg=hg-T*sg;\n",
+ "print'gg value %f kJ/kg'%round(gg,1);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "liquid phase\n",
+ "gf value -96.900000 kJ/kg\n",
+ "vapour phase\n",
+ "gg value -96.800000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-8 ,Page No.813"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=15;#lake temperature in C\n",
+ "P=92.0;#atmospheric pressure in kPa\n",
+ "\n",
+ "#from Table A-4\n",
+ "Pv=1.7057;\n",
+ "\n",
+ "#calculations\n",
+ "yv=Pv/P;\n",
+ "print'mole fraction of water vapor at the surface is %f'%round(yv,4);\n",
+ "yw=1-yv;\n",
+ "print'mole fraction of water in the lake is %f percent'%(round(yw)*100)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mole fraction of water vapor at the surface is 0.018500\n",
+ "mole fraction of water in the lake is 100.000000 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-9 ,Page No.214"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=17.0;#lake temperature in C\n",
+ "P=92.0;#atmospheric pressure in kPa\n",
+ "\n",
+ "#from Table A-4\n",
+ "Pv=1.96;\n",
+ "\n",
+ "#constants from Table 16-2\n",
+ "H=62000.0;\n",
+ "\n",
+ "#calculations\n",
+ "Pda=P-Pv;#dry air\n",
+ "yda=Pda/H/100;#in bar\n",
+ "print'mole fraction of air is %f'%(yda)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mole fraction of air is 0.000015\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-10 ,Page No.814"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=358;#hydrogen gas temperature in K\n",
+ "P=300/100;#pressure of hydrogen gas in bar\n",
+ "\n",
+ "#constants used\n",
+ "M=2;\n",
+ "s=0.00901;#solubility in kmol/m^3 bar\n",
+ "p=0.027;\n",
+ "\n",
+ "#calculations\n",
+ "pH2=s*P;\n",
+ "print'molar density of H2 %f kmol/m^3'%round(pH2,3);\n",
+ "pH2=p*M;\n",
+ "print'mass density of H2 %f kg/m^3'%round(pH2,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "molar density of H2 0.027000 kmol/m^3\n",
+ "mass density of H2 0.054000 kg/m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16-11 ,Page No.815"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "yw=0.30;#water mole fraction\n",
+ "ya=0.70;#ammonia mole fraction\n",
+ "T=40;#mixture temperature in C\n",
+ "\n",
+ "#saturation pressure\n",
+ "pw=7.3851;\n",
+ "pa=1554.33;\n",
+ "#calulations\n",
+ "Pw=yw*pw;\n",
+ "Pa=ya*pa;\n",
+ "Pt=Pw+Pa;\n",
+ "yw=Pw/Pt;\n",
+ "ya=Pa/Pt;\n",
+ "print'mole fraction of water vapour %f'%round(yw,4);\n",
+ "print'mole fraction of ammonia %f'%round(ya,4);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mole fraction of water vapour 0.002000\n",
+ "mole fraction of ammonia 0.998000\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file