Thermodynamics 

Nonequilibrium thermodynamics is a branch of thermodynamics that deals with physical systems that are not in thermodynamic equilibrium but can be described in terms of macroscopic quantities (nonequilibrium state variables) that represent an extrapolation of the variables used to specify the system in thermodynamic equilibrium. Nonequilibrium thermodynamics is concerned with transport processes and with the rates of chemical reactions.
Almost all systems found in nature are not in thermodynamic equilibrium, for they are changing or can be triggered to change over time, and are continuously and discontinuously subject to flux of matter and energy to and from other systems and to chemical reactions. Many systems and processes can, however, be considered to be in equilibrium locally, thus allowing description by currently known equilibrium thermodynamics.^{[1]} Nevertheless, some natural systems and processes remain beyond the scope of equilibrium thermodynamic methods due to the existence of non variational dynamics, where the concept of free energy is lost.^{[2]}
The thermodynamic study of nonequilibrium systems requires more general concepts than are dealt with by equilibrium thermodynamics.^{[3]} One fundamental difference between equilibrium thermodynamics and nonequilibrium thermodynamics lies in the behaviour of inhomogeneous systems, which require for their study knowledge of rates of reaction which are not considered in equilibrium thermodynamics of homogeneous systems. This is discussed below. Another fundamental and very important difference is the difficulty, in defining entropy at an instant of time in macroscopic terms for systems not in thermodynamic equilibrium. However, it can be done locally, and the macroscopic entropy will then be given by the integral of the locally defined entropy density. It has been found that many systems far outside global equilibrium still obey the concept of local equilibrium.^{[4]}
A profound difference separates equilibrium from nonequilibrium thermodynamics. Equilibrium thermodynamics ignores the timecourses of physical processes. In contrast, nonequilibrium thermodynamics attempts to describe their timecourses in continuous detail.
Equilibrium thermodynamics restricts its considerations to processes that have initial and final states of thermodynamic equilibrium; the timecourses of processes are deliberately ignored. Nonequilibrium thermodynamics, on the other hand, attempting to describe continuous timecourses, needs its state variables to have a very close connection with those of equilibrium thermodynamics.^{[5]} This conceptual issue is overcome under the assumption of local equilibrium, which entails that the relationships that hold between macroscopic state variables at equilibrium hold locally, also outside equilibrium.^{[1]} Throughout the past decades, the assumption of local equilibrium has been tested, and found to hold, under increasingly extreme conditions, such as in the shock front of violent explosions, on reacting surfaces, and under extreme thermal gradients.^{[6]}^{[7]}^{[8]}^{[9]}
Thus, nonequilibrium thermodynamics provides a consistent framework for modelling not only the initial and final states of a system, but also the evolution of the system in time. Together with the concept of entropy production, this provides a powerful tool in process optimisation, and provides a theoretical foundation for exergy analysis.^{[1]}
The suitable relationship that defines nonequilibrium thermodynamic state variables is as follows. When the system is in local equilibrium, nonequilibrium state variables are such that they can be measured locally with sufficient accuracy by the same techniques as are used to measure thermodynamic state variables, or by corresponding time and space derivatives, including fluxes of matter and energy. In general, nonequilibrium thermodynamic systems are spatially and temporally nonuniform, but their nonuniformity still has a sufficient degree of smoothness to support the existence of suitable time and space derivatives of nonequilibrium state variables.
Because of the spatial nonuniformity, nonequilibrium state variables that correspond to extensive thermodynamic state variables have to be defined as spatial densities of the corresponding extensive equilibrium state variables. When the system is in local equilibrium, intensive nonequilibrium state variables, for example temperature and pressure, correspond closely with equilibrium state variables. It is necessary that measuring probes be small enough, and rapidly enough responding, to capture relevant nonuniformity. Further, the nonequilibrium state variables are required to be mathematically functionally related to one another in ways that suitably resemble corresponding relations between equilibrium thermodynamic state variables.^{[10]} In reality, these requirements, although strict, have been shown to be fulfilled even under extreme conditions, such as during phase transitions, at reacting interfaces, and in plasma droplets surrounded by ambient air.^{[11]}^{[12]}^{[13]} There are, however, situations where there are appreciable nonlinear effects even at the local scale.^{[14]}^{[15]}
Some concepts of particular importance for nonequilibrium thermodynamics include time rate of dissipation of energy (Rayleigh 1873,^{[16]} Onsager 1931,^{[17]} also^{[10]}^{[18]}), time rate of entropy production (Onsager 1931),^{[17]} thermodynamic fields,^{[19]}^{[20]}^{[21]} dissipative structure,^{[22]} and nonlinear dynamical structure.^{[18]}
One problem of interest is the thermodynamic study of nonequilibrium steady states, in which entropy production and some flows are nonzero, but there is no time variation of physical variables.
One initial approach to nonequilibrium thermodynamics is sometimes called 'classical irreversible thermodynamics'.^{[23]} There are other approaches to nonequilibrium thermodynamics, for example extended irreversible thermodynamics,^{[23]}^{[24]} and generalized thermodynamics,^{[25]} but they are hardly touched on in the present article.
According to Wildt^{[26]} (see also Essex^{[27]}^{[28]}^{[29]}), current versions of nonequilibrium thermodynamics ignore radiant heat; they can do so because they refer to laboratory quantities of matter under laboratory conditions with temperatures well below those of stars. At laboratory temperatures, in laboratory quantities of matter, thermal radiation is weak and can be practically nearly ignored. But, for example, atmospheric physics is concerned with large amounts of matter, occupying cubic kilometers, that, taken as a whole, are not within the range of laboratory quantities; then thermal radiation cannot be ignored.
The terms 'classical irreversible thermodynamics'^{[23]} and 'local equilibrium thermodynamics' are sometimes used to refer to a version of nonequilibrium thermodynamics that demands certain simplifying assumptions, as follows. The assumptions have the effect of making each very small volume element of the system effectively homogeneous, or wellmixed, or without an effective spatial structure. Even within the thoughtframe of classical irreversible thermodynamics, care^{[18]} is needed in choosing the independent variables^{[30]} for systems. In some writings, it is assumed that the intensive variables of equilibrium thermodynamics are sufficient as the independent variables for the task (such variables are considered to have no 'memory', and do not show hysteresis); in particular, local flow intensive variables are not admitted as independent variables; local flows are considered as dependent on quasistatic local intensive variables.
Also it is assumed that the local entropy density is the same function of the other local intensive variables as in equilibrium; this is called the local thermodynamic equilibrium assumption^{[10]}^{[18]}^{[22]}^{[24]}^{[6]}^{[31]}^{[32]}^{[33]} (see also Keizer (1987)^{[34]}). Radiation is ignored because it is transfer of energy between regions, which can be remote from one another. In the classical irreversible thermodynamic approach, there is allowed spatial variation from infinitesimal volume element to adjacent infinitesimal volume element, but it is assumed that the global entropy of the system can be found by simple spatial integration of the local entropy density. This approach assumes spatial and temporal continuity and even differentiability of locally defined intensive variables such as temperature and internal energy density. While these demands may appear severely constrictive, it has been found that the assumptions of local equilibrium hold for a wide variety of systems, including reacting interfaces, on the surfaces of catalysts, in confined systems such as zeolites, under temperature gradients as large as K m, and even in shock fronts moving at up to six times the speed of sound.^{[7]}^{[8]}^{[9]}^{[35]}
In other writings, local flow variables are considered; these might be considered as classical by analogy with the timeinvariant longterm timeaverages of flows produced by endlessly repeated cyclic processes; examples with flows are in the thermoelectric phenomena known as the Seebeck and the Peltier effects, considered by Kelvin in the nineteenth century and by Lars Onsager in the twentieth.^{[6]}^{[36]} These effects occur at metal junctions, which were originally effectively treated as twodimensional surfaces, with no spatial volume, and no spatial variation.
A further extension of local equilibrium thermodynamics is to allow that materials may have "memory", so that their constitutive equations depend not only on present values but also on past values of local equilibrium variables. Thus time comes into the picture more deeply than for timedependent local equilibrium thermodynamics with memoryless materials, but fluxes are not independent variables of state.^{[37]}
Extended irreversible thermodynamics is a branch of nonequilibrium thermodynamics that goes outside the restriction to the local equilibrium hypothesis. The space of state variables is enlarged by including the fluxes of mass, momentum and energy and eventually higher order fluxes. The formalism is wellsuited for describing highfrequency processes and smalllength scales materials.
There are many examples of stationary nonequilibrium systems, some very simple, like a system confined between two thermostats at different temperatures or the ordinary Couette flow, a fluid enclosed between two flat walls moving in opposite directions and defining nonequilibrium conditions at the walls. Laser action is also a nonequilibrium process, but it depends on departure from local thermodynamic equilibrium and is thus beyond the scope of classical irreversible thermodynamics; here a strong temperature difference is maintained between two molecular degrees of freedom (with molecular laser, vibrational and rotational molecular motion), the requirement for two component 'temperatures' in the one small region of space, precluding local thermodynamic equilibrium, which demands that only one temperature be needed. Damping of acoustic perturbations or shock waves are nonstationary nonequilibrium processes. Driven complex fluids, turbulent systems and glasses are other examples of nonequilibrium systems.
The mechanics of macroscopic systems depends on a number of extensive quantities. It should be stressed that all systems are permanently interacting with their surroundings, thereby causing unavoidable fluctuations of extensive quantities. Equilibrium conditions of thermodynamic systems are related to the maximum property of the entropy. If the only extensive quantity that is allowed to fluctuate is the internal energy, all the other ones being kept strictly constant, the temperature of the system is measurable and meaningful. The system's properties are then most conveniently described using the thermodynamic potential Helmholtz free energy (A = U  TS), a Legendre transformation of the energy. If, next to fluctuations of the energy, the macroscopic dimensions (volume) of the system are left fluctuating, we use the Gibbs free energy (G = U + PV  TS), where the system's properties are determined both by the temperature and by the pressure.
Nonequilibrium systems are much more complex and they may undergo fluctuations of more extensive quantities. The boundary conditions impose on them particular intensive variables, like temperature gradients or distorted collective motions (shear motions, vortices, etc.), often called thermodynamic forces. If free energies are very useful in equilibrium thermodynamics, it must be stressed that there is no general law defining stationary nonequilibrium properties of the energy as is the second law of thermodynamics for the entropy in equilibrium thermodynamics. That is why in such cases a more generalized Legendre transformation should be considered. This is the extended Massieu potential. By definition, the entropy (S) is a function of the collection of extensive quantities . Each extensive quantity has a conjugate intensive variable (a restricted definition of intensive variable is used here by comparison to the definition given in this link) so that:
We then define the extended Massieu function as follows:
where is Boltzmann's constant, whence
The independent variables are the intensities.
Intensities are global values, valid for the system as a whole. When boundaries impose to the system different local conditions, (e.g. temperature differences), there are intensive variables representing the average value and others representing gradients or higher moments. The latter are the thermodynamic forces driving fluxes of extensive properties through the system.
It may be shown that the Legendre transformation changes the maximum condition of the entropy (valid at equilibrium) in a minimum condition of the extended Massieu function for stationary states, no matter whether at equilibrium or not.
In thermodynamics one is often interested in a stationary state of a process, allowing that the stationary state include the occurrence of unpredictable and experimentally unreproducible fluctuations in the state of the system. The fluctuations are due to the system's internal subprocesses and to exchange of matter or energy with the system's surroundings that create the constraints that define the process.
If the stationary state of the process is stable, then the unreproducible fluctuations involve local transient decreases of entropy. The reproducible response of the system is then to increase the entropy back to its maximum by irreversible processes: the fluctuation cannot be reproduced with a significant level of probability. Fluctuations about stable stationary states are extremely small except near critical points (Kondepudi and Prigogine 1998, page 323).^{[38]} The stable stationary state has a local maximum of entropy and is locally the most reproducible state of the system. There are theorems about the irreversible dissipation of fluctuations. Here 'local' means local with respect to the abstract space of thermodynamic coordinates of state of the system.
If the stationary state is unstable, then any fluctuation will almost surely trigger the virtually explosive departure of the system from the unstable stationary state. This can be accompanied by increased export of entropy.
The scope of presentday nonequilibrium thermodynamics does not cover all physical processes. A condition for the validity of many studies in nonequilibrium thermodynamics of matter is that they deal with what is known as local thermodynamic equilibrium.
Local thermodynamic equilibrium of matter^{[10]}^{[22]}^{[31]}^{[32]}^{[33]} (see also Keizer (1987)^{[34]} means that conceptually, for study and analysis, the system can be spatially and temporally divided into 'cells' or 'microphases' of small (infinitesimal) size, in which classical thermodynamical equilibrium conditions for matter are fulfilled to good approximation. These conditions are unfulfilled, for example, in very rarefied gases, in which molecular collisions are infrequent; and in the boundary layers of a star, where radiation is passing energy to space; and for interacting fermions at very low temperature, where dissipative processes become ineffective. When these 'cells' are defined, one admits that matter and energy may pass freely between contiguous 'cells', slowly enough to leave the 'cells' in their respective individual local thermodynamic equilibria with respect to intensive variables.
One can think here of two 'relaxation times' separated by order of magnitude.^{[39]} The longer relaxation time is of the order of magnitude of times taken for the macroscopic dynamical structure of the system to change. The shorter is of the order of magnitude of times taken for a single 'cell' to reach local thermodynamic equilibrium. If these two relaxation times are not well separated, then the classical nonequilibrium thermodynamical concept of local thermodynamic equilibrium loses its meaning^{[39]} and other approaches have to be proposed, see for instance Extended irreversible thermodynamics. For example, in the atmosphere, the speed of sound is much greater than the wind speed; this favours the idea of local thermodynamic equilibrium of matter for atmospheric heat transfer studies at altitudes below about 60 km where sound propagates, but not above 100 km, where, because of the paucity of intermolecular collisions, sound does not propagate.
Edward A. Milne, thinking about stars, gave a definition of 'local thermodynamic equilibrium' in terms of the thermal radiation of the matter in each small local 'cell'.^{[40]} He defined 'local thermodynamic equilibrium' in a 'cell' by requiring that it macroscopically absorb and spontaneously emit radiation as if it were in radiative equilibrium in a cavity at the temperature of the matter of the 'cell'. Then it strictly obeys Kirchhoff's law of equality of radiative emissivity and absorptivity, with a black body source function. The key to local thermodynamic equilibrium here is that the rate of collisions of ponderable matter particles such as molecules should far exceed the rates of creation and annihilation of photons.
It is pointed out by W.T. Grandy Jr,^{[41]}^{[42]}^{[43]}^{[44]} that entropy, though it may be defined for a nonequilibrium system is—when strictly considered—only a macroscopic quantity that refers to the whole system, and is not a dynamical variable and in general does not act as a local potential that describes local physical forces. Under special circumstances, however, one can metaphorically think as if the thermal variables behaved like local physical forces. The approximation that constitutes classical irreversible thermodynamics is built on this metaphoric thinking.
This point of view shares many points in common with the concept and the use of entropy in continuum thermomechanics,^{[45]}^{[46]}^{[47]}^{[48]} which evolved completely independently of statistical mechanics and maximumentropy principles.
To describe deviation of the thermodynamic system from equilibrium, in addition to constitutive variables that are used to fix the equilibrium state, as was described above, a set of variables that are called internal variables have been introduced. The equilibrium state is considered to be stable and the main property of the internal variables, as measures of nonequilibrium of the system, is their tending to disappear; the local law of disappearing can be written as relaxation equation for each internal variable

(1) 
where is a relaxation time of a corresponding variables. It is convenient to consider the initial value are equal to zero. The above equation is valid for small deviations from equilibrium; The dynamics of internal variables in general case is considered by Pokrovskii.^{[49]}
Entropy of the system in nonequilibrium is a function of the total set of variables

(1) 
The essential contribution to the thermodynamics of the nonequilibrium systems was brought by Prigogine, when he and his collaborators investigated the systems of chemically reacting substances. The stationary states of such systems exists due to exchange both particles and energy with the environment. In section 8 of the third chapter of his book,^{[50]} Prigogine has specified three contributions to the variation of entropy of the considered system at the given volume and constant temperature . The increment of entropy can be calculated according to the formula

(1) 
The first term on the right hand side of the equation presents a stream of thermal energy into the system; the last term—a part of a stream of energy coming into the system with the stream of particles of substances that can be positive or negative, , where is chemical potential of substance . The middle term in (1) depicts energy dissipation (entropy production) due to the relaxation of internal variables . In the case of chemically reacting substances, which was investigated by Prigogine, the internal variables appear to be measures of incompleteness of chemical reactions, that is measures of how much the considered system with chemical reactions is out of equilibrium. The theory can be generalised,^{[51]}^{[49]} to consider any deviation from the equilibrium state as an internal variable, so that we consider the set of internal variables in equation (1) to consist of the quantities defining not only degrees of completeness of all chemical reactions occurring in the system, but also the structure of the system, gradients of temperature, difference of concentrations of substances and so on.
The fundamental relation of classical equilibrium thermodynamics ^{[52]}
expresses the change in entropy of a system as a function of the intensive quantities temperature , pressure and chemical potential and of the differentials of the extensive quantities energy , volume and particle number .
Following Onsager (1931,I),^{[17]} let us extend our considerations to thermodynamically nonequilibrium systems. As a basis, we need locally defined versions of the extensive macroscopic quantities , and and of the intensive macroscopic quantities , and .
For classical nonequilibrium studies, we will consider some new locally defined intensive macroscopic variables. We can, under suitable conditions, derive these new variables by locally defining the gradients and flux densities of the basic locally defined macroscopic quantities.
Such locally defined gradients of intensive macroscopic variables are called 'thermodynamic forces'. They 'drive' flux densities, perhaps misleadingly often called 'fluxes', which are dual to the forces. These quantities are defined in the article on Onsager reciprocal relations.
Establishing the relation between such forces and flux densities is a problem in statistical mechanics. Flux densities () may be coupled. The article on Onsager reciprocal relations considers the stable nearsteady thermodynamically nonequilibrium regime, which has dynamics linear in the forces and flux densities.
In stationary conditions, such forces and associated flux densities are by definition time invariant, as also are the system's locally defined entropy and rate of entropy production. Notably, according to Ilya Prigogine and others, when an open system is in conditions that allow it to reach a stable stationary thermodynamically nonequilibrium state, it organizes itself so as to minimize total entropy production defined locally. This is considered further below.
One wants to take the analysis to the further stage of describing the behaviour of surface and volume integrals of nonstationary local quantities; these integrals are macroscopic fluxes and production rates. In general the dynamics of these integrals are not adequately described by linear equations, though in special cases they can be so described.
Main article: Onsager reciprocal relations 
Following Section III of Rayleigh (1873),^{[16]} Onsager (1931, I)^{[17]} showed that in the regime where both the flows () are small and the thermodynamic forces () vary slowly, the rate of creation of entropy is linearly related to the flows:
and the flows are related to the gradient of the forces, parametrized by a matrix of coefficients conventionally denoted :
from which it follows that:
The second law of thermodynamics requires that the matrix be positive definite. Statistical mechanics considerations involving microscopic reversibility of dynamics imply that the matrix is symmetric. This fact is called the Onsager reciprocal relations.
The generalization of the above equations for the rate of creation of entropy was given by Pokrovskii.^{[49]}
Main article: Extremal principles in nonequilibrium thermodynamics 
Until recently, prospects for useful extremal principles in this area have seemed clouded. Nicolis (1999)^{[53]} concludes that one model of atmospheric dynamics has an attractor which is not a regime of maximum or minimum dissipation; she says this seems to rule out the existence of a global organizing principle, and comments that this is to some extent disappointing; she also points to the difficulty of finding a thermodynamically consistent form of entropy production. Another top expert offers an extensive discussion of the possibilities for principles of extrema of entropy production and of dissipation of energy: Chapter 12 of Grandy (2008)^{[54]} is very cautious, and finds difficulty in defining the 'rate of internal entropy production' in many cases, and finds that sometimes for the prediction of the course of a process, an extremum of the quantity called the rate of dissipation of energy may be more useful than that of the rate of entropy production; this quantity appeared in Onsager's 1931^{[17]} origination of this subject. Other writers have also felt that prospects for general global extremal principles are clouded. Such writers include Glansdorff and Prigogine (1971), Lebon, Jou and CasasVásquez (2008), and Šilhavý (1997). There is good experimental evidence that heat convection does not obey extremal principles for time rate of entropy production.^{[55]} Theoretical analysis shows that chemical reactions do not obey extremal principles for the second differential of time rate of entropy production.^{[56]} The development of a general extremal principle seems infeasible in the current state of knowledge.
Nonequilibrium thermodynamics has been successfully applied to describe biological processes such as protein folding/unfolding and transport through membranes.^{[57]}^{[58]} It is also used to give a description of the dynamics of nanoparticles, which can be out of equilibrium in systems where catalysis and electrochemical conversion is involved.^{[59]} Also, ideas from nonequilibrium thermodynamics and the informatic theory of entropy have been adapted to describe general economic systems.^{[60]} ^{[61]}