Entropy Balance for open system

4.5 Entropy Balance for Open Systems
As with energy balance for open systems, once can extend the equation 4.24 to a generalized entropy balance equation that may be written for the system shown in fig. 3.6.  There is, however, an important point of departure from the first law. Unlike energy, entropyis not a conserved quantityfor real world processes in which both mechanical and thermal irreversibilities are inevitable. Hence for such processes are attended by a positive entropy generation rate,This conclusion may be expressed in mathematical terms as follows

As with eqn. 4.24, for eqn. 4.25 too, the left side reduces to zero if the processes occurring in the open system are totally reversible; that is, both with respect to the system as well to the surroundings. Or else there is a net entropy generation.
A process is said to be internally reversible if all the processes occurring within the system are mechanically reversible, that is they are not subject to dissipative forces.  External reversibility, on the other hand, signifies that all heat transfer between the system and surrounding occur under infinitesimal gradients and are therefore thermally reversible. In principle reversible heat transfer is possible if the surroundings have heat reservoirs with temperatures equal to those of the control surface or if reversible Carnot engines operate between the control-surface temperatures and the heat-reservoir temperatures. 
We next expand eqn. 4.25 to a further level of detail.  Let there be heat transfer at the rate  at a particular part of the control surface of the open system where the surrounding temperature is given by 

Here, j runs over all the heat reservoirs associated with the system. The negative sign is used for the entropy term for the surroundings as heat transfer terms by convention are associated with the system. 
Putting eqn. 4.26 in eqn. 4.25 one obtains: 
For steady flows through the control volume eqn. 4.27 reduces to:
Further, for the simplest case of one inlet and exit, and one surrounding temperature:

4.6 Ideal and Lost Work for Flow Systems
We next derive the expressions for work exchange between system and surroundings for an open system operating under steady state by incorporating the idea of irreversibility. As we have discussed earlier, mechanical irreversibilities lead to loss of work due to dissipative conversion to heat. Thus, if work is to be delivered by an open system the maximum work obtains when the processes are mechanically reversible, we call that ideal work. Conversely, when work is done on the system the ideal work provides the minimum work needed to change the fluid state between the inlet and the exit. This is because an extra work would need to be provided beyond the ideal work against mechanical dissipative forces.  From the considerations in the last section it may be evident that ideal work obtains when the processes associated with the open system are both internally and externally reversible. For such a case one may write eqn. 4.29 as follows: 
Thus: (4.31)
From the 1st Law applied to the ideal case: