{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3 : Entropy and the Second law of Thermodynamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.2 Page No : 144" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "\n", "# Variables\n", "del_U = 0. ; \t\t\t# As no work or heat transfered across its boundaries during the process \n", "T_1 = 500. ; \t\t\t# [K]\n", "\n", "# Calculations and Results\n", "V1 = 1.6682 / 2 * 10**-3; \t\t\t# [m**3]\n", "V2 = 2. * V1 ; \n", "del_S_sur = 0 ; \t\t\t# As no heat transfered across its boundaries during the process \n", "\n", "\n", "print \"(a)For an ideal gas u = u(T only)\"\n", "print ' Final temperature = %g K '%(T_1);\n", "\n", "q_rev = 8.314 * T_1 * math.log(V2/V1) ;\n", "del_S_sys = q_rev / T_1 ;\n", "del_S_univ = del_S_sys + del_S_sur ;\n", "\n", "print 'b)Entropy change for universe = %.2f J/molK)'%(del_S_univ);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(a)For an ideal gas u = u(T only)\n", " Final temperature = 500 K \n", "b)Entropy change for universe = 5.76 J/molK)\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3 Page No : 145" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "# Variables\n", "T_1_1 = 273. ;\t\t\t# {K}\n", "T_1_2 = 373. ; \t\t\t#[K]\n", "Cp = 24.5 ; \t\t\t# [J/molK]\n", "del_S_sur = 0. ; \t\t\t#Since the system is isolated \n", "\n", "# Calculations\n", "T2 = (T_1_1 + T_1_2)/2 ;\n", "del_S = Cp / 2 * math.log(T2**2 / (T_1_1 * T_1_2)) ;\n", "\n", "# Results\n", "print \"Entropy change for the system = %.2f J/mol K)\"%( del_S);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Entropy change for the system = 0.30 J/mol K)\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.4 Page No : 147" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "del_h_vap = 38.56 * 10**3 ; \t\t\t#[J/mol] , From Table \n", "Tb = 78.2 + 273. \t\t\t#[K] ,From table\n", "\n", "# Calculations\n", "del_S = - del_h_vap / Tb * 10**-3 ;\n", "\n", "# Results\n", "print \"Change in entropy = %.4f kJ/mol K\"%(del_S);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Change in entropy = -0.1098 kJ/mol K\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.5 Page No : 149" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "# Variables\n", "P_1 = 300. * 10**3 \t\t#[N/m**2]\n", "T_1 = 700. \t\t \t# [*C]\n", "V_bar_1 = 20. ; \t\t\t #[m/s]\n", "P_2 = 200. * 10**3 ; \t\t\t# [N/m**2]\n", "h_cap_1 = 3927.1 * 10**3 ; \t\t# [J/kg] , From table\n", "S_cap_1 = 8.8319 \t\t\t # [kJ/kgK] , From table\n", "\n", "# Calculations\n", "S_cap_2 = S_cap_1 \t\t\t# Reverssible adiabatic process \n", "T2 = 623. \t\t\t# [*C] ,From table by interpolation\n", "h_cap_2 = 3754.7 * 10**3\t\t# [J/kgK] ,From table by interpolation\n", "V_bar_2 = math.sqrt(2 * (h_cap_1 - h_cap_2) + V_bar_1**2) ; \n", "\n", "# Results\n", "print 'The final temperature is %g C and the exit velocity is %.1f m/s'%(T2,V_bar_2);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The final temperature is 623 C and the exit velocity is 587.5 m/s\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.6 page no : 150" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "m1 = 10 # kg/s\n", "m2 = 1.95 # kg/s\n", "s1 = 6.14 # kJ / kg K\n", "s2 = .2945 # kJ / kg K\n", "s3 = 5.6140 # kJ / kg K\n", "\n", "# Calculations\n", "m3 = m1 + m2\n", "dSdT = (m3 * s3) - (m1 *s1) + (m2*s2)\n", "\n", "#results\n", "print \"dS/dTuniv = %.2f kW/k\"%dSdT\n", "\n", "# note : answer in book is wrong. " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "dS/dTuniv = 6.26 kW/k\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.7 Page No : 153" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "# Variables\n", "V_1 = 0.5 ; \t\t\t#[m**3]\n", "P_1 = 150. ; \t\t\t#[kPa]\n", "T_1 = 20. + 273.\t\t#[K]\n", "P_2 = 400. ; \t\t\t# [kPa]\n", "Cp = 2.5 * 8.314 ;\n", "\n", "\n", "# Calculations and Results\n", "Q = V_1 * (P_1 - P_2)\n", "print \"a)Heat transferd = %g kJ\"%(Q);\n", "del_S_sys = (P_1 * V_1) / T_1 * -math.log(P_2 / P_1) ;\n", "print 'b)Entropy change of system = %.2f kJ/K '%(del_S_sys);\n", "Q_surr = - Q ;\n", "del_S_surr = Q_surr / T_1 ;\n", "print ' Entropy change of surrounding = %.2f kJ/K '%(del_S_surr) ; \n", "del_S_univ = del_S_sys + del_S_surr ;\n", "print ' Entropy change of universe =%.2f kJ/K '%(del_S_univ) ;\n", "\n", "print \"c)Since entropy of the universe increases , the process is irreverssible .\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "a)Heat transferd = -125 kJ\n", "b)Entropy change of system = -0.25 kJ/K \n", " Entropy change of surrounding = 0.43 kJ/K \n", " Entropy change of universe =0.18 kJ/K \n", "c)Since entropy of the universe increases , the process is irreverssible .\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.8 Page No : 154" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "import math\n", "A = 3.355 \t\t\t# from table\n", "B = 0.575 * 10**-3 ; \t\t\t# from table\n", "D = -0.016 * 10**5 ; \t\t\t# from table\n", "R = 8.314 ;\n", "P1 = 1. \t\t\t#[bar]\n", "P2 = 0.5 ; \t\t\t #[bar]\n", "\n", "# Calculations\n", "def f(T):\n", " return R * (A * math.log(T) + B * T + D / (2 * T**2))\n", "\n", "S1 = f(373.) - f(298.) ;\n", "S2 = R * math.log(P1 / P2) ; \n", "del_S = S1 - S2 ; \n", "\n", "# Results\n", "print 'Entropy change = %.2f J/mol K'%(del_S);\n", "\n", "# Note : Answer may be different because of rouding error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Entropy change = 0.88 J/mol K\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.9 Page No : 155" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "P = 1. \t\t\t#[bar]\n", "p_O2 = 0.5 ; \t\t\t#[bar]\n", "p_N2 = 0.5 ; \t\t\t# [bar]\n", "n_O2 = 1. \t\t\t#[mol]\n", "n_N2 = 1. \t\t\t#[mol]\n", "R = 8.314 \t\t\t# J/mol K\n", "\n", "# Calculations\n", "del_S_1_O2 = -n_O2 * R * math.log(p_O2 / P) ;\n", "del_S_1_N2 = -n_N2 * R * math.log(p_N2 / P) ; \n", "del_S_2 = 0.\n", "del_S = del_S_2 + del_S_1_O2 + del_S_1_N2 ;\n", "\n", "# Results\n", "print \" Entropy of mixing = %.2f J/K\"%(del_S);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Entropy of mixing = 11.53 J/K\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.11 Page No : 157" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#Variables\n", "P_1 = 10. ; \t\t\t#[bar]\n", "T_1 = 298. ; \t\t\t# [K]\n", "P_2 = 1. ; \t\t\t#[bar]\n", "T_2 = 298. ; \t\t\t# [K]\n", "P_3 = 1. ; \t\t\t#[bar]\n", "R = 8.314 ; \t\t\t# [J/mol K]\n", "n = 4. ; \t\t\t#[mol]\n", "X = 0.01 ;\n", "\n", "# Calculations\n", "del_S_sys = - R * math.log(P_2 / P_1);\n", "del_S_surr = - R * (1 - P_2 / P_1) ;\n", "del_s_univ_1 = del_S_sys + del_S_surr ; \n", "Del_S_univ_1 = n * del_s_univ_1 ;\n", "\n", "Del_S_univ_2 = 0 ;\n", "n_3 = n * P_3 / P_1 ;\n", "\n", "n_out = n - n_3 ;\n", "del_S_sys_3 = - n_out * R * math.log(X) ;\n", "Del_S_univ_3 = del_S_sys_3\n", "Del_S_univ = Del_S_univ_1 + Del_S_univ_2 + Del_S_univ_3 ;\n", "\n", "# Results\n", "print \"Total entropy change of universe = %.2f J/K \"%(Del_S_univ) ;\n", "print \"No matter how slow the leak , the driving force for the expansion is finite . \\\n", "So the process canot be reverssible .\"\n", "\n", "# Note : answer is different becuase of rounding error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Total entropy change of universe = 184.48 J/K \n", "No matter how slow the leak , the driving force for the expansion is finite . So the process canot be reverssible .\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.12 Page No : 162" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "n_dot = 250. \t\t\t# [mol/s]\n", "P_1 = 125. * 10**5 ; \t\t\t# [N/m**2]\n", "V_cap_1 = 5. * 10**-4 \t\t\t# [m**3/mol]\n", "P_2 = 8 * 10.**5 ; \t\t \t# [N/m**2]\n", "\n", "# Calculations\n", "X = 3 * P_1**0.6667 * V_cap_1 * ( P_2**(1./3) - P_1**(1./3)) ;\n", "W_dot_s = n_dot * X * 10**-6 \n", "\n", "# Results\n", "print 'Power generated = %.1f MW'%(W_dot_s) ;\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Power generated = -2.8 MW\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.13 Page No : 163" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "Ws_real = -2.1 ; \t\t\t#[MW]\n", "Ws_rev = -2.8 ; \t\t\t# [MW]\n", "\n", "# Calculations\n", "n_tur = Ws_real / Ws_rev ;\n", "\n", "# Results\n", "print \"Isentropic efficiency of turbine = %.2f %%\"%( n_tur * 100);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Isentropic efficiency of turbine = 75.00 %\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.14 Page No : 166" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "P_1 = 10. * 10**6 ; \t\t\t# [N/m**2]\n", "T_1 = 600. + 273 ; \t\t\t #[K]\n", "T_H = T_1 ;\n", "T_C = 100. + 273 ; \t\t\t #[K]\n", "P_3 = 10. * 10**4 ; \t\t\t#[N/m**2]\n", "P_4 = P_1 ;\n", "h_cap_1 = 3625.3 ; \t\t\t# [kJ/kg],From steam table\n", "S_cap_1 = 6.9028 ; \t\t\t#[kJ/kgK],From steam table\n", "S_cap_2 = S_cap_1 ; \t\t\t#[kJ/kgK],From steam table\n", "S_cap_v = 7.3593 ; \t\t\t#[kJ/kgK],From steam table\n", "S_cap_l = 1.3025 ; \t\t\t#[kJ/kgK],From steam table\n", "h_cap_l = 417.44 ;\t\t\t# [kJ/kg],From steam table\n", "h_cap_v = 2675.5 ;\t\t\t# [kJ/kg],From steam table\n", "V_cap_l = 10**-3 ; \t\t\t# [m**3/kg],From steam table\n", "\n", "# Calculations\n", "X = (S_cap_2 - S_cap_l) / (S_cap_v - S_cap_l);\n", "h_cap_2 = (1 - X) * h_cap_l + X * h_cap_v ;\n", "W_cap_s = h_cap_2 - h_cap_1 ;\n", "h_cap_3 = h_cap_l ;\n", "\n", "W_cap_c = V_cap_l * (P_4 - P_3) * 10**-3 ;\n", "h_cap_4 = h_cap_3 + W_cap_c ;\n", "W_net = W_cap_s + W_cap_c ; \t\t\t# [kJ/kg]\n", "n_turb = ( -W_cap_s - W_cap_c) / (h_cap_1 - h_cap_4) ;\n", "\n", "# Results\n", "print \"Efficiency of the Rankine cycle = %.1f %% \"%(n_turb * 100 );\n", "n_carnot = 1 - T_C / T_H ;\n", "print \"Efficiency of the Carnot cycle = %.1f %%\"%(n_carnot * 100);\n", "print \"The Rankine efficiecy is lower than Carnot efficiency .\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Efficiency of the Rankine cycle = 34.7 % \n", "Efficiency of the Carnot cycle = 57.3 %\n", "The Rankine efficiecy is lower than Carnot efficiency .\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.15 Page No : 167" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "n_turb = 0.85 ;\n", "n_comp = 0.85 ;\n", "W_cap_s_rev = -1120. ; \t\t\t#[kJ/kg]\n", "h_cap_1 = 3625.3 ; \t\t\t#[kJ/kg]\n", "h_cap_l = 417.44 ; \t \t\t#[kJ/kg]\n", "W_cap_c_rev = 9.9 ; \t\t\t#[kJ/kg]\n", "\n", "# Calculations\n", "W_cap_s_act = n_turb * W_cap_s_rev ;\n", "h_cap_2_act = W_cap_s_act + h_cap_1 ;\n", "h_cap_3 = h_cap_l ;\n", "W_cap_c_act = W_cap_c_rev / n_comp ;\n", "h_cap_4_act = W_cap_c_act + h_cap_3 ;\n", "W_cap_net = W_cap_s_act + W_cap_c_act ;\n", "n_rank_act = (-W_cap_s_act - W_cap_c_act) / (h_cap_1 - h_cap_4_act) ;\n", "\n", "# Results\n", "print \"W_cap_net = %.1f kJ/kg\"%(W_cap_net) ;\n", "print \"Efficiency of Rankine cycle = %.1f %%\"%(n_rank_act*100) \n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "W_cap_net = -940.4 kJ/kg\n", "Efficiency of Rankine cycle = 29.4 %\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.16 Page No : 171" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "P_1 = 120. * 10**3 ; \t\t\t#[N]\n", "P_2 = 900. * 10**3 ; \t\t\t#[N]\n", "h_4 = 25.486 \t\t\t#[kJ/mol], From table\n", "h_1 = h_4 ;\n", "h_2 = 39.295 ; \t\t \t#[kJ/mol], From table\n", "S_2 = 177.89 ; \t\t \t#[kJ/molK], From table\n", "S_3 = S_2 ; \t\t\t #[kJ/mol]\n", "h_3 = 43.578 \t\t\t#[kJ/mol] , Enthalpy corresponding to S3 value which equales to S2\n", "Q_dot_c_des = 10. \t \t\t#[kW]\n", "\n", "# Calculations\n", "q_c = h_2 - h_1 ;\n", "Q_dot_c = h_2 - h_1 ;\n", "W_dot_c = h_3 - h_2 ;\n", "COP = Q_dot_c / W_dot_c ;\n", "n_dot = Q_dot_c_des / q_c ;\n", "\n", "# Results\n", "print \"COP of the refrigerator is = %.2f \\nMass flow rate needed = %.3f mol/s\"%(COP,n_dot)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "COP of the refrigerator is = 3.22 \n", "Mass flow rate needed = 0.724 mol/s\n" ] } ], "prompt_number": 11 } ], "metadata": {} } ] }