Heat transfer reservoir and system at same temperature

It is true that the condition for thermodynamic equilibrium between two systems in contact through a diathermal, rigid and impermeable wall is the equality of temperatures. This is a consequence of the principle of maximum entropy applied to the isolated system made of the two systems at thermal contact. Thermodynamic temperature actually emerges as the state function of each sub-system which ensures the extremum condition for the total entropy as function of the energy content of the two subsystems: $$ dS = dS_1+dS_2 = \left( \frac{\partial{S_1}}{\partial{E_1}} - \frac{\partial{S_2}}{\partial{E_2}}\right)dE_1=0 $$ for any $dE_1$, implies $ \frac{1}{T_1}=\frac{\partial{S_1}}{\partial{E_1}}=\frac{\partial{S_2}}{\partial{E_2}} = \frac{1}{T_2}$, where use has been done of the condition of an isolated total system ($E_1+E_2= E =$ constant). The energy $\bar E_1$ at which $T_1(\bar E_1)=T_2(E-\bar E_1) $ will be the equilibrium value of the energy of subsystem $1$.

However, thermodynamic equilibrium implies the existence of an underlying microscopic dynamics of the system which continuously make it exploring all the microscopic configurations consistent with the global constraints. In the present case, the total system should be thought as exploring all the possible sharing of energy between subsystem $1$ and $2$ at constant $E$. This implies deviations (fluctuations) around the equilibrium value of $\bar E_1$ (and correspondingly of $\bar E_2=E-\bar E_1$. Due to the extensiveness of energy, the relative fluctuations will be smaller and smaller the most each subsystem is large. For a very large subsystem, say system $2$, one can neglect the relative fluctuations and the system can be considered at almost fixed $E_2$, while system $1$ continues to fluctuate around $\bar E_1$. As a consequence, $ \frac{1}{T_2}=\frac{\partial{S_2}}{\partial{E_2}}$ is almost constant (system $2$ becomes a $thermostat$, i.e.its temperature is almost unaffected by fluctuations) while temperature of system $1$ may undergo temporary fluctuations around the average (equilibrium value).

The stability of thermodynamic equilibrium (i.e. the fact that entropy of the total system is not only at an extremum point but at a maximum) implies that these fluctuations trigger a response of the system in the direction of reestablishing the equilibrium value of $\bar E_1$ rough fluxes of energy from subsystem $1$ into the reservoir or the other way around, depending if the fluctuation was increasing or decreasing $\bar E_1$ respectively.

Basically, this is the content of the so called Le Chatelier's principle saying that in a system at thermodynamic equilibrium, every fluctuation (inhomogeneity) triggers a response which tends to reduce it. It is also clear that it is a topic which, strictly speaking, it is at the border between equilibrium and non-equilibrium thermodynamics.


I just read that "a heat transfer between a reservoir and a system at same temperature is a reversible process". If there's no temperature difference, why would there be a heat flow?

You are correct. If there is no temperature difference there can be no energy transfer in the form of heat. Heat is defined as energy transfer due solely to temperature difference. It is for this reason there is no such thing as a truly reversible heat transfer process. All real processes are irreversible. A reversible heat transfer process it is an idealization where the temperature difference approaches Zero in the limit such that the total entropy change (system + surroundings) approaches zero in the limit.

The second law requires that the total entropy change as a result of a process be the following:

$$\Delta S_{tot}=\Delta S_{sys}+\Delta S_{surr}≥0$$

Where $\Delta S_{tot}$ is the total entropy change of the system plus the surrounding (entropy change of the universe) for any process where the system and surroundings interact. The equality applies if the process is reversible, and the inequality if it is irreversible. Since all real processes are irreversible, the law tells us that the total entropy of the universe increases as a result of a real process.

The property of entropy is defined as

$$dS=\frac {dQ_{rev}}{T}$$

where $dQ$ is a reversible differential transfer of heat and $T$ is the temperature at which it is transferred. Although it I defined for a reversible transfer of heat, it applies to any process between two states. If a process occurs at constant temperature, we can say

$$\Delta S=\frac{Q}{T}$$

And that the heat transfer occurs isothermally.

Let body A be our system and body B the surroundings. Let A be at a lower temperature than B, so that heat transfer $Q$ occurs from B to A. Applying the second law to our bodies:

$$\Delta S_{tot}=\frac{+Q}{T_A}+\frac{-Q}{T_B}$$

The plus sign for body A simply means the entropy increases for body A because heat is transferred in, and the negative sign for body B means its entropy has decreased because heat is transferred out.

From the equation, we observe that for all $T_{B}>T_{A}$, $\Delta S_{tot}>0$. We further note that as the two temperatures get closer and closer to each other, $\Delta S_{tot}$ goes to 0. But if $T_{B}<T_{A}$ meaning heat transfers from the cold body to the hot body, $\Delta S$ would be less than zero, violating the second law. Thus the second law precludes that natural transfer of heat from a cold body to a hot body.

Note that for $\Delta S_{tot}=0$, the condition for reversibility, the temperatures would have to be equal. But we know that heat will not flow unless there is a temperature difference. So we see that for all real heat transfer processes, such processes are irreversible.

Irreversibility and entropy increase is not limited to heat transfer processes. Any process goes from a state of disequilibrium to equilibrium. An example is an irreversible adiabatic ($Q=0$) process. Beside heat, you have processes involving pressure differentials (pressure disequilibrium). These processes are also irreversible and generate entropy. In general all real processes are driven by disequilibrium, be it thermal, mechanical, chemical, etc. disequilibrium. And it is disequilibrium that generates entropy.

Hope this helps.