summaryrefslogtreecommitdiff
path: root/Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb')
-rw-r--r--Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb704
1 files changed, 704 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb
new file mode 100644
index 0000000..5ecb5d3
--- /dev/null
+++ b/Chemical_Engineering_Thermodynamics_by_P_Ahuja/5-Exergy.ipynb
@@ -0,0 +1,704 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 5: Exergy"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.1: Determination_of_fraction_of_the_availability_loss.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.1\n",
+"//Page number - 184\n",
+"printf('Example - 5.1 and Page number - 184\n\n');\n",
+"\n",
+"\n",
+"//Given\n",
+"T_1 = 500+273.15;//[C] - Condensation temperature\n",
+"T_2 = 250+273.15;//[C] - Temperature at which vaporization takes place.\n",
+"\n",
+"T_3 = 25+273.15;//[C] - Ambient atmospheric temperature.\n",
+"\n",
+"Q = 1;//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",
+"//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",
+"//Therefore,loss in exergy is given by\n",
+"Ex_loss = Ex_T_1 - Ex_T_2;\n",
+"//Fraction of exergy lost due to irreversible process is,\n",
+"Ex_fraction =(Ex_loss/Ex_T_1);\n",
+"printf(' The fraction of exergy lost due to irreversible process is %f',Ex_fraction);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.2: Determination_of_availability_change_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.2\n",
+"//Page number - 188\n",
+"printf('Example - 5.2 and Page number - 188\n\n');\n",
+"\n",
+"//Given\n",
+"T_1 = 300;//[K] - Initial temperature.\n",
+"P_1 = 100;//[kPa] - Initial pressure.\n",
+"T_2 = 500;//[K] - Final temperature.\n",
+"T_0 = 300;//[K] - Environment temperature.\n",
+"P_0 = 1;//[atm] - Environment pressure.\n",
+"R = 8.314;//[J/mol*K]\n",
+"//(Cp_0/R)= 3.626\n",
+"Cp_0 = 3.626*R;//[J/mol-K] - Heat capacity at constant pressure\n",
+"\n",
+"\n",
+"//(1).\n",
+"//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",
+"//Let us determine the change in internal energy\n",
+"//For ideal gas the molar internal energy change is given by delta_U = Cv_0*(T_2-T_1)\n",
+"//For ideal gas Cp_0 - Cv_0 = R, and therefore\n",
+"Cv_0 = ((Cp_0/R)- 1)*R;//[J/mol-K] - Heat capacity at constant volume\n",
+"delta_U = Cv_0*(T_2-T_1);//[J/mol]\n",
+"//delta_U = -w (from energy balance). Therefore, U1-U2 = -delta_U.\n",
+"//The entropy change of ideal gas is given by\n",
+"//delta_S = Cp_0*log(T_2/T_1) - R*log(P_2/P_1), but,(P1*V1/T1) = (P1*V1/T1) and therefore (P2/P1) = (T2/T1)\n",
+"delta_S = Cp_0*log(T_2/T_1) - R*log(T_2/T_1);//[J/mol-K]\n",
+"//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",
+"//(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);//[J/mol]\n",
+"printf(' (1).The change in exergy is %f J/mol\n\n',delta_phi);\n",
+"\n",
+"//(2).\n",
+"//Entropy change of the system is given by, delta_S_sys = q/T_b + S_gen\n",
+"//Since the system is adiabatic therefore, delta_S_sys = S_gen\n",
+"S_gen = delta_S;\n",
+"//Irreversibility is given by\n",
+"i = T_0*S_gen;//[J/mol]\n",
+"printf(' (2).The value of irreversibility is %f J/mol',i);\n",
+"//Irreversibility can also be determined using\n",
+"//i = (W_rev_use - W_use)\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.3: Determination_of_availability_change_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.3\n",
+"//Page number - 190\n",
+"printf('Example - 5.3 and Page number - 190\n\n')\n",
+"\n",
+"//Given\n",
+"P_1 = 15;//[bar] - Initial pressure\n",
+"P_1 = P_1*10^(5);//[Pa]\n",
+"T_1 = 300+273.15;//[K] - Initial temperature\n",
+"T_0 = 298.15;//[K]\n",
+"T_R = 1200;//[K] - Reservoir temerature.\n",
+"P_0 = 1;//[bar]\n",
+"P_0 = P_0*10^(5);//[Pa]\n",
+"n = 1;//[mol] - No of moles\n",
+"R = 8.314;//[J/mol*K]\n",
+"Y = 1.4;// - Ratio of heat capacities.\n",
+"Cv_0 = R/(Y-1);//[J/mol-K] - Heat capacity at constant volume\n",
+"Cp_0 = Cv_0 + R;//[J/mol-K] - Heat capacity at constant pressure\n",
+"\n",
+"//(1)\n",
+"//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;//[K]\n",
+"W = P_1*(((R*T_2)/P_1)-((R*T_1)/P_1));//[J/mol] - Actual work done\n",
+"delta_U = Cv_0*(T_2-T_1);//[J/mol] - Change in internal energy.\n",
+"q = W + delta_U;//[J/mol] - Heat change\n",
+"//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",
+"//delta_S = Cp_0*log(T_2/T_1) - R*log(P_2/P_1), and P_1 = P_2, Therefore\n",
+"delta_S = Cp_0*log(T_2/T_1);;//[J/mol-K] - Entropy change.\n",
+"//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));//[J/mol]\n",
+"//Actual work done is given by, W = P_1*(V2-V1)\n",
+"//Work done to displace the atmosphere is given by, W = P_0*(V_2-V_1)\n",
+"//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));//[J/mol] - useful work done\n",
+"W_rev_use = delta_phi;// reversible useful work done\n",
+"//Irreversibility is given by,\n",
+"i = W_rev_use - W_use;//[J/mol]\n",
+"printf(' (a).The ireversibility value is %f J/mol\n\n',i);\n",
+"\n",
+"//The irreversibility can also be calculated using \n",
+"// i = T_0*S_gen\n",
+"//S_gen = delta_S - (q/T_R)\n",
+"\n",
+"//(b)\n",
+"//V2 = 2*V_1 and therefore T_2 = 2*T_1, as P_2 = P_1\n",
+"//Actual work done is same as before\n",
+"//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",
+"//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;//[J/mol]\n",
+"W_rev_use_b = delta_phi_b;// reversible useful work done\n",
+"W_use_b = W_use;// useful work done\n",
+"//Now the irreversibility is given by,\n",
+"i_b = W_rev_use_b - W_use_b;//[J/mol]\n",
+"printf(' (b).The ireversibility value is %f J/mol\n\n',i_b);\n",
+"\n",
+"//The irreversibility can also be calculated using \n",
+"// i_b = T_0*S_gen\n",
+"//S_gen = delta_S - (q/T_R) and here, q = 0\n",
+"\n",
+"//(c)\n",
+"P_2_c = 10;//[bar] - Final pressure, (Given)\n",
+"P_2_c = P_2_c*10^(5);//[Pa]\n",
+"//(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));//[K]\n",
+"//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);//[J/mol]\n",
+"//The final molar volume is calculated using P_1*V_1^(Y) = P_2*V_2^(Y)\n",
+"//V_2 = V_1*((P_1/P_2_c)^(1/Y))\n",
+"V_1 = (R*T_1)/P_1;//[cubic metre/mol] - Initial molar volume\n",
+"V_2 = V_1*((P_1/P_2_c)^(1/Y));//[cubic metre/mol] - Final molar volume\n",
+"//Now let us determine the work done to displace the atmosphere,\n",
+"W_atm_c = P_0*(V_2 - V_1);//[J/mol] - work done to displace the atmosphere\n",
+"//Thus useful work is given by,\n",
+"W_use_c = W - W_atm_c;//[J/mol] - useful work done\n",
+"//Here delta_S = 0,for reversible adiabatic process.Therefore,\n",
+"W_rev_use_c = W_use_c;\n",
+"//Now finally the irreversibility is given by,\n",
+"i_c = W_rev_use_c - W_use_c;//[J/mol]\n",
+"printf(' (c).The ireversibility value is %f J/mol\n\n',i_c);\n",
+"\n",
+"//(d)\n",
+"//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",
+"//Under isothermal conditions work done is\n",
+"W_d = R*T_1*log(V_2_d/V_1);//[J/mol]\n",
+"//Work done to displace the atmosphere is given by,\n",
+"W_atm_d = P_0*(V_2_d - V_1);//[J/mol] - work done to displace the atmosphere\n",
+"//Thus useful work is given by,\n",
+"W_use_d = W_d - W_atm_d;//[J/mol] - useful work done\n",
+"delta_U_d = 0;//isothermal conditions\n",
+"q_d = W_d;// since, delta_U_d = 0\n",
+"//delta_S_d = Cp_0*log(T_2/T_1) - R*log(P_2/P_1), and T_1 = T_2, Therefore\n",
+"delta_S_d = -R*log(P_2_d/P_1);//[J/mol-K] - Entropy change\n",
+"//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));//[J/mol] - Reversible useful work done.\n",
+"//The irreversibility is given by,\n",
+"i_d = W_rev_use_d - W_use_d;//[J/mol]\n",
+"printf(' (d).The ireversibility value is %f J/mol\n\n',i_d);\n",
+"\n",
+"//(e)\n",
+"P_2_e = 10;//[bar] - Final pressure, (Given)\n",
+"P_2_e = P_2_e*10^(5);//[Pa]\n",
+"//During the expansion of an ideal gas in into vacuum the temperature of the gas remains the same,\n",
+"T_2_e = T_1;// Final temperature\n",
+"//Since boundary of the system is fixed so no net work is done, W = 0 and thus\n",
+"W_use_e = 0;//[J/mol] - Useful work done\n",
+"//Here, delta_U = 0,as temperature is same and\n",
+"//(V_1-V_2) = 0,as for overall system there is no change in volume\n",
+"delta_S_e = - R*log(P_2_e/P_1);//[J/mol-K] - Entropy change\n",
+"//The reversible useful work is given by,\n",
+"W_rev_use_e = - T_0*(-delta_S_e);//[J/mol] - Reversible useful work done.\n",
+"//The irreversibility is given by,\n",
+"i_e = W_rev_use_e - W_use_e;//[J/mol]\n",
+"printf(' (e).The ireversibility value is %f J/mol\n\n',i_e);\n",
+"\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.4: Determination_of_useful_work_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.4\n",
+"//Page number - 194\n",
+"printf('Example - 5.4 and Page number - 194\n\n')\n",
+"\n",
+"\n",
+"//Given\n",
+"T_1 = 150+273.15;//[K] - Initial temperature.\n",
+"m = 4.6;//[kg] - mass of water\n",
+"P_1 = 1;//[MPa] - Initial pressure\n",
+"Q = 11000;//[kJ] - Heat transferred to the system.\n",
+"T_R = 600+273.15;//[K] - Temperature of the reservior.\n",
+"T_0 = 298;//[K] - Temperature of the environment\n",
+"P_0 = 100;//[kPa] - Pressure of the environment\n",
+"\n",
+"//(1)\n",
+"//The entropy change of an isothermal system undergoing an internally reversible process is given by,\n",
+"delta_S_t = (Q/T_1);//[kJ] - Entropy change\n",
+"delta_S = delta_S_t/m;//[kJ/kg-K] - \n",
+"\n",
+"//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;//[m^(3)/kg] - initial specific volume\n",
+"U_1 = 631.68;//[kJ/kg] - initial specific internal energy\n",
+"S_1 = 1.8418;//[kJ/kg-K] - initial entropy\n",
+"//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;//[kJ/kg-K] - Final entropy\n",
+"\n",
+"//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;//[kJ/kg-K]\n",
+"//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",
+"//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;//[kJ/kg] - Internal energy\n",
+"U_t_2 = 2576.9;//[kJ/kg]\n",
+"V_t_1 = 1.9364;//[m^(3)/kg] - Specific volume\n",
+"V_t_2 = 0.9596;//[m^(3)/kg]\n",
+"S_t_1 = 7.6134;//[kJ/kg-K] - Entropy\n",
+"S_t_2 = 7.2795;//[kJ/kg-K]\n",
+"//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;//[Mpa] - Final pressure\n",
+"//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));//[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));//[m^(3)/kg] - Final specific volume\n",
+"\n",
+"q = Q/m;//[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));//[kJ/kg] - Reversible useful work done.\n",
+"\n",
+"//Now let us calculate the actual work done. We know q - W = delta_U, therefore\n",
+"W = q - (U_2 - U_1);//[kJ/kg] - Work done\n",
+"W_use = W - P_0*(V_2 - V_1);//[kJ/kg]\n",
+"i = W_rev_use - W_use;//[kJ/kg] - Irreversibility\n",
+"//Since the system contains 4.6 g therefore, \n",
+"W_use_new = W_use*m;//[kJ]\n",
+"W_rev_use_new = W_rev_use*m;//[kJ]\n",
+"I = W_rev_use_new - W_use_new;//[kJ]\n",
+"\n",
+"printf(' (1).The useful work obtained is %f kJ\n\n',W_use_new);\n",
+"printf(' (2).The reversible usefuk work done is %f kJ\n\n',W_rev_use_new);\n",
+"printf(' (3).The irreversibility is %f kJ\n\n',I);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.5: Determination_of_reversible_work_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.5\n",
+"//Page number - 197\n",
+"printf('Example - 5.5 and Page number - 197\n\n')\n",
+"\n",
+"//Given\n",
+"T_1 = 700+273.15;//[K] - Initial temperature.\n",
+"P_1 = 12;//[MPa] - Initial pressure\n",
+"P_2 = 0.6;//[MPa] - Final pressure\n",
+"//At 12 MPa and 700 C,\n",
+"H_1 = 3858.4;//[kJ/kg] - initial enthalpy\n",
+"S_1 = 7.0757;//[kJ/kg-K] - initial entropy\n",
+"\n",
+"//At 0.6 MPa and 200 C,\n",
+"H_2 = 2850.1;//[kJ/kg]\n",
+"S_2 = 6.9673;//[kJ/kg-K]\n",
+"\n",
+"//At 0.6 MPa and 250 C,\n",
+"H_3 = 2957.2;//[kJ/kg]\n",
+"S_3 = 7.1824;//[kJ/kg-K]\n",
+"\n",
+"//At 0.6 MPa and 300 C,\n",
+"H_4 = 3061.6;//[kJ/kg]\n",
+"S_4 = 7.3732;//[kJ/kg-K]\n",
+"\n",
+"//(1)\n",
+"//In the case of ideal turbine the entropy change does not take place,therefore the exit conditions are\n",
+"P_exit = P_2;//[MPa] - exit pressure\n",
+"T_exit = ((S_1 - S_2)/(S_3 - S_2))*(250 - 200) + 200;//[C] - exit temperature\n",
+"H_exit = ((S_1 - S_2)/(S_3 - S_2))*(H_3 - H_2) + H_2;//[kJ/kg] - exit enthalpy\n",
+"\n",
+"//Snce it is a flow pocess,therfore\n",
+"//W_rev = H_1 - H_exit - T_0*(S_1 - S_2)\n",
+"//As S_1 = S_2,the above equation becomes\n",
+"W_rev_1 = H_1 - H_exit;//[kJ/kg] - reversible work done\n",
+"\n",
+"//From the first law the actual work done can be calculated using, delta_H = q - W\n",
+"//Since the turbine does not exchange heat,therefore W = - delta_H.\n",
+"W_1 = - (H_exit - H_1);//[kJ/kg]\n",
+"\n",
+"printf(' (1).The reversible work done is %f kJ/kg\n',W_1);\n",
+"printf(' And since the maximum work is same as the actual work,therefore irreversibility is zero\n\n');\n",
+"\n",
+"//(2)\n",
+"//Given\n",
+"T_0 = 298.15;//[K] - Environment temperature\n",
+"P_0 = 1;//[atm] - Environment pressure\n",
+"adi_eff = 0.88;//adiabatc efficiency\n",
+"\n",
+"//(H_1 - H_exit_actual)/(H_1 - H_exit) = 0.88, therefore\n",
+"H_exit_actual = H_1 - 0.88*(H_1 - H_exit);// - Actual exit enthalpy\n",
+"\n",
+"//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;//[C]\n",
+"S_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(S_4 - S_3) + S_3;//[kJ/kg]\n",
+"\n",
+"//Now reversible work done is given by,\n",
+"W_rev_2 = H_1 - H_exit_actual - T_0*(S_1 - S_exit_actual);//[kJ/kg]\n",
+"printf(' (2).The reversible work done is %f kJ/kg\n',W_rev_2);\n",
+"\n",
+"//The actual work is given by the first law,\n",
+"W_2 = H_1 - H_exit_actual;//[kJ/kg] - Actual work done\n",
+"i = W_rev_2 - W_2;//[kJ/kg] - irreversibility\n",
+"printf(' The value of irreversibility is %f kJ/kg\n',i);\n",
+"\n",
+"//The irreversibility can also be determined using\n",
+"// i = T_0*S_gen, and S_gen is given by\n",
+"// S_gen = (q/T_R) - delta_S\n",
+"\n",
+"//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",
+"printf(' The second law efficiency of the turbine is %f\n',sec_eff);"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.6: Determination_of_maximum_obtainable_work_and_efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.6\n",
+"//Page number - 198\n",
+"printf('Example - 5.6 and Page number - 198\n\n')\n",
+"\n",
+"//Given\n",
+"P_1 = 8;//[bar] - Initial pressure\n",
+"T_1 = 93 + 273.15;//[C] - Initial temperature\n",
+"V_1 = 100;//[m/s] - Initial velocity\n",
+"P_2 = 1.25;//[bar] - Exit pressure\n",
+"T_2 = 27 + 273.15;//[C] - Exit temperature\n",
+"V_2 = 60;//[m/s] - Exit velocity \n",
+"Y = 1.4;//Ratio of specific heat capacities\n",
+"T_0 = 298.15;//[K] - surrounding temperature\n",
+"P_0 = 1;//[bar] - surrounding pressure\n",
+"R = 8.314;//[J/mol*K] - Gas constant\n",
+"Cp_0 = (R*Y)/(Y-1);//[J/mol-K] - Heat capacity at constant pressure\n",
+"\n",
+"//Since the amount of heat transfer is negligible,therefore from first law the actual work done is given by,\n",
+"//W = delta_H + (delta_V_square)/2\n",
+"delta_H = Cp_0*(T_2 - T_1);//[J/mol] - enthalpy change\n",
+"delta_H = (delta_H/28.84);//[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;//[kJ/kg] - Actual work done\n",
+"printf(' The actual work done is %f kJ/kg\n\n',W);\n",
+"\n",
+"//Now let us calculate the maximum work that can be obtained\n",
+"//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*log(T_2/T_1) - R*log(P_2/P_1);//[J/mol-K] - Entropy change\n",
+"delta_S = delta_S/28.84;//kJ/kg-K]\n",
+"W_rev = -delta_H - ((delta_V_square/2)/1000) + T_0*delta_S;//[kJ/kg]\n",
+"printf(' The maximum work obtainable per kg of air is %f kJ/kg\n\n',W_rev);\n",
+"\n",
+"//The second law efficiency of the turbine is actual work done divided by reversible work,therefore\n",
+"sec_eff = W/W_rev;\n",
+"printf(' The second law efficiency of the turbine is %f\n\n',sec_eff);\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.7: Determination_of_entropy_generation_rate_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.7\n",
+"//Page number - 200\n",
+"printf('Example - 5.7 and Page number - 200\n\n')\n",
+"\n",
+"//Given\n",
+"m_cold_water = 60;//[kg/s] - mass flow rate of cold water\n",
+"P_1 = 50;//[kPa]\n",
+"T_2 = 250;//[C]\n",
+"T_water_1 = 1000 + 273.15;//[K] - Entering temperature of water\n",
+"T_water_2 = 450 +273.15;//[K] - Exit temperature of water\n",
+"T_0 = 298.15;//[K] - surrounding temperature\n",
+"P_0 = 1;//[atm] - surrounding pressure\n",
+"Cp_0 = 1.005;//[kJ/kg-K]\n",
+"\n",
+"//For water at 50 kPa under saturated conditions,T_sat = 81.33 C, \n",
+"H_liq_1 = 340.49;//[kJ/kg] - Enthalpy\n",
+"S_liq_1 = 1.0910;//[kJ/kg-K] - Entropy\n",
+"\n",
+"//For steam at 50 kPa and 250 C,\n",
+"H_2 = 2976.0;//[kJ/kg]\n",
+"S_2 = 8.3556;//[kJ/kg-K]\n",
+"\n",
+"//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",
+"//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));//[kg/s] - mass flow rate of hot water\n",
+"\n",
+"//Since there is no heat exchange with the surrounding therefore the total entropy generation is given by\n",
+"//S_gen = delta_S_hot + delta_S_cold\n",
+"delta_S_cold = S_2 - S_liq_1;//[kJ/kg-K] - change of entropy of cold water\n",
+"//delta_S_hot = Cp_0*log(T_2/T_1)-R*log(P_2/P_1), But pressure drop is zero,therfore\n",
+"delta_S_hot = Cp_0*log(T_water_2/T_water_1);//[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;//[kW/K] - Entropy generated\n",
+"printf(' The entropy generation rate is %f kW/K\n\n',S_gen);\n",
+"\n",
+"//The irreversibility rete is given by\n",
+"I = T_0*S_gen;//[kW]\n",
+"printf(' The irreversibility rate of the heat exchanger is %f kW\n',I);\n",
+"\n",
+"//The irreversibility can also be determined using the exergy approach\n",
+"//We know that, I = W_rev - , but since actual work done zero in heat exchangers,therefore I = W_rev = exergy change\n",
+"//(si_1 - si_2)_cold = H_1 - H_2 - T_0*(S_1 - S_2)\n",
+"//(si_1 - si_2)_hot = Cp_0*(T_1 - T_2)- T_0*(S_1 - S_2)\n",
+"// I = (si_1 - si_2)_cold - (si_1 - si_2)_hot.\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.8: Calculation_of_exit_temperature_entropy_and_irreversibility_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.8\n",
+"//Page number - 201\n",
+"printf('Example - 5.8 and Page number - 201\n\n')\n",
+"\n",
+"//Given\n",
+"m_water = 10000;//[kg/h] - Mass flow rate of cold water\n",
+"m_water = m_water/3600;//[kg/s]\n",
+"T_1_water = 30 + 273.15;//[K] - Cold water entering temperature\n",
+"m_HC = 5000;//[kg/h] - mass flow rate of hot hydrocarbon\n",
+"m_HC = m_HC/3600;//[kg/s]\n",
+"T_1_HC = 200 + 273.15;//[K] - Hot hydrocarbon entering temperature\n",
+"T_2_HC = 100 + 273.15;//[K] - Hot hydrocarbon leaving temperature\n",
+"Cp_0_water = 1.0;//[kcal/kg-K] - Mean heat capacity of cooling water\n",
+"Cp_0_HC = 0.6;//[kcal/kg-K] - Mean heat capacity of hydrocarbon\n",
+"\n",
+"//(1)\n",
+"//Applying energy balance to the heat exchanger,we get\n",
+"//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;//[K]\n",
+"T_2 = T_2_water - 273.15;//[C]\n",
+"printf(' (1).The exit temperature of the cooling water is %f C\n\n',T_2);\n",
+"\n",
+"//(2)\n",
+"//delta_S_hot_HC = Cp_0*log(T_2/T_1)-R*log(P_2/P_1), But pressure drop is zero,therfore\n",
+"delta_S_hot_HC = (Cp_0_HC*4.184)*log(T_2_HC/T_1_HC);//[kW/K] - change of entropy of hot hydrocarbon\n",
+"delta_S_HC = m_HC*delta_S_hot_HC;//[kW/K] - Entropy change for hudrocarbon liquid \n",
+"printf(' (2).Entropy change rate of hydrocarbon liquid is %f kW/K\n',delta_S_HC);\n",
+"\n",
+"delta_S_cold_water = (Cp_0_water*4.184)*log(T_2_water/T_1_water);//[kW/K] - change of entropy of cooling water\n",
+"delta_S_water = m_water*delta_S_cold_water;//[kW/K] - Entropy change for water\n",
+"printf(' And entropy change rate of water is %f kW/K\n\n',delta_S_water);\n",
+"\n",
+"//(3)\n",
+"T_0 = 298.15;//[K] - Surrounding temperature\n",
+"//S_gen = delta_S_cold_water + delta_S_hot_HC = m_water*delta_S_cold_water + m_HC*delta_S_hot_HC;//[kW/K] - Entropy generated\n",
+"S_gen = delta_S_water + delta_S_HC;//[kW/K]\n",
+"I = T_0*S_gen;//[kW]\n",
+"printf(' (3).The irreversibility rate of the heat exchanger is %f kW\n',I);\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.9: Determinatio_of_exit_temperature_availability_change_and_irreversibility.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"\n",
+"//Example - 5.9\n",
+"//Page number - 202\n",
+"printf('Example - 5.9 and Page number - 202\n\n');\n",
+"\n",
+"//Given\n",
+"T_1_hotgas = 800;//[K]\n",
+"P_1_hotgas = 1;//[bar]\n",
+"T_2_hotgas = 700;//[K]\n",
+"P_2_hotgas = 1;//[bar]\n",
+"T_1_air = 470;//[K]\n",
+"P_1_air = 1;//[bar]\n",
+"P_2_air = 1;//[bar]\n",
+"Cp_0_hotgas = 1.08;//[kJ/kg-K] - Mean heat capacity of hot gas\n",
+"Cp_0_air = 1.05;//[kcal/kg-K] - Mean heat capacity of air\n",
+"T_0 = 298.15;//[K] - surrounding temperature\n",
+"P_0 = 1;//[bar] - surrounding pressure\n",
+"//m_air = 2*m_hotgas\n",
+"\n",
+"//(1)\n",
+"//Assuming heat exchange only takes places in-between the streams,from energy balance we get,\n",
+"//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));//[K] - Temp of emerging air\n",
+"printf(' (1).The temperature of emerging air is %f K\n\n',T_2_air);\n",
+"\n",
+"//(2)\n",
+"//Availability change of hot gas is given by,\n",
+"//(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));//[kJ/kg] - change in enthalpy of hotgas\n",
+"//delta_S_hotgas = Cp_0_hotgas*log(T_2_hotgas/T_1_hotgas)- R*log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n",
+"delta_S_hotgas = Cp_0_hotgas*log(T_2_hotgas/T_1_hotgas);//[kJ/kg-K] - change of entropy of hot gas\n",
+"delta_si_hotgas = (-delta_H_hotgas) - (-T_0*delta_S_hotgas);//[kJ/kg]\n",
+"printf(' (2).The availability change of hot gas is %f kJ/kg\n\n',delta_si_hotgas);\n",
+"\n",
+"//(3)\n",
+"//Availability change of air is given by,\n",
+"//(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));//[kJ/kg] - change in enthalpy of air\n",
+"//delta_S_air = Cp_0_air*log(T_2_air/T_1_air)- R*log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n",
+"delta_S_air = Cp_0_air*log(T_2_air/T_1_air);//[kJ/kg-K] - change of entropy of air\n",
+"delta_si_air = (-delta_H_air) - (-T_0*delta_S_air);//[kJ/kg]\n",
+"printf(' (3).The availability change of air is %f kJ/kg\n\n',delta_si_air);\n",
+"\n",
+"//(4)\n",
+"//For the heat exchanger (Q = 0, W = 0)\n",
+"//Basis : 1 kg of hot gas flowing through heat exchanger\n",
+"S_gen = delta_S_hotgas + 2*delta_S_air;//[kJ/kg-K] - (as m_air = 2*m_hotgas)\n",
+"I = T_0*S_gen;//[kJ/kg]\n",
+"printf(' (4).The irreversibility of thr exchanger per kg of hot gas flowing is %f kJ/kg\n',I);\n",
+"\n",
+"//Irreversibility can also be obtained using\n",
+"//I = 2*(si_1 - si_2)_air + (si_1 - si_2)_hotgas\n",
+""
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}