  The second law of equilibrium thermodynamics explains the direction of
spontaneous processes in a system after removing internal constraints. When the
system only exchanges energy with the environment as heat, the second law
states that spontaneous processes at constant temperature satisfy: $\textrm{d}
U - \delta Q \leq 0$. Here, $\textrm{d} U$ is the infinitesimal change of the
internal energy, and $\delta Q$ is the infinitesimal heat exchanged in the
process. We will consider three different systems in a heat flow: ideal gas,
van der Waals gas, and a binary mixture of ideal gases. We will also study
ideal gas and van der Waals gas in the heat flow and gravitational field. We
will divide each system internally into two subsystems by a movable wall. We
will show that the direction of the motion of the wall, after release, at
constant boundary conditions is determined by the same inequality as in
equilibrium thermodynamics. The only difference between equilibrium and
non-equilibrium law is the dependence of the net heat change, $\delta Q$, on
the state parameters of the system. We will also consider a wall thick and
permeable to gas particles and derive Archimedes' principle in the heat flow.
Finally, we will study the ideal gas's Couette flow, where the direction of the
motion of the internal wall follows from the inequality $\textrm{d} E - \delta
Q - \delta W_s \leq 0$, with $\textrm{d} E$ being the infinitesimal change of
the total energy (internal and kinetic) and $\delta W_s$ the infinitesimal work
exchanged with the environment due to shear force. Ultimately, we will
synthesize all these cases in a framework of the second law of non-equilibrium
thermodynamics.
