Chapter 5 : Exergy

Example 5.1 Page Number : 184

In [1]:
 
import math

# Variables
T_1 = 500+273.15;			#[C] - Condensation temperature
T_2 = 250+273.15;			#[C] - Temperature at which vaporization takes place.

T_3 = 25+273.15;			#[C] - Ambient atmospheric temperature.

Q = 1;			

# Calculations
			#The exergy content of the vapour at 500 C,
Ex_T_1 = Q*(1-(T_3/T_1));
Ex_T_2 = Q*(1-(T_3/T_2));
			#Therefore,loss in exergy is given by
Ex_loss = Ex_T_1 - Ex_T_2;
			#Fraction of exergy lost due to irreversible process is,
Ex_fraction =(Ex_loss/Ex_T_1);

# Results
print " The fraction of exergy lost due to irreversible process is %f"%(Ex_fraction);
 The fraction of exergy lost due to irreversible process is 0.299954

Example 5.2 Page Number : 188

In [2]:
 
# Variables
T_1 = 300.;			#[K] - Initial temperature.
P_1 = 100.;			#[kPa] - Initial pressure.
T_2 = 500.;			#[K] - Final temperature.
T_0 = 300.;			#[K] - Environment temperature.
P_0 = 1.;			#[atm] - Environment pressure.
R = 8.314;			#[J/mol*K]
			#(Cp_0/R)= 3.626
Cp_0 = 3.626*R;			#[J/mol-K] - Heat capacity at constant pressure


# Calculations and Results
			#(1).
			#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)
			#Let us determine the change in internal energy

			#For ideal gas Cp_0 - Cv_0 = R, and therefore
Cv_0 = ((Cp_0/R)- 1)*R;			#[J/mol-K] - Heat capacity at constant volume
delta_U = Cv_0*(T_2-T_1);			#[J/mol]
			#delta_U = -w (from energy balance). Therefore, U1-U2 = -delta_U.
			#The entropy change of ideal gas is given by
			#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)
delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(T_2/T_1);			#[J/mol-K]
			#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)
			#(V_1 - V_2) = 0, because the tank is rigid and so the volume is constant
delta_phi = (-delta_U) - T_0*(-delta_S);			#[J/mol]
print " 1).The change in exergy is %f J/mol"%(delta_phi);

			#(2).
			#Entropy change of the system is given by,  delta_S_sys = q/T_b + S_gen
			#Since the system is adiabatic therefore,  delta_S_sys = S_gen
S_gen = delta_S;
			#Irreversibility is given by
i = T_0*S_gen;			#[J/mol]
print " 2).The value of irreversibility is %f J/mol"%(i);
			#Irreversibility can also be determined using
			#i = (W_rev_use - W_use)
 1).The change in exergy is -1020.722863 J/mol
 2).The value of irreversibility is 3345.789937 J/mol

Example 5.3 Page Number : 190

In [8]:
 
import math
# Variables
P_1 = 15.;			#[bar] - Initial pressure
P_1 = P_1*10**(5);			#[Pa]
T_1 = 300.+273.15;			#[K] - Initial temperature
T_0 = 298.15;			#[K]
T_R = 1200.;			#[K] - Reservoir temerature.
P_0 = 1.;			#[bar]
P_0 = P_0*10**(5);			#[Pa]
n = 1.;			#[mol] - No of moles
R = 8.314;			#[J/mol*K]
Y = 1.4;			# - Ratio of heat capacities.
Cv_0 = R/(Y-1);			#[J/mol-K] - Heat capacity at constant volume
Cp_0 = Cv_0 + R;			#[J/mol-K] - Heat capacity at constant pressure

# Calculations and Results
			#(1)
			#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.
T_2 = 2*T_1;			#[K]
W = P_1*(((R*T_2)/P_1)-((R*T_1)/P_1));			#[J/mol] - Actual work done
delta_U = Cv_0*(T_2-T_1);			#[J/mol] - Change in internal energy.
q = W + delta_U;			#[J/mol] - Heat change
			#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))
			#delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and P_1 = P_2, Therefore
delta_S = Cp_0*math.log(T_2/T_1);			#[J/mol-K] - Entropy change.
			#Substituting expressions for delta_phi calculation. Decrease in availability is given by,
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]
			#Actual work done is given by, W = P_1*(V2-V1)
			#Work done to print lace the atmosphere is given by, W = P_0*(V_2-V_1)
			#Therefore, W_use = (P_1*(V2-V1) - P_0*(V2-V1))
W_use = (P_1-P_0)*(((R*T_2)/P_1)-((R*T_1)/P_1));			#[J/mol] - useful work done
W_rev_use = delta_phi;			# reversible useful work done
			#Irreversibility is given by,
i = W_rev_use - W_use;			#[J/mol]
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);

			#The irreversibility can also be calculated using 
			# i = T_0*S_gen
			#S_gen = delta_S - (q/T_R)

			#(b)
			#V2 = 2*V_1 and therefore T_2 = 2*T_1, as P_2 = P_1
			#Actual work done is same as before
			#Let work done on stirrer be W_stir. Thus net work done by the system is W - W_stir.Fron energy balance we get,
W_stir = W + delta_U;
			#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
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]
W_rev_use_b = delta_phi_b;			# reversible useful work done
W_use_b = W_use;			# useful work done
			#Now the irreversibility is given by,
i_b = W_rev_use_b - W_use_b;			#[J/mol]
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);

			#The irreversibility can also be calculated using 
			# i_b = T_0*S_gen
			#S_gen = delta_S - (q/T_R) and here, q = 0

			#(c)
P_2_c = 10;			#[bar] - Final pressure, (Given)
P_2_c = P_2_c*10**(5);			#[Pa]
			#(P_1**(1-Y))*(T_1**(Y)) = (P_2**(1-Y))*(T_2**(Y))
T_2_c = T_1*((P_1/P_2_c)**((1-Y)/Y));			#[K]
			#Work done is given by, W = -delta_U = -Cv_0*(T_2_c - T_1)
W_c = -Cv_0*(T_2_c - T_1);			#[J/mol]
			#The final molar volume is calculated using P_1*V_1**(Y) = P_2*V_2**(Y)
			#V_2 = V_1*((P_1/P_2_c)**(1/Y))
V_1 = (R*T_1)/P_1;			#[cubic metre/mol] - Initial molar volume
V_2 = V_1*((P_1/P_2_c)**(1/Y));			#[cubic metre/mol] - Final molar volume
			#Now let us determine the work done to print lace the atmosphere,
W_atm_c = P_0*(V_2 - V_1);			#[J/mol] - work done to print lace the atmosphere
			#Thus useful work is given by,
W_use_c = W - W_atm_c;			#[J/mol] - useful work done
			#Here delta_S = 0,for reversible adiabatic process.Therefore,
W_rev_use_c = W_use_c;
			#Now finally the irreversibility is given by,
i_c = W_rev_use_c - W_use_c;			#[J/mol]
print " c).When the system expands reversibly and adiabatically behind a piston \n the ireversibility value is %f J/mol"%(i_c);

			#(d)
			#Here temperature is constant,but V_2 = 2*V_1, therefore P_2 = P_1/2
V_2_d = 2*V_1;
P_2_d = P_1/2;
			#Under isothermal conditions work done is
W_d = R*T_1*math.log(V_2_d/V_1);			#[J/mol]
			#Work done to print lace the atmosphere is given by,
W_atm_d = P_0*(V_2_d - V_1);			#[J/mol] - work done to print lace the atmosphere
			#Thus useful work is given by,
W_use_d = W_d - W_atm_d;			#[J/mol] - useful work done
delta_U_d = 0;			#isothermal conditions
q_d = W_d;			# since, delta_U_d = 0
			#delta_S_d = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and T_1 = T_2, Therefore
delta_S_d = -R*math.log(P_2_d/P_1);			#[J/mol-K] - Entropy change
			#The reversible useful work is given by,
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.
			#The irreversibility is given by,
i_d = W_rev_use_d - W_use_d;			#[J/mol]
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);

			#(e)
P_2_e = 10;			#[bar] - Final pressure, (Given)
P_2_e = P_2_e*10**(5);			#[Pa]
			#During the expansion of an ideal gas in into vacuum the temperature of the gas remains the same,
T_2_e = T_1;			# Final temperature
			#Since boundary of the system is fixed so no net work is done, W = 0 and thus
W_use_e = 0;			#[J/mol] - Useful work done
			#Here, delta_U = 0,as temperature is same and
			#(V_1-V_2) = 0,as for overall system there is no change in volume
delta_S_e = - R*math.log(P_2_e/P_1);			#[J/mol-K] - Entropy change
			#The reversible useful work is given by,
W_rev_use_e =  - T_0*(-delta_S_e);			#[J/mol] - Reversible useful work done.
			#The irreversibility is given by,
i_e = W_rev_use_e - W_use_e;			#[J/mol]
print " e).When the system expands adiabatically into an adjacent chamber \n the ireversibility value is %f J/mol"%(i_e);
 a).When the system is confined at constant pressure by a piston and is heated until it's volume is doubled 
 the ireversibility value is 1869.841742 J/mol
 b).When the system is confined at constant pressure by a piston and is stirred until it's volume is doubled 
 the ireversibility value is 6013.652646 J/mol
 c).When the system expands reversibly and adiabatically behind a piston 
 the ireversibility value is 0.000000 J/mol
 d).When the system expands reversibly and isothermally behind a piston until it's volume is doubled 
 the ireversibility value is 897.537657 J/mol
 e).When the system expands adiabatically into an adjacent chamber 
 the ireversibility value is 1005.074654 J/mol

Example 5.4 Page Number : 194

In [4]:
 
T_1 = 150+273.15;			#[K] - Initial temperature.
m = 4.6;			#[kg] - mass of water
P_1 = 1;			#[MPa] - Initial pressure
Q = 11000;			#[kJ] - Heat transferred to the system.
T_R = 600+273.15;			#[K] - Temperature of the reservior.
T_0 = 298;			#[K] - Temperature of the environment
P_0 = 100;			#[kPa] - Pressure of the environment

# Calculations
			#(1)
			#The entropy change of an isothermal system undergoing an internally reversible process is given by,
delta_S_t = (Q/T_1);			#[kJ] - Entropy change
delta_S = delta_S_t/m;			#[kJ/kg-K] - 

			#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
V_1 = 0.001091;			#[m**(3)/kg] - initial specific volume
U_1 = 631.68;			#[kJ/kg] - initial specific internal energy
S_1 = 1.8418;			#[kJ/kg-K] - initial entropy
			#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.
S_2 = S_1 + delta_S;			#[kJ/kg-K] - Final entropy

			#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.
S_final = 7.494;			#[kJ/kg-K]
			#At 150 C, and 0.1 MPa: V = 1.9364 m**(3)/kg, U = 2582.8 kJ/kg, S = 7.6134 kJ/kg-K
			#At 150 C, and 0.2 MPa: V = 0.9596 m**(3)/kg, U = 2576.9 kJ/kg, S = 7.2795 kJ/kg-K
U_t_1 = 2582.8;			#[kJ/kg] - Internal energy
U_t_2 = 2576.9;			#[kJ/kg]
V_t_1 = 1.9364;			#[m**(3)/kg] - Specific volume
V_t_2 = 0.9596;			#[m**(3)/kg]
S_t_1 = 7.6134;			#[kJ/kg-K] - Entropy
S_t_2 = 7.2795;			#[kJ/kg-K]
			#The pressure at exit is given by,
P_2 = ((S_final - S_t_1)/(S_t_2 - S_t_1))*(0.2 - 0.1) + 0.1;			#[Mpa] - Final pressure
			#At final state
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
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

q = Q/m;			#[kJ/kg] - Heat supplied per unit kg of mass.
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.

			#Now let us calculate the actual work done. We know q - W = delta_U, therefore
W = q - (U_2 - U_1);			#[kJ/kg] - Work done
W_use = W - P_0*(V_2 - V_1);			#[kJ/kg]
i = W_rev_use - W_use;			#[kJ/kg] - Irreversibility
			#Since the system contains 4.6 g therefore, 
W_use_new = W_use*m;			#[kJ]
W_rev_use_new = W_rev_use*m;			#[kJ]
I = W_rev_use_new - W_use_new;			#[kJ]

# Results
print " 1).The useful work obtained is %f kJ"%(W_use_new);
print " 2).The reversible usefuk work done is %f kJ"%(W_rev_use_new);
print " 3).The irreversibility is %f kJ"%(I);
 1).The useful work obtained is 1304.987050 kJ
 2).The reversible usefuk work done is 5297.425775 kJ
 3).The irreversibility is 3992.438725 kJ

Example 5.5 Page Number : 197

In [5]:
 
T_1 = 700+273.15;			#[K] - Initial temperature.
P_1 = 12;			#[MPa] - Initial pressure
P_2 = 0.6;			#[MPa] - Final pressure
			#At 12 MPa and 700 C,
H_1 = 3858.4;			#[kJ/kg] - initial enthalpy
S_1 = 7.0757;			#[kJ/kg-K] - initial entropy

			#At 0.6 MPa and 200 C,
H_2 = 2850.1;			#[kJ/kg]
S_2 = 6.9673;			#[kJ/kg-K]

			#At 0.6 MPa and 250 C,
H_3 = 2957.2;			#[kJ/kg]
S_3 = 7.1824;			#[kJ/kg-K]

			#At 0.6 MPa and 300 C,
H_4 = 3061.6;			#[kJ/kg]
S_4 = 7.3732;			#[kJ/kg-K]

# Calculations and Results
			#(1)

P_exit = P_2;			#[MPa] - exit pressure
T_exit = ((S_1 - S_2)/(S_3 - S_2))*(250 - 200) + 200;			#[C] - exit temperature
H_exit = ((S_1 - S_2)/(S_3 - S_2))*(H_3 - H_2) + H_2;			#[kJ/kg] - exit enthalpy

			#Snce it is a flow pocess,therfore
			#W_rev = H_1 - H_exit - T_0*(S_1 - S_2)
			#As S_1 = S_2,the above equation becomes
W_rev_1 = H_1 - H_exit;			#[kJ/kg] - reversible work done

			#From the first law the actual work done can be calculated using, delta_H = q - W
			#Since the turbine does not exchange heat,therefore W = - delta_H.
W_1 = - (H_exit - H_1);			#[kJ/kg]

print " 1).The reversible work done is %f kJ/kg"%(W_1);
print "     And since the maximum work is same as the actual work ,therefore irreversibility is zero"

			#(2)
			# Variables
T_0 = 298.15;			#[K] - Environment temperature
P_0 = 1;			#[atm] - Environment pressure
adi_eff = 0.88;			#adiabatc efficiency

			#(H_1 - H_exit_actual)/(H_1 - H_exit) = 0.88, therefore
H_exit_actual = H_1 - 0.88*(H_1 - H_exit);			# - Actual exit enthalpy

			#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,
T_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(300 - 250) + 250;			#[C]
S_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(S_4 - S_3) + S_3;			#[kJ/kg]

			#Now reversible work done is given by,
W_rev_2 = H_1 - H_exit_actual - T_0*(S_1 - S_exit_actual);			#[kJ/kg]
print " 2).The reversible work done is %f kJ/kg"%(W_rev_2);

			#The actual work is given by the first law,
W_2 = H_1 - H_exit_actual;			#[kJ/kg] - Actual work done
i = W_rev_2 - W_2;			#[kJ/kg] - irreversibility
print "     The value of irreversibility is %f kJ/kg"%(i);

			#The irreversibility can also be determined using
			# i = T_0*S_gen, and S_gen is given by
			# S_gen = (q/T_R) - delta_S

			#The second law efficiency of the turbine is actual work done divided by reversible work,therefore
sec_eff = W_2/W_rev_2;
print "     The second law efficiency of the turbine is %f"%(sec_eff);
 1).The reversible work done is 954.326778 kJ/kg
     And since the maximum work is same as the actual work ,therefore irreversibility is zero
 2).The reversible work done is 905.072590 kJ/kg
     The value of irreversibility is 65.265025 kJ/kg
     The second law efficiency of the turbine is 0.927890

Example 5.6 Page Number : 198

In [6]:
 
P_1 = 8.;			#[bar] - Initial pressure
T_1 = 93. + 273.15;			#[C] - Initial temperature
V_1 = 100.;			#[m/s] - Initial velocity
P_2 = 1.25;			#[bar] - Exit pressure
T_2 = 27. + 273.15;			#[C] - Exit temperature
V_2 = 60.;			#[m/s] - Exit velocity 
Y = 1.4;			#Ratio of specific heat capacities
T_0 = 298.15;			#[K] - surrounding temperature
P_0 = 1.;			#[bar] - surrounding pressure
R = 8.314;			#[J/mol*K] - Gas constant
Cp_0 = (R*Y)/(Y-1);			#[J/mol-K] - Heat capacity at constant pressure

# Calculations and Results

			#W = delta_H + (delta_V_square)/2
delta_H = Cp_0*(T_2 - T_1);			#[J/mol] - enthalpy change
delta_H = (delta_H/28.84);			#[kJ/kg] - (1 mole = 28.84 g).
delta_V_square = V_2**(2) - V_1**(2);

W = - delta_H - ((delta_V_square)/2)/1000;			#[kJ/kg] - Actual work done
print " The actual work done is %f kJ/kg"%(W);

			#Now let us calculate the maximum work that can be obtained
			#W_rev = (H_1 + (V_1**(2))/2) - (H_2 + (V_2**(2))/2) - T_0*(S_1 - S_2)
delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);			#[J/mol-K] - Entropy change
delta_S = delta_S/28.84;			#kJ/kg-K]
W_rev = -delta_H - ((delta_V_square/2)/1000) + T_0*delta_S;			#[kJ/kg]
print " The maximum work obtainable per kg of air is %f kJ/kg"%(W_rev);

			#The second law efficiency of the turbine is actual work done divided by reversible work,therefore
sec_eff = W/W_rev;
print " The second law efficiency of the turbine is %f"%(sec_eff);
 The actual work done is 69.792718 kJ/kg
 The maximum work obtainable per kg of air is 169.550182 kJ/kg
 The second law efficiency of the turbine is 0.411635

Example 5.7 Page Number : 200

In [7]:
 
m_cold_water = 60;			#[kg/s] - mass flow rate of cold water
P_1 = 50;			#[kPa]
T_2 = 250;			#[C]
T_water_1 = 1000 + 273.15;			#[K] - Entering temperature of water
T_water_2 = 450 +273.15;			#[K] - Exit temperature of water
T_0 = 298.15;			#[K] - surrounding temperature
P_0 = 1;			#[atm] - surrounding pressure
Cp_0 = 1.005;			#[kJ/kg-K]

			#For water at 50 kPa under saturated conditions,T_sat = 81.33 C, 
H_liq_1 = 340.49;			#[kJ/kg] - Enthalpy
S_liq_1 = 1.0910;			#[kJ/kg-K] - Entropy

			#For steam at 50 kPa and 250 C,
H_2 = 2976.0;			#[kJ/kg]
S_2 = 8.3556;			#[kJ/kg-K]

# Calculations and Results


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


			#S_gen = delta_S_hot + delta_S_cold
delta_S_cold = S_2 - S_liq_1;			#[kJ/kg-K] - change of entropy of cold water
			#delta_S_hot = Cp_0*math.log(T_2/T_1)-R*math.log(P_2/P_1), But pressure drop is zero,therfore
delta_S_hot = Cp_0*math.log(T_water_2/T_water_1);			#[kJ/kg-K] - change of entropy of hot water

S_gen = m_cold_water*delta_S_cold + m_hot_water*delta_S_hot;			#[kW/K] - Entropy generated
print " The entropy generation rate is %f kW/K"%(S_gen);

			#The irreversibility rete is given by
I = T_0*S_gen;			#[kW]
print " The irreversibility rate of the heat exchanger is %f kW"%(I);

			
 The entropy generation rate is 273.250824 kW/K
 The irreversibility rate of the heat exchanger is 81469.733193 kW

Example 5.8 Page Number : 201

In [8]:
 
m_water = 10000.;			#[kg/h] - Mass flow rate of cold water
m_water = m_water/3600;			#[kg/s]
T_1_water = 30. + 273.15;			#[K] - Cold water entering temperature
m_HC = 5000.;			#[kg/h] - mass flow rate of hot hydrocarbon
m_HC = m_HC/3600;			#[kg/s]
T_1_HC = 200. + 273.15;			#[K] - Hot hydrocarbon entering temperature
T_2_HC = 100. + 273.15;			#[K] - Hot hydrocarbon leaving temperature
Cp_0_water = 1.0;			#[kcal/kg-K] - Mean heat capacity of cooling water
Cp_0_HC = 0.6;			#[kcal/kg-K] - Mean heat capacity of hydrocarbon


# Calculations and Results
			#(1)
			#Applying energy balance to the heat exchanger,we get
			#m_water*Cp_0_water*(T - T_1_water) = m_HC*Cp_0_HC*(T_1_HC - T_2_HC)
T_2_water = ((m_HC*Cp_0_HC*(T_1_HC - T_2_HC))/(m_water*Cp_0_water)) + T_1_water;			#[K]
T_2 = T_2_water - 273.15;			#[C]
print " 1).The exit temperature of the cooling water is %f C"%(T_2);

			#(2)
			#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
delta_S_hot_HC = (Cp_0_HC*4.184)*math.log(T_2_HC/T_1_HC);			#[kW/K] - change of entropy of hot hydrocarbon
delta_S_HC = m_HC*delta_S_hot_HC;			#[kW/K] - Entropy change for hudrocarbon liquid 
print " 2).Entropy change rate of hydrocarbon liquid is %f kW/K"%(delta_S_HC);

delta_S_cold_water = (Cp_0_water*4.184)*math.log(T_2_water/T_1_water);			#[kW/K] - change of entropy of cooling water
delta_S_water = m_water*delta_S_cold_water;			#[kW/K] - Entropy change for water
print "     And entropy change rate of water is %f kW/K"%(delta_S_water);

			#(3)
T_0 = 298.15;			#[K] - Surrounding temperature
			#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
S_gen = delta_S_water + delta_S_HC;			#[kW/K]
I = T_0*S_gen;			#[kW]
print " 3).The irreversibility rate of the heat exchanger is %f kW"%(I);
 1).The exit temperature of the cooling water is 60.000000 C
 2).Entropy change rate of hydrocarbon liquid is -0.827846 kW/K
     And entropy change rate of water is 1.096732 kW/K
 3).The irreversibility rate of the heat exchanger is 80.168382 kW

Example 5.9 Page Number : 202

In [9]:
 
T_1_hotgas = 800.;			#[K]
P_1_hotgas = 1.;			#[bar]
T_2_hotgas = 700.;			#[K]
P_2_hotgas = 1.;			#[bar]
T_1_air = 470.;			#[K]
P_1_air = 1.;			#[bar]
P_2_air = 1.;			#[bar]
Cp_0_hotgas = 1.08;			#[kJ/kg-K] - Mean heat capacity of hot gas
Cp_0_air = 1.05;			#[kcal/kg-K] - Mean heat capacity of air
T_0 = 298.15;			#[K] - surrounding temperature
P_0 = 1.;			#[bar] - surrounding pressure
			#m_air = 2*m_hotgas

# Calculations and Results
			#(1)
			#Assuming heat exchange only takes places in-between the streams,from energy balance we get,
			#m_gas*Cp_0_hotgas*(T_2_hotgas - T_1_hotgas) + 2*m_gas*Cp_0_air*(T - T_1_air), 
T_2_air = T_1_air - ((Cp_0_hotgas*(T_2_hotgas - T_1_hotgas))/(2*Cp_0_air));			#[K] - Temp of emerging air
print " 1).The temperature of emerging air is %f K"%(T_2_air);

			#(2)
			#Availability change of hot gas is given by,
			#(si_1 - si_2)_hot = H_1 - H_2 - T_0*(S_1 - S_2)
delta_H_hotgas = (Cp_0_hotgas*(T_2_hotgas - T_1_hotgas));			#[kJ/kg] - change in enthalpy of hotgas
			#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
delta_S_hotgas = Cp_0_hotgas*math.log(T_2_hotgas/T_1_hotgas);			#[kJ/kg-K] - change of entropy of hot gas
delta_si_hotgas = (-delta_H_hotgas) - (-T_0*delta_S_hotgas);			#[kJ/kg]
print " 2).The availability change of hot gas is %f kJ/kg"%(delta_si_hotgas);

			#(3)
			#Availability change of air is given by,
			#(si_1 - si_2)_air = H_1 - H_2 - T_0*(S_1 - S_2)
delta_H_air = (Cp_0_air*(T_2_air - T_1_air));			#[kJ/kg] - change in enthalpy of air
			#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
delta_S_air = Cp_0_air*math.log(T_2_air/T_1_air);			#[kJ/kg-K] - change of entropy of air
delta_si_air = (-delta_H_air) - (-T_0*delta_S_air);			#[kJ/kg]
print " 3).The availability change of air is %f kJ/kg"%(delta_si_air);

			#(4)
			#For the heat exchanger (Q = 0, W = 0)
			#Basis : 1 kg of hot gas flowing through heat exchanger
S_gen = delta_S_hotgas + 2*delta_S_air;			#[kJ/kg-K] - (as  m_air = 2*m_hotgas)
I = T_0*S_gen;			#[kJ/kg]
print " 4).The irreversibility of thr exchanger per kg of hot gas flowing is %f kJ/kg"%(I);

			#Irreversibility can also be obtained using
			#I = 2*(si_1 - si_2)_air + (si_1 - si_2)_hotgas
 1).The temperature of emerging air is 521.428571 K
 2).The availability change of hot gas is 65.002625 kJ/kg
 3).The availability change of air is -21.492234 kJ/kg
 4).The irreversibility of thr exchanger per kg of hot gas flowing is 22.018157 kJ/kg