Entropy is produced in irreversible processes. The importance of avoiding irreversible processes (hence reducing the entropy production) was recognized as early as 1824 by Carnot. In 1867 Rudolf Clausius expanded his previous work from 1854 on the concept of “unkompensierte Verwandlungen” (uncompensated transformations), which, in our modern nomenclature, would be called the entropy production. In the same article in which he introduced the name entropy, Clausius gives the expression for the entropy production (for a closed system), which he denotes by *N*, in equation (71) which reads

N
=
S
−
S
0
−
∫
d
Q
T
.
Here *S* is the entropy in the final state and the integral is to be taken from the initial state to the final state. From the context it is clear that *N* = 0 if the process is reversible and *N* > 0 in case of an irreversible process.

The laws of thermodynamics system apply to well-defined systems. Fig.1 is a general representation of a thermodynamic system. We consider systems which, in general, are inhomogeneous. Heat and mass are transferred across the boundaries (nonadiabatic, open systems), and the boundaries are moving (usually through pistons). In our formulation we assume that heat and mass transfer and volume changes take place only separately at well-defined regions of the system boundary. The expression, given here, are not the most general formulations of the first and second law. E.g. kinetic energy and potential energy terms are missing and exchange of matter by diffusion is excluded.

The rate of entropy production, denoted by
S
˙
i
, is a key element of the second law of thermodynamics for open inhomogeneous systems which reads

d
S
d
t
=
Σ
k
Q
˙
k
T
k
+
Σ
k
S
˙
k
+
Σ
k
S
˙
i
k
with
S
˙
i
k
≥
0.
Here *S* is the entropy of the system; *T*_{k} is the temperature at which the heat flow
Q
˙
k
enters the system;
S
˙
k
=
n
˙
k
S
m
k
=
m
˙
k
s
k
represents the entropy flow into the system at position *k*, due to matter flowing into the system (
n
˙
k
,
m
˙
k
are the molar flow and mass flow and *S*_{mk} and *s*_{k} are the molar entropy (i.e. entropy per mole) and specific entropy (i.e. entropy per unit mass) of the matter, flowing into the system, respectively);
S
˙
i
k
represents the entropy production rates due to internal processes. The index *i* in
S
˙
i
k
refers to the fact that the entropy is produced due to irreversible processes. The entropy-production rate of every process in nature is always positive or zero. This is an essential aspect of the second law.

The ∑'s indicate the algebraic sum of the respective contributions if there are more heat flows, matter flows, and internal processes.

In order to demonstrate the impact of the second law, and the role of entropy production, it has to be combined with the first law which reads

d
U
d
t
=
Σ
k
Q
˙
k
+
Σ
k
H
˙
k
−
Σ
k
p
k
d
V
k
d
t
+
P
,
with *U* the internal energy of the system;
H
˙
k
=
n
˙
k
H
m
k
=
m
˙
k
h
k
the enthalpy flows into the system due to the matter that flows into the system (*H*_{mk} its molar enthalpy, *h*_{k} the specific enthalpy (i.e. enthalpy per unit mass)), and d*V*_{k}/d*t* are the rates of change of the volume of the system due to a moving boundary at position *k* while *p*_{k} is the pressure behind that boundary; *P* represents all other forms of power application (such as electrical).

The first and second law have been formulated in terms of time derivatives of *U* and *S* rather than in terms of total differentials d*U* and d*S* where it is tacitly assumed that d*t* > 0. So, the formulation in terms of time derivatives is more elegant. An even bigger advantage of this formulation is, however, that it is emphasizes that *heat flow* and *power* are the basic thermodynamic properties and that heat and work are derived quantities being the time integrals of the heat flow and the power respectively.

Entropy is produced in irreversible processes. Some important irreversible processes are:

heat flow through a thermal resistance
fluid flow through a flow resistance such as in the Joule expansion or the Joule-Thomson effect
diffusion
chemical reactions
Joule heating
friction between solid surfaces
fluid viscosity within a system.
The expression for the rate of entropy production in the first two cases will be derived in separate sections.

Most heat engines and refrigerators are closed cyclic machines. In the steady state the internal energy and the entropy of the machines after one cycle are the same as at the start of the cycle. Hence, on average, d*U*/d*t* = 0 and d*S*/d*t* = 0 since *U* and *S* are functions of state. Furthermore they are closed systems (
n
˙
=
0
) and the volume is fixed (d*V*/d*t* = 0). This leads to a significant simplification of the first and second law:

0
=
Σ
k
Q
˙
k
+
P
and

0
=
Σ
k
Q
˙
k
T
k
+
S
˙
i
.
The summation is over the (two) places where heat is added or removed.

For a heat engine (Fig.2a) the first and second law obtain the form

0
=
Q
˙
H
−
Q
˙
a
−
P
and

0
=
Q
˙
H
T
H
−
Q
˙
a
T
a
+
S
˙
i
.
Here
Q
˙
H
is the heat supplied at the high temperature *T*_{H},
Q
˙
a
is the heat removed at ambient temperature *T*_{a}, and *P* is the power delivered by the engine. Eliminating
Q
˙
a
gives

P
=
T
H
−
T
a
T
H
Q
˙
H
−
T
a
S
˙
i
.
The efficiency is defined by

η
=
P
Q
˙
H
.
If
S
˙
i
=
0
the performance of the engine is at its maximum and the efficiency is equal to the Carnot efficiency

η
C
=
T
H
−
T
a
T
H
.
For refrigerators (fig.2b) holds

0
=
Q
˙
L
−
Q
˙
a
+
P
and

0
=
Q
˙
L
T
L
−
Q
˙
a
T
a
+
S
˙
i
.
Here *P* is the power, supplied to produce the cooling power
Q
˙
L
at the low temperature *T*_{L}. Eliminating
Q
˙
a
now gives

Q
˙
L
=
T
L
T
a
−
T
L
(
P
−
T
a
S
˙
i
)
.
The Coefficient Of Performance of refrigerators is defined by

ξ
=
Q
˙
L
P
.
If
S
˙
i
=
0
the performance of the cooler is at its maximum. The COP is then given by the Carnot Coefficient Of Performance

ξ
C
=
T
L
T
a
−
T
L
.
In both cases we find a contribution
T
a
S
˙
i
which reduces the system performance. This product of ambient temperature and the (average) entropy production rate
P
d
i
s
s
=
T
a
S
˙
i
is called the dissipated power.

It is interesting to investigate how the above mathematical formulation of the second law relates with other well-known formulations of the second law.

We first look at a heat engine, assuming that
Q
˙
a
=
0
. In other words: the heat flow
Q
˙
H
is completely converted into power. In this case the second law would reduce to

0
=
Q
˙
H
T
H
+
S
˙
i
.
Since
Q
˙
H
≥
0
and
T
H
>
0
this would result in
S
˙
i
≤
0
which violates the condition that the entropy production is always positive. Hence: *No process is possible in which the sole result is the absorption of heat from a reservoir and its complete conversion into work.* This is the Kelvin statement of the second law.

Now look at the case of the refrigerator and assume that the input power is zero. In other words: heat is transported from a low temperature to a high temperature without doing work on the system. The first law with *P* =0 would give

Q
˙
L
=
Q
˙
a
and the second law then yields

0
=
Q
˙
L
T
L
−
Q
˙
L
T
a
+
S
˙
i
or

S
˙
i
=
Q
˙
L
(
1
T
a
−
1
T
L
)
.
Since
Q
˙
L
≥
0
and
T
a
>
T
L
this would result in
S
˙
i
≤
0
which again violates the condition that the entropy production is always positive. Hence: *No process is possible whose sole result is the transfer of heat from a body of lower temperature to a body of higher temperature.* This is the Clausius statement of the second law.

In case of a heat flow
Q
˙
from *T*_{1} to *T*_{2} the rate of entropy production is given by

S
˙
i
=
Q
˙
(
1
T
2
−
1
T
1
)
.
If the heat flow is in a bar with length *L*, cross-sectional area *A*, and thermal conductivity κ, and the temperature difference is small

Q
˙
=
κ
A
L
(
T
1
−
T
2
)
the entropy production rate is

S
˙
i
=
κ
A
L
(
T
1
−
T
2
)
2
T
1
T
2
.
In case of a volume flow
V
˙
from a pressure *p*_{1} to *p*_{2}

S
˙
i
=
−
∫
1
2
V
˙
T
d
p
.
For small pressure drops and defining the flow conductance *C* by
V
˙
=
C
(
p
1
−
p
2
)
we get

S
˙
i
=
C
(
p
1
−
p
2
)
2
T
.
The dependences of
S
˙
i
on (*T*_{1}-*T*_{2}) and on (*p*_{1}-*p*_{2}) are quadratic. This is typical for expressions of the entropy production rates in general. They guarantee that the entropy production is positive.

In this Section we will calculate the entropy of mixing when two ideal gases diffuse into each other. Consider a volume *V*_{t} divided in two volumes *V*_{a} and *V*_{b} so that *V*_{t} = *V*_{a}+*V*_{b}. The volume *V*_{a} contains *n*_{a} moles of an ideal gas *a* and *V*_{b} contains *n*_{b} moles of gas *b*. The total amount is *n*_{t} = *n*_{a}+*n*_{b}. The temperature and pressure in the two volumes is the same. The entropy at the start is given by

S
t
1
=
S
a
1
+
S
b
1
.
When the division between the two gases is removed the two gases expand, comparable to a Joule-Thomson expansion. In the final state the temperature is the same as initially but the two gases now both take the volume *V*_{t}. The relation of the entropy of *n* moles an ideal gas is

S
=
n
C
V
ln
T
T
0
+
n
R
ln
V
V
0
with *C*_{V} the molar heat capacity at constant volume and *R* the molar ideal gas constant. The system is an adiabatic closed system, so the entropy increase during the mixing of the two gases is equal to the entropy production. It is given by

S
i
=
S
t
2
−
S
t
1
.
As the initial and final temperature are the same the temperature terms plays no role, so we can focus on the volume terms. The result is

S
i
=
n
a
R
ln
V
t
V
a
+
n
b
R
ln
V
t
V
b
.
Introducing the concentration *x* = *n*_{a}/*n*_{t} = *V*_{a}/*V*_{t} we arrive at the well known expression

S
i
=
−
n
t
R
[
x
ln
x
+
(
1
−
x
)
ln
(
1
−
x
)
]
.
The Joule expansion is similar to the mixing described above. It takes place in an adiabatic system consisting of a gas and two rigid vessels (a and b) of equal volume, connected by a valve. Initially the valve is closed. Vessel (a) contains the gas under high pressure while the other vessel (b) is empty. When the valve is opened the gas flows from vessel (a) into (b) until the pressures in the two vessels are equal. The volume, taken by the gas, is doubled while the internal energy of the system is constant (adiabatic and no work done). Assuming that the gas is ideal the molar internal energy is given by *U*_{m} = *C*_{V}*T*. As *C*_{V} is constant, constant *U* means constant *T*. The molar entropy of an ideal gas, as function of the molar volume *V*_{m} and *T*, is given by

S
m
=
C
V
ln
T
T
0
+
R
ln
V
m
V
0
.
The system, of the two vessels and the gas, is closed and adiabatic, so the entropy production during the process is equal to the increase of the entropy of the gas. So, doubling the volume with *T* constant, gives that the entropy production per mole gas is

S
m
i
=
R
ln
2.
The Joule expansion gives a nice opportunity to explain the entropy production in statistical mechanical (microscopic) terms. At the expansion the volume, that the gas can occupy, is doubled. That means that, for every molecule there are now two possibilities: it can be placed in container an or in b. If we have one mole of gas the number of molecules is equal to Avogadro's number *N*_{A}. The increase of the microscopic possibilities is a factor 2 per molecule so in total a factor 2^{NA}. Using the well-known Boltzmann expression for the entropy

S
m
=
k
ln
Ω
,
with *k* Boltzmann's constant and *Ω* the number of microscopic possibilities to realize the macroscopic state, gives

S
m
i
=
k
ln
(
2
N
A
)
=
k
N
A
ln
2
=
R
ln
2.
So, at an irreversible process, the number of microscopic possibilities to realize the macroscopic state is increased by a certain factor.

In this Section we derive the basic inequalities and stability conditions for closed systems. For closed systems the first law reduces to

d
U
d
t
=
Q
˙
−
p
d
V
d
t
+
P
.
The second law we write as

d
S
d
t
−
Q
˙
T
≥
0.
For **adiabatic systems**
Q
˙
=
0
so **d***S*/d*t* ≥ 0. In other words: the entropy of adiabatic systems cannot decrease. In equilibrium the entropy is at its maximum. Isolated systems are a special case of adiabatic systems, so this statement is also valid for isolated systems.

Now consider systems with **constant temperature and volume**. In most cases *T* is the temperature of the surroundings with which the system is in good thermal contact. Since *V* is constant the first law gives
Q
˙
=
d
U
/
d
t
−
P
. Substitution in the second law, and using that *T* is constant, gives

d
(
T
S
)
d
t
−
d
U
d
t
+
P
≥
0.
With the Helmholtz free energy, defined as

F
=
U
−
T
S
,
we get

d
F
d
t
−
P
≤
0.
If *P* = 0 this is the mathematical formulation of the general property that the free energy of systems with fixed temperature and volume tends to a minimum. The expression can be integrated from the initial state i to the final state f resulting in

W
S
≤
F
i
−
F
f
where W_{S} is the work done *by* the system. If the process inside the system is completely reversible the equality sign holds. Hence the maximum work, that can be extrated from the system, is equal to the free energy of the initial state minus the free energy of the final state.

Finally we consider systems with **constant temperature and pressure** and take *P* = 0. As *p* is constant the first laws gives

d
U
d
t
=
Q
˙
−
d
(
p
V
)
d
t
.
Combining with in the second law, and using that *T* is constant, gives

d
(
T
S
)
d
t
−
d
U
d
t
−
d
(
p
V
)
d
t
≥
0.
With the Gibbs free energy, defined as

G
=
U
+
p
V
−
T
S
,
we get

d
G
d
t
≤
0.
In homogeneous systems the temperature and pressure are well-defined and all internal processes are reversible. Hence
S
˙
i
=
0
. As a result the second law, multiplied by *T*, reduces to

T
d
S
d
t
=
Q
˙
+
n
˙
T
S
m
.
With *P*=0 the first law becomes

d
U
d
t
=
Q
˙
+
n
˙
H
m
−
p
d
V
d
t
.
Eliminating
Q
˙
and multiplying with d*t* gives

d
U
=
T
d
S
−
p
d
V
+
(
H
m
−
T
S
m
)
d
n
.
Since

H
m
−
T
S
m
=
G
m
=
μ
with *G*_{m} the molar Gibbs free energy and *μ* the molar chemical potential we obtain the well-known result

d
U
=
T
d
S
−
p
d
V
+
μ
d
n
.