Exactly as you said: "(5) seems to say that the entropy change for an irreversible process is 0 for the case of the system itself, but is > 0 for the case of the surroundings." After the cycle is finished, by definition of the "cycle", the system returns to its *original state* irrespective of all the irreversibilities that may have taken place within it during some portions of the cycle.
Entropy being a state variable it also assumes its initial value after the cycle. The only place therefore where the entropy will have increased *after* the cycle is in the reservoirs that do not perform any "cycle", they are sinks and sources of heat and their state can and will change per Clausius., i.e., $$\Delta S_{res} =\frac{q_{res}}{T_{res}}$$

As regards to equality vs. inequality I always learned and thought I understood that any time there is irreversible process it is *inequality* and *never* equality, and that goes for any part of the process. This can be understood intuitively by noting that irreversibility is caused by internal dissipation, i.e., heat generation, therefore during irreversible processes less heat is absorbed from the reservoir and more heat is rejected to the reservoir if compared to a reversible transition.

Incidentally, the absorbed or rejected $q$ of a reservoir is always *reversible*, that is why its entropy change is just the ratio of the heat and its temperature.

**Answering your questions**

(1) As long as the irreversibility arises solely as a consequence of the fact that the system and the environment are at different temperatures, the methods outlined below work. You can calculate $\Delta S_{\textrm{sys}}$ as normal, and calculating $\Delta S_{\textrm{env}}$ is also straight-forward if we treat its temperature as constant. There is no such thing as $\delta Q^{\textrm{rev}}$ and $\delta Q^{\textrm{irr}}$. The *difference* between the reversible and irreversible cases is the path that the environment takes through state space.

(2) This depends on what $\delta Q$ and what $T$ you're talking about. If $Q$ is the heat flow into the system, and $T$ is the temperature of the system, then this is $\mathrm dS_{\textrm{sys}}=\delta Q_{\textrm{sys}}/T_{\textrm{sys}}$. If these are the heat flow into the environment and the temperature of the reservoir, then this is $\mathrm dS_{\textrm{env}}=\delta Q_{\textrm{env}}/T_{\textrm{env}}$. If $Q$ is the heat flow into the system and $T$ is the temperature of the environment, then $\delta Q_{\textrm{sys}}/T_{\textrm{env}}$ is just $-\mathrm dS_{\textrm{env}}$, and we can interpret the quantity $\mathrm d\sigma = \mathrm dS_{\textrm{sys}} - \delta Q_{\textrm{sys}}/T_{\textrm{env}}$ as the *entropy production* of this part of the process. In the case where the irreversibility arises solely as a consequence of heat flow between system and environment when they have different temperatures, and if the system operates on a quasi-static cycle, then the net entropy production $\sigma = \oint\mathrm d\sigma$ goes into the environment.

(3) Let's write the Clausius' inequality carefully as
$$
\frac{\delta Q_{\textrm{sys}}}{T_{\textrm{env}}} < \mathrm dS_{\textrm{sys}}.
$$
Using the answer to part (2) and this form of the inequality, I think that dissolves question (3), but I'm not sure.

Now, I think it's worth expanding on these comments:

**Preliminaries**

(A) If we are talking about the system following the cycle shown above, there is no such thing as $\delta Q^{\textrm{rev}}$ vs $\delta Q^{\textrm{irr}}$. The reason is that in order to even draw that diagram to begin with, we are assuming that the system is undergoing quasi-static processes. The irreversibility is *solely* a product of the energy exchange with the environment. In particular, it is due to heat flow between the system and its environment when the there is a finite temperature difference between them.

(B) The Clausius' inequality is subtle. The temperature that shows up in $\delta Q/T$ is the temperature of the *boundary* of the system, *not the system itself*! In other words, $T$ appearing in the Clausius' inequality is actually the temperature of the environment. This is why during an irreversible process, the entropy change of the system, defined by $\oint \delta Q_{\textrm{sys}}/T_\textrm{sys}$, can be zero, while $\oint \delta Q_{\textrm{sys}}/T_\textrm{res}<0$.

In any case, it is useful to do some calculations explicitly. Let's concentrate on the isochoric process $1\to2$ for the purposes of illustration.

**Heuristics**

Below, we carefully compute the entropy changes for both system and environment, but for now, let's give a quick heuristic explanation of what's going on.

If---as illustrated in the figures above---the system undergoes a quasi-static process (meaning that the system moves through a sequence of equilibrium states and so always has a well-defined set of thermodynamic variables), then the entropy change of the system is given by integrating $\delta Q_{\textrm{sys}}/T_\textrm{sys}$ from point 1 to 2 along a reversible path, regardless of whether the actual process is reversible or not. If the process is *not* quasi-static for the system, it is possible that the system can be broken up into subsystems that *do* undergo quasi-static processes.

In general, one can calculate the entropy change during an irreversible process between two equilibrium states by imagining a quasi-static process between them and calculating $\Delta S$ for that process. If the process is quasi-static, we can use $dS = \delta Q/T$. If not, we can use the thermodynamic relation

$$\mathrm dU = T\,\mathrm dS-p\, \mathrm dV+\mu\, \mathrm d N$$

by solving for $\mathrm \,dS$ and integrating along the reversible path.

Here, we assume that the irreversibility arises solely as a consequence of heat exchange between the system and its environment while they are different temperatures, which means that the system and environment each undergo separate quasi-static processes, but we can think of them as two subsystems comprising a closed system that does *not* undergo a quasi-static process.

We do a sample calculation carefully below, but note that $T_\textrm{sys}$ is changing throughout the process. On the other hand, the entropy change of the environment is given by integrating $\delta Q_{\textrm{env}}/T_\textrm{env}$ along a reversible path, where these are now quantities associated with the *environment*.

Now, consider the case where the system is in contact with a single reservoir of temperature $T_2$ throughout this process, which means that at all times, $T_\textrm{env} > T_\textrm{sys}$. In any small part of the process, the heat flow out of the reservoir is equal to the heat flow into the system, and so the entropy gain of the system is necessarily larger than the entropy loss of the reservoir:
$$
\mathrm dS_{\textrm{sys}} = \frac{\delta Q_{\textrm{sys}}}{T_{\textrm{sys}}} > \frac{\delta Q_{\textrm{sys}}}{T_{\textrm{res}}} = -\frac{\delta Q_{\textrm{res}}}{T_{\textrm{res}}} = -\mathrm dS_{\textrm{res}}
$$

Finally, if we were to calculate part of the Clausius' inequality integral, it would be exactly
$$
\frac{\delta Q_{\textrm{sys}}}{T_{\textrm{res}}} = -\mathrm dS_{\textrm{res}} < \mathrm dS_{\textrm{sys}}
$$
as it's supposed to.

**Careful calculation**

The entropy change of the system is given by
$$
\Delta S_{\textrm{sys},1\to2} = \int_{1}^{2}\frac{\delta Q_{\textrm{sys}}}{T}
= \int_{T_1}^{T_2}\frac{nC_V\,\mathrm dT}{T},
$$
where $C_V$ is the molar specific heat of the gas at constant volume. This evaluates to
$$
\Delta S_{\textrm{sys},1\to2} = nC_V\ln\left(\frac{T_2}{T_1}\right),
$$
which can be written as
$$
\Delta S_{\textrm{sys},1\to2} = Q_{1\to2}\frac{\ln\left({T_2}/{T_1}\right)}{T_2-T_1},
$$
where $Q_{1\to2}$ is the heat flow into the system during this process; this quantity is positive since $T_2 > T_1$.

Now, suppose that this process comes about due to the system being in contact with a thermal reservoir of constant temperature $T_2$. Then, the change in entropy of the *reservoir* is given by
$$
\Delta S_{\textrm{res},1\to2} = \int_{1}^{2}\frac{\delta Q_{\textrm{res}}}{T_{\textrm{res}}}
= \int_{1}^{2}\frac{-\delta Q_{\textrm{sys}}}{T_2},
$$
assuming that the system and reservoir are otherwise isolated from the rest of the universe so that $\delta Q_{\textrm{res}} = -\delta Q_{\textrm{sys}}$. This last term evaluates to
$$
\Delta S_{\textrm{res},1\to2} = -\frac{Q_{1\to2}}{T_2},
$$
and so the total entropy change of the universe is
$$
dS = \Delta S_{\textrm{sys},1\to2} + \Delta S_{\textrm{res},1\to2}
=Q_{1\to2}\left(\frac{\ln\left({T_2}/{T_1}\right)}{T_2-T_1}-\frac{1}{T_2}\right).
$$
It is relatively straight-forward to show that this quantity is positive for $T_2>T_1$ (our assumption).

The piece of the Clausius' inequality here is then just
$$
\int_1^2 \frac{\delta Q_{\textrm{sys}}}{T_{\textrm{res}}} = \frac{Q_{1\to2}}{T_2}
< Q_{1\to2}\frac{\ln\left({T_2}/{T_1}\right)}{T_2-T_1} = \Delta S_{\textrm{sys},1\to2}.
$$

## Best Answer

## TL;DR

The integral in the Clausius inequality is

negativetheportionof the entropy change of the reservoirs that is due to energy exchange via heating with the system, i.e. $$0 \geq \oint \frac{\delta Q_{\text{sys}}}{T_{\textrm{res}}} = - \Delta S_{\text{res due to heat exchange with sys}}.$$ (I use the word "portion" because the reservoirs are allowed to exchange energy with the rest of the universe, and so some portion of the entropy change of the reservoirs could come from elsewhere). Strict inequality arises when (a) at least one of the processes undergone by the system is non-quasi-static or (b) the system and reservoirs exchange energy via heating when there is a finite temperature difference between them. Strict equality holds when neither (a) nor (b) hold, and in this case the cycle undergone by the system is called reversible.Finally, one can use the Clausius inequality to characterize how much work we could have done but didn't by (b) not taking advantage of those finite temperature differences or (c) not taking advantage of the

internalirreversibilities$-$like internal pressure gradients, internal temperature gradients, and so on, which synonymous with the processes not being quasi-static$-$to do work.## Brief note on the question before the long explanation

In the question, you have written the Clausius inequality incorrectly. It is actually $$\oint \frac{\delta Q_{\text{sys}}}{T_{\textrm{res}}} \leq 0.$$ Note the subscripts! - the $Q$ is the heating of the

system, but the $T$ is the temperature of thereservoirs! So when you sayyou are reversing things! The reservoirs' total entropy either stays the same or goes

up, which is of course a consequence of the Second Law, keeping in mind that the change in system entropy is zero because the system operates on a cycle.## Explanation

We'll take this in steps, starting with the Carnot cycle, moving on to an arbitrary reversible engine, move from there to an irreversible engine where the irreversibility is due to temperature difference between the system and the reservoir, and finally conclude by looking at an engine where there are irreversibilities present

withinthe system.## The reversible Carnot cycle

Here we compute the integral in the Clausius inequality for the four processes: the first is an isothermal compression, the second an adiabatic compression, the third an isothermal expansion, and the fourth an adiabatic expansion. During the isothermal phases, the system and the reservoir with which its in contact are at the same, constant temperature.We therefore break up the integral into these four parts as \begin{align} \oint \frac{\delta Q}{T_{\textrm{res}}} = \int_{1} \frac{\delta Q}{T_{\textrm{res}}}+\int_{2} \frac{\delta Q}{T_{\textrm{res}}} +\int_{3} \frac{\delta Q}{T_{\textrm{res}}}+\int_{4} \frac{\delta Q}{T_{\textrm{res}}}. \end{align} Processes 2 and 4 are adiabatic, so they contribute nothing to the integral, and so we are left with \begin{align} \oint \frac{\delta Q}{T_{\textrm{res}}} = \int_{1} \frac{\delta Q}{T_{\textrm{res}}}+\int_{3} \frac{\delta Q}{T_{\textrm{res}}} =\int_{1} \frac{\delta Q}{T_{\textrm{C}}}+\int_{3} \frac{\delta Q}{T_{\textrm{H}}} =\frac{1}{T_{\textrm{C}}}\int_{1} \delta Q + \frac{1}{T_{\textrm{H}}}\int_{3} \delta Q, \end{align} which is then just \begin{align} \oint \frac{\delta Q}{T_{\textrm{res}}} &=\frac{Q_{1}}{T_{\textrm{C}}} + \frac{Q_{3}}{T_{\textrm{H}}} =\frac{-Q_{\textrm{C}}}{T_{\textrm{C}}} + \frac{Q_{\textrm{H}}}{T_{\textrm{H}}}. \end{align} This quantity is zero for the Carnot cycle, as can be readily verified in various ways, so this satisfies the inequality.

It is also useful to compute the

componentof the change in entropy of the reservoirs during this process that is due to exchange of energy with the system. The reservoirs might be gaining or losing entropy because they might be interacting with other parts of the universe, but we don't care about that (or we can assume for now that the system plus reservoirs is thermally (but not mechanically) isolated from the rest of the universe. The change in entropy of the system is of course zero because it operates on a cycle. So: $$\Delta S_{\text{res}} = \frac{Q_{\text{hot}}}{T_{\text{H}}} + \frac{Q_{\text{cold}}}{T_{\text{C}}} = \frac{-Q_{\text{H}}}{T_{\text{H}}} + \frac{Q_{\text{C}}}{T_{\text{C}}}.$$ This isexactlythe negative of the quantity we computed above (although of course, it's still zero in this case). This suggests that what we are computing is the change in entropy of the reservoirs that is brought about due to energy exchange via heating with the system.## An arbitrary reversible engine

In this case, the system temperature is at all times equal to the temperature of the reservoir that it is in contact with. But since the temperature of the system can change while it is also exchanging energy via heating with the reservoir, the temperature of the reservoir must be changing along with the system (or, as is normally stipulated, the system is brought into contact with a sequence of reservoirs with infinitesimally different temperatures). If we calculate the

portionof the net change in entropy of the reservoirs that is due to the exchange of energy via heating with the system, then we exactly compute $$\oint \frac{\delta Q_{\text{res}}}{T_{\text{res}}} = -\oint \frac{\delta Q_{\text{sys}}}{T_{\text{res}}}.$$ This is the negative of the quantity appearing in the Clausius inequality, and in this case it is again 0. This is harder to see, of course, but in the proof the Clausius inequality, it is shown that equality holds for reversible cycles.Once again, this suggests that the left-hand side of the Clausius inequality is the negative of the change in entropy of the

reservoirsthat is brought about by exchange of energy via heating with the system (that is undergoing a cycle).## A non-Carnot cycle operating between only two temperatures

Let's consider one of the simplest cases, which is the Otto cycle. The Otto cycle consists of an adiabatic compression (Processes 1), and adiabatic expansion (Process 3), and two isochors (Processes 2 and 4). During the adiabatic processes, no energy is exchanged by heating. Therefore, the change in entropy of the reservoirs brought about by exchange of energy via heating with the system is \begin{align} \oint \frac{\delta Q_{\text{res}}}{T_{\textrm{res}}} = \int_{2} \frac{\delta Q_{\text{res}}}{T_{\textrm{res}}}+\int_{4} \frac{\delta Q_{\text{res}}}{T_{\textrm{res}}} =\frac{Q_{\text{cold}}}{T_{\textrm{C}}} + \frac{Q_{\text{hot}}}{T_{\textrm{H}}} =\frac{Q_{\text{C}}}{T_{\textrm{C}}} + \frac{-Q_{\text{H}}}{T_{\textrm{H}}}. \end{align} Now, during Process 2, the system is always hotter than the reservoir, and during Process 4, the system is always cooler than the reservoir. We will do the careful calculation in just a second, but this implies that the quantity we've just calculated must be

positive, which then implies that the negative of this quantity (which is the one that appears in the Clausius inequality) is negative.As for the calculation, we can write $\bar{T}_{\text{sys},2} > T_{\text{C}}$, where $$\bar{T}_{\text{sys},2} = \frac{1}{\Delta S_2}\int_2 TdS$$ is the average temperature during Process 2. Similarly, during Process 4, the system is always cooler than the reservoir, so $\bar{T}_{\text{sys},4} < T_{\text{H}}$. The change in entropy for the cycle can be written in terms of the average temperatures as \begin{align} 0 &= \Delta S_{\text{sys}} = \Delta S_1 + \Delta S_2 + \Delta S_3 + \Delta S_4 = \Delta S_2 + \Delta S_4\\ &=\frac{Q_2}{\bar{T}_{\text{sys},2}} + \frac{Q_4}{\bar{T}_{\text{sys},4}} =\frac{-Q_{\text{C}}}{\bar{T}_{\text{sys},2}} + \frac{Q_{\text{H}}}{\bar{T}_{\text{sys},4}} \\ & > \frac{-Q_{\text{C}}}{{T}_{\text{C}}} + \frac{Q_{\text{H}}}{{T}_{\text{H}}} \end{align}

This quantity is exactly the negative of the quantity above, which shows that the net change in entropy (due to the interactions with the system) of the reservoirs during the cycle is necessarily

positiveand that the Clausius inequality is then again satisfied (because the integral in the inequality is the negative of the change in entropy of the reservoir that we computed above).## Intermission

To sum up, the quantity $$-\oint \frac{\delta Q_{\text{sys}}}{T_{\text{res}}}$$ is exactly the portion of the change in entropy of the reservoirs that is due to exchange of energy via heating with the system (which is undergoing a thermodynamic cycle). By carefully comparing the temperatures of the system and the reservoirs while heating is going on, we have determined that this quantity must be non-negative, and hence the inequality is satisfied.

So far, strict inequality is a result of the system and reservoirs exchanging energy via heating when they are at different temperatures, which makes sense since heat flow across a finite temperature difference is an irreversible process. However, the Clausius inequality should be strict for all irreversible processes, so we need to analyze the case where there are so-called irreversibilities

withinthe system itself during the operation of the cycle: these are things like friction, temperature differentials within the system, pressure gradients within the system, etc. Anything that leads the system to undergo non-quasi-static processes, essentially.## Internal irreversibilities

This situation is hard to analyze, and I'm not entirely sure I can do it with any sort of rigor at all. So let's work in reverse and consider a special case. Let's suppose we've got a system undergoing a thermodynamic cycle in which all of the processes are reversible except for one which is an irreversible, adiabatic expansion. There could for instance be a very rapid expansion of the system due to a large pressure differential between the system and its environment.

In order for the the Clausius inequality to be strict, there must be, in one of the

otherprocesses, more heat flowoutcompared to the reversible version of the cycle$-$making $\delta Q/T_{\text{res}}$more negativefor the process$-$of less heat flowincompared to the reversible version$-$making $\delta Q/T_{\text{res}}$smallerfor the process. This is consistent with the engine being less efficient, because either there's more waste, or there's thesameamount of waste but less available energy.Basically, during the adiabatic expansion, there is

lesswork done than if the adiabatic expansion was reversible (but took place between the same two volumes) (this is, by the way, another way to state the Second Law).Again, this is all very nebulous because I don't actually know how to "mathematize" this part. But the overall point is this: if the system is allowed to undergo non-quasi-static (i.e. internally reversible) processes during the cycle, then it actually generates

moreentropy that it has to then get rid of to the reservoirs (in order for $\Delta S_{\text{sys,cycle}} = 0$), and as a consequence, this extra entropy is added to the reservoirs, which is why the Clausius inequality is strict in this case.## Final words

And this is all ignoring possible irreversible processes

elsewhere. The reservoirs themselves could be exchanging energy via heating with other parts of the universe, and as a consequence, the entropy of the universe could be increasingeven if the Clausius inequality applied to this collection of system and reservoirs is actually an equality.This, I think, is the final piece of the puzzle that always bugged me before. The Clausius inequality is really about calculating how much irreversibility there is associated with a system undergoing a thermodynamic cycle, and the irreversibility consists of two parts: (a) non-quasi-static processes going on inside the system and (b) energy exchange via heating between system and reservoir when they are at different temperatures.

In thermal systems

engineering(I am a physicist, but I teach an engineering thermodynamics course as a service course for the engineering department), the Clausius inequality is used to characterize how much work could have been done but wasn't due to (a) and (b) above. There, the idea is that if the Clausius inequality is strict, this means that a sufficiently clever engineer can fix the engine in order to get more work out and hence get the Clausius inequality closer to an equality. For instance, we can always put a little Carnot engine between the original system and the reservoir it is exchanging energy withifthey are exchanging energy when at different temperatures, and hence extract more work.