diff options
author | hardythe1 | 2015-04-07 15:58:05 +0530 |
---|---|---|
committer | hardythe1 | 2015-04-07 15:58:05 +0530 |
commit | 92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch) | |
tree | 205e68d0ce598ac5caca7de839a2934d746cce86 /Thermodynamics/Chapter12.ipynb | |
parent | b14c13fcc6bb6d01c468805d612acb353ec168ac (diff) | |
download | Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2 Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip |
added books
Diffstat (limited to 'Thermodynamics/Chapter12.ipynb')
-rwxr-xr-x | Thermodynamics/Chapter12.ipynb | 504 |
1 files changed, 504 insertions, 0 deletions
diff --git a/Thermodynamics/Chapter12.ipynb b/Thermodynamics/Chapter12.ipynb new file mode 100755 index 00000000..6b383304 --- /dev/null +++ b/Thermodynamics/Chapter12.ipynb @@ -0,0 +1,504 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:26bd61324c67aa0fef3f72b60851ba818d2a228685c4163bcb87732321b4f4fb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12:NON-REACTING MIXTURES OF GASES AND LIQUIDS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.1, Page No:553"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1=28.02; # Molecular mass of N2\n",
+ "M2=32; # Molecular mass of O2\n",
+ "M3=39.91; # Molecular mass of Ar\n",
+ "M4=44; # Molecular mass of CO2\n",
+ "M5=2.02; # Molecular mass of H2\n",
+ "y1=0.7803; # Part by volume of N2 in dry atmospheric air\n",
+ "y2=0.2099; # Part by volume of O2 in dry atmospheric air\n",
+ "y3=0.0094; # Part by volume of Ar in dry atmospheric air\n",
+ "y4=0.0003; # Part by volume of CO2 in dry atmospheric air\n",
+ "y5=0.0001; # Part by volume of H2 in dry atmospheric air\n",
+ "R_1=8.3143; # Universal gas constant of air in kJ/kmol K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Average molecular mass and apperent gas constant of dry atmospheric air\n",
+ "M=(y1*M1)+(y2*M2)+(y3*M3)+(y4*M4)+(y5*M5); # Average molecular mass\n",
+ "R=R_1/M; #Apperent gas constant of dry atmospheric air\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Average molecular mass and apperent gas constant of dry atmospheric air\",\"\\nAverage molecular mass = \",round(M,3),\"kmol\"\n",
+ "print \"Apperent gas constant of dry atmospheric air =\",round(R,3),\"kJ/kg K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).The fraction of each component\n",
+ "m1=(M1*y1)/M;#The fraction of N2 component\n",
+ "m2=(M2*y2)/M;#The fraction of O2 component\n",
+ "m3=(M3*y3)/M;#The fraction of Ar component\n",
+ "m4=(M4*y4)/M;#The fraction of CO2 component\n",
+ "m5=(M5*y5)/M;#The fraction of H2 component\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).The fraction of N2,O2,Ar,CO2,H2 components are given below respectively \"\n",
+ "print \"m1 =\",round(m1,4)\n",
+ "print \"m2 =\",round(m2,4)\n",
+ "print \"m3 =\",round(m3,4)\n",
+ "print \"m4 =\",round(m4,4)\n",
+ "print \"m5 =\",round(m5,4)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Average molecular mass and apperent gas constant of dry atmospheric air \n",
+ "Average molecular mass = 28.969 kmol\n",
+ "Apperent gas constant of dry atmospheric air = 0.287 kJ/kg K\n",
+ "\n",
+ "(b).The fraction of N2,O2,Ar,CO2,H2 components are given below respectively \n",
+ "m1 = 0.7547\n",
+ "m2 = 0.2319\n",
+ "m3 = 0.013\n",
+ "m4 = 0.0005\n",
+ "m5 = 0.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.2, Page No:555"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1=44; # Molecular mass of CO2\n",
+ "M2=32; # Molecular mass of O2\n",
+ "M3=28; # Molecular mass of CO\n",
+ "M4=28; # Molecular mass of N2\n",
+ "y1=0.1; # Part by volume of CO2 in exhaust gas\n",
+ "y2=0.06; # Part by volume of O2 in exhaust gas\n",
+ "y3=0.03; # Part by volume of CO in exhaust gas\n",
+ "y4=0.81; # Part by volume of N2 in exhaust gas\n",
+ "R_1=8.3143; # Universal gas constant in kJ/kmol K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Average molecular mass and apperent gas constant of exhaust gas\n",
+ "M=(y1*M1)+(y2*M2)+(y3*M3)+(y4*M4); # Average molecular mass\n",
+ "R=R_1/M; #Apperent gas constant of dry atmospheric air\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Average molecular mass and apperent gas constant of exhaust gas\",\"\\nAverage molecular mass = \",round(M,3),\"kmol\"\n",
+ "print \"Apperent gas constant of exhaust gas =\",round(R,4),\"kJ/kg K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).The fraction of each component\n",
+ "m1=(M1*y1)/M;#The fraction of CO2 component\n",
+ "m2=(M2*y2)/M;#The fraction of O2 component\n",
+ "m3=(M3*y3)/M;#The fraction of CO component\n",
+ "m4=(M4*y4)/M;#The fraction of N2 component\n",
+ "print \"\\n(b).The fraction of CO2,O2,CO,N2 components are given below respectively \"\n",
+ "print \"m1 =\",round(m1,3)\n",
+ "print \"m2 =\",round(m2,3)\n",
+ "print \"m3 =\",round(m3,3)\n",
+ "print \"m4 =\",round(m4,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Average molecular mass and apperent gas constant of exhaust gas \n",
+ "Average molecular mass = 29.84 kmol\n",
+ "Apperent gas constant of exhaust gas = 0.2786 kJ/kg K\n",
+ "\n",
+ "(b).The fraction of CO2,O2,CO,N2 components are given below respectively \n",
+ "m1 = 0.147\n",
+ "m2 = 0.064\n",
+ "m3 = 0.028\n",
+ "m4 = 0.76\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.3, Page No:557"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "y1=0.79; # Volume of Nitrogen in 1 kg of air\n",
+ "y2=0.21; # Volume of Oxygen in 1 kg of air\n",
+ "R_1=8.3143; # Universal gas constant of air in kJ/kmol K\n",
+ "T0=298; # temperature of Surroundings in kelvin\n",
+ "\n",
+ "#Calculation\n",
+ "del_Sgen=-R_1*((y1*math.log (y1))+(y2*math.log (y2))); #Entropy generation\n",
+ "LW=T0*del_Sgen; # Minimum work\n",
+ "\n",
+ "#Result\n",
+ "print \"The minimum work required for separation of two gases = \",round(LW,0),\"kJ/kmmol K\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum work required for separation of two gases = 1273.0 kJ/kmmol K\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.4, Page No:562"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "DPT=8; # Dew point temperature in degree celcius\n",
+ "p=100; # Pressure of air in kPa\n",
+ "T=25; # Temperature of air in degree celcius\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).partial pressure of water vapour in air\n",
+ "pv=1.0854; # Saturation pressure of water at DBT in kPa\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).partial pressure of water vapour in air = \",pv,\"kPa\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Specific humidity\n",
+ "sh=0.622*pv/(p-pv);#Specific humidity\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Specific humidity =\",round(sh,4),\"kg of water vapour /kg of dry air\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Relative humidity\n",
+ "pg=3.169; # Saturation pressure of water at T in kPa\n",
+ "RH=pv/pg; #Relative humidity\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n(c).Relative humidity =\",round(RH*100,2),\"%\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).partial pressure of water vapour in air = 1.0854 kPa\n",
+ "\n",
+ "(b).Specific humidity = 0.0068 kg of water vapour /kg of dry air\n",
+ "\n",
+ "(c).Relative humidity = 34.25 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.5, Page No:566"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "DBT=35; # Dry bulb temperature in degree celcius\n",
+ "WBT=23; # Wet bulb temperature in degree celcius\n",
+ "P=100; # Pressure of air in kPa\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "R=0.287; # characteristic gas constant of air in kJ/kg K\n",
+ "# (a).Humidity ratio\n",
+ "hv=2565.3; # specific enthalpy hg at DBT in kJ/kg \n",
+ "hfWBT=96.52; hfgWBT=2443; # specific enthalpy at WBT in kJ/kg \n",
+ "PsatWBT=2.789;# Saturation pressure at WBT in kPa\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "shWBT=0.622*PsatWBT/(P-PsatWBT);# specific humidity\n",
+ "sh=((Cpo*(WBT-DBT))+(shWBT*hfgWBT))/(hv-hfWBT); # Humidity ratio\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Humidity ratio =\",round(sh,4),\"kg w.v /kg d.a\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Relative Humidity\n",
+ "pv=sh*P/(0.622+sh); # Partial pressure of water vapour\n",
+ "pg=5.628; # Saturation pressure at DBT in kPa\n",
+ "RH=pv/pg; #Relative Humidity\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Relative Humidity =\",round(RH*100,2),\"%\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Dew point temperature\n",
+ "DPT=17.5; # Saturation temperature at pg in degree celcius\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n(c).Dew point temperature =\",DPT,\"oC\"\n",
+ "\n",
+ "#Calculation for (d)\n",
+ "# (d).Specific volume\n",
+ "v=(R*(DBT+273))/(P-pv); # Specific volume\n",
+ "\n",
+ "#Result for (d)\n",
+ "print \"\\n(d).Specific volume = \",round(v,1),\"m^3/kg\"\n",
+ "\n",
+ "#Calculation for (e)\n",
+ "# (e).Enthalpy of air\n",
+ "h=(Cpo*DBT)+(sh*hv); #Enthalpy of air\n",
+ "\n",
+ "#Result for (e)\n",
+ "print \"\\n(e).Enthalpy of air =\",round(h,0),\"kJ/kg d.a\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Humidity ratio = 0.0128 kg w.v /kg d.a\n",
+ "\n",
+ "(b).Relative Humidity = 35.78 %\n",
+ "\n",
+ "(c).Dew point temperature = 17.5 oC\n",
+ "\n",
+ "(d).Specific volume = 0.9 m^3/kg\n",
+ "\n",
+ "(e).Enthalpy of air = 68.0 kJ/kg d.a\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.6, Page No:570"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "DPT1=30; # Dew point temperature at inlet in degree celcius\n",
+ "DPT2=15; # Dew point temperature at outlet in degree celcius\n",
+ "RH1=0.50; # Relative humidity at inlet\n",
+ "RH2=0.80; # Relative humidity at outlet\n",
+ "p=101.325; # Atmospheric pressure in kPa\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "pg1=4.246; # saturation pressure of water at DBT1 in kPa\n",
+ "pg2=1.7051; # saturation pressure of water at DBT2 in kPa\n",
+ "pv1=RH1*pg1; pv2=RH2*pg2; # Partial pressure of water vapour in air at inlet and outlet\n",
+ "hv1=2556.3;# specific enthalpy hg at DBT1 in kJ/kg\n",
+ "hv2=2528.9;# specific enthalpy hg at DBT2 in kJ/kg\n",
+ "hv3=63;# specific enthalpy hf at DBT 2in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "sh1=0.622*pv1/(p-pv1); sh2=0.622*pv2/(p-pv2); # Specific humidities at inlet and outlet\n",
+ "q=(Cpo*(DPT2-DPT1))+(sh2*hv2)-(sh1*hv1)+((sh1-sh2)*hv3); # Heat transfer\n",
+ "\n",
+ "#Result\n",
+ "print \"Heat removed from the air =\",round(q,1),\"kJ/kg of dry air\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat removed from the air = -27.3 kJ/kg of dry air\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.7, Page No:572"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "y1=0.5; # Molecular mass of CH4 in kmol\n",
+ "y2=0.5; # Molecular mass of C3H8 in kmol\n",
+ "T=363; # Temperature of gas in kelvin\n",
+ "p=5.06; # Pressure of gas in MPa\n",
+ "v=0.48; # volume of cylinder in m^3\n",
+ "R_1=8.3143; # Universal gas constant of air in kJ/kmol K\n",
+ "# (a).Using kay\u2019s rule\n",
+ "# let component 1 refer to methane and component 2 to propane\n",
+ "# the critical properties\n",
+ "Tc1=190.7; Tc2=370; # temperature in kelvin\n",
+ "Pc1=46.4; Pc2=42.7; # Pressure in bar\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# using kay\u2019s rule for the mixture\n",
+ "Tcmix=y1*Tc1+y2*Tc2;\n",
+ "Pcmix=y1*Pc1+y2*Pc2;\n",
+ "# reduced properties\n",
+ "Tr=T/Tcmix; Pr=p/Pcmix;\n",
+ "# From generalized chart\n",
+ "z=0.832;\n",
+ "v_1=z*R_1*T/(p*10**3); # molar volume of the mixture\n",
+ "d=(v-v_1)/v; # Percentage deviation from actual value\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Using kay\u2019s rule\",\"\\nPercentage deviation from actual value = \",round(d*100,1),\"%\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Using Redlich-Kwong equation of state\n",
+ "a1=0.42748*R_1*Tc1**2.5/Pc1;\n",
+ "a2=0.42748*R_1*Tc2**2.5/Pc2;\n",
+ "b1=0.08664*R_1*Tc1/Pc1;\n",
+ "b2=0.08664*R_1*Tc2/Pc2;\n",
+ "# Substituting these values in the equation 12.16\n",
+ "# And solving these equation by iteration method we get\n",
+ "v_1=0.47864;# molar volume of the mixture\n",
+ "d=(v-v_1)/v; # Percentage deviation from actual value\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Using Redlich-Kwong equation of state\",\"\\nPercentage deviation from actual value = \",round(d*100,1),\"%\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Using kay\u2019s rule \n",
+ "Percentage deviation from actual value = -3.4 %\n",
+ "\n",
+ "(b).Using Redlich-Kwong equation of state \n",
+ "Percentage deviation from actual value = 0.3 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.8, Page No:586"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "ln_piCH4=-0.0323;\n",
+ "pi_CH4=0.9683;\n",
+ "p=6895; # Pressure in kPa\n",
+ "T=104.4; # Temperature in degree celcius\n",
+ "a=0.784;\n",
+ "\n",
+ "#Calculation \n",
+ "f_CH4=pi_CH4*a*p; # Faguacity\n",
+ "\n",
+ "#Result\n",
+ "print \"The Required Faguacity = \",round(f_CH4,0),\"kPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Required Faguacity = 5234.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |