paradoxical results in different applications of the 2nd law of thermodynamics Assume two closed systems adjacent to each other together forming one adiabatic system. Both systems are assumed to have their volumes fixed and can therefore communicate with each other through heat transfer only. Now let study this simple example with three different formulation:


*

*The first formulation is what I had always thought to be obvious, when I thought I know Classic Thermodynamics! Assume $\delta Q$ is the heat flow from system $2$ into system $1$:
\begin{align}
&\Delta S=\Delta S_1+\Delta S_2\,,\qquad \Delta S_1\ge\int_1^2\frac{\delta Q}{T_1}\quad\text{&}\quad \Delta S_2\ge\int_1^2\frac{-\delta Q}{T_2}\\
&\Rightarrow\;\Delta S\ge\int_1^2\delta Q\,\Bigl(\frac{1}{T_1}-\frac{1}{T_2}\Bigr)
\end{align}
Now again the Clausius statement of the second law says if $\delta Q\ge0$ then $T_2\ge T_1$ and if $\delta Q\le0$ then $T_2\le T_1$. Therefore, eitherway we would have
$$\Delta S\ge\int_1^2\delta Q\,\Bigl(\frac{1}{T_1}-\frac{1}{T_2}\Bigr)\ge0$$

*But no matter if the process is reversible or not, only assuming that the system has no work (volume is fixed, but also assume there is no friction or gravity work and etc.) we would obtain:
\begin{align}
&\delta Q-\delta W=dU=T dS - p dV\quad\Rightarrow\quad\delta Q=T dS\\
&\Rightarrow\quad \Delta S_1=\int_1^2\frac{\delta Q}{T_1}\;\;\text{&}\;\; \Delta S_2=\int_1^2\frac{-\delta Q}{T_2}\\
&\Rightarrow\quad \Delta S=\Delta S_1+\Delta S_2=\int_1^2\delta Q\,\Bigl(\frac{1}{T_1}-\frac{1}{T_2}\Bigr)\ge0
\end{align}
The problem is that we have derived in the first line $\delta Q=T dS$ which is not correct in general and this suggests that even if the volume is fixed but yet another work should exist, but if the containers contain only solid material what work should be considered to resolve this paradoxical result?

*In the Emanuel's ``Advanced Classical Thermodynamics" it has been suggested to write the entropy change in a closed system as:
$$dS=dS_{int}+\frac{\delta Q}{T_{surr}}$$
wherein, int and surr are the abbreviations for internal and the surrounding, respectively. Assuming the irreversibility caused by the flow of heat between a finite temperature difference $T_{surr}-T$ to be considered inside $dS_{int}$ then it concludes the second law of thermodynamics as:
$$dS_{int}\ge0$$
Now returning back to our two-system problem we would have:
\begin{align}
&dS=dS_{int_{total}}+0\quad\text{&}\quad dS_1=dS_{int_1}+\frac{\delta Q}{T_2}\quad\text{&}\quad dS_2=dS_{int_2}-\frac{\delta Q}{T_1}\\
&dS=dS_1+dS_2\quad\Rightarrow\quad dS_{int_{total}}=dS_{int_1}+dS_{int_2}-\delta Q\,\Bigl(\frac{1}{T_1}-\frac{1}{T_2}\Bigr)
\end{align}
The last line requires $dS_{int_{total}}\le dS_{int_1}+dS_{int_2}$ which is not correct obviously and it should have been only "equal" instead of "lower or equal".
As is already clear, the second formulation of the problem should have a mistake but I just cannot find it, but the third formulation is rather more serious problem, to me either assuming the irreversibility of heat flow between finite temperature differences cannot be removed from it into $dS_{int}$ or if it is done then only one temperature should be used in the formulation, but then the problem rises that which one, $T_1$ or $T_2$? If it is arbitrary and I can write both $dS\ge\frac{\delta Q}{T_{surr}}$ and $dS\ge\frac{\delta Q}{T}$ then the first formulation above would run into problem!
Thanks
 A: It is best to always stick to the rigorous formulation of the second law, which comes in two parts. Quote from the book "Fundamentals of Statistical and Thermal Physics "by F. Reif:
1) In any process in which a thermally isolated system goes from one macrostate to another, the entropy tends to increase, i.e.,
$$\Delta S\geq 0$$
2) If the system is not isolated and undergoes a quasi-static infinitesimal process in which it absorbs heat $dQ$, then
$$dS = \frac{dQ}{T}$$
Combining 1) and 2) in the form of statements such as $dS\geq\frac{dQ}{T}$ are weaker than the second law as formulated above, as you need to make additional assumptions that would make this valid. It's best to never use such statements directly and always stick to the modern rigorous formulation of the second law that doesn't assume that temperature is definable during any non quasi-static change.
The paradox you consider is resolved when you consider that the system is not in thermal equilibrium. Note that you are in principle free to define the thermodynamic description of a given physical system. So, the physical system is described exactly by specifying its microstate, and the thermodynamic description is a course grained description of it where you keep only a few macroscopic parameters. Now, what then can happen is that a slightly less course grained description would have allowed equilibrium thermodynamics to be applicable to the system. This is the case here.
So, you have two choice. You if you describe the system as one isolated system, then temperature is not defined and you can only use the first part of the second law which doesn;t invoke a notion of temperature. However, if you take a sligly less course graiend look at the system, you see that you have two subsystems, the changes in entropy of the system can be described by the second part of the second law, provided the changes are quasi-static.
