# Given Inputs from HW-12i
m_air = 0.1754 # mass of air in the balloon [kg]
c_p = 1.004 # c_p = c_v + R where c_v = 0.717 kJ/(kg.K) from HW-12i [kJ/(kg.K)]
T_1 = 273.15 # initial temperature in [K]
T_2 = 293.15 # final temperature in [K]
R = 0.287 # gas constant for[kJ/(kg-K)]
p_1 = 125 # initial pressure [kPa]
p_2 = 130.25 # final pressure [kPa]
Q_12 = 2.9364 # heat transfer into the ballon [kJ]
T_b = 293.15 # boundary temperature [K]
The total entropy generation $\sigma$ and show the process on a T-s diagram.
Choose a system that includes the balloon and a thin thermal boundary layer between the balloon and the room, such that the boundary temperature is the room temperature. We will ignore the entropy change of the thermal boundary layer.
1) closed system, 2) quasi-equilibrium process for the air in the balloon 3) ideal gas for the balloon air with constant specific heat, 4) neglect balloon material and thermal boundary layer in evaluating change in system entropy
Integration of the basic entropy balance for a closed system with a single source for heat transfer and a constant boundary temperature gives
$$ \Delta S_{12} = \dfrac{Q_{12}}{T_b} +\sigma_{12} $$The total entropy generation is then
$$\sigma_{12} = \Delta S_{12} - \dfrac{Q_{12}}{T_b} $$The change in entropy of the system is estimated as the change in entropy of the air in the balloon (neglecting balloon material and thin boundary layer between the balloon and room). The ideal gas equation for evaluating the entropy change of the air is determined by integrating the ideal gas equation, $ds = c_{P}\dfrac{dT}{T} - R\dfrac{dP}{P}$, assuming a constant specific heat, leading to
$$\Delta S_{12} = m \left [ c_{P} ln \left( \dfrac{T_{2}}{T_{1}} \right) - R \cdot ln\left(\dfrac{P_{2}}{P_{1}}\right) \right ]$$import numpy as np
DeltaS_12 = m_air*(np.log((T_2)/(T_1))*c_p - R*np.log((p_2)/(p_1))) # change in entropy for air in the balloon [kJ/K]
Sigma_12 = DeltaS_12 - Q_12/T_b # total entropy generation [kJ/K]
print('DeltaS_12 = ',round(DeltaS_12,5),'kJ/K')
print('Sigma_12 = ',round(Sigma_12,5),'kJ/K')
The entropy generation is greater than zero indicating that there are irreversibilities associated with the heat transfer. These irreversibilities occur within the thin boundary layer.
# Given Inputs from HW-12i
m_air = 1 # mass of air [kg]
c_p_air = 1.013 # c_p = c_v + R where c_v = 0.726 kJ/(kg.K) from HW-13i [kJ/(kg.K)]
T_air_1 = 473.15 # initial temperature in [°K]
R_air = 0.287 # gas constant for air [kJ/(kg-K)]
p_1 = 200 # initial pressure [kPa]
p_2 = 165.8 # final pressure [kPa]
m_oil = 0.5 # mass of oil [kg]
c_oil = 1.7 # specific heat of oil [kJ/(Kg.K)]
T_oil_1 = 323.15 # initial temperature of oil [°K]
T_2 = 392.25 # final temperature of air and oil [°K]
The total entropy generation $\sigma$
1) closed system, 2) oil is an incompressible liquid with constant specific heat, 3) air with an ideal gas with constant specific heat
The combined system is adiabatic. Thus, integration of the basic entropy balance for this closed system gives
$$ \Delta S_{12} = \sigma_{12} $$For this problem, the change in entropy of the system is the sum of the changes in entropy of the air and oil, such that the entropy generation is then
$$\sigma_{12} = \Delta S_{air,12} + \Delta S_{oil,12} $$The basic property relations for entropy change of the air and oil are integrated assuming constant specific heats, to give
$$\Delta S_{air,12} = m_{air} \left [ c_{P,air} ln \left( \dfrac{T_{2}}{T_{air,1}} \right) - R \cdot ln\left(\dfrac{P_{2}}{P_{1}}\right) \right ]$$$$\Delta S_{oil,12} = m_{oil} c_{oil} ln\left(\frac{T_{2}}{T_{oil,1}}\right) $$import numpy as np
DeltaS_air_12 = m_air*(np.log((T_2)/(T_air_1))*c_p_air - R_air*np.log((p_2)/(p_1))) # change in entropy for air [kJ/K]
DeltaS_oil_12 = m_oil*c_oil*(np.log((T_2)/(T_oil_1))) # change in entropy for oil [kJ/K]
Sigma_12 = DeltaS_air_12 + DeltaS_oil_12 # total entropy generation [kJ/K]
print('DeltaS_air_12 = ',round(DeltaS_air_12,5),'kJ/K')
print('DeltaS_oil_12 = ',round(DeltaS_oil_12,5),'kJ/K')
print('Sigma_12 = ',round(Sigma_12,6),'kJ/K')
The entropy generation is greater than zero indicating that there are internal irreversibilities associated with this process.
Consider compression of air treated as an ideal gas (R = 0.287 kJ/kg-K) in a closed piston cylinder device with initial conditions of $p_1$ = 1 bar, $T_1$ = 300 K, and $V_1$ = 0.0005 $m^3$. At the end of the compression stroke, $p_2$ = 18.65 bar.
# Given Inputs:
p_1 = 100 # initial pressure [kPa]
T_1 = 300 # initial temperature [K]
V_1 = 0.0005 # initial volume [m^3]
p_2 = 1865 # final pressure [kPa]
Use entropy balances to determine:
a) final temperature after the compression process assuming an adiabatic and internally reversible process,
b) total heat transfer if it is an isothermal and internally reversible process.
Show the two processes on a T-s diagram. Compare results for part b with the heat transfer obtained using an energy balance with boundary work.
Integration of the entropy balance for a closed, adiabatic system undergoing an internally reversible process leads to
$$ \Delta S_{12} = \sigma_{12} = 0 $$However, for an ideal gas
$$\Delta s_{12} = s^{o}_{2} - s^{o}_{1} - R \cdot ln\left(\frac{P_{2}}{P_{1}}\right)$$Therefore,
$$s^{o}_{2} = s^{o}_{1} + R \cdot ln\left(\frac{P_{2}}{P_{1}}\right)$$From the ideal gas table for air, $s^{o} (T_1 = 300K) = 1.703 kJ/kg-K$.
s_0_T1 = 1.703 # s_o at temperature T_1 from table [kJ/K]
s_0_T2 = 1.703 + R*np.log((p_2)/(p_1)) # s_o at temperature T_2 [kJ/K]
print('s_0_T2 = ',round(s_0_T2,5),'kJ/K')
Using the Ideal Gas Table for air, $T_2$ = 680 K gives $s^{o}_{2}$ = 2.543 kJ/K.
Integration of the basic entropy balance for a closed system with a single location for heat transfer and a constant boundary temperature gives
$$ \Delta S_{12} = \dfrac{Q_{12}}{T} +\sigma_{12} $$Since the process is internally reversible, then the entropy generation is 0 and
$$Q_{12} = T \cdot \Delta S_{12} = m \cdot T \cdot \Delta s_{12}$$For an ideal gas undergoing an isothermal process, the specific entropy change is
$$\Delta s_{12} = s^{o}_{2} - s^{o}_{1} - R \cdot ln\left(\frac{P_{2}}{P_{1}}\right) = -R \cdot ln\left(\frac{P_{2}}{P_{1}}\right)$$Therefore,
$$Q_{12} = -m \cdot R \cdot T \cdot ln\left(\frac{P_{2}}{P_{1}}\right)$$The mass of the air can be calculated using the ideal gas law at the initial state.
m = p_1*V_1/(R*T_1)
Q_12 = -m*R*T_1*np.log(p_2/p_1)
print('m = ',round(m,7),'kg')
print('Q_12 = ', round(Q_12,3),'kJ')
1) neglect KE and PE changes
Based on the first law for a closed system, there is no change in internal energy since the temperature stays the same and air is treated as an ideal gas. The energy balance then becomes:
$$ 0 = Q_{12} - W_{12}$$where $W_{12}$ can be calculated as the boundary work assuming $PV = mRT = constant$:
$$ W_{12}=\int PdV = mRT \int_{V_{1}}^{V_{2}} \frac{dV}{V} = mRTln \left(\frac{V_{2}}{V_{1}} \right) $$Applying the ideal gas law for constant mass and constant temperature, then
$$ \frac{V_{2}}{V_{1}} = \frac{P_{1}}{P_{2}} $$Then, combining these equations gives
$$Q_{12} = W_{12} = -mRTln \left(\frac{P_{2}}{P_{1}}\right)$$This is the exact same expression determined using an entropy balance.