From 92cca121f959c6616e3da431c1e2d23c4fa5e886 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 7 Apr 2015 15:58:05 +0530 Subject: added books --- .../Chapter13.ipynb | 453 +++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter13.ipynb (limited to 'Thermodynamics_An_Engineering_Approach/Chapter13.ipynb') diff --git a/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb new file mode 100755 index 00000000..936d90ae --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb @@ -0,0 +1,453 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: Gas Mixtures" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-1 ,Page No.683" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mO2=3.0;#moles of oxygen\n", + "mN2=5.0;#moles of nitrogen\n", + "mCH4=12.0;#moles of methane\n", + "\n", + "#molecular masses in kg\n", + "MO2=32.0;\n", + "MN2=28.0;\n", + "MCH4=16.0;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "mm=mO2+mN2+mCH4;\n", + "mfO2=mO2/mm;\n", + "mfN2=mN2/mm;\n", + "mfCH4=mCH4/mm;\n", + "print'mass fraction of oxygen is %f'%round(mfO2,2);\n", + "print'mass fraction of nitrogen is %f'%round(mfN2,2);\n", + "print'mass fraction of methane is %f'%round(mfCH4,2);\n", + "\n", + "#part - b\n", + "NO2=mO2/MO2;\n", + "NN2=mN2/MN2;\n", + "NCH4=mCH4/MCH4;\n", + "Nm=NO2+NN2+NCH4;\n", + "yO2=NO2/Nm;\n", + "yN2=NN2/Nm;\n", + "yCH4=NCH4/Nm;\n", + "print'mole fraction of oxygen is %f'%round(yO2,3);\n", + "print'mole fraction of nitrogen is %f'%round(yN2,3);\n", + "print'mole fraction of methane is %f'%round(yCH4,3);\n", + "\n", + "#part - c\n", + "Mm=mm/Nm;\n", + "print'average molecular mass %f kg/kmol'%round(Mm,1);\n", + "Rm=Ru/Mm;\n", + "print'gas constant of mixture %f kJ/kg - K'%round(Rm,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass fraction of oxygen is 0.150000\n", + "mass fraction of nitrogen is 0.250000\n", + "mass fraction of methane is 0.600000\n", + "mole fraction of oxygen is 0.092000\n", + "mole fraction of nitrogen is 0.175000\n", + "mole fraction of methane is 0.734000\n", + "average molecular mass 19.600000 kg/kmol\n", + "gas constant of mixture 0.425000 kJ/kg - K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-2 ,Page No.687" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "NN2=2.0;#moles of nitrogen\n", + "NCO2=6.0;#moles of carbon dioxide\n", + "Tm=300.0;#temperature of gases in K\n", + "Pm=15000.0;#pressure of gases in kPa\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kmol - K\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "Nm=NN2+NCO2;\n", + "Vm=Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis of the ideal-gas equation of state %f m^3'%round(Vm,3);\n", + "\n", + "#part - b\n", + "#from Table A-1\n", + "#for nitrogen\n", + "TcrN=126.2;\n", + "PcrN=3390;\n", + "#for Carbondioxide\n", + "TcrC=304.2;\n", + "PcrC=7390;\n", + "yN2=NN2/Nm;\n", + "yCO2=NCO2/Nm;\n", + "Tcr=yN2*TcrN+yCO2*TcrC;\n", + "Pcr=yN2*PcrN+yCO2*PcrC;\n", + "Tr=Tm/Tcr;\n", + "Pr=Pm/Pcr;\n", + "#from Fig A-15b\n", + "Zm=0.49;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis Kay\u2019s rule %f m^3'%round(Vm,3);\n", + "\n", + "#part - c\n", + "#for nitrogen\n", + "TrN=Tm/TcrN;\n", + "PrN=Pm/PcrN;\n", + "#from Fig A-15b\n", + "Zn=1.02;\n", + "#for Carbondioxide\n", + "TrC=Tm/TcrC;\n", + "PcrC=Pm/PcrC;\n", + "#from Fig A-15b\n", + "Zc=0.3;\n", + "Zm=yN2*Zn+yCO2*Zc;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis compressibility factors and Amagat\u2019s law %f m^3'%round(Vm,3);\n", + "\n", + "#part - d\n", + "VRN=(Vm/NN2)/(Ru*TcrN/PcrN);\n", + "VRC=(Vm/NCO2)/(Ru*TcrC/PcrC);\n", + "#from Fig A-15b\n", + "Zn=0.99;\n", + "Zc=0.56;\n", + "Zm=yN2*Zn+yCO2*Zc;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "#When the calculations are repeated we obtain 0.738 m3 after the second iteration, 0.678 m3 after the third iteration, and 0.648 m3 after the fourth iteration.\n", + "Vm=0.648;\n", + "print'compressibility factors and Dalton\u2019s law the volume of the tank on the basis %f m^3'%round(Vm,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the volume of the tank on the basis of the ideal-gas equation of state 1.330000 m^3\n", + "the volume of the tank on the basis Kay\u2019s rule 0.652000 m^3\n", + "the volume of the tank on the basis compressibility factors and Amagat\u2019s law 0.639000 m^3\n", + "compressibility factors and Dalton\u2019s law the volume of the tank on the basis 0.648000 m^3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-3 ,Page No.691" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mN=4.0;#mass of nitrogen in kg\n", + "T1N=20.0;#temperature of nitrogen in K\n", + "P1N=150.0;#pressure of nitrogen in kPa\n", + "mO=7.0;#mass of oxygen in kg\n", + "T1O=40.0;#temperature of oxygen in K\n", + "P1O=100.0;#pressure of oxygen in kPa\n", + "\n", + "#molecular masses in kg\n", + "MO=32.0;\n", + "MN=28.0;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#from Table A-2a\n", + "CvN=0.743;\n", + "CvO=0.658;\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "#Ein - Eout = dEsystem\n", + "# (m*cv*dT)N2 + (m*cv*dT)= 0;\n", + "Tm= (mN*CvN*T1N+ mO*CvO*T1O)/(mN*CvN+mO*CvO);\n", + "print'the mixture temperature %f C'%round(Tm,1);\n", + "\n", + "#part - b\n", + "NO=mO/MO;\n", + "NN=mN/MN;\n", + "Nm=NO+NN;\n", + "VO=NO*Ru*(T1O+273)/P1O;\n", + "VN=NN*Ru*(T1N+273)/P1N;#Exergy Destruction during Mixing of Ideal Gases\n", + "Vm=VO+VN;\n", + "Pm=Nm*Ru*(Tm+273)/Vm; \n", + "print'the mixture pressure after equilibrium has been established %f kPa'%round(Pm,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mixture temperature 32.200000 C\n", + "the mixture pressure after equilibrium has been established 114.500000 kPa\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-4 ,Page No.692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#given data\n", + "NO=3.0;#moles of oxygen \n", + "NC=5.0;#moles of carbondioxide\n", + "T0=25+273.0;#temperature of gasses in K\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#calculations\n", + "Nm=NO+NC;\n", + "yO=NO/Nm;\n", + "yC=NC/Nm;\n", + "#dSm= -Ru*(NO*log(yO)+NC*log(yC))\n", + "Sm=-Ru*(NO*log(yO)+NC*log(yC));\n", + "print'the entropy change %f kJ/K'%round(Sm);\n", + "Xdestroyed=T0*Sm/1000;\n", + "print'exergy destruction associated %f MJ'%round(Xdestroyed,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the entropy change 44.000000 kJ/K\n", + "exergy destruction associated 13.100000 MJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-5 ,Page No.694" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T1=220;#intial temperature in K\n", + "T2=160;#final temperature in K\n", + "Pm=10;#pressure of air in MPa\n", + "yN=0.79;#mole fraction of nitrogen\n", + "yO=0.21;#mole fractions of oxygen\n", + "\n", + "\n", + "#critical properties\n", + "#for Nitrogen\n", + "TcrN=126.2;\n", + "PcrN=3.39;\n", + "#for Oxygen\n", + "TcrO=154.8;\n", + "PcrO=5.08;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#from Tables A-18 & 19\n", + "#at T1\n", + "h1N=6391;\n", + "h1O=6404;\n", + "#for T2\n", + "h2N=4648;\n", + "h2O=4657;\n", + "\n", + "#calculations\n", + "#part - a\n", + "qouti=yN*(h1N-h2N)+yO*(h1O-h2O);\n", + "print'the heat transfer during this process using the ideal-gas approximation %i kJ/kmol'%round(qouti);\n", + "\n", + "#part - b\n", + "Tcrm=yN*TcrN+yO*TcrO;\n", + "Pcrm=yN*PcrN+yO*PcrO;\n", + "Tr1=T1/Tcrm;\n", + "Tr2=T2/Tcrm;\n", + "Pr=Pm/Pcrm;\n", + "#at these values we get\n", + "Zh1=1;\n", + "Zh2=2.6\n", + "qout=qouti-Ru*Tcrm*(Zh1-Zh2);\n", + "print'the heat transfer during this process using Kay\u2019s rule %i kJ/kmol'%round(qout);\n", + "\n", + "#part - c\n", + "#for nitrogen\n", + "TrN1=T1/TcrN;\n", + "TrN2=T2/TcrN;\n", + "PrN=Pm/PcrN;\n", + "#from Fig A-15b\n", + "Zh1n=0.9;\n", + "Zh2n=2.4;\n", + "#for Oxygen\n", + "TrO1=T1/TcrO;\n", + "TrO2=T2/TcrO;\n", + "PcrO=Pm/PcrO;\n", + "#from Fig A-15b\n", + "Zh1O=1.3;\n", + "Zh2O=4.0;\n", + "#from Eq 12-58\n", + "h12N=h1N-h2N-Ru*TcrN*(Zh1n-Zh2n);# h1 - h2 for nitrogen\n", + "h12O=h1O-h2O-Ru*TcrO*(Zh1O-Zh2O);# h1 - h2 for oxygen\n", + "qout=yN*h12N+yO*h12O;\n", + "print'the heat transfer during this process using Amagat\u2019s law %i kJ/kmol'%round(qout);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the heat transfer during this process using the ideal-gas approximation 1744 kJ/kmol\n", + "the heat transfer during this process using Kay\u2019s rule 3502 kJ/kmol\n", + "the heat transfer during this process using Amagat\u2019s law 3717 kJ/kmol\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-6 ,Page No.705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#13.6 (d) answer not matching as float datatype is giving more accurate answer in comparison to textbook that has given approximate due to rounding off to two decimal places\n", + "\n", + "#given data\n", + "mfs=0.0348;#salinity mass fraction\n", + "mfw=1-mfs;\n", + "T0=288.15;#temperature of sea water in K\n", + "\n", + "#constants used\n", + "Mw=18;\n", + "Ms=58.44;\n", + "Rw=0.4615;\n", + "pm=1028;\n", + "Ru=8.314;\n", + "\n", + "#calculations\n", + "#part - a\n", + "Mm=1/((mfs/Ms)+(mfw/Mw));\n", + "yw=mfw*Mm/Mw;\n", + "ys=1-yw;\n", + "print'the mole fraction of the water is %f'%round(yw,4);\n", + "print'the mole fraction of the saltwater is %f'%round(ys,5);\n", + "\n", + "#part - b\n", + "wmin=-Ru*T0*(ys*log(ys)+yw*log(yw));\n", + "wm=wmin/Mm;\n", + "print'the minimum work input required to separate 1 kg of seawater completely into pure water and pure salts %f kJ'%round(wm,2);\n", + "\n", + "#part - c\n", + "wmin=Rw*T0*log(1/yw);\n", + "print'the minimum work input required to obtain 1 kg of fresh water from the sea %f kJ'%round(wmin,2);\n", + "\n", + "#part - d\n", + "Pmin=pm*Rw*T0*log(1/yw);\n", + "print'the minimum gauge pressure that the seawater must be raised if fresh water is to be obtained by reverse osmosis using semipermeable membranes %i kPa'%round(Pmin)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mole fraction of the water is 0.989000\n", + "the mole fraction of the saltwater is 0.010980\n", + "the minimum work input required to separate 1 kg of seawater completely into pure water and pure salts 7.850000 kJ\n", + "the minimum work input required to obtain 1 kg of fresh water from the sea 1.470000 kJ\n", + "the minimum gauge pressure that the seawater must be raised if fresh water is to be obtained by reverse osmosis using semipermeable membranes 1510 kPa\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit