{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 9 : Gases and Vapour Mixtures" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.1 Page no : 420" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate :\n", "(i) The partial pressure of each constituent,\n", "(ii) The total pressure in the vessel, and\n", "'''\n", "\n", "# Variables\n", "V = 0.35; \t\t\t#m**3\n", "import math \n", "m_CO = 0.4; \t\t\t#kg\n", "m_air = 1; \t\t\t#kg\n", "m_O2 = 0.233; \t\t\t#kg\n", "m_N2 = 0.767; \t\t\t#kg\n", "T = 293.; \t\t\t#K\n", "R0 = 8.314; \t\t\t#kJ/kg K\n", "M_O2 = 32.; \t\t\t#Molecular mass of O2\n", "M_N2 = 28.; \t\t\t#Molecular mass of N2\n", "M_CO = 28.; \t\t\t#Molecular mass of CO\n", "\n", "# Calculations and Results\n", "\n", "p_O2 = m_O2*R0*10**3*T/M_O2/V/10**5; \t\t\t#bar\n", "print (\"partial pressure for p_O2 %.3f\")% (p_O2), (\"bar\")\n", "\n", "p_N2 = m_N2*R0*10**3*T/M_N2/V/10**5; \t\t\t#bar\n", "print (\"partial pressure for p_N2 %.3f\")% (p_N2), (\"bar\")\n", "\n", "p_CO = m_CO*R0*10**3*T/M_CO/V/10**5; \t\t\t#bar\n", "print (\"partial pressure for p_CO %.3f\")%(p_CO), (\"bar\")\n", "\n", "\n", "print (\"(ii) Total pressure in the vessel\")\n", "p = p_O2+p_N2+p_CO;\n", "print (\"p = %.3f\")% (p), (\"bar\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "partial pressure for p_O2 0.507 bar\n", "partial pressure for p_N2 1.907 bar\n", "partial pressure for p_CO 0.994 bar\n", "(ii) Total pressure in the vessel\n", "p = 3.408 bar\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.2 Page no : 421" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate : (i) Gas constant for air ;\n", "(ii) Apparent molecular weight.\n", "'''\n", "\n", "# Variables\n", "R0 = 8.314;\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "M_Ar = 40.;\n", "M_CO2 = 44.;\n", "\n", "# Calculations\n", "R_O2 = R0/M_O2; \t\t\t#kJ/kg K\n", "R_N2 = R0/M_N2; \t\t\t#kJ/kg K\n", "R_Ar = R0/M_Ar; \t\t\t#kJ/kg K\n", "R_CO2 = R0/M_CO2; \t\t\t#kJ/kg K\n", "\n", "O2 = 0.2314;\n", "N2 = 0.7553;\n", "Ar = 0.0128;\n", "CO2 = 0.0005;\n", "\n", "# Results\n", "print (\"(i) Gas constant for air\")\n", "R = O2*R_O2 + N2*R_N2 + Ar*R_Ar + CO2*R_CO2;\n", "print (\"R = %.3f\")%(R), (\"kJ/kg K\")\n", "\n", "print (\"(ii) Apparent molecular weight.\")\n", "M = R0/R;\n", "print (\"M = %.3f\")%(M)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Gas constant for air\n", "R = 0.287 kJ/kg K\n", "(ii) Apparent molecular weight.\n", "M = 28.954\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.3 Page no : 422" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate the analysis by volume and the partial pressure \n", "'''\n", "\n", "# Variables\n", "p = 1.; \t\t\t#bar\n", "#For oxygen\n", "m_O2 = 0.2314;\n", "M_O2 = 32;\n", "n_O2 = m_O2/M_O2;\n", "#For Nitrogen\n", "m_N2 = 0.7553;\n", "M_N2 = 28.;\n", "n_N2 = m_N2/M_N2;\n", "#For Argon\n", "m_Ar = 0.0128;\n", "M_Ar = 40;\n", "n_Ar = m_Ar/M_Ar;\n", "\n", "#For CO2\n", "m_CO2 = 0.0005;\n", "M_CO2 = 44;\n", "n_CO2 = m_CO2/M_CO2;\n", "\n", "# Calculations and Results\n", "n = n_O2 + n_N2 + n_Ar + n_CO2;\n", "\n", "#Let Vi/V be A\n", "A_O2 = n_O2/n * 100;\n", "print (\"Vi/V of O2 = %.3f\")%(A_O2),(\"%\")\n", "\n", "A_N2 = n_N2/n * 100;\n", "print (\"Vi/V of N2 = %.3f\")%(A_N2), (\"%\")\n", "\n", "A_Ar = n_Ar/n *100;\n", "print (\"Vi/V of Ar %.3f\")% (A_Ar), (\"%\")\n", "\n", "A_CO2 = n_CO2/n * 100;\n", "print (\"Vi/V of CO2 = %.3f\")% (A_CO2), (\"%\")\n", "\n", "\n", "P_O2 = n_O2/n*p;\n", "print (\"Partial pressure of O2 = %.3f\")% (P_O2), (\"bar\")\n", "\n", "P_N2 = n_N2/n*p;\n", "print (\"Partial pressure of N2 = %.3f\")% (P_N2), (\"bar\")\n", "\n", "P_Ar = n_Ar/n*p;\n", "print (\"Partial pressure of Ar = %.3f\")% (P_Ar), (\"bar\")\n", "\n", "P_CO2 = n_CO2/n*p;\n", "print (\"Partial pressure of CO2 = %.4f\")% (P_CO2), (\"bar\")\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Vi/V of O2 = 20.937 %\n", "Vi/V of N2 = 78.103 %\n", "Vi/V of Ar 0.927 %\n", "Vi/V of CO2 = 0.033 %\n", "Partial pressure of O2 = 0.209 bar\n", "Partial pressure of N2 = 0.781 bar\n", "Partial pressure of Ar = 0.009 bar\n", "Partial pressure of CO2 = 0.0003 bar\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.4 Page no : 423" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate for the mixture :\n", "(i) The masses of CO 2 , O 2 and N 2 , and the total mass ;\n", "(ii) The percentage carbon content by mass ;\n", "(iii) The apparent molecular weight and the gas constant for the mixture ;\n", "(iv) The specific volume of the mixture\n", "'''\n", "\n", "# Variables\n", "p = 1.*10**5; \t\t\t#Pa\n", "T = 293.; \t\t\t#K\n", "n_CO2 = 1.; \t\t\t#moles of CO2\n", "n = 4.; \t\t\t#moles of air\n", "M_CO2 = 44.;\n", "M_N2 = 28.;\n", "M_O2 = 32.;\n", "\n", "#Let A be the volumeetric analysis\n", "A_O2 = 0.21;\n", "A_N2 = 0.79;\n", "\n", "# Calculations and Results\n", "n_O2 = A_O2*n;\n", "n_N2 = A_N2*n;\n", "\n", "print (\"(i) The masses of CO2, O2 and N2, and the total mass\")\n", "\n", "m_CO2 = n_CO2*M_CO2;\n", "print (\"Mass of CO2 = %.3f\")%(m_CO2),(\"kg\")\n", "\n", "m_O2 = n_O2*M_O2;\n", "print (\"Mass of O2 = %.3f\")%(m_O2),(\"kg\")\n", "\n", "m_N2 = n_N2*M_N2;\n", "print (\"Mass of N2 = %.3f\")%(m_N2),(\"kg\")\n", "\n", "m = m_CO2 + m_O2 + m_N2;\n", "print (\"Total mass = %.3f\")% (m), (\"kg\")\n", "\n", "\n", "print (\"(ii) The percentage carbon content by mass\")\n", "#Since the molecular weight of carbon is 12, therefore, there are 12 kg of carbon present for every mole of CO2\n", "m_C = 12; \t\t\t#kg\n", "\n", "C = m_C/m*100;\n", "print (\"Percentage carbon in mixture %.3f\")%(C),(\"%\")\n", "\n", "\n", "print (\"(iii) The apparent molecular weight and the gas consmath.tant for the mixture\")\n", "n = n_CO2 + n_O2 + n_N2;\n", "M = n_CO2/n*M_CO2 + n_O2/n*M_O2 + n_N2/n*M_N2;\n", "print (\"Apparent Molecular weight %.3f\")%(M)\n", "\n", "R0 = 8.314;\n", "R = R0/M;\n", "print (\"Gas constant for the mixture = %.3f\")%(R),(\"kJ/kg K\")\n", "\n", "\n", "print (\"(iv) The specific volume of the mixture\")\n", "v = R*10**3*T/p;\n", "print (\"specific volume = %.3f\")%(v),(\"m**3/kg\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) The masses of CO2, O2 and N2, and the total mass\n", "Mass of CO2 = 44.000 kg\n", "Mass of O2 = 26.880 kg\n", "Mass of N2 = 88.480 kg\n", "Total mass = 159.360 kg\n", "(ii) The percentage carbon content by mass\n", "Percentage carbon in mixture 7.530 %\n", "(iii) The apparent molecular weight and the gas consmath.tant for the mixture\n", "Apparent Molecular weight 31.872\n", "Gas constant for the mixture = 0.261 kJ/kg K\n", "(iv) The specific volume of the mixture\n", "specific volume = 0.764 m**3/kg\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.5 Page no : 424" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "calculate :\n", "(ii) The volume of the container.\n", "(i) The mass of O 2 required ;\n", "'''\n", "\n", "# Variables\n", "p = 1.*10**5; \t\t\t#Pa\n", "T = 298.; \t\t\t#K\n", "M_H2 = 2.;\n", "M_O2 = 32.;\n", "R0 = 8314.;\n", "# ratio = V_H2/V_O2 = 2;\n", "ratio = 2;\n", "\n", "# Calculations and Results\n", "print (\"(i) The mass of O2 required\")\n", "\t\t\t#Let the mass of O2 per kg of H2 = x kg\n", "m_H2 = 1; \t\t\t#kg\n", "n_H2 = m_H2/M_H2;\n", "\n", "# n_O2 = x/M_O2\n", "x = M_O2*n_H2/ratio;\n", "print (\"Mass of O2 per kg of H2 = %.3f\")%(x), (\"kg\")\n", "\n", "print (\"(ii) The volume of the container\")\n", "n_O2 = x/M_O2;\n", "n = n_H2 + n_O2;\n", "V = n*R0*T/p;\n", "print (\"V = %.3f\")%(V), (\"m**3\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) The mass of O2 required\n", "Mass of O2 per kg of H2 = 8.000 kg\n", "(ii) The volume of the container\n", "V = 18.582 m**3\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.6 Page no : 424" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate per mole of mixture the mass of mixture to be removed, and mass of CO to be added.\n", "'''\n", "\n", "#Let composition of mixture by volume be denoted by c1\n", "#Let Final composition desired be denoted by c2\n", "\n", "# Variables\n", "c1_H2 = 0.78;\n", "c1_CO = 0.22;\n", "c2_H2 = 0.52;\n", "c2_CO = 0.48;\n", "M_H2 = 2.;\n", "M_CO = 28.;\n", "\n", "# Calculations\n", "M = c1_H2*M_H2 + c1_CO*M_CO;\n", "# Let x kg of mixture be removed and y kg of CO be added.\n", "x = (c1_H2 - c2_H2)/c1_H2*M;\n", "\n", "# Results\n", "print (\"Mass of mixture removed = %.3f\")%(x), (\"kg\")\n", "\n", "y = M_CO/M*x;\n", "print (\"Mass of CO added = %.3f\")%(y),(\"kg\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Mass of mixture removed = 2.573 kg\n", "Mass of CO added = 9.333 kg\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.7 Page no : 425" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate per kg of gas :\n", "(i) The workdone ;\n", "(ii) The heat flow ;\n", "(iii) Change of entropy per kg of mixture.\n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "ratio = 1./8; \t\t\t#volume ratio; v1/v2\n", "T1 = 1223.; \t\t\t#K\n", "cp_CO2 = 1.235; \t\t\t#kJ/kg K\n", "cp_O2 = 1.088; \t\t\t#kJ/kg K\n", "cp_N2 = 1.172; \t\t\t#kJ/kg K\n", "n_CO2 = 0.13;\n", "n_O2 = 0.125;\n", "n_N2 = 0.745;\n", "M_CO2 = 44.;\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "\n", "\n", "# Calculations\n", "m_CO2 = M_CO2*n_CO2;\n", "m_O2 = M_O2*n_O2;\n", "m_N2 = M_N2*n_N2;\n", "m = m_CO2 + m_O2 + m_N2;\n", "\n", "# Let Fraction by mass be denoted by F\n", "F_CO2 = m_CO2/m;\n", "F_O2 = m_O2/m;\n", "F_N2 = m_N2/m;\n", "cp = F_CO2*cp_CO2 + F_O2*cp_O2 + F_N2*cp_N2;\n", "R0 = 8.314;\n", "R = F_CO2*R0/M_CO2 + F_O2*R0/M_O2 + F_N2*R0/M_N2;\n", "\n", "cv = cp - R;\n", "n = 1.2;\n", "\n", "print (\"(i) The workdone\")\n", "T2 = T1*(ratio)**(n-1);\n", "W = R*(T1-T2)/(n-1);\n", "print (\"W = %.3f\")%(W), (\"kJ/kg\")\n", "\n", "print (\"(ii) The heat flow\")\n", "du = cv*(T2-T1);\n", "Q = du + W;\n", "print (\"Q = %.3f\")%(Q), (\"kJ/kg\")\n", "\n", "\n", "print (\"(iii) Change of entropy per kg of mixture\")\n", "ds_1A = R*math.log(1/ratio); \t\t\t#isothermal process\n", "ds_2A = cv*math.log(T1/T2);\n", "\n", "ds_12 = ds_1A - ds_2A;\n", "print (\"change of entropy = %.3f\")% (ds_12), (\"kJ/kg K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) The workdone\n", "W = 565.669 kJ/kg\n", "(ii) The heat flow\n", "Q = 190.777 kJ/kg\n", "(iii) Change of entropy per kg of mixture\n", "change of entropy = 0.191 kJ/kg K\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.8 Page no : 427" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Calculate the values of C p , C v , c p and c v for the mixture.\n", "import math \n", "\n", "# Variables\n", "M_CO2 = 44.;\n", "M_H2 = 2.;\n", "M_N2 = 28.;\n", "M_CH4 = 16.;\n", "M_CO = 28.;\n", "\n", "# Let volumetric analysis be denoted by V\n", "V_CO = 0.28;\n", "V_H2 = 0.13;\n", "V_CH4 = 0.04;\n", "V_CO2 = 0.04;\n", "V_N2 = 0.51;\n", "Cp_CO = 29.27; \t\t\t#kJ/mole K\n", "Cp_H2 = 28.89; \t\t\t#kJ/mole K\n", "Cp_CH4 = 35.8; \t\t\t#kJ/mole K\n", "Cp_CO2 = 37.22; \t\t\t#kJ/mole K\n", "Cp_N2 = 29.14; \t\t\t#kJ/mole K\n", "R0 = 8.314; \n", "\n", "# Calculations and Results\n", "Cp = V_CO*Cp_CO + V_H2*Cp_H2 + V_CO2*Cp_CO2 + V_CH4*Cp_CH4 + V_N2*Cp_N2;\n", "print (\"Cp = %.3f\")%(Cp), (\"kJ/mole K\")\n", "\n", "Cv = Cp-R0;\n", "print (\"Cv = %.3f\")% (Cv), (\"kJ/mole K\")\n", "\n", "M = V_CO*M_CO + V_H2*M_H2 + V_CO2*M_CO2 + V_CH4*M_CH4 + V_N2*M_N2;\n", "\n", "cp = Cp/M;\n", "print (\"cp = %.3f\")%(cp), (\"kJ/kg K\")\n", "\n", "cv = Cv/M;\n", "print (\"cv %.3f\")% (cv), (\"kJ/kg K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Cp = 29.733 kJ/mole K\n", "Cv = 21.419 kJ/mole K\n", "cp = 1.200 kJ/kg K\n", "cv 0.864 kJ/kg K\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.9 Page no : 427" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# determine :\n", "# (i) Partial pressures of the constituents ; (ii) Gas constant of mixture.\n", "\n", "import math \n", "\n", "# Variables\n", "p = 1.3 \t\t\t#bar\n", "R0 = 8.314;\n", "M_CO2 = 44.;\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "M_CO = 28.;\n", "m_O2 = 0.1;\n", "m_N2 = 0.7;\n", "m_CO2 = 0.15;\n", "m_CO = 0.05;\n", "#Considering 1 kg of mixture\n", "m = 1; \t\t\t#kg\n", "\n", "# Calculations\n", "#let moles be denoted by n\n", "n_O2 = m_O2/M_O2;\n", "n_N2 = m_N2/M_N2;\n", "n_CO2 = m_CO2/M_CO2;\n", "n_CO = m_CO/M_CO;\n", "M = 1/(m_O2/M_O2 + m_N2/M_N2 + m_CO2/M_CO2 + m_CO/M_CO);\n", "n = m/M;\n", "x_O2 = n_O2/n;\n", "x_N2 = n_N2/n;\n", "x_CO2 = n_CO2/n;\n", "x_CO = n_CO/n;\n", "\n", "# Results\n", "print (\"(i) Partial pressures of the constituents\")\n", "P_O2 = x_O2*p;\n", "print (\"Partial pressure of O2 = %.3f\")% (P_O2), (\"bar\")\n", "\n", "P_N2 = x_N2*p;\n", "print (\"Partial pressure of N2 = %.3f\")% (P_N2), (\"bar\")\n", "\n", "P_CO2 = x_CO2*p;\n", "print (\"Partial pressure of CO2 = %.3f\")% (P_CO2), (\"bar\")\n", "\n", "P_CO = x_CO*p;\n", "print (\"Partial pressure of CO = %.3f\")% (P_CO), (\"bar\")\n", "\n", "R_mix = R0/M;\n", "print (\"Gas constant of mixture = %.3f\")%(R_mix), (\"kJ/kg K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Partial pressures of the constituents\n", "Partial pressure of O2 = 0.122 bar\n", "Partial pressure of N2 = 0.975 bar\n", "Partial pressure of CO2 = 0.133 bar\n", "Partial pressure of CO = 0.070 bar\n", "Gas constant of mixture = 0.277 kJ/kg K\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.10 Page no : 428" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Find :\n", "(i) The mole fraction of each constituent,\n", "(ii) The equivalent molecular weight of the mixture,\n", "(iii) The equivalent gas constant of the mixture,\n", "(iv) The partial pressures and partial volumes,\n", "(v) The volume and density of the mixture, and\n", "(vi) The c p and c v of the mixture.\n", "\n", "'''\n", "\n", "# Variables\n", "p = 4.*10**5; \t\t \t#Pa\n", "import math \n", "T = 293.; \t\t\t #K\n", "R0 = 8.314;\n", "\n", "m_N2 = 4.; \t \t\t #kg\n", "m_CO2 = 6.; \t\t\t #kg\n", "\n", "M_N2 = 28.; \t\t \t #Molecular mass\n", "M_CO2 = 44.; \t\t\t #Molecular mass\n", "\n", "n_N2 = m_N2/M_N2; \t\t\t#moles of N2\n", "n_CO2 = m_CO2/M_CO2; \t\t\t#moles of CO2\n", "\n", "x_N2 = n_N2/(n_N2+n_CO2);\n", "print (\"x_N2 = %.3f\")% (x_N2)\n", "\n", "x_CO2 = n_CO2/(n_CO2+n_N2);\n", "print (\"x_CO2 = %.3f\")% (x_CO2)\n", "\n", "\n", "print (\"(ii) The equivalent molecular weight of the mixture\")\n", "M = x_N2*M_N2 + x_CO2*M_CO2;\n", "print (\"M = %.3f\")%(M), (\"kg/kg-mole\")\n", "\n", "print (\"(iii) The equivalent gas consmath.tant of the mixture\")\n", "m = m_N2+m_CO2;\n", "Rmix = (m_N2*(R0/M_N2) + m_CO2*(R0/M_CO2))/m;\n", "print (\"Rmix = %.3f\")% (Rmix), (\"kJ/kg K\")\n", "\n", "print (\"(iv) The partial pressures and partial volumes\")\n", "P_N2 = x_N2*p/10**5;\n", "print (\"P_N2 = %.3f\")% (P_N2), (\"bar\")\n", "\n", "P_CO2 = x_CO2*p/10**5;\n", "print (\"P_CO2 = %.3f\")% (P_CO2), (\"bar\")\n", "\n", "V_N2 = m_N2*R0/M_N2*T/p*10**3;\n", "print (\"V_N2 %.3f\")% (V_N2), (\"m**3\")\n", "\n", "V_CO2 = m_CO2*R0/M_CO2*T/p*10**3;\n", "print (\"V_CO2 %.3f\")% (V_CO2), (\"m**3\")\n", "\n", "print (\"(v) The volume and density of the mixture\")\n", "\n", "V = m*Rmix*10**3*T/p;\n", "print (\"V = %.3f\")% (V), (\"m**3\")\n", "\n", "rho_mix = m/V;\n", "print (\"Density of mixture = %.3f\")% (rho_mix), (\"kg/m**3\")\n", "\n", "\n", "print (\"(vi) cp and cv of the mixture\")\n", "\n", "y_N2 = 1.4;\n", "cv_N2 = (R0/M_N2)/(y_N2 - 1);\n", "cp_N2 = cv_N2*y_N2;\n", "\n", "y_CO2 = 1.286;\n", "cv_CO2 = (R0/M_CO2)/(y_CO2 - 1);\n", "cp_CO2 = cv_CO2*y_CO2;\n", "\n", "cp = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);\n", "print (\"cp = %.3f\")%(cp),(\"kJ/kg K\")\n", "\n", "cv = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);\n", "print (\"cv = %.3f\")%(cv),(\"kJ/kg K\")\n", "\n", "T1 = 293.; \t\t\t#K\n", "T2 = 323.; \t\t\t#K\n", "dU = m*cv*(T2-T1);\n", "print (\"Change in internal energy = %.3f\")% (dU), (\"kJ\")\n", "\n", "dH = m*cp*(T2-T1);\n", "print (\"Change in enthalpy = %.3f\")% (dH), (\"kJ\")\n", "\n", "dS = m*cv*math.log(T2/T1); \t\t\t#Consmath.tant volume process\n", "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/kg K\")\n", "\n", "\n", "print (\"When the mixture is heated at constant pressure\")\n", "\n", "print (\"If the mixture is heated at constant pressure \u0394U and \u0394H will remain the same\")\n", "\n", "dS = m*cp*math.log(T2/T1);\n", "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/kg K\")\n", "\n", "\n", "# Note : Answers are slightly different because of rounding error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "x_N2 = 0.512\n", "x_CO2 = 0.488\n", "(ii) The equivalent molecular weight of the mixture\n", "M = 35.814 kg/kg-mole\n", "(iii) The equivalent gas consmath.tant of the mixture\n", "Rmix = 0.232 kJ/kg K\n", "(iv) The partial pressures and partial volumes\n", "P_N2 = 2.047 bar\n", "P_CO2 = 1.953 bar\n", "V_N2 0.870 m**3\n", "V_CO2 0.830 m**3\n", "(v) The volume and density of the mixture\n", "V = 1.700 m**3\n", "Density of mixture = 5.881 kg/m**3\n", "(vi) cp and cv of the mixture\n", "cp = 0.925 kJ/kg K\n", "cv = 0.693 kJ/kg K\n", "Change in internal energy = 208.001 kJ\n", "Change in enthalpy = 277.644 kJ\n", "Change in entropy = 0.676 kJ/kg K\n", "When the mixture is heated at constant pressure\n", "If the mixture is heated at constant pressure \u0394U and \u0394H will remain the same\n", "Change in entropy = 0.902 kJ/kg K\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.11 Page no : 430" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate :\n", "(i) The final temperature and pressure of the mixture ;\n", "(ii) The change of entropy of the system.\n", "\n", "'''\n", "\n", "# Variables\n", "Cv_O2 = 21.07; \t\t\t#kJ/mole K\n", "Cv_CO = 20.86; \t\t\t#kJ/mole K\n", "p_O2 = 8*10**5; \t\t\t#Pa\n", "p_CO = 1*10**5; \t\t\t#Pa\n", "V_O2 = 1.8; \t\t\t#m**3\n", "V_CO = 3.6; \t\t\t#m**3\n", "T_O2 = 323.; \t\t\t#K\n", "T_CO = 293.; \t\t\t#K\n", "R0 = 8314.;\n", "\n", "# Calculations and Results\n", "n_O2 = p_O2*V_O2/R0/T_O2;\n", "n_CO = p_CO*V_CO/R0/T_CO;\n", "n = (n_O2+n_CO);\n", "V = (V_O2+V_CO);\n", "\n", "print (\"(i) Final temperature (T) and pressure (p) of the mixture\")\n", "\n", "#Before mixing\n", "U1 = n_O2*Cv_O2*T_O2 + n_CO*Cv_CO*T_CO;\n", "\n", "T = U1/(n_O2*Cv_O2 + n_CO*Cv_CO);\n", "t = T-273;\n", "\n", "print (\"Final temperature = %.3f\")% (t), (\"\u00b0C\")\n", "\n", "p = n*R0*T/V/10**5;\n", "print (\"Final pressure = %.3f\")% (p), (\"bar\")\n", "\n", "\n", "#For oxygen\n", "dS_O1A = n_O2*R0*math.log(V/V_O2); \t\t\t#isothermal process\n", "dS_O2A = n_O2*Cv_O2*math.log(T_O2/T); \t\t\t#consmath.tant volume process\n", "dS_O12 = dS_O1A - dS_O2A; \t\t\t# Change of entropy of O2\n", "\n", "#For CO\n", "dS_CO12 = n_CO*R0*math.log(V/V_CO) + n_CO*Cv_CO*math.log(T/T_CO); \t\t\t#Change of entropy of CO\n", "dS = (dS_O12 + dS_CO12)/10**3;\n", "print (\"(ii)Change of entropy of system = %.3f\")% (dS), (\"kJ/K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Final temperature (T) and pressure (p) of the mixture\n", "Final temperature = 43.569 \u00b0C\n", "Final pressure = 3.334 bar\n", "(ii)Change of entropy of system = 5.396 kJ/K\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.12 Page no : 432" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "(a) Calculate : (i) The final equilibrium pressure ;\n", "(ii) The amount of heat transferred to the surroundings ;\n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "p_A = 16.*10**5; \t\t\t#Pa\n", "p_B = 6.4*10**5; \t\t\t#Pa\n", "\n", "T_A = 328.; \t\t\t#K\n", "T_B = 298.; \t\t\t#K\n", "\n", "n_A = 0.6 \t\t\t#kg-mole\n", "m_B = 3; \t \t\t#kg\n", "\n", "R0 = 8314.;\n", "M_A = 28.; \n", "y = 1.4;\n", "\n", "V_A = n_A*R0*T_A/p_A;\n", "m_A = n_A*M_A;\n", "R = R0/M_A;\n", "V_B = m_B*R*T_B/p_B;\n", "V = V_A+V_B;\n", "m = m_A+m_B;\n", "T = 303.; \t\t\t#K\n", "\n", "print (\"(a) (i) Final equilibrium pressure, p\")\n", "p = m*R*T/V/10**5;\n", "print (\"p = %.3f\")% (p), (\"bar\")\n", "\n", "cv = R/10**3/(y-1);\n", "\n", "print (\"(ii) Amount of heat transferred, Q :\")\n", "\n", "U1 = cv*(m_A*T_A + m_B*T_B);\n", "U2 = m*cv*T;\n", "Q = U2-U1;\n", "print (\"Q = %.3f\")% (Q),(\"kJ\")\n", "\n", "print (\"(b) If the vessel were insulated :\")\n", "\n", "print (\"(i) Final temperature,\")\n", "\n", "T = cv*(m_A*T_A + m_B*T_B)/(m*cv);\n", "t = T-273;\n", "print (\"T = %.3f\")% (t), (\"\u00b0C\")\n", "\n", "\n", "print (\"(ii) Final pressure\")\n", "\n", "p = m*R*T/V/10**5;\n", "print (\"p = %.3f\")% (p), (\"bar\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(a) (i) Final equilibrium pressure, p\n", "p = 12.393 bar\n", "(ii) Amount of heat transferred, Q :\n", "Q = -300.640 kJ\n", "(b) If the vessel were insulated :\n", "(i) Final temperature,\n", "T = 50.455 \u00b0C\n", "(ii) Final pressure\n", "p = 13.230 bar\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.13 Page no : 434" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate the increase in entropy \n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "m_O2 = 3.; \t\t\t#kg\n", "M_O2 = 32.;\n", "m_N2 = 9.; \t\t\t#kg\n", "M_N2 = 28.;\n", "R0 = 8.314;\n", "\n", "# Calculations\n", "R_O2 = R0/M_O2;\n", "R_N2 = R0/M_N2;\n", "x_O2 = (m_O2/M_O2)/((m_O2/M_O2) + (m_N2/M_N2));\n", "x_N2 = (m_N2/M_N2)/((m_O2/M_O2) + (m_N2/M_N2));\n", "dS = -m_O2*R_O2*math.log(x_O2) -m_N2*R_N2*math.log(x_N2);\n", "\n", "# Results\n", "print (\"Change in entropy = %.3f\")% (dS),(\"kJ/kg K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Change in entropy = 1.844 kJ/kg K\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.14 Page no : 434" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Calculate the mass of O 2 added.\n", "# Variables\n", "m_N2 = 2.5; \t\t\t#kg \n", "M_N2 = 28.;\n", "p_N2 = 15.; \t\t\t#bar\n", "p_total = 20.; \t\t\t#bar\n", "\n", "# Calculations\n", "n_N2 = m_N2/M_N2;\n", "p_O2 = p_total-p_N2;\n", "n_O2 = p_O2/p_N2*n_N2;\n", "M_O2 = 32;\n", "m_O2 = n_O2*M_O2;\n", "\n", "# Results\n", "print (\"Mass of O2 added = %.3f\")% (m_O2), (\"kg\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Mass of O2 added = 0.952 kg\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.15 Page no : 435" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Determine :\n", "(i) The moles of nitrogen per mole of oxygen ;\n", "(ii) The partial pressure of oxygen and nitrogen if the total pressure is atmosphere ;\n", "(iii) The kg of nitrogen per kg of mixture.\n", "\n", "'''\n", "\n", "# Variables\n", "n_O2 = 1.;\n", "M_N2 = 28.;\n", "M_O2 = 32.;\n", "\n", "# Calculations and Results\n", "print (\"(i) Moles of N2 per mole of O2 :\")\n", "n_N2 = n_O2*0.79/0.21;\n", "print (\"n_N2 = %.3f\")%(n_N2),(\"moles\")\n", "\n", "n = n_O2+n_N2;\n", "print (\"(ii)\")\n", "p = 1; \t\t\t#atm\n", "\n", "p_O2 = n_O2/n*p;\n", "print (\"p_O2 = %.3f\")% (p_O2), (\"atm\")\n", "\n", "p_N2 = n_N2/n*p;\n", "print (\"p_N2 = %.3f\")% (p_N2), (\"atm\")\n", "\n", "\n", "x = n_N2*M_N2/(n_N2*M_N2+n_O2*M_O2);\n", "print (\"(iii) The kg of nitrogen per kg of mixture = %.3f\")% (x), (\"kg N2/kg mix\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Moles of N2 per mole of O2 :\n", "n_N2 = 3.762 moles\n", "(ii)\n", "p_O2 = 0.210 atm\n", "p_N2 = 0.790 atm\n", "(iii) The kg of nitrogen per kg of mixture = 0.767 kg N2/kg mix\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.16 Page no : 436" ] }, { "cell_type": "code", "collapsed": false, "input": [ " # Find the masses of O 2 , N 2 and CO 2 in the cylinder.\n", "\n", "import math \n", "\n", "# Variables\n", "V = 0.6; \t\t\t#m**3\n", "p1 = 12.*10**5; \t\t\t#Pa\n", "p2 = 18.*10**5; \t\t\t#Pa\n", "T = 298.; \t\t\t#K\n", "R0 = 8.314;\n", "x_O2 = 0.23;\n", "x_N2 = 0.77;\n", "\n", "n = p1*V/R0/10**3/T;\n", "#Considering 100 kg of air\n", "m_O2 = 23.; \t\t\t#kg\n", "m_N2 = 77.; \t\t\t#kg\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "m = 100.; \t\t\t#kg\n", "\n", "# Calculations and Results\n", "R = (m_O2/M_O2 + m_N2/M_N2)*R0/m; \t\t\t#for air\n", "M = R0/R \t \t\t#for air\n", "\n", "m = p1*V/R/T/10**3;\n", "\n", "m_O2 = x_O2*m;\n", "print (\"Mass of O2 = %.3f\")% (m_O2), (\"kg\")\n", "\n", "m_N2 = x_N2*m;\n", "print (\"Mass of N2 = %.3f\")% (m_N2), (\"kg\")\n", "\n", "#After adding CO2 in the vessel\n", "p2 = 18.*10**5; \t\t\t#Pa;\n", "\n", "p_CO2 = 6.*10**5; \t\t\t#Pa\n", "M_CO2 = 44.;\n", "R_CO2 = R0/M_CO2;\n", "\n", "m_CO2 = p_CO2*V/(R_CO2*10**3*T);\n", "print (\"Mass of CO2 = %.3f\")% (m_CO2), (\"kg\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Mass of O2 = 1.927 kg\n", "Mass of N2 = 6.451 kg\n", "Mass of CO2 = 6.393 kg\n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.17 Page no : 437" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate-\n", "(i) The partial pressure ;\n", "(ii) The total pressure ;\n", "(iii) The mean value of R for the mixture.\n", "'''\n", "# Variables\n", "V = 6; \t\t \t#m**3\n", "A = 0.45; \n", "B = 0.55;\n", "R_A = 0.288; \t\t\t#kJ/kg K\n", "R_B = 0.295; \t\t\t#kJ/kg K\n", "m = 2. \t\t\t#kg\n", "T = 303. \t\t\t #K\n", "\n", "# Calculations\n", "print (\"(i) The partial pressures\")\n", "m_A = A*m;\n", "m_B = B*m;\n", "\n", "p_A = m_A*R_A*10**3*T/V/10**5; \t\t\t#bar\n", "print (\"p_A = %.3f\")% (p_A), (\"bar\")\n", "\n", "p_B = m_B*R_B*10**3*T/V/10**5; \t\t\t#bar\n", "print (\"p_B = %.3f\")% (p_B), (\"bar\")\n", "\n", "\n", "print (\"(ii) The total pressure\")\n", "p = p_A+p_B;\n", "print (\"p = %.3f\")% (p), (\"bar\")\n", "\n", "\n", "print (\"(iii) The mean value of R for the mixture\")\n", "Rm = (m_A*R_A + m_B*R_B)/(m_A + m_B);\n", "print (\"Rm = %.3f\")% (Rm), (\"kJ/kg K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) The partial pressures\n", "p_A = 0.131 bar\n", "p_B = 0.164 bar\n", "(ii) The total pressure\n", "p = 0.295 bar\n", "(iii) The mean value of R for the mixture\n", "Rm = 0.292 kJ/kg K\n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.18 Page no : 438" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Determine-\n", "(i) The mole fraction of each component ; (ii) The average molecular weight ;\n", "(iii) The specific gas constant ;\n", "(iv) The volume and density ;\n", "(v) The partial pressures and partial volumes.\n", "'''\n", "\n", "# Variables\n", "m_O2 = 4.; \t\t\t#kg\n", "m_N2 = 6.; \t\t\t#kg\n", "p = 4.*10**5; \t\t\t#Pa\n", "T = 300.; \t\t\t#K\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "m = 10.; \t\t\t#kg\n", "\n", "# Calculations and Results\n", "print (\"(i) The mole fraction of each component\")\n", "n_O2 = m_O2/M_O2;\n", "n_N2 = m_N2/M_N2;\n", "\n", "x_O2 = n_O2/(n_O2+n_N2);\n", "print (\"x_O2 = %.3f\")% (x_O2)\n", "\n", "x_N2 = n_N2/(n_N2+n_O2);\n", "print (\"x_N2 = %.3f\")% (x_N2)\n", "\n", "\n", "print (\"(ii) The average molecular weight\")\n", "M = (n_O2*M_O2 + n_N2*M_N2)/(n_O2 + n_N2);\n", "print (\"M = %.3f\")%(M)\n", "\n", "print (\"(iii) The specific gas consmath.tant\")\n", "R0 = 8.314;\n", "R = R0/M;\n", "print (\"R = %.3f\")% (R), (\"kJ/kg K\")\n", "\n", "print (\"(iv) The volume and density\")\n", "V = m*R*T*10**3/p;\n", "print (\"V = %.3f\")%(V), (\"m**3\")\n", "\n", "rho = (m_O2/V) + (m_N2/V);\n", "print (\"density = %.3f\")% (rho), (\"kg/m**3\")\n", "\n", "\n", "print (\"(v) The partial pressures and partial volumes\")\n", "p_O2 = n_O2*R0*10**3*T/V/10**5; \t\t\t#bar\n", "print (\"p_O2 = %.3f\")%(p_O2), (\"bar\")\n", "\n", "p_N2 = n_N2*R0*10**3*T/V/10**5; \t\t\t#bar\n", "print (\"p_N2 = %.3f\")% (p_N2), (\"bar\")\n", "\n", "V_O2 = x_O2*V;\n", "print (\"V_O2 = %.3f\")% (V_O2), (\"m**3\")\n", "\n", "V_N2 = x_N2*V;\n", "print (\"V_N2 = %.3f\")% (V_N2), (\"m**3\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) The mole fraction of each component\n", "x_O2 = 0.368\n", "x_N2 = 0.632\n", "(ii) The average molecular weight\n", "M = 29.474\n", "(iii) The specific gas consmath.tant\n", "R = 0.282 kJ/kg K\n", "(iv) The volume and density\n", "V = 2.116 m**3\n", "density = 4.727 kg/m**3\n", "(v) The partial pressures and partial volumes\n", "p_O2 = 1.474 bar\n", "p_N2 = 2.526 bar\n", "V_O2 = 0.779 m**3\n", "V_N2 = 1.336 m**3\n" ] } ], "prompt_number": 20 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.19 Page no : 439" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Calculate :\n", "(i) The final temperature of the mixture ; \n", "(ii) The change in entropy.\n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "cp_CO2 = 0.85; \t\t\t#kJ/kg K\n", "cp_N2 = 1.04; \t\t\t#kJ/kg K\n", "m_CO2 = 4.; \t\t\t#kg\n", "T1_CO2 = 313.; \t\t\t#K\n", "m_N2 = 8.; \t\t\t#kg\n", "T1_N2 = 433.; \t\t\t#K\n", "p2 = 0.7; \t\t\t#bar\n", "p1_CO2 = 1.4; \t\t\t#bar\n", "p1_N2 = 1.;\n", "R = 8.314;\n", "M_CO2 = 44.;\n", "M_N2 = 28.;\n", "R_CO2 = R/M_CO2;\n", "R_N2 = R/M_N2;\n", "\n", "# Calculations and Results\n", "print (\"(i) Final temperature, T2\")\n", "T2 = (m_CO2*cp_CO2*T1_CO2 + m_N2*cp_N2*T1_N2)/(m_CO2*cp_CO2 + m_N2*cp_N2);\n", "print (\"T2 = %.3f\")%(T2),(\"K\")\n", "\n", "print (\"(ii) Change in entropy\")\n", "n_CO2 = 0.0909;\n", "n_N2 = 0.2857;\n", "n = n_CO2 + n_N2;\n", "x_CO2 = n_CO2/n;\n", "x_N2 = n_N2/n;\n", "p2_CO2 = x_CO2*p2;\n", "p2_N2 = x_N2*p2;\n", "\n", "dS = m_CO2*cp_CO2*math.log(T2/T1_CO2) - m_CO2*R_CO2*math.log(p2_CO2/p1_CO2) + m_N2*cp_N2*math.log(T2/T1_N2) - m_N2*R_N2*math.log(p2_N2/p1_N2);\n", "print (\"dS = %.3f\")%(dS), (\"kJ/K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Final temperature, T2\n", "T2 = 398.188 K\n", "(ii) Change in entropy\n", "dS = 3.223 kJ/K\n" ] } ], "prompt_number": 21 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.20 Page no : 440" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "calculate the entropy change in the mixing process.\n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "cv_O2 = 0.39; \t\t\t#kJ/kg K\n", "cv_N2 = 0.446; \t\t\t#kJ/kg K\n", "n_O2 = 1.;\n", "n_N2 = 2.;\n", "M_O2 = 32.;\n", "M_N2 = 28.;\n", "m_O2 = 32.; \t\t\t#kg\n", "m_N2 = 2*28.; \t\t\t#kg\n", "T_O2 = 293.; \t\t\t#K\n", "T_N2 = 301.; \t\t\t#K\n", "R0 = 8.314;\n", "\n", "# Calculations\n", "p_O2 = 2.5*10**5; \t\t\t#Pa\n", "p_N2 = 1.5*10**5; \t\t\t#Pa\n", "T2 = (m_O2*cv_O2*T_O2 + m_N2*cv_N2*T_N2)/(m_O2*cv_O2 + m_N2*cv_N2);\n", "V_O2 = n_O2*R0*10**5*T_O2/p_O2;\n", "V_N2 = n_N2*R0*10**5*T_N2/p_N2;\n", "V = V_O2+V_N2;\n", "dS = m_O2*(cv_O2*math.log(T2/T_O2) + R0/M_O2*math.log(V/V_O2)) + m_N2*(cv_N2*math.log(T2/T_N2) + R0/M_N2*math.log(V/V_N2));\n", "\n", "# Results\n", "print (\"Entropy change in the mixing process = %.3f\")%(dS),(\"kJ\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Entropy change in the mixing process = 16.627 kJ\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.21 Page no : 421" ] }, { "cell_type": "code", "collapsed": false, "input": [ "'''\n", "Determine :\n", "(i) The temperature of the equilibrium mixture ;\n", "(ii) The pressure of the mixture ;\n", "(iii) The change in entropy for each component and total value.\n", "'''\n", "\n", "import math \n", "\n", "# Variables\n", "cv_N2 = 0.744; \t\t\t#kJ/kg K\n", "cv_H2 = 10.352; \t\t\t#kJ/kg K\n", "cp_N2 = 1.041; \t\t\t#kJ/kg K\n", "cp_H2 = 14.476; \t\t\t#kJ/kg K\n", "V = 0.45; \t\t\t#m**3\n", "V_H2 = 0.3; \t\t\t#m**3\n", "V_N2 = 0.15; \t\t\t#m**3\n", "p_H2 = 3.*10**5; \t\t\t#Pa\n", "p_N2 = 6.*10**5; \t\t\t#Pa\n", "T_H2 = 403.; \t\t\t#K\n", "T_N2 = 303.; \t\t\t#K\n", "\n", "# Calculations and Results\n", "R_H2 = 8.314/2;\n", "R_N2 = 8.314/28;\n", "\n", "print (\"(i) Temperature of equilibrium mixture\")\n", "\n", "m_H2 = p_H2*V_H2/(R_H2*10**3)/T_H2;\n", "m_N2 = p_N2*V_N2/(R_N2*10**3)/T_N2;\n", "T2 = (m_H2*cv_H2*T_H2 + m_N2*cv_N2*T_N2)/(m_H2*cv_H2 + m_N2*cv_N2);\n", "print (\"T2 = %.3f\")%(T2),(\"K\")\n", "\n", "print (\"(ii) Pressure of the mixture\")\n", "p2_H2 = m_H2*R_H2*10**3*T2/V;\n", "p2_N2 = m_N2*R_N2*10**3*T2/V;\n", "\n", "p2 = p2_H2+p2_N2;\n", "print (\"p2 = %.3f\")%(p2/10**5),(\"bar\")\n", "\n", "print (\"(iii) Change in entropy :\")\n", "\n", "dS_H2 = m_H2*(cp_H2*math.log(T2/T_H2) - R_H2*math.log(p2_H2/p_H2));\n", "print (\"Change in entropy of H2 = %.3f\")%(dS_H2),(\"kJ/K\")\n", "\n", "dS_N2 = m_N2*(cp_N2*math.log(T2/T_N2) - R_N2*math.log(p2_N2/p_N2));\n", "print (\"Change in entropy of N2 = %.3f\")%(dS_N2),(\"kJ/K\")\n", "\n", "dS = dS_H2+dS_N2;\n", "\n", "print (\"Total change in entropy = %.3f\")%(dS),(\"kJ/K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(i) Temperature of equilibrium mixture\n", "T2 = 345.767 K\n", "(ii) Pressure of the mixture\n", "p2 = 3.998 bar\n", "(iii) Change in entropy :\n", "Change in entropy of H2 = 0.006 kJ/K\n", "Change in entropy of N2 = 0.425 kJ/K\n", "Total change in entropy = 0.430 kJ/K\n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.22 Page no : 443" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Calculate c v and c p of the mixture.\n", "\n", "import math \n", "\n", "# Variables\n", "cv_N2 = 0.745; \t\t\t#kJ/kg K\n", "cv_CO2 = 0.653; \t\t#kJ/kg K\n", "cp_N2 = 1.041; \t\t\t#kJ/kg K\n", "cp_CO2 = 0.842; \t\t#kJ/kg K\n", "m_N2 = 4.; \t\t\t#kg\n", "m_CO2 = 6.; \t\t#kg\n", "pmix = 4.; \t\t \t#bar\n", "m = m_N2+m_CO2;\n", "\n", "T1 = 298.; \t\t\t #K\n", "T2 = 323.; \t\t\t #K\n", "\n", "# Calculations and Results\n", "cv_mix = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);\n", "print (\"cv_mix = %.3f\")% (cv_mix), (\"kJ/kg K\")\n", "\n", "cp_mix = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);\n", "print (\"cp_mix = %.3f\")% (cp_mix), (\"kJ/kg K\")\n", "\n", "dU = m*cv_mix*(T2-T1);\n", "print (\"Change in internal energy = %.3f\")% (dU), (\"kJ\")\n", "\n", "dH = m*cp_mix*(T2-T1);\n", "print (\"Change in enthalpy = %.3f\")% (dH), (\"kJ\")\n", "\n", "dS = m_N2*cv_N2*math.log(T2/T1) + m_CO2*cv_CO2*math.log(T2/T1);\n", "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/K\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "cv_mix = 0.690 kJ/kg K\n", "cp_mix = 0.922 kJ/kg K\n", "Change in internal energy = 172.450 kJ\n", "Change in enthalpy = 230.400 kJ\n", "Change in entropy = 0.556 kJ/K\n" ] } ], "prompt_number": 24 } ], "metadata": {} } ] }