Turtles at the Bottom 🐢

Andrew August's Notebook

Notes on Thermodynamics

Thermodynamics is a framework for modelling macroscopic matter, at a scale where individual particles are irrelevant and only collective, bulk properties matter. At such a scale, systems can be described in terms of a small number of state variables, despite there being an enormous number of degrees of freedom at the microscopic level.

When is Thermodynamics?

As the saying goes, “all models are wrong but some are useful”. Thermodynamics is no exception. It’s only accurate, and therefore useful under the following conditions:

States

When the conditions listed above are true, we can characterize a system using a small number of state variables:

Although this looks like a 5-dimensional state space, in practice these variables are related to each other in a way that reduces the overall dimensionality. For example, an ideal gas with fixed \(N\) has

or without constants:

Thus, an ideal gas’s state is really only two dimensional. For example, to the full state all we need to know is \((P,V)\) or \((S,U)\) or \((T,V)\), etc. But note that not all pairs of variables work, for example \((P,S)\) doesn’t determine \(U\).

Energy

The energy of a thermal system is defined by its internal energy \(U\), which is simply the total kinetic and potential energy of its particles.

To calculate \(U\) for a system, we could theoretically sum all its particle energies, but thermodynamics is about analyzing large systems using a small number of macroscopic variables, ignoring underlying particles, so we’d like to use a different method. Besides, when thermodynamics was invented no one knew what matter was made of, so such a sum wasn’t an option, yet a thermodynamic definition of \(U\) was developed and it’s what we’ll use here.

That definition of \(U\) comes from the first law of thermodynamics which describes energy flow and says that internal energy changes through just two mechanisms: heat \(Q\) and work \(W\) \(\Delta U = Q + W\)

Work

Work is defined as energy transferred by a force acting through a displacement. “Displacement” usually refers to a change in the spatial coordinate of a particle, but in thermodynamics it’s defined more generally as changing an extensive variable. An extensive variable is any quantity that defines the size or amount of matter in a system, such as volume, mass, etc.. This contrasts with intensive variables such as temperature and pressure which do not change when volume, for example, is cut in half.

There are many different types of work. For example, if a system contains charges in a potential \(\phi\), we can “displace” charge by adding an amount \(dq\) thereby doing an amount of work given by

\[dW_{\text{electrical}} = \phi\ dq\]

Similarly, if we displace a system’s volume \(V\) against a pressure \(P\), the work done is

\[dW_{\text{mechanical}} = -P\ dV\]

The negative sign is used to make decreases in volume increase internal energy. Going forward, I’ll focus on mechanical work and refer to it simply as \(W\).

Let’s look at two common processes involving work: isothermal and adiabatic processes.

Isothermal processes are where temperature is held constant. In practice, this is acheived by placing the system in contact with a constant-temperature reservoir and changing the system so slowly that its temperature remains equal to the reservoir at all times.

How much does the system’s internal energy change in such a process? As an example, an ideal gas has \(U = U(T)\), so its internal energy in fact doesn’t change. So where does the work energy go? It’s all dissipated to the environment as heat. To find out how much heat, we use the first law:

\[\begin{align} Q &= -W \\ &= \int P\ dV \\ &= NkT \int_{V_i}^{V_f} \frac{1}{V}\ dV \\ &= NkT \ln \frac{V_f}{V_i} \end{align}\]

Adiabatic processes are where no heat enters or leaves a system. In practice, this is acheived by thermally insulating a system from its environment. How does internal energy change in this case? From the first law,

\[\Delta U = W\]

We can’t calculate \(W\) like for the isotherm because \(T\) isn’t constant. Instead, we have to use an explicit formula for \(U\). For an ideal gas we have

\[\begin{align} dU &= dW \\ \rightarrow \frac{d}{2}Nk\ dT &= -P\ dV \\ \end{align}\]

Inserting the ideal gas equation of state and integrating yields

\[VT^{f/2} = \text{const}\]

Now, given \((T_i, V_i, V_f)\) we can solve for \(T_f\) and use it to calculate the change in internal energy as \(U(T_f) - U(T_i)\). (Note that this last equation is equivalent to \(PV^{(f+2)/2} = \text{const}\).)

Heat

Heat is defined as energy transfer due to a temperature gradient between two systems. Compared to work, heat is much more passive in the sense that it occurs spontaneously and always from the high temperature system to the low temperature one (unless work is supplied to make the process go in reverse, such as a refrigerator, which I’ll discuss later).

In terms of terminology, systems don’t “have” heat—heat is a mechanism of energy transfer, not a property of a system. In common language we say objects “are hot” but really we mean to say they’re at a higher temperature than something else and can therefore transfer energy to it via heat. “Hot” object don’t physically contain something called heat.

The amount of heat transferred between two systems depends on what the systems are made of, and this is captured by a quantity called heat capacity:

\[C = \frac{\partial Q}{\partial T}\]

Heat capacity is defined as the amount of heat needed to raise a system’s temperature by 1K. Or, as I like to think of it, the energy a system gains or loses when it equilibrates with a reservoir that’s (originally) 1K hotter or cooler than it.

Heat capacity depends on the constraints of the process. Specifically, whether the process occurs under constant volume or constant pressure conditions. Under constant volume, no work is done, so

\[\begin{align} C_V &= \left( \frac{\partial Q}{\partial T} \right)_V \\ &= \left( \frac{\partial U}{\partial T} \right)_V \\ \end{align}\]

Under constant pressure, volume changes, so work is done and therefore

\[\begin{align} C_P &= \left( \frac{\partial Q}{\partial T} \right)_P \\ &= \left( \frac{\partial (U -W)}{\partial T} \right)_P \\ &= \left( \frac{\partial U}{\partial T} \right)_P + P\left( \frac{\partial V}{\partial T} \right)_P \\ \end{align}\]

For solids and liquids, volume doesn’t change much with temperature, so the second term in \(C_P\) can be ignored and \(C_V \approx C_P\). For gases, volume changes significantly with temperature. As an example, for an ideal gas,

\[U = \frac{d}{2}NkT\]

so

\[C_V = \frac{d}{2}Nk\]

and

\[C_P = \frac{d}{2}Nk + Nk\]

A few reference heat capacities per unit mass:

Material Specific Heat Capacity (J/(kg·K))
Water (liquid) 4,186
Ice 2,090
Steam 2,010
Air 1,005
Iron / Steel 450
Gold 129
Lead 128

The last thing I’ll note about heat is that \(C\) is defined for a given phase–solid, liquid or gas. If a phase transition occurs then heat energy goes into breaking chemical bonds while temperature stays constant.

Path Dependence

l;k

Heat Engines

Heat engines are systems that convert heat into work. In doing so they effectively transform the incoherent energy of microscopic particles into coherent macroscopic motion, like the lifting of a weight or rotation of a drive shaft. Heat engines have the following components:

In the examples that follow, the heat engine will be a sealed container of gas (the working substance) with a weighted piston on top. When the gas expands it does work against gravity and when it compresses it does \(PdV\) work.

The purpose of an engine is to output work continuously, so engines operate in a cycle starting and ending at the same point in state space before running again. The cycle has four stages:

  1. Heating: the gas is in state \((T_C, V_C)\) and placed in contact with the hot reservoir
  2. Power stroke: the gas absorbs heat, expanding and doing work until it reaches \((T_H, V_H)\)
  3. Cooling: the gas is placed in contact with the cold reservoir
  4. Compression: the gas dumps heat into the cold reservoir and compresses until it resets to \((T_C, V_C)\)

There are many different physical designs that realize a heat engine, but amazingly all of them have the same upper limit on their efficiency. To see this, start with conservation of energy \(Q_H = Q_C + W\) and define efficiency as \(\eta = \frac{W}{Q_H} = 1 - \frac{Q_C}{Q_H}\) So the more heat exchanged into and out of the engine the more efficient it is. This is probably an intuitive result, but perhaps less intuitive is that the upper limit never can reach 100%. The reason for this is that the engine has to dump energy to the environment in order to reset, and this energy is never recovered.

Potentials

\begin{align} df = \grad f \cdot d\mathbf{r}
\Rightarrow \int_{\mathbf{r}1}^{\mathbf{r}_2} df = \int{\mathbf{r}_1}^{\mathbf{r}_2}\grad f \cdot d\mathbf{r} \end{align}

The energy of a thermodynamic system is captured by the fundamental thermodynamic relation: \(dU = T\ dS + \sum_i X_i\ dY_i\)

Here, \(X_i\) is a generalized force and \(Y_i\) is the corresponding generalized displacement, together they account for a type of work. Here are a few examples of force-displacement pairs:

For the rest of this discussion I’ll only consider systems that change volume, i.e. those involving mechanical work, but the results are easy to generalize.

The fundamental thermodynamic relation assuming only mechanical work becomes

\[dU = T\ dS - P\ dV\]

Path Dependence

“Doing” thermodynamics generally means calculating how the temperature, pressure, volume or energy of systems change when they interact with eachother. For example, if a gas is heated, what happens to its volume? Or if a liquid evaporates, how much heat does it have to absorb?

To answer questions like these, it’s sometimes enough to know only the initial and final state of the system, like its initial and final temperature. Other times, however, it’s necessary to know the path the system follows through state space from its initial state to its final state. For example, consider the amount of work done on an ideal gas:

\[W = -\int P\ dV\]

Imagine the gas transitions from state \((P_1, V_1)\) to state \((P_2, V_2)\) via the paths shown in the diagram. We have

\[\begin{align} W_A = P_1\ (V_2 - V_1) \\ W_B = P_2\ (V_2 - V_1) \end{align}\]

the two works are different, which demonstrates that work is path dependent.

As an example of path independence, consider the internal energy of an ideal gas. The internal energy is given by \(U \propto T\), so the change in internal energy during any process only depends on initial and final states, namely temperature.

Can we determine if a quantity is path dependent without explicitly computing it for different paths and comparing? Yes—using a mathematical thing called exact differentials. The differential expression

\[F(x,y)\ dx + G(x,y)\ dy\]

is called an exact differential if there exists a function \(f(x,y)\) such that

\[F = \frac{\partial f}{\partial x} \ \text{ and }\ G = \frac{\partial f}{\partial y}\]

For example, the expression \(y\ dx + x\ dy\) is an exact differential because it’s the total differential of \(f = xy\). It turns out that exact differentials are path independent, so we can calculate the total change in \(df\) using just the endpoints:

\[\int_{\mathbf{r}_1}^{\mathbf{r}_2} df = f(\mathbf{r}_2) - f(\mathbf{r}_1)\]

On the other hand \(y\ dx\), for example, is an inexact differential because there’s no function \(f\) such that \(df = y\ dx\). Note that I’ve written these differentials in terms of two variables \(x\) and \(y\), but in general they can depend on any number of scalar variables.

Thus, in thermodynamics, if a quantity is an exact differnetial then we can compute it by simply looking at end points, otherwise we have to be more careful and consider exactly how the change occurs. Exact differentials will be denoted by \(df\), while inexact differentials will be denoted by \(\delta f\) to remind us that path matters.

Reversibility

Reversibility is an important idealization in thermodynamics in much the same way that “frictionless” is an important idealization in mechanics: it removes all dissipative effects so we can understand the underlying phenomenon before accounting for real-world losses.

Reversible processes are quasistatic and frictionless, where quasistatic means that change is so slow the system and environment are arbitrarily close to equilibrium at all times. Of course in the limit of true reversibility the process is so slow that it doesn’t happen, which is what makes this an idealization. As we’ll see, if a system and environment can be returned to their initial state without producing entropy then the process is reversible.