--------------------------------
The second law of thermodynamics
--------------------------------
Thermodynamical relations are defined at euqilibrium. However,
thermodynamics has always been more general than equilibrium
thermodynamics - steam engines didn't operate at equilibrium.
Before the time when irreversible thermodynamics was developped,
the only (but extremely important) statement thermodynamics could make
about the nonequilibrium situation was the second law in its global
form (in contrast with the local form in irreversible thermodynamics):
The simple version of the global second law says:
Under constant and fixed equilibrium boundary conditions, a
nonequilibrium system will ultimately reach (metastable) equilibrium,
the equilibrium state reached will have the same intensive state
variables as those corresponding to the boundary conditions, and the
thermodynamic potential appropriate for the boundary conditions
applied (-S, U, H, G, etc.) will attain a (local) minimum.
Thus, if one knows the analytic form of the potential, one can predict
the final state by solving a corresponding optimization problem.
This scenario is used for a huge number of applications, including
phase equilibrium and chemical equilibrium.
A more general version of the global second law allows for reversible
processes (implemented through changing boundary conditions), and is
formulated in Chapter 4 of my book from
http://lanl.arxiv.org/abs/0810.1019
The local second law says that the local mean entropy production is
always nonnegative. It implies both versions of the global form.