# Engineering Thermodynamics/Second Law
## Introduction

The first law is a statement of energy conservation. The rise in temperature of a substance when work is done is well known. Thus work can be completely converted to heat. However, we observe that in nature, we don't see the conversion in the other direction spontaneously.
The statement of the second law is facilitated by using the concept of heat engines. Heat engines work in a cycle and convert heat into work. A thermal reservoir is defined as a system which is in equilibrium and large enough so that heat transferred to and from it does not change its temperature appreciably.

### Heat Engine

Heat engines work between two thermal reservoirs, the low temperature reservoir and the high temperature reservoir. The performance of a heat engine is measured by its thermal efficiency, which is defined as the ratio of work output to heat input, i.e., η = W/Q$_1$, where W is the net work done, and Q$_1$ is heat transferred from the high temperature reservoir.

### Heat Pumps

Heat pumps transfer heat from a low temperature reservoir to a high temperature reservoir using external work, and can be considered as reversed heat engines.

## Statement of the Second Law of Thermodynamics
### Kelvin-Planck Statement

"It is impossible to construct a heat engine which will operate continuously and convert all the heat it draws from a reservoir into work."
In other words, "It is impossible to have a heat engine which works in cycle and does work by exchanging heat with only one reservoir."

### Clausius Statement

"It is impossible to construct a heat pump which will transfer heat from a low temperature reservoir to a high temperature reservoir without using external work."
In other words, "It is impossible for heat to flow from a low temperature (sink) to a high temperature (source) without external work."

### PMM2

A perpetual motion machine of the second kind, or PMM2 is one which converts 100% of the heat input into work while working in a cycle. A machine like this would violate the second law of thermodynamics, and would therefore be impossible to build. A PMM2 has an η$_{th}$ of 1.

### Equivalence of Clausius and Kelvin-Planck Statements

Kelvin-Planck from Clausius
Suppose we can construct a heat pump which transfers heat from a low temperature reservoir to a high temperature one without using external work. Then, we can couple it with a heat engine in such a way that the heat removed by the heat pump from the low temperature reservoir is the same as the heat rejected by the heat engine, so that the combined system is now a heat engine which converts heat to work without any external effect. This is thus in violation of the Kelvin-Planck statement of the second law.
Clausius from Kelvin-Planck
Now suppose we have a heat engine which can convert heat into work without rejecting heat anywhere else. We can combine it with a heat pump so that the work produced by the engine is used by the pump. Now the combined system is a heat pump which uses no external work, violating the Clausius statement of the second law.
Thus, we see that the Clausius and Kelvin-Planck statements are equivalent, and one necessarily implies the other.

## Carnot Cycle

Nicholas Sadi Carnot devised a reversible cycle in 1824 called the Carnot cycle for an engine working between two reservoirs at different temperatures. It consists of two reversible isothermal and two reversible adiabatic processes. For a cycle 1-2-3-4, the working material
* Undergoes isothermal expansion in 1-2 while absorbing heat from high temperature reservoir
* Undergoes adiabatic expansion in 2-3
* Undergoes isothermal compression in 3-4, and
* Undergoes adiabatic compression in 4-1.
Heat is transferred to the working material during 1-2 (Q$_1$) and heat is rejected during 3-4 (Q$_2$). The thermal efficiency is thus η$_{th}$ = W/Q$_1$. Applying first law, we have, W = Q$_1$ − Q$_2$, so that η$_{th}$ = 1 − Q$_2$/Q$_1$.
Carnot's principle states that
* No heat engine working between two thermal reservoirs is more efficient than the Carnot engine, and
* All Carnot engines working between reservoirs of the same temperature have the same efficiency.
The proof by contradiction of the above statements come from the second law, by considering cases where they are violated. For instance, if you had a Carnot engine which was more efficient than another one, we could use that as a heat pump (since processes in a Carnot cycle are reversible) and combine with the other engine to produce work without heat rejection, to violate the second law. A corollary of the Carnot principle is that Q$_2$/Q$_1$ is purely a function of t$_2$ and t$_1$, the reservoir temperatures. Or,
${\frac {Q_{1}}{Q_{2}}}=\phi \left(t_{1},t_{2}\right)$

## Thermodynamic Temperature Scale

Lord Kelvin used Carnot's principle to establish the thermodynamic temperature scale which is independent of the working material. He considered three temperatures, t$_1$, t$_2$, and t$_3$, such that t$_1$ > t$_3$ > t$_2$.
As shown in the previous section, the ratio of heat transferred only depends on the temperatures. Considering reservoirs 1 and 2:
${\frac {Q_{1}}{Q_{2}}}=\phi \left(t_{1},t_{2}\right)$
Considering reservoirs 2 and 3:
${\frac {Q_{2}}{Q_{3}}}=\phi \left(t_{2},t_{3}\right)$
Considering reservoirs 1 and 3:
${\frac {Q_{1}}{Q_{3}}}=\phi \left(t_{1},t_{3}\right)$
Eliminating the heat transferred, we have the following condition for the function φ.
$\phi \left(t_{1},t_{2}\right)={\frac {\phi \left(t_{1},t_{3}\right)}{\phi \left(t_{2},t_{3}\right)}}$
Now, it is possible to choose an arbitrary temperature for 3, so it is easy to show using elementary multivariate calculus that φ can be represented in terms of an increasing function of temperature ζ as follows:
$\phi \left(t_{1},t_{2}\right)={\frac {\zeta \left(t_{1}\right)}{\zeta \left(t_{2}\right)}}$
Now, we can have a one to one association of the function ζ with a new temperature scale called the thermodynamic temperature scale, T, so that
${\frac {Q_{1}}{Q_{2}}}={\frac {T_{1}}{T_{2}}}$
Thus we have the thermal efficiency of a Carnot engine as
$\eta _{th}=1-{\frac {T_{2}}{T_{1}}}$
The thermodynamic temperature scale is also known as the Kelvin scale, and it needs only one fixed point, as the other one is absolute zero. The concept of absolute zero will be further refined during the statement of the third law of thermodynamics.
* 1st Law: Energy can neither be created or destroyed
* 2nd Law: All spontaneous events act to increase total entropy
* 3rd Law: Absolute zero is removal of all thermal molecular motion

## Reservoir

Reservoirs are systems of large quantity of matter which no temperature difference will occur when finite amount of heat is transferred or removed. Examples of reservoirs are atmosphere, oceans, seas etc.

## Clausius Theorem

Clausius theorem states that any reversible process can be replaced by a combination of reversible isothermal and adiabatic processes.
Consider a reversible process a-b. A series of isothermal and adiabatic processes can replace this process if the heat and work interaction in those processes is the same as that in the process a-b. Let this process be replaced by the process a-c-d-b, where a-c and d-b are reversible adiabatic processes, while c-d is a reversible isothermal process. The isothermal line is chosen such that the area a-e-c is the same as the area b-e-d. Now, since the area under the p-V diagram is the work done for a reversible process, we have, the total work done in the cycle a-c-d-b-a is zero. Applying the first law, we have, the total heat transferred is also zero as the process is a cycle. Since a-c and d-b are adiabatic processes, the heat transferred in process c-d is the same as that in the process a-b. Now applying first law between the states a and b along a-b and a-c-d-b, we have, the work done is the same. Thus the heat and work in the process a-b and a-c-d-b are the same and any reversible process a-b can be replaced with a combination of isothermal and adiabatic processes, which is the Clausius theorem.
A corollary of this theorem is that any reversible cycle can be replaced by a series of Carnot cycles.
Suppose each of these Carnot cycles absorbs heat dQ$_1$$^i$ at temperature T$_1$$^i$ and rejects heat dQ$_2$$^i$ at T$_2$$^i$. Then, for each of these engines, we have dQ$_1$$^i$/dQ$_2$$^i$ = −T$_1$$^i$/T$_2$$^i$. The negative sign is included as the heat lost from the body has a negative value. Summing over a large number of these cycles, we have, in the limit,
$\oint _{R}{\frac {dQ}{T}}=0$
This means that the quantity dQ/T is a property. It is given the name entropy.
Further, using Carnot's principle, for an irreversible cycle, the efficiency is less than that for the Carnot cycle, so that
$\eta _{irr}=1-{\frac {dQ_{2}}{dQ_{1}}}<\eta _{Carnot}$
${\frac {dQ_{1}}{T_{1}}}-{\frac {dQ_{2}}{T_{2}}}<0$
As the heat is transferred out of the system in the second process, we have, assuming the normal conventions for heat transfer,
${\frac {dQ_{1}}{T_{1}}}+{\frac {dQ_{2}}{T_{2}}}<0$
So that, in the limit we have,
$\oint _{I}{\frac {dQ}{T}}<0$
$\oint {\frac {dQ}{T_{reservoir}}}\leq 0$
The above inequality is called the inequality of Clausius. Here the equality holds in the reversible case.

## Entropy

Entropy is the quantitative statement of the second law of thermodynamics. It is represented by the symbol S, and is defined by
$dS\equiv \left({\frac {dQ}{T}}\right)_{rev}$
Note that as we have used the Carnot cycle, the temperature is the reservoir temperature. However, for a reversible process, the system temperature is the same as the reversible temperature.
Consider a system undergoing a cycle 1-2-1, where it returns to the original state along a different path. Since entropy of the system is a property, the change in entropy of the system in 1-2 and 2-1 are numerically equal. Suppose reversible heat transfer takes place in process 1-2 and irreversible heat transfer takes place in process 2-1. Applying Clausius's inequality, it is easy to see that the heat transfer in process 2-1 dQ$_{irr}$ is less than T dS. That is, in an irreversible process the same change in entropy takes place with a lower heat transfer. As a corollary, the change in entropy in any process, dS, is related to the heat transfer dQ as
dS ≥ dQ/T
For an isolated system, dQ = 0, so that we have
dS$_{isolated}$ ≥ 0
This is called the principle of increase of entropy and is an alternative statement of the second law.
Further, for the whole universe, we have
ΔS = ΔS$_{sys}$ + ΔS$_{surr}$ > 0
For a reversible process,
ΔS$_{sys}$ = (Q/T)$_{rev}$ = −ΔS$_{surr}$
So that
ΔS$_{universe}$ = 0
for a reversible process.
Since T and S are properties, you can use a T-S graph instead of a p-V graph to describe the change in the system undergoing a reversible cycle. We have, from the first law, dQ + dW = 0. Thus the area under the T-S graph is the work done by the system. Further, the reversible adiabatic processes appear as vertical lines in the graph, while the reversible isothermal processes appear as horizontal lines.

### Entropy for an Ideal Gas

An ideal gas obeys the equation pv = RT. According to the first law,
dQ + dW = dU
For a reversible process, according to the definition of entropy, we have
dQ = T dS
Also, the work done is the pressure volume work, so that
dW = -p dV
The change in internal energy:
dU = m c$_v$ dT
T dS = p dV + m c$_v$ dT
Taking per unit quantities and applying ideal gas equation,
ds = R dV/v + c$_v$ dT/T
$\Delta s=R\ln {\frac {v_{2}}{v_{1}}}+c_{v}\ln {\frac {T_{2}}{T_{1}}}$
As a general rule, all things being equal, entropy increases as, temperature increases and as pressure and concentration decreases and energy stored as internal energy has higher entropy than energy which is stored as kinetic energy.

## Availability

From the second law of thermodynamics, we see that we cannot convert all the heat energy to work. If we consider the aim of extracting useful work from heat, then only some of the heat energy is available to us. It was previously said that an engine working with a reversible cycle was more efficient than an irreversible engine. Now, we consider a system which interacts with a reservoir and generates work, i.e., we look for the maximum work that can be extracted from a system given that the surroundings are at a particular temperature.
Consider a system interacting with a reservoir and doing work in the process. Suppose the system changes state from 1 to 2 while it does work. We have, according to the first law,
dQ - dW = dE,
where dE is the change in the internal energy of the system. Since it is a property, it is the same for both the reversible and irreversible process. For an irreversible process, it was shown in a previous section that the heat transferred is less than the product of temperature and entropy change. Thus the work done in an irreversible process is lower, from first law.

### Availability Function

The availability function is given by Φ, where
Φ ≡ E − T$_0$S
where T$_0$ is the temperature of the reservoir with which the system interacts. The availability function gives the effectiveness of a process in producing useful work. The above definition is useful for a non-flow process. For a flow process, it is given by
Ψ ≡ H − T$_0$S

### Irreversibility

Maximum work can be obtained from a system by a reversible process. The work done in an actual process will be smaller due to the irreversibilities present. The difference is called the irreversibility and is defined as
I ≡ W$_{rev}$ − W
From the first law, we have
W = ΔE − Q
I = ΔE - Q - (Φ$_2$ − Φ$_1$)
As the system interacts with surroundings of temperature T$_0$, we have
ΔS$_{surr}$ = Q/T$_0$
Also, since
E − Φ = T$_0$ ΔS$_{sys}$
we have
I = T$_0$ (ΔS$_{sys}$ + ΔS$_{surr}$)
Thus,
I ≥ 0
I represents increase in unavailable energy.

### Helmholtz and Gibbs Free Energies

Helmholtz Free Energy is defined as
F ≡ U − TS
The Helmholtz free energy is relevant for a non-flow process. For a flow process, we define the Gibbs Free Energy
G ≡ H − TS
The Helmholtz and Gibbs free energies have applications in finding the conditions for equilibrium.