summaryrefslogtreecommitdiff
path: root/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Chemical_Engineering_Thermodynamics/ch5_2.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Chemical_Engineering_Thermodynamics/ch5_2.ipynb')
-rw-r--r--Chemical_Engineering_Thermodynamics/ch5_2.ipynb761
1 files changed, 761 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics/ch5_2.ipynb b/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
new file mode 100644
index 00000000..db8558ce
--- /dev/null
+++ b/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
@@ -0,0 +1,761 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5 : Exergy"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.1 Page Number : 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of fraction of the availability loss\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 500+273.15;\t\t\t#[C] - Condensation temperature\n",
+ "T_2 = 250+273.15;\t\t\t#[C] - Temperature at which vaporization takes place.\n",
+ "\n",
+ "T_3 = 25+273.15;\t\t\t#[C] - Ambient atmospheric temperature.\n",
+ "\n",
+ "Q = 1;\t\t\t#We are taking a fictitious value of Q, its value is not given.But we need to initialize it wid some value,so we are taking its value as Q=1.\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#The exergy content of the vapour at 500 C,\n",
+ "Ex_T_1 = Q*(1-(T_3/T_1));\n",
+ "Ex_T_2 = Q*(1-(T_3/T_2));\n",
+ "\t\t\t#Therefore,loss in exergy is given by\n",
+ "Ex_loss = Ex_T_1 - Ex_T_2;\n",
+ "\t\t\t#Fraction of exergy lost due to irreversible process is,\n",
+ "Ex_fraction =(Ex_loss/Ex_T_1);\n",
+ "\n",
+ "# Results\n",
+ "print \" The fraction of exergy lost due to irreversible process is %f\"%(Ex_fraction);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The fraction of exergy lost due to irreversible process is 0.299954\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.2 Page Number : 188"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of availability change and irreversibility\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 300.;\t\t\t#[K] - Initial temperature.\n",
+ "P_1 = 100.;\t\t\t#[kPa] - Initial pressure.\n",
+ "T_2 = 500.;\t\t\t#[K] - Final temperature.\n",
+ "T_0 = 300.;\t\t\t#[K] - Environment temperature.\n",
+ "P_0 = 1.;\t\t\t#[atm] - Environment pressure.\n",
+ "R = 8.314;\t\t\t#[J/mol*K]\n",
+ "\t\t\t#(Cp_0/R)= 3.626\n",
+ "Cp_0 = 3.626*R;\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1).\n",
+ "\t\t\t#The availability change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2)\n",
+ "\t\t\t#Let us determine the change in internal energy\n",
+ "\t\t\t#For ideal gas the molar internal energy change is given by delta_U = Cv_0*(T_2-T_1)\n",
+ "\t\t\t#For ideal gas Cp_0 - Cv_0 = R, and therefore\n",
+ "Cv_0 = ((Cp_0/R)- 1)*R;\t\t\t#[J/mol-K] - Heat capacity at constant volume\n",
+ "delta_U = Cv_0*(T_2-T_1);\t\t\t#[J/mol]\n",
+ "\t\t\t#delta_U = -w (from energy balance). Therefore, U1-U2 = -delta_U.\n",
+ "\t\t\t#The entropy change of ideal gas is given by\n",
+ "\t\t\t#delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), but,(P1*V1/T1) = (P1*V1/T1) and therefore (P2/P1) = (T2/T1)\n",
+ "delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(T_2/T_1);\t\t\t#[J/mol-K]\n",
+ "\t\t\t#The exergy change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2)\n",
+ "\t\t\t#(V_1 - V_2) = 0, because the tank is rigid and so the volume is constant\n",
+ "delta_phi = (-delta_U) - T_0*(-delta_S);\t\t\t#[J/mol]\n",
+ "print \" 1).The change in exergy is %f J/mol\"%(delta_phi);\n",
+ "\n",
+ "\t\t\t#(2).\n",
+ "\t\t\t#Entropy change of the system is given by, delta_S_sys = q/T_b + S_gen\n",
+ "\t\t\t#Since the system is adiabatic therefore, delta_S_sys = S_gen\n",
+ "S_gen = delta_S;\n",
+ "\t\t\t#Irreversibility is given by\n",
+ "i = T_0*S_gen;\t\t\t#[J/mol]\n",
+ "print \" 2).The value of irreversibility is %f J/mol\"%(i);\n",
+ "\t\t\t#Irreversibility can also be determined using\n",
+ "\t\t\t#i = (W_rev_use - W_use)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The change in exergy is -1020.722863 J/mol\n",
+ " 2).The value of irreversibility is 3345.789937 J/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.3 Page Number : 190"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of availability change and irreversibility\n",
+ "\n",
+ "import math\n",
+ "# Variables\n",
+ "P_1 = 15.;\t\t\t#[bar] - Initial pressure\n",
+ "P_1 = P_1*10**(5);\t\t\t#[Pa]\n",
+ "T_1 = 300.+273.15;\t\t\t#[K] - Initial temperature\n",
+ "T_0 = 298.15;\t\t\t#[K]\n",
+ "T_R = 1200.;\t\t\t#[K] - Reservoir temerature.\n",
+ "P_0 = 1.;\t\t\t#[bar]\n",
+ "P_0 = P_0*10**(5);\t\t\t#[Pa]\n",
+ "n = 1.;\t\t\t#[mol] - No of moles\n",
+ "R = 8.314;\t\t\t#[J/mol*K]\n",
+ "Y = 1.4;\t\t\t# - Ratio of heat capacities.\n",
+ "Cv_0 = R/(Y-1);\t\t\t#[J/mol-K] - Heat capacity at constant volume\n",
+ "Cp_0 = Cv_0 + R;\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#V_2 = 2*V_1 and since pressure is constant,we get (V_1/T_1) = (2*V_1/T_1), or, T_2 = 2*T_1.\n",
+ "T_2 = 2*T_1;\t\t\t#[K]\n",
+ "W = P_1*(((R*T_2)/P_1)-((R*T_1)/P_1));\t\t\t#[J/mol] - Actual work done\n",
+ "delta_U = Cv_0*(T_2-T_1);\t\t\t#[J/mol] - Change in internal energy.\n",
+ "q = W + delta_U;\t\t\t#[J/mol] - Heat change\n",
+ "\t\t\t#Now the availability change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2) + q*(1-(T_0/T_R))\n",
+ "\t\t\t#delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and P_1 = P_2, Therefore\n",
+ "delta_S = Cp_0*math.log(T_2/T_1);\t\t\t#[J/mol-K] - Entropy change.\n",
+ "\t\t\t#Substituting expressions for delta_phi calculation. Decrease in availability is given by,\n",
+ "delta_phi = (-delta_U) + P_0*(((R*T_1)/P_1)-((R*T_2)/P_1)) - T_0*(-delta_S) + q*(1-(T_0/T_R));\t\t\t#[J/mol]\n",
+ "\t\t\t#Actual work done is given by, W = P_1*(V2-V1)\n",
+ "\t\t\t#Work done to print lace the atmosphere is given by, W = P_0*(V_2-V_1)\n",
+ "\t\t\t#Therefore, W_use = (P_1*(V2-V1) - P_0*(V2-V1))\n",
+ "W_use = (P_1-P_0)*(((R*T_2)/P_1)-((R*T_1)/P_1));\t\t\t#[J/mol] - useful work done\n",
+ "W_rev_use = delta_phi;\t\t\t# reversible useful work done\n",
+ "\t\t\t#Irreversibility is given by,\n",
+ "i = W_rev_use - W_use;\t\t\t#[J/mol]\n",
+ "print \" a).When the system is confined at constant pressure by a piston and is heated until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i);\n",
+ "\n",
+ "\t\t\t#The irreversibility can also be calculated using \n",
+ "\t\t\t# i = T_0*S_gen\n",
+ "\t\t\t#S_gen = delta_S - (q/T_R)\n",
+ "\n",
+ "\t\t\t#(b)\n",
+ "\t\t\t#V2 = 2*V_1 and therefore T_2 = 2*T_1, as P_2 = P_1\n",
+ "\t\t\t#Actual work done is same as before\n",
+ "\t\t\t#Let work done on stirrer be W_stir. Thus net work done by the system is W - W_stir.Fron energy balance we get,\n",
+ "W_stir = W + delta_U;\n",
+ "\t\t\t#Initially the exergy is due to that of the system at state 1 and stirrer work,'W_stir' and finally we have the exergy due to system at state 2,the stirrer work is spent,thus availability is given by\n",
+ "delta_phi_b = (-delta_U) + P_0*(((R*T_1)/P_1)-((R*T_2)/P_1)) - T_0*(-delta_S) + W_stir;\t\t\t#[J/mol]\n",
+ "W_rev_use_b = delta_phi_b;\t\t\t# reversible useful work done\n",
+ "W_use_b = W_use;\t\t\t# useful work done\n",
+ "\t\t\t#Now the irreversibility is given by,\n",
+ "i_b = W_rev_use_b - W_use_b;\t\t\t#[J/mol]\n",
+ "print \" b).When the system is confined at constant pressure by a piston and is stirred until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i_b);\n",
+ "\n",
+ "\t\t\t#The irreversibility can also be calculated using \n",
+ "\t\t\t# i_b = T_0*S_gen\n",
+ "\t\t\t#S_gen = delta_S - (q/T_R) and here, q = 0\n",
+ "\n",
+ "\t\t\t#(c)\n",
+ "P_2_c = 10;\t\t\t#[bar] - Final pressure, (Given)\n",
+ "P_2_c = P_2_c*10**(5);\t\t\t#[Pa]\n",
+ "\t\t\t#(P_1**(1-Y))*(T_1**(Y)) = (P_2**(1-Y))*(T_2**(Y))\n",
+ "T_2_c = T_1*((P_1/P_2_c)**((1-Y)/Y));\t\t\t#[K]\n",
+ "\t\t\t#Work done is given by, W = -delta_U = -Cv_0*(T_2_c - T_1)\n",
+ "W_c = -Cv_0*(T_2_c - T_1);\t\t\t#[J/mol]\n",
+ "\t\t\t#The final molar volume is calculated using P_1*V_1**(Y) = P_2*V_2**(Y)\n",
+ "\t\t\t#V_2 = V_1*((P_1/P_2_c)**(1/Y))\n",
+ "V_1 = (R*T_1)/P_1;\t\t\t#[cubic metre/mol] - Initial molar volume\n",
+ "V_2 = V_1*((P_1/P_2_c)**(1/Y));\t\t\t#[cubic metre/mol] - Final molar volume\n",
+ "\t\t\t#Now let us determine the work done to print lace the atmosphere,\n",
+ "W_atm_c = P_0*(V_2 - V_1);\t\t\t#[J/mol] - work done to print lace the atmosphere\n",
+ "\t\t\t#Thus useful work is given by,\n",
+ "W_use_c = W - W_atm_c;\t\t\t#[J/mol] - useful work done\n",
+ "\t\t\t#Here delta_S = 0,for reversible adiabatic process.Therefore,\n",
+ "W_rev_use_c = W_use_c;\n",
+ "\t\t\t#Now finally the irreversibility is given by,\n",
+ "i_c = W_rev_use_c - W_use_c;\t\t\t#[J/mol]\n",
+ "print \" c).When the system expands reversibly and adiabatically behind a piston \\n the ireversibility value is %f J/mol\"%(i_c);\n",
+ "\n",
+ "\t\t\t#(d)\n",
+ "\t\t\t#Here temperature is constant,but V_2 = 2*V_1, therefore P_2 = P_1/2\n",
+ "V_2_d = 2*V_1;\n",
+ "P_2_d = P_1/2;\n",
+ "\t\t\t#Under isothermal conditions work done is\n",
+ "W_d = R*T_1*math.log(V_2_d/V_1);\t\t\t#[J/mol]\n",
+ "\t\t\t#Work done to print lace the atmosphere is given by,\n",
+ "W_atm_d = P_0*(V_2_d - V_1);\t\t\t#[J/mol] - work done to print lace the atmosphere\n",
+ "\t\t\t#Thus useful work is given by,\n",
+ "W_use_d = W_d - W_atm_d;\t\t\t#[J/mol] - useful work done\n",
+ "delta_U_d = 0;\t\t\t#isothermal conditions\n",
+ "q_d = W_d;\t\t\t# since, delta_U_d = 0\n",
+ "\t\t\t#delta_S_d = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and T_1 = T_2, Therefore\n",
+ "delta_S_d = -R*math.log(P_2_d/P_1);\t\t\t#[J/mol-K] - Entropy change\n",
+ "\t\t\t#The reversible useful work is given by,\n",
+ "W_rev_use_d = P_0*(V_1 - V_2_d) - T_0*(-delta_S_d) + q_d*(1-(T_0/T_R));\t\t\t#[J/mol] - Reversible useful work done.\n",
+ "\t\t\t#The irreversibility is given by,\n",
+ "i_d = W_rev_use_d - W_use_d;\t\t\t#[J/mol]\n",
+ "print \" d).When the system expands reversibly and isothermally behind a piston until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i_d);\n",
+ "\n",
+ "\t\t\t#(e)\n",
+ "P_2_e = 10;\t\t\t#[bar] - Final pressure, (Given)\n",
+ "P_2_e = P_2_e*10**(5);\t\t\t#[Pa]\n",
+ "\t\t\t#During the expansion of an ideal gas in into vacuum the temperature of the gas remains the same,\n",
+ "T_2_e = T_1;\t\t\t# Final temperature\n",
+ "\t\t\t#Since boundary of the system is fixed so no net work is done, W = 0 and thus\n",
+ "W_use_e = 0;\t\t\t#[J/mol] - Useful work done\n",
+ "\t\t\t#Here, delta_U = 0,as temperature is same and\n",
+ "\t\t\t#(V_1-V_2) = 0,as for overall system there is no change in volume\n",
+ "delta_S_e = - R*math.log(P_2_e/P_1);\t\t\t#[J/mol-K] - Entropy change\n",
+ "\t\t\t#The reversible useful work is given by,\n",
+ "W_rev_use_e = - T_0*(-delta_S_e);\t\t\t#[J/mol] - Reversible useful work done.\n",
+ "\t\t\t#The irreversibility is given by,\n",
+ "i_e = W_rev_use_e - W_use_e;\t\t\t#[J/mol]\n",
+ "print \" e).When the system expands adiabatically into an adjacent chamber \\n the ireversibility value is %f J/mol\"%(i_e);\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " a).When the system is confined at constant pressure by a piston and is heated until it's volume is doubled \n",
+ " the ireversibility value is 1869.841742 J/mol\n",
+ " b).When the system is confined at constant pressure by a piston and is stirred until it's volume is doubled \n",
+ " the ireversibility value is 6013.652646 J/mol\n",
+ " c).When the system expands reversibly and adiabatically behind a piston \n",
+ " the ireversibility value is 0.000000 J/mol\n",
+ " d).When the system expands reversibly and isothermally behind a piston until it's volume is doubled \n",
+ " the ireversibility value is 897.537657 J/mol\n",
+ " e).When the system expands adiabatically into an adjacent chamber \n",
+ " the ireversibility value is 1005.074654 J/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.4 Page Number : 194"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of useful work and irreversibility\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 150+273.15;\t\t\t#[K] - Initial temperature.\n",
+ "m = 4.6;\t\t\t#[kg] - mass of water\n",
+ "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n",
+ "Q = 11000;\t\t\t#[kJ] - Heat transferred to the system.\n",
+ "T_R = 600+273.15;\t\t\t#[K] - Temperature of the reservior.\n",
+ "T_0 = 298;\t\t\t#[K] - Temperature of the environment\n",
+ "P_0 = 100;\t\t\t#[kPa] - Pressure of the environment\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#The entropy change of an isothermal system undergoing an internally reversible process is given by,\n",
+ "delta_S_t = (Q/T_1);\t\t\t#[kJ] - Entropy change\n",
+ "delta_S = delta_S_t/m;\t\t\t#[kJ/kg-K] - \n",
+ "\n",
+ "\t\t\t#At 150 C,it has been reported in the book that, P_sat - 0.4758 kPa, V_liq = 0.001091 m**(3)/kg, U_liq = 631.68 kJ/kg, S_liq = 1.8418 kJ/kg-K, S_vap = 6.8379 kJ/kg-K\n",
+ "V_1 = 0.001091;\t\t\t#[m**(3)/kg] - initial specific volume\n",
+ "U_1 = 631.68;\t\t\t#[kJ/kg] - initial specific internal energy\n",
+ "S_1 = 1.8418;\t\t\t#[kJ/kg-K] - initial entropy\n",
+ "\t\t\t#The initial state of the water is a compressed liquid state,and S_1 is therefore equal to the entropy of the saturated liquid of the saturated liquid at the same temperature.\n",
+ "S_2 = S_1 + delta_S;\t\t\t#[kJ/kg-K] - Final entropy\n",
+ "\n",
+ "\t\t\t#At the final state the temperature is 150 C and S = 7.499 kJ/kg-K which is more than S_vap therefore it is superheated steam.\n",
+ "S_final = 7.494;\t\t\t#[kJ/kg-K]\n",
+ "\t\t\t#At 150 C, and 0.1 MPa: V = 1.9364 m**(3)/kg, U = 2582.8 kJ/kg, S = 7.6134 kJ/kg-K\n",
+ "\t\t\t#At 150 C, and 0.2 MPa: V = 0.9596 m**(3)/kg, U = 2576.9 kJ/kg, S = 7.2795 kJ/kg-K\n",
+ "U_t_1 = 2582.8;\t\t\t#[kJ/kg] - Internal energy\n",
+ "U_t_2 = 2576.9;\t\t\t#[kJ/kg]\n",
+ "V_t_1 = 1.9364;\t\t\t#[m**(3)/kg] - Specific volume\n",
+ "V_t_2 = 0.9596;\t\t\t#[m**(3)/kg]\n",
+ "S_t_1 = 7.6134;\t\t\t#[kJ/kg-K] - Entropy\n",
+ "S_t_2 = 7.2795;\t\t\t#[kJ/kg-K]\n",
+ "\t\t\t#The pressure at exit is given by,\n",
+ "P_2 = ((S_final - S_t_1)/(S_t_2 - S_t_1))*(0.2 - 0.1) + 0.1;\t\t\t#[Mpa] - Final pressure\n",
+ "\t\t\t#At final state\n",
+ "U_2 = U_t_1 + (U_t_2 - U_t_1)*((S_final - S_t_1)/(S_t_2 - S_t_1));\t\t\t#[kJ/kg] - Final specific internal energy\n",
+ "V_2 = V_t_1 + (V_t_2 - V_t_1)*((S_final - S_t_1)/(S_t_2 - S_t_1));\t\t\t#[m**(3)/kg] - Final specific volume\n",
+ "\n",
+ "q = Q/m;\t\t\t#[kJ/kg] - Heat supplied per unit kg of mass.\n",
+ "W_rev_use = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2) + q*(1 - (T_0/T_R));\t\t\t#[kJ/kg] - Reversible useful work done.\n",
+ "\n",
+ "\t\t\t#Now let us calculate the actual work done. We know q - W = delta_U, therefore\n",
+ "W = q - (U_2 - U_1);\t\t\t#[kJ/kg] - Work done\n",
+ "W_use = W - P_0*(V_2 - V_1);\t\t\t#[kJ/kg]\n",
+ "i = W_rev_use - W_use;\t\t\t#[kJ/kg] - Irreversibility\n",
+ "\t\t\t#Since the system contains 4.6 g therefore, \n",
+ "W_use_new = W_use*m;\t\t\t#[kJ]\n",
+ "W_rev_use_new = W_rev_use*m;\t\t\t#[kJ]\n",
+ "I = W_rev_use_new - W_use_new;\t\t\t#[kJ]\n",
+ "\n",
+ "# Results\n",
+ "print \" 1).The useful work obtained is %f kJ\"%(W_use_new);\n",
+ "print \" 2).The reversible usefuk work done is %f kJ\"%(W_rev_use_new);\n",
+ "print \" 3).The irreversibility is %f kJ\"%(I);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The useful work obtained is 1304.987050 kJ\n",
+ " 2).The reversible usefuk work done is 5297.425775 kJ\n",
+ " 3).The irreversibility is 3992.438725 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.5 Page Number : 197"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of reversible work and irreversibility\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 700+273.15;\t\t\t#[K] - Initial temperature.\n",
+ "P_1 = 12;\t\t\t#[MPa] - Initial pressure\n",
+ "P_2 = 0.6;\t\t\t#[MPa] - Final pressure\n",
+ "\t\t\t#At 12 MPa and 700 C,\n",
+ "H_1 = 3858.4;\t\t\t#[kJ/kg] - initial enthalpy\n",
+ "S_1 = 7.0757;\t\t\t#[kJ/kg-K] - initial entropy\n",
+ "\n",
+ "\t\t\t#At 0.6 MPa and 200 C,\n",
+ "H_2 = 2850.1;\t\t\t#[kJ/kg]\n",
+ "S_2 = 6.9673;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "\t\t\t#At 0.6 MPa and 250 C,\n",
+ "H_3 = 2957.2;\t\t\t#[kJ/kg]\n",
+ "S_3 = 7.1824;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "\t\t\t#At 0.6 MPa and 300 C,\n",
+ "H_4 = 3061.6;\t\t\t#[kJ/kg]\n",
+ "S_4 = 7.3732;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#In the case of ideal turbine the entropy change does not take place,therefore the exit conditions are\n",
+ "P_exit = P_2;\t\t\t#[MPa] - exit pressure\n",
+ "T_exit = ((S_1 - S_2)/(S_3 - S_2))*(250 - 200) + 200;\t\t\t#[C] - exit temperature\n",
+ "H_exit = ((S_1 - S_2)/(S_3 - S_2))*(H_3 - H_2) + H_2;\t\t\t#[kJ/kg] - exit enthalpy\n",
+ "\n",
+ "\t\t\t#Snce it is a flow pocess,therfore\n",
+ "\t\t\t#W_rev = H_1 - H_exit - T_0*(S_1 - S_2)\n",
+ "\t\t\t#As S_1 = S_2,the above equation becomes\n",
+ "W_rev_1 = H_1 - H_exit;\t\t\t#[kJ/kg] - reversible work done\n",
+ "\n",
+ "\t\t\t#From the first law the actual work done can be calculated using, delta_H = q - W\n",
+ "\t\t\t#Since the turbine does not exchange heat,therefore W = - delta_H.\n",
+ "W_1 = - (H_exit - H_1);\t\t\t#[kJ/kg]\n",
+ "\n",
+ "print \" 1).The reversible work done is %f kJ/kg\"%(W_1);\n",
+ "print \" And since the maximum work is same as the actual work ,therefore irreversibility is zero\"\n",
+ "\n",
+ "\t\t\t#(2)\n",
+ "\t\t\t# Variables\n",
+ "T_0 = 298.15;\t\t\t#[K] - Environment temperature\n",
+ "P_0 = 1;\t\t\t#[atm] - Environment pressure\n",
+ "adi_eff = 0.88;\t\t\t#adiabatc efficiency\n",
+ "\n",
+ "\t\t\t#(H_1 - H_exit_actual)/(H_1 - H_exit) = 0.88, therefore\n",
+ "H_exit_actual = H_1 - 0.88*(H_1 - H_exit);\t\t\t# - Actual exit enthalpy\n",
+ "\n",
+ "\t\t\t#Now two properties i.e pressure = 0.6 MPa and enthalpy = H_exit_actual is fixed at the exit. The exit temperature is given by,\n",
+ "T_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(300 - 250) + 250;\t\t\t#[C]\n",
+ "S_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(S_4 - S_3) + S_3;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "\t\t\t#Now reversible work done is given by,\n",
+ "W_rev_2 = H_1 - H_exit_actual - T_0*(S_1 - S_exit_actual);\t\t\t#[kJ/kg]\n",
+ "print \" 2).The reversible work done is %f kJ/kg\"%(W_rev_2);\n",
+ "\n",
+ "\t\t\t#The actual work is given by the first law,\n",
+ "W_2 = H_1 - H_exit_actual;\t\t\t#[kJ/kg] - Actual work done\n",
+ "i = W_rev_2 - W_2;\t\t\t#[kJ/kg] - irreversibility\n",
+ "print \" The value of irreversibility is %f kJ/kg\"%(i);\n",
+ "\n",
+ "\t\t\t#The irreversibility can also be determined using\n",
+ "\t\t\t# i = T_0*S_gen, and S_gen is given by\n",
+ "\t\t\t# S_gen = (q/T_R) - delta_S\n",
+ "\n",
+ "\t\t\t#The second law efficiency of the turbine is actual work done divided by reversible work,therefore\n",
+ "sec_eff = W_2/W_rev_2;\n",
+ "print \" The second law efficiency of the turbine is %f\"%(sec_eff);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The reversible work done is 954.326778 kJ/kg\n",
+ " And since the maximum work is same as the actual work ,therefore irreversibility is zero\n",
+ " 2).The reversible work done is 905.072590 kJ/kg\n",
+ " The value of irreversibility is 65.265025 kJ/kg\n",
+ " The second law efficiency of the turbine is 0.927890\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.6 Page Number : 198"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of maximum obtainable work and efficiency\n",
+ "\n",
+ "# Variables\n",
+ "P_1 = 8.;\t\t\t#[bar] - Initial pressure\n",
+ "T_1 = 93. + 273.15;\t\t\t#[C] - Initial temperature\n",
+ "V_1 = 100.;\t\t\t#[m/s] - Initial velocity\n",
+ "P_2 = 1.25;\t\t\t#[bar] - Exit pressure\n",
+ "T_2 = 27. + 273.15;\t\t\t#[C] - Exit temperature\n",
+ "V_2 = 60.;\t\t\t#[m/s] - Exit velocity \n",
+ "Y = 1.4;\t\t\t#Ratio of specific heat capacities\n",
+ "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n",
+ "P_0 = 1.;\t\t\t#[bar] - surrounding pressure\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Gas constant\n",
+ "Cp_0 = (R*Y)/(Y-1);\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#Since the amount of heat transfer is negligible,therefore from first law the actual work done is given by,\n",
+ "\t\t\t#W = delta_H + (delta_V_square)/2\n",
+ "delta_H = Cp_0*(T_2 - T_1);\t\t\t#[J/mol] - enthalpy change\n",
+ "delta_H = (delta_H/28.84);\t\t\t#[kJ/kg] - (1 mole = 28.84 g).\n",
+ "delta_V_square = V_2**(2) - V_1**(2);\n",
+ "\n",
+ "W = - delta_H - ((delta_V_square)/2)/1000;\t\t\t#[kJ/kg] - Actual work done\n",
+ "print \" The actual work done is %f kJ/kg\"%(W);\n",
+ "\n",
+ "\t\t\t#Now let us calculate the maximum work that can be obtained\n",
+ "\t\t\t#W_rev = (H_1 + (V_1**(2))/2) - (H_2 + (V_2**(2))/2) - T_0*(S_1 - S_2)\n",
+ "delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);\t\t\t#[J/mol-K] - Entropy change\n",
+ "delta_S = delta_S/28.84;\t\t\t#kJ/kg-K]\n",
+ "W_rev = -delta_H - ((delta_V_square/2)/1000) + T_0*delta_S;\t\t\t#[kJ/kg]\n",
+ "print \" The maximum work obtainable per kg of air is %f kJ/kg\"%(W_rev);\n",
+ "\n",
+ "\t\t\t#The second law efficiency of the turbine is actual work done divided by reversible work,therefore\n",
+ "sec_eff = W/W_rev;\n",
+ "print \" The second law efficiency of the turbine is %f\"%(sec_eff);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The actual work done is 69.792718 kJ/kg\n",
+ " The maximum work obtainable per kg of air is 169.550182 kJ/kg\n",
+ " The second law efficiency of the turbine is 0.411635\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.7 Page Number : 200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of entropy generation rate and irreversibility\n",
+ "\n",
+ "# Variables\n",
+ "m_cold_water = 60;\t\t\t#[kg/s] - mass flow rate of cold water\n",
+ "P_1 = 50;\t\t\t#[kPa]\n",
+ "T_2 = 250;\t\t\t#[C]\n",
+ "T_water_1 = 1000 + 273.15;\t\t\t#[K] - Entering temperature of water\n",
+ "T_water_2 = 450 +273.15;\t\t\t#[K] - Exit temperature of water\n",
+ "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n",
+ "P_0 = 1;\t\t\t#[atm] - surrounding pressure\n",
+ "Cp_0 = 1.005;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "\t\t\t#For water at 50 kPa under saturated conditions,T_sat = 81.33 C, \n",
+ "H_liq_1 = 340.49;\t\t\t#[kJ/kg] - Enthalpy\n",
+ "S_liq_1 = 1.0910;\t\t\t#[kJ/kg-K] - Entropy\n",
+ "\n",
+ "\t\t\t#For steam at 50 kPa and 250 C,\n",
+ "H_2 = 2976.0;\t\t\t#[kJ/kg]\n",
+ "S_2 = 8.3556;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#The cold stream is water which enters as saturated liquid at 50 kPa and exits as superheated vapour at 50 kPa and 250 C,since pressure drop is neglected.\n",
+ "\t\t\t#The mass flow rate of hot stream can be obtained from energy balance\n",
+ "m_hot_water = (m_cold_water*(H_2 - H_liq_1))/(Cp_0*(T_water_1 - T_water_2));\t\t\t#[kg/s] - mass flow rate of hot water\n",
+ "\n",
+ "\t\t\t#Since there is no heat exchange with the surrounding therefore the total entropy generation is given by\n",
+ "\t\t\t#S_gen = delta_S_hot + delta_S_cold\n",
+ "delta_S_cold = S_2 - S_liq_1;\t\t\t#[kJ/kg-K] - change of entropy of cold water\n",
+ "\t\t\t#delta_S_hot = Cp_0*math.log(T_2/T_1)-R*math.log(P_2/P_1), But pressure drop is zero,therfore\n",
+ "delta_S_hot = Cp_0*math.log(T_water_2/T_water_1);\t\t\t#[kJ/kg-K] - change of entropy of hot water\n",
+ "\n",
+ "S_gen = m_cold_water*delta_S_cold + m_hot_water*delta_S_hot;\t\t\t#[kW/K] - Entropy generated\n",
+ "print \" The entropy generation rate is %f kW/K\"%(S_gen);\n",
+ "\n",
+ "\t\t\t#The irreversibility rete is given by\n",
+ "I = T_0*S_gen;\t\t\t#[kW]\n",
+ "print \" The irreversibility rate of the heat exchanger is %f kW\"%(I);\n",
+ "\n",
+ "\t\t\t#The irreversibility can also be determined using the exergy approach\n",
+ "\t\t\t#We know that, I = W_rev - , but since actual work done zero in heat exchangers,therefore I = W_rev = exergy change\n",
+ "\t\t\t#(si_1 - si_2)_cold = H_1 - H_2 - T_0*(S_1 - S_2)\n",
+ "\t\t\t#(si_1 - si_2)_hot = Cp_0*(T_1 - T_2)- T_0*(S_1 - S_2)\n",
+ "\t\t\t# I = (si_1 - si_2)_cold - (si_1 - si_2)_hot.\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The entropy generation rate is 273.250824 kW/K\n",
+ " The irreversibility rate of the heat exchanger is 81469.733193 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.8 Page Number : 201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of exit temperature entropy and irreversibility rate\n",
+ "\n",
+ "# Variables\n",
+ "m_water = 10000.;\t\t\t#[kg/h] - Mass flow rate of cold water\n",
+ "m_water = m_water/3600;\t\t\t#[kg/s]\n",
+ "T_1_water = 30. + 273.15;\t\t\t#[K] - Cold water entering temperature\n",
+ "m_HC = 5000.;\t\t\t#[kg/h] - mass flow rate of hot hydrocarbon\n",
+ "m_HC = m_HC/3600;\t\t\t#[kg/s]\n",
+ "T_1_HC = 200. + 273.15;\t\t\t#[K] - Hot hydrocarbon entering temperature\n",
+ "T_2_HC = 100. + 273.15;\t\t\t#[K] - Hot hydrocarbon leaving temperature\n",
+ "Cp_0_water = 1.0;\t\t\t#[kcal/kg-K] - Mean heat capacity of cooling water\n",
+ "Cp_0_HC = 0.6;\t\t\t#[kcal/kg-K] - Mean heat capacity of hydrocarbon\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#Applying energy balance to the heat exchanger,we get\n",
+ "\t\t\t#m_water*Cp_0_water*(T - T_1_water) = m_HC*Cp_0_HC*(T_1_HC - T_2_HC)\n",
+ "T_2_water = ((m_HC*Cp_0_HC*(T_1_HC - T_2_HC))/(m_water*Cp_0_water)) + T_1_water;\t\t\t#[K]\n",
+ "T_2 = T_2_water - 273.15;\t\t\t#[C]\n",
+ "print \" 1).The exit temperature of the cooling water is %f C\"%(T_2);\n",
+ "\n",
+ "\t\t\t#(2)\n",
+ "\t\t\t#delta_S_hot_HC = Cp_0*math.log(T_2/T_1)-R*math.log(P_2/P_1), But pressure drop is zero,therfore\n",
+ "delta_S_hot_HC = (Cp_0_HC*4.184)*math.log(T_2_HC/T_1_HC);\t\t\t#[kW/K] - change of entropy of hot hydrocarbon\n",
+ "delta_S_HC = m_HC*delta_S_hot_HC;\t\t\t#[kW/K] - Entropy change for hudrocarbon liquid \n",
+ "print \" 2).Entropy change rate of hydrocarbon liquid is %f kW/K\"%(delta_S_HC);\n",
+ "\n",
+ "delta_S_cold_water = (Cp_0_water*4.184)*math.log(T_2_water/T_1_water);\t\t\t#[kW/K] - change of entropy of cooling water\n",
+ "delta_S_water = m_water*delta_S_cold_water;\t\t\t#[kW/K] - Entropy change for water\n",
+ "print \" And entropy change rate of water is %f kW/K\"%(delta_S_water);\n",
+ "\n",
+ "\t\t\t#(3)\n",
+ "T_0 = 298.15;\t\t\t#[K] - Surrounding temperature\n",
+ "\t\t\t#S_gen = delta_S_cold_water + delta_S_hot_HC = m_water*delta_S_cold_water + m_HC*delta_S_hot_HC;\t\t\t#[kW/K] - Entropy generated\n",
+ "S_gen = delta_S_water + delta_S_HC;\t\t\t#[kW/K]\n",
+ "I = T_0*S_gen;\t\t\t#[kW]\n",
+ "print \" 3).The irreversibility rate of the heat exchanger is %f kW\"%(I);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The exit temperature of the cooling water is 60.000000 C\n",
+ " 2).Entropy change rate of hydrocarbon liquid is -0.827846 kW/K\n",
+ " And entropy change rate of water is 1.096732 kW/K\n",
+ " 3).The irreversibility rate of the heat exchanger is 80.168382 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.9 Page Number : 202"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determinatio of exit temperature availability change and irreversibility\n",
+ "\n",
+ "# Variables\n",
+ "T_1_hotgas = 800.;\t\t\t#[K]\n",
+ "P_1_hotgas = 1.;\t\t\t#[bar]\n",
+ "T_2_hotgas = 700.;\t\t\t#[K]\n",
+ "P_2_hotgas = 1.;\t\t\t#[bar]\n",
+ "T_1_air = 470.;\t\t\t#[K]\n",
+ "P_1_air = 1.;\t\t\t#[bar]\n",
+ "P_2_air = 1.;\t\t\t#[bar]\n",
+ "Cp_0_hotgas = 1.08;\t\t\t#[kJ/kg-K] - Mean heat capacity of hot gas\n",
+ "Cp_0_air = 1.05;\t\t\t#[kcal/kg-K] - Mean heat capacity of air\n",
+ "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n",
+ "P_0 = 1.;\t\t\t#[bar] - surrounding pressure\n",
+ "\t\t\t#m_air = 2*m_hotgas\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#Assuming heat exchange only takes places in-between the streams,from energy balance we get,\n",
+ "\t\t\t#m_gas*Cp_0_hotgas*(T_2_hotgas - T_1_hotgas) + 2*m_gas*Cp_0_air*(T - T_1_air), \n",
+ "T_2_air = T_1_air - ((Cp_0_hotgas*(T_2_hotgas - T_1_hotgas))/(2*Cp_0_air));\t\t\t#[K] - Temp of emerging air\n",
+ "print \" 1).The temperature of emerging air is %f K\"%(T_2_air);\n",
+ "\n",
+ "\t\t\t#(2)\n",
+ "\t\t\t#Availability change of hot gas is given by,\n",
+ "\t\t\t#(si_1 - si_2)_hot = H_1 - H_2 - T_0*(S_1 - S_2)\n",
+ "delta_H_hotgas = (Cp_0_hotgas*(T_2_hotgas - T_1_hotgas));\t\t\t#[kJ/kg] - change in enthalpy of hotgas\n",
+ "\t\t\t#delta_S_hotgas = Cp_0_hotgas*math.log(T_2_hotgas/T_1_hotgas)- R*math.log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n",
+ "delta_S_hotgas = Cp_0_hotgas*math.log(T_2_hotgas/T_1_hotgas);\t\t\t#[kJ/kg-K] - change of entropy of hot gas\n",
+ "delta_si_hotgas = (-delta_H_hotgas) - (-T_0*delta_S_hotgas);\t\t\t#[kJ/kg]\n",
+ "print \" 2).The availability change of hot gas is %f kJ/kg\"%(delta_si_hotgas);\n",
+ "\n",
+ "\t\t\t#(3)\n",
+ "\t\t\t#Availability change of air is given by,\n",
+ "\t\t\t#(si_1 - si_2)_air = H_1 - H_2 - T_0*(S_1 - S_2)\n",
+ "delta_H_air = (Cp_0_air*(T_2_air - T_1_air));\t\t\t#[kJ/kg] - change in enthalpy of air\n",
+ "\t\t\t#delta_S_air = Cp_0_air*math.log(T_2_air/T_1_air)- R*math.log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n",
+ "delta_S_air = Cp_0_air*math.log(T_2_air/T_1_air);\t\t\t#[kJ/kg-K] - change of entropy of air\n",
+ "delta_si_air = (-delta_H_air) - (-T_0*delta_S_air);\t\t\t#[kJ/kg]\n",
+ "print \" 3).The availability change of air is %f kJ/kg\"%(delta_si_air);\n",
+ "\n",
+ "\t\t\t#(4)\n",
+ "\t\t\t#For the heat exchanger (Q = 0, W = 0)\n",
+ "\t\t\t#Basis : 1 kg of hot gas flowing through heat exchanger\n",
+ "S_gen = delta_S_hotgas + 2*delta_S_air;\t\t\t#[kJ/kg-K] - (as m_air = 2*m_hotgas)\n",
+ "I = T_0*S_gen;\t\t\t#[kJ/kg]\n",
+ "print \" 4).The irreversibility of thr exchanger per kg of hot gas flowing is %f kJ/kg\"%(I);\n",
+ "\n",
+ "\t\t\t#Irreversibility can also be obtained using\n",
+ "\t\t\t#I = 2*(si_1 - si_2)_air + (si_1 - si_2)_hotgas\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The temperature of emerging air is 521.428571 K\n",
+ " 2).The availability change of hot gas is 65.002625 kJ/kg\n",
+ " 3).The availability change of air is -21.492234 kJ/kg\n",
+ " 4).The irreversibility of thr exchanger per kg of hot gas flowing is 22.018157 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file