{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 08: Available energy Availability and irreversibility" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.1:pg-249" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.1\n", "\n", " The fraction of energy that becomes unavailable due to irreversible heat transfer is 0.260038240918\n" ] } ], "source": [ "\n", "T0 = 35.0 # Heat rejection temperature in degree Celsius \n", "T1 = 420 # Vapor condensation temperature in degree Celsius \n", "T1_ = 250 # water vapor temperature in degree Celsius \n", "print \"\\n Example 8.1\"\n", "f = ((T0+273)*((T1+273)-(T1_+273)))/((T1_+273)*((T1+273)-(T0+273)))# fraction of energy lost\n", "print \"\\n The fraction of energy that becomes unavailable due to irreversible heat transfer is \",f \n", "#The answers vary due to round off error\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.2:pg-250" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.2\n", "\n", " Total change in entropy is 2.03990232306 kJ/K\n", "\n", " Increase in unavailable energy is 618.090403887 kJ\n" ] } ], "source": [ "from scipy import integrate\n", "import math\n", "\n", "lhw = 1858.5 # Latent heat of water in kJ/kg\n", "Tew = 220 # Water evaporation temperature in degree Celsius\n", " \n", "Tig = 1100 # Initial temperature of the gas in degree Celsius\n", "Tfg = 550 # Final temperature of the gas in degree Celsius\n", "T0 = 303 # Atmospheric temperature in degree Celsius\n", "Tg2 = 823 \n", "Tg1 = 1373\n", "print \"\\n Example 8.2\"\n", "Sw = lhw/(Tew+273) # Entropy generation in water\n", "Sg,error = integrate.quad(lambda T:3.38/T,Tg1,Tg2)\n", "St = Sg+Sw \n", "print \"\\n Total change in entropy is \",St ,\" kJ/K\"\n", "\n", "print \"\\n Increase in unavailable energy is \",T0*St ,\" kJ\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.4:pg-253" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.4\n", "\n", " The decrease in the available energy is 281.816890623 kJ\n" ] } ], "source": [ "import math\n", "from scipy import integrate\n", "Ts_ = 15 # Ambient temperature in degree Celsius\n", "Tw1_ = 95 # Temperature of water sample 1 in degree Celsius\n", "Tw2_ = 35# Temperature of water sample 2 in degree Celsius\n", "m1 = 25 # Mass of water sample 1 in kg\n", "m2 = 35 # Mass of water sample 2 in kg\n", "cp = 4.2 # Specific heat capacity of water in kJ/kgK\n", "print \"\\n Example 8.4\"\n", "Ts = Ts_+273# Ambient temperature in K\n", "Tw1 = Tw1_+273 # Temperature of water sample 1 in K\n", "Tw2 = Tw2_+273# Temperature of water sample 2 in K\n", "AE25,er = integrate.quad(lambda T:m1*cp*(1-(Ts/T)),Ts,Tw1)\n", "AE35,er2 = integrate.quad(lambda T:m2*cp*(1-(Ts/T)),Ts,Tw2)\n", "AEt = AE25 + AE35\n", "Tm = (m1*Tw1+m2*Tw2)/(m1+m2) # Temperature after mixing\n", "AE60,er3 = integrate.quad(lambda T:(m1+m2)*cp*(1-(Ts/T)),Ts,Tm)\n", "AE = AEt - AE60\n", "print \"\\n The decrease in the available energy is \",AE ,\" kJ\"\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.5:pg-254" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.5\n", "\n", " The final RPM of the flywheel would be 222.168786807 RPM\n" ] } ], "source": [ "import math\n", "from scipy import integrate\n", "N1 = 3000 # Speed of rotation of flywheel in RPM\n", "I = 0.54 # Moment of inertia of flywheel in kgm**2\n", "ti_ = 15 # Temperature of insulated system in degree Celsius \n", "m = 2 # Water equivalent of shaft \n", "print \"\\n Example 8.5\"\n", "w1 = (2*math.pi*N1)/60 # Angular velocity of rotation in rad/s\n", "Ei = 0.5*I*w1**2 # rotational kinetic energy\n", "dt = Ei/(1000*2*4.187) # temperature change\n", "ti = ti_+273# Temperature of insulated system in Kelvin\n", "tf = ti+dt # final temperature\n", "AE,er = integrate.quad(lambda T: m*4.187*(1-(ti/T)),ti,tf)\n", "UE = Ei/1000 - AE # Unavailable enrgy\n", "w2 = math.sqrt(AE*1000*2/I) # Angular speed in rad/s \n", "N2 = (w2*60)/(2*math.pi) # Speed of rotation in RPM\n", "print \"\\n The final RPM of the flywheel would be \",N2 ,\" RPM\"\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.6:pg-255" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.6\n", "\n", " The maximum work is 122.957271378 kJ\n", "\n", " Change in availability is 82.4328713783 kJ\n", "\n", " Irreversibility is 15.2572713783 kJ\n" ] } ], "source": [ "import math\n", "from scipy import integrate\n", "T1_ = 80.0 # Initial temperature of air in degree Celsius \n", "T2_ = 5.0 # Final temperature of air in degree Celsius \n", "V2 = 2.0 # Assumed final volume\n", "V1 = 1.0 # Assumed initial volume\n", "P0 = 100.0 # Final pressure of air in kPa\n", "P1 = 500.0 # Initial pressure of air in kPa\n", "R = 0.287 # Gas constant\n", "cv = 0.718 # Specific heat capacity at constant volume for gas in kJ/kg K\n", "m = 2.0 # Mass of gas in kg\n", "print \"\\n Example 8.6\"\n", "T1= T1_+273 # Initial temperature of air in K \n", "T2 = T2_+273 # Final temperature of air in K \n", "S= integrate.quad(lambda T:(m*cv)/T,T1,T2)[0] + integrate.quad(lambda V: (m*R)/V,V1,V2)[0] # Entropy change\n", "U = m*cv*(T1-T2)# Change in internal energy\n", "Wmax = U-(T2*(-S)) # Maximum possible work\n", "V1_ = (m*R*T1)/P1 # volume calculation\n", "CA = Wmax-P0*(V1_) # Change in availability\n", "I = T2*S # Irreversibility\n", "print \"\\n The maximum work is \",Wmax ,\" kJ\"\n", "print \"\\n Change in availability is \",CA ,\" kJ\"\n", "print \"\\n Irreversibility is \",I ,\" kJ\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.7:pg-256" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.7\n", "\n", " The decrease in availability is 260.756521108 kJ/kg\n", "\n", " The maximum work is 260.756521108 kJ/kg\n", "\n", " The irreversibility is 49.6565211082 kJ/kg\n", "\n", " Alternatively, The irreversibility is 49.6565211082 kJ/kg\n" ] } ], "source": [ "\n", "P1 = 500.0 # Initial pressure of steam in kPa\n", "P2 = 100.0# Final pressure of steam in kPa\n", "T1_ = 520.0 #Initial temperature of steam in degree Celsius\n", "T2_ = 300.0 #Final temperature of steam in degree Celsius\n", "cp = 1.005 # Specific heat capacity of steam in kJ/kgK\n", "t0 = 20.0 # Atmospheric temperature in degree Celsius \n", "R = 0.287 # Gas constant\n", "Q = -10.0 # Heat loss to surrounding in kJ/kg\n", "print \"\\n Example 8.7\"\n", "T1 = T1_+273 #Initial temperature of steam in degree Celsius\n", "T2 = T2_+273 #Final temperature of steam in degree Celsius\n", "S21 = (R*math.log(P2/P1))-(cp*math.log(T2/T1))\n", "T0 = t0+273\n", "CA = cp*(T1-T2)-T0*S21 # Change in availability\n", "Wmax = CA # Maximum possible work\n", "W = cp*(T1-T2)+Q # net work\n", "I = Wmax-W # Irreversibility\n", "# Altenatively\n", "Ssystem = -Q/T0\n", "Ssurr = -S21\n", "I1 = T0*(Ssystem+Ssurr)\n", "print \"\\n The decrease in availability is \",CA ,\" kJ/kg\"\n", "print \"\\n The maximum work is \",Wmax ,\" kJ/kg\"\n", "print \"\\n The irreversibility is \",I ,\" kJ/kg\"\n", "print \"\\n Alternatively, The irreversibility is \",I1 ,\" kJ/kg\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.8:pg-258" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.8\n", "\n", " The initial and final availbility of the products are 85.9672398469 kJ/Kg and 39.6826771757 kJ/Kg respectively\n", "\n", " The irreversibility of the process is 319.369801955 kW\n", "\n", " Total power generated by the heat engine is 472.671938045 kW\n" ] } ], "source": [ "\n", "T0 = 300.0 # Atmospheric temperature in K\n", "Tg1_ = 300.0 # Higher temperature of combustion product in degree Celcius\n", "Tg2_ = 200.0 # Lower temperature of combustion product in degree Celcius\n", "Ta1 = 40.0 # Initial air temperature in K\n", "cpg = 1.09 # Specific heat capacity of combustion gas in kJ/kgK\n", "cpa = 1.005# Specific heat capacity of air in kJ/kgK\n", "mg = 12.5 # mass flow rate of product in kg/s\n", "ma = 11.15# mass flow rate of air in kg/s\n", "\n", "print \"\\n Example 8.8\"\n", "Tg1 = Tg1_+273 # Higher temperature of combustion product in K\n", "Tg2 = Tg2_+273 # Lower temperature of combustion product in K\n", "f1 = cpg*(Tg1-T0)-T0*cpg*(math.log(Tg1/T0)) # Initial availability of product\n", "f2 = cpg*(Tg2-T0)-T0*cpg*(math.log(Tg2/T0)) # Final availabilty of product\n", "print \"\\n The initial and final availbility of the products are \",f1 ,\" kJ/Kg and \",f2 ,\" kJ/Kg respectively\"\n", "#The answer provided in the textbook is wrong\n", "\n", "# Part (b)\n", "Dfg = f1-f2 # Decrease in availability of products\n", "Ta2 = (Ta1+273) + (mg/ma)*(cpg/cpa)*(Tg1-Tg2) # Exit temperature of air\n", "Ifa = cpa*(Ta2-(Ta1+273))-T0*cpa*(math.log(Ta2/(Ta1+273))) # Increase in availability of air\n", "I = mg*Dfg-ma*Ifa # Irreversibility \n", "print \"\\n The irreversibility of the process is \",I ,\" kW\"\n", "##The answer provided in the textbook contains round off error\n", "\n", "# Part (c)\n", "Ta2_ = (Ta1+273)*(Tg1/Tg2)**((12.5*1.09)/(11.5*1.005))\n", "Q1 = mg*cpg*(Tg1-Tg2) # Heat supply rate from gas to working fluid\n", "Q2 = ma*cpa*(Ta2_-(Ta1+273))# Heat rejection rate from the working fluid in heat engine\n", "W = Q1-Q2 # Power developed by heat engine\n", "print \"\\n Total power generated by the heat engine is \",W ,\" kW\"\n", "#The answer provided in the textbook contains round off error\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.9:pg-260" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.9\n", "\n", " The irreversibility rate is 15.8201795694 kW\n", "\n", " The irreversibility rate at lower temperature is 3.03317755354 kW\n" ] } ], "source": [ "\n", "T2 = 790.0 # Final temperature of gas in degree Celsius\n", "T1 = 800.0 # Initial temperature of gas in degree Celsius\n", "m = 2.0 # Mass flow rate in kg/s\n", "cp = 1.1 # Specific heat capacity in kJ/KgK\n", "T0 = 300.0 # Ambient temperature in K\n", "\n", "print \"\\n Example 8.9\"\n", "I = m*cp*(((T1+273)-(T2+273))-T0*(math.log((T1+273)/(T2+273)))) # irreversibility rate\n", "print \"\\n The irreversibility rate is \",I ,\" kW\"\n", "\n", "# At lower temperature\n", "T1_ = 80.0 # Initial temperature of gas in degree Celsius\n", "T2_ = 70.0 # Initial temperature of gas in degree Celsius\n", "I_ = m*cp*(((T1_+273)-(T2_+273))-T0*(math.log((T1_+273)/(T2_+273)))) # irreversibility rate\n", "print \"\\n The irreversibility rate at lower temperature is \",I_ ,\" kW\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.10:pg-261" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.10\n", "\n", " The rate of energy loss because of the pressure drop due to friction 25.83 kW\n" ] } ], "source": [ "\n", "m = 3 # Mass flow rate in kg/s\n", "R = 0.287 # Gas constant\n", "T0 = 300 # Ambient temperature in K\n", "k = 0.10 # Fractional pressure drop\n", "print \"\\n Example 8.10\"\n", "Sgen = m*R*k # Entropy generation\n", "I = Sgen*T0 # Irreversibility Calculation\n", "print \"\\n The rate of energy loss because of the pressure drop due to friction \",I ,\" kW\"\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.11:pg-261" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.11\n", "\n", " The rate of entropy generation is 0.0446035560498 kW/K\n", "\n", " The rate of energy loss due to mixing is 13.3810668149 kW\n", "\n", " The rate of energy loss due to mixing is 13.3810668149 kW\n" ] } ], "source": [ "\n", "m1 = 2.0 # Flow rate of water in kg/s\n", "m2 = 1.0 # Flow rate of another stream in kg/s\n", "T1 = 90.0 # Temperature of water in degree Celsius\n", "T2 = 30.0# Temperature of another stream in degree Celsius\n", "T0 =300.0 # Ambient temperature in K\n", "cp = 4.187 # Specific heat capacity of water in kJ/kgK\n", "\n", "print \"\\n Example 8.11\"\n", "m = m1+m2 # Net mass flow rate\n", "x = m1/m # mass fraction\n", "t = (T2+273)/(T1+273) # Temperature ratio\n", "Sgen = m*cp*math.log((x+t*(1-x))/(t**(1-x))) # Entropy generation\n", "I = T0*Sgen # Irreversibility production\n", "# Alternatively\n", "T = (m1*T1+m2*T2)/(m1+m2) # equilibrium temperature\n", "Sgen1 = m1*cp*math.log((T+273)/(T1+273))+m2*cp*math.log((T+273)/(T2+273))# Entropy generation\n", "I1 = T0*Sgen1 # Irreversibility production\n", "print \"\\n The rate of entropy generation is \",Sgen ,\" kW/K\"\n", "print \"\\n The rate of energy loss due to mixing is \",I ,\" kW\"\n", "print \"\\n The rate of energy loss due to mixing is \",I1 ,\" kW\" # Calculation from alternative way\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.12:pg-262" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.12\n", " \n", "\n", " PART (A)\n", "\n", " The first law efficiency is 96.0 percent\n", "\n", " The second law efficiency is 79.0588235294 percent\n", " \n", "\n", " PART (B)\n", "\n", " The first law efficiency is 90.0 percent\n", "\n", " The second law efficiency is 42.3529411765 percent\n", " \n", "\n", " PART (C)\n", "\n", " The first law efficiency is 60.0 percent\n", "\n", " The second law efficiency is 4.41176470588 percent\n", " \n", "\n", " PART (D)\n", "\n", " The First law efficiency for all the three cases would remain same and here is 90.0 percent\n", "\n", " The Second law efficiency of part (a) is 74.1176470588 percent\n", "\n", " The Second law efficiency of part (b) is 42.3529411765 percent\n", "\n", " The Second law efficiency of part (c) is 6.61764705882 percent\n" ] } ], "source": [ "\n", "Qr = 500.0 # Heat release in kW\n", "Tr = 2000.0 # Fuel burning temperature in K \n", "T0 = 300.0 # Ambient temperature in K\n", "# Part (a)\n", "print \"\\n Example 8.12\"\n", "Qa = 480.0 # Energy absorption by furnace in kW\n", "Ta = 1000.0 # Furnace temperature in K \n", "n1a = (Qa/Qr) # first law efficiency\n", "n2a = n1a*(1.0-(T0/Ta))/(1.0-(T0/Tr)) #second law efficiency\n", "\n", "#The answers vary due to round off error\n", "print \" \\n\\n PART (A)\"\n", "print \"\\n The first law efficiency is \",n1a*100 ,\" percent\" \n", "print \"\\n The second law efficiency is \",n2a*100 ,\" percent\"\n", "\n", "# Part (b)\n", "Qb = 450.0 # Energy absorption in steam generation in kW\n", "Tb = 500.0# steam generation temperature in K \n", "n1b = (Qb/Qr)# first law efficiency\n", "n2b = n1b*(1.0-(T0/Tb))/(1.0-(T0/Tr))#second law efficiency\n", "print \" \\n\\n PART (B)\"\n", "print \"\\n The first law efficiency is \",n1b*100 ,\" percent\" \n", "print \"\\n The second law efficiency is \",n2b*100 ,\" percent\"\n", "# Part (c)\n", "Qc = 300.0 # Energy absorption in chemical process in kW\n", "Tc = 320.0 # chemical process temperature in K \n", "n1c = (Qc/Qr) # first law efficiency\n", "n2c = n1c*(1.0-(T0/Tc))/(1.0-(T0/Tr))#second law efficiency\n", "print \" \\n\\n PART (C)\"\n", "print \"\\n The first law efficiency is \",n1c*100 ,\" percent\"\n", "print \"\\n The second law efficiency is \",n2c*100 ,\" percent\" \n", "# Part (d)\n", "Qd = 450.0 \n", "n1d = (Qd/Qr)\n", "n2a_= n1d*(1.0-(T0/Ta))/(1.0-(T0/Tr))\n", "n2b_= n1d*(1.0-(T0/Tb))/(1.0-(T0/Tr))\n", "n2c_= n1d*(1.0-(T0/Tc))/(1.0-(T0/Tr))\n", "print \" \\n\\n PART (D)\"\n", "print \"\\n The First law efficiency for all the three cases would remain same and here is \",n1d*100 ,\" percent\" #The answer provided in the textbook is wrong\n", "\n", "print \"\\n The Second law efficiency of part (a) is \",n2a_*100 ,\" percent\"\n", "\n", "print \"\\n The Second law efficiency of part (b) is \",n2b_*100 ,\" percent\"\n", "\n", "print \"\\n The Second law efficiency of part (c) is \",n2c_*100 ,\" percent\"\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.14:pg-265" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.14\n", "\n", " The power input is -235.675 kW\n", " \n", " The second law efficiency of the compressor is 85.5494233193 percent\n" ] } ], "source": [ "\n", "cp = 1.005 # Specific heat capacity of air in kJ/kgK \n", "T2 = 160.0 # Compressed air temperature in degree Celsius\n", "T1 = 25.0 # Ambient temperature\n", "T0 = 25.0 # Ambient temperature\n", "R = 0.287 # Gas constant\n", "P2 = 8.0 # Pressure ratio\n", "P1 = 1.0 # Initial pressure of gas in bar\n", "Q = -100.0 # Heat loss to surrounding in kW\n", "m = 1.0 # Mass flow rate in kg/s\n", "\n", "print \"\\n Example 8.14\"\n", "W = Q + m*cp*((T1+273)-(T2+273)) # power input\n", "AF = cp*((T2+273)- (T1+273))-(T0+273)*((cp*math.log((T2+273)/(T1+273))-(R*math.log(P2/P1)))) # Availability\n", "e = AF/-W # efficiency \n", "print \"\\n The power input is \",W ,\" kW\"\n", "print \" \\n The second law efficiency of the compressor is \",e*100 ,\" percent\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.15:pg-265" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.15\n", "\n", " The exergy of the complete vacuum is 100.0 kJ\n" ] } ], "source": [ "\n", "# Since vacuum has zero mass\n", "U = 0 # Initial internal energy in kJ/kg\n", "H0 = 0 # Initial enthalpy in kJ/kg\n", "S = 0 # Initial entropy in kJ/kgK\n", "# If the vacuum has reduced to dead state\n", "U0 = 0 # Final internal energy in kJ/kg\n", "H0 = 0 # Final enthalpy in kJ/kg\n", "S0 = 0 # Final entropy in kJ/kgK\n", "V0 = 0 # Final volume in m**3\n", "P0 = 1.0 # Pressure in bar\n", "V = 1.0 # Volume of space in m**3\n", "fi = P0*1e5*V\n", "\n", "print \"\\n Example 8.15\"\n", "print \"\\n The exergy of the complete vacuum is \",fi/1e3 ,\" kJ\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.16:pg-266" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.16\n", "\n", " Exergy produced is 34.6210270729 MJ or 9.61695196469 kWh\n" ] } ], "source": [ "\n", "m = 1000.0 # Mass of fish in kg \n", "T0 = 300.0 # Ambient temperature in K\n", "P0 = 1.0 # Ambient pressure in bar\n", "T1 = 300.0 # Initial temperature of fish in K\n", "T2_ = -20.0 # Final temperature of fish in degree Celsius\n", "Tf_ = -2.2 # Freezing point temperature of fish in degree Celsius\n", "Cb = 1.7 # Specific heat of fish below freezing point in kJ/kg\n", "Ca = 3.2 # Specific heat of fish above freezing point in kJ/kg\n", "Lh = 235.0 # Latent heat of fusion of fish in kJ/kg \n", "\n", "print \"\\n Example 8.16\"\n", "T2 = T2_+273 # Final temperature of fish in K\n", "Tf = Tf_+273 # Freezing point temperature of fish in K\n", "H12 = m*((Cb*(Tf-T2))+Lh+(Ca*(T1-Tf))) # Enthalpy change \n", "H21 = -H12 # Enthalpy change \n", "S12 = m*((Cb*math.log(Tf/T2))+(Lh/Tf)+(Ca*math.log(T1/Tf))) # Entropy change\n", "S21 = -S12 # Entropy change\n", "E = H21-T0*S21 #Exergy produced\n", "print \"\\n Exergy produced is \",E/1e3 ,\" MJ or \",E/3600 ,\" kWh\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.17:pg-267" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.17\n", "\n", " The irreversibility in case a is 110.031839359 kJ/kg\n", "\n", " The irreversibility in case b is 38.2318393592 kJ/kg\n" ] } ], "source": [ "\n", "cv = 0.718 # Specific heat capacity of air in kJ/kg\n", "T2 = 500.0 # Final temperature of air in K\n", "T1 = 300.0# Initial temperature of air in K\n", "m = 1.0 # Mass of air in kg\n", "T0 = 300.0 # Ambient temperature\n", "# Case (a)\n", "print \"\\n Example 8.17\"\n", "Sua = cv*math.log(T2/T1) # Entropy change of universe\n", "Ia = T0*Sua # irreversibility\n", "print \"\\n The irreversibility in case a is \",Ia ,\" kJ/kg\"\n", "\n", "# Case (b)\n", "Q = m*cv*(T2-T1) # Heat transfer\n", "T = 600 # Temperature of thermal reservoir in K\n", "Sub = Sua-(Q/T) # Entropy change of universe\n", "Ib = T0*Sub # irreversibility\n", "print \"\\n The irreversibility in case b is \",Ib ,\" kJ/kg\"\n", "#The answers vary due to round off error\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.18:pg-268" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.18\n", "\n", " Irreversibility per unit mass is 142.7096 kJ/kg\n", "\n", " The second law efficiency of the turbine is 78.0527289547 percent\n" ] } ], "source": [ "\n", "h1 = 3230.9 # Enthalpy of steam at turbine inlet in kJ/kg\n", "s1 = 6.69212# Entropy of steam at turbine inlet in kJ/kgK \n", "V1 = 160.0 # Velocity of steam at turbine inlet in m/s\n", "T1 = 400.0 # Temperature of steam at turbine inlet in degree Celsius\n", "h2 = 2676.1 # Enthalpy of steam at turbine exit in kJ/kg\n", "s2 = 7.3549 # Entropy of steam at turbine exit in kJ/kgK \n", "V2 = 100.0 # Velocity of steam at turbine exit in m/s\n", "T2 = 100.0 # Temperature of steam at turbine exit in degree Celsius\n", "T0 = 298.0 # Ambient temperature in K\n", "W = 540.0 # Work developed by turbine in kW\n", "Tb = 500.0 # Average outer surface temperature of turbine in K\n", "\n", "print \"\\n Example 8.18\"\n", "Q = (h1-h2)+((V1**2-V2**2)/2)*1e-03-W # Heat loss\n", "I = 151.84-Q*(0.404) # Irreversibility \n", "AF = W + Q*(1.0-(T0/Tb)) + I # Exergy transfer\n", "n2 = W/AF # second law efficiency\n", "\n", "print \"\\n Irreversibility per unit mass is \",I ,\" kJ/kg\"\n", "print \"\\n The second law efficiency of the turbine is \",n2*100 ,\" percent\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.19:pg-269" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.19\n", "\n", " Case A:\n", "\n", " Rate of availability transfer with heat and the irreversibility rate are \n", " 1.7 kW and -6.8 kW respectively.\n", "\n", " Case B:\n", "\n", " Rate of availability in case b is 3.4 kW \n" ] } ], "source": [ "\n", "T0 = 300.0 # Ambient temperature in K\n", "T = 1500.0 # Resistor temperature in K\n", "Q = -8.5 # Power supply in kW\n", " \n", "# Case (a)\n", "W = -Q # work transfer\n", "I = Q*(1.0-T0/T) + W # Irreversibility\n", "R = Q*(1.0-T0/T) # availability\n", "\n", "print \"\\n Example 8.19\"\n", "print \"\\n Case A:\"\n", "print \"\\n Rate of availability transfer with heat and the irreversibility rate are \\n \",I ,\" kW and \",R ,\" kW respectively.\"\n", "# Case (b)\n", "T1 = 500.0 # Furnace wall temperature\n", "Ib = - Q*(1.0-T0/T) + Q*(1.0-T0/T1) # Irreversibility\n", "print \"\\n Case B:\"\n", "print \"\\n Rate of availability in case b is \",Ib ,\" kW \"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex8.20:pg-270" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Example 8.20\n", "\n", "\n", " Part A:\n", "\n", " There is heat loss to surrounding.\n", "\n", "\n", " Part B:\n", "\n", " The polytropic index is 1.0\n", "\n", "\n", " Part C:\n", "\n", " Isothermal efficiency is 97.8793558312 percent \n", "\n", "\n", " Part D:\n", "\n", " The minimum work input is -6.44697949667 kJ/kg, and irreversibility is 108.941520503 kJ/kg\n", "\n", "\n", " Part E:\n", "\n", " Second law efficiency is 6.0 percent\n" ] } ], "source": [ "import math\n", "p1 = 1 # Air pressure at compressure inlet in bar\n", "t1 = 30 # Air temperature at compressure inlet in degree Celsius\n", "p2 = 3.5 # Air pressure at compressure exit in bar\n", "t2 = 141 # Air temperature at compressure exit in degree Celsius\n", "v = 90 # Air velocity at compressure exit in m/s\n", "cp = 1.0035 # Specific heat capacity of air in kJ/kg\n", "y = 1.4 # Heat capacity ratio\n", "R = 0.287 # Gas constant\n", "print \"\\n Example 8.20\\n\"\n", "T2s = (t1+273)*(p2/p1)**((y-1)/y)\n", "if T2s>(t2+273): \n", " print \"\\n Part A:\"\n", " print \"\\n There is heat loss to surrounding.\"\n", "n =(1/(1-((math.log((t2+273)/(t1+273)))/(math.log(p2/p1)))))\n", "print \"\\n\\n Part B:\"\n", "print \"\\n The polytropic index is \",n\n", "Wa = cp*(t1-t2)-(v**2)/2000 # Actual work \n", "Wt = -R*(t1+273)*math.log(p2/p1) - (v**2)/2000 # Isothermal work\n", "nt =Wt/Wa # Isothermal efficency\n", "print \"\\n\\n Part C:\"\n", "print \"\\n Isothermal efficiency is \",nt*100 ,\" percent \"\n", "df = cp*(t1-t2) + (t1+273)*(R*math.log(p2/p1) - cp*math.log((t2+273)/(t1+273))) -(v**2)/2000\n", "Wm = df # Minimum work input\n", "I = Wm-Wa # Irreversibility\n", "\n", "print \"\\n\\n Part D:\"\n", "print \"\\n The minimum work input is \",Wm,\" kJ/kg, and irreversibility is \",I ,\" kJ/kg\"\n", "# The answers given in the book contain round off error\n", "\n", "neta = Wm/Wa\n", "print \"\\n\\n Part E:\"\n", "print \"\\n Second law efficiency is \",math. ceil(neta*100) ,\" percent\"\n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" } }, "nbformat": 4, "nbformat_minor": 0 }