Published on *PNG 520: Phase Behavior of Natural Gas and Condensate Fluids* (https://www.e-education.psu.edu/png520)

Module Goal: To establish the mathematical framework for thermodynamics of phase equilibrium.

Module Objective: To highlight the importance of thermodynamic functions as functions of state.

Thermodynamics plays an important role in science and engineering. Most physical processes of engineering interest operate on thermodynamic principles. *Thermodynamics* is the science dealing exclusively with the principles of energy conversion. This message is conveyed by the word itself: *“thermo”* means “heat” — a manifestation of energy — and *“dynamics”* deals with “motion.”

Often times, we do not use thermodynamics as much as we should. This is either because we do not know how useful a tool it can be, or, simply because we do not know how to use it.

The basic ingredients for the utilization of thermodynamics are:

- The ability to identify and define the system that best characterizes a given process
- The availability of relevant information
- Sound engineering judgment

The goal of this module, combined with all the background that we already have built on fluid behavior, is to establish a foundation for us to cultivate a culture of the appropriate utilization of thermodynamics.

What kinds of problems can be solved with thermodynamics? There are three general classes of thermodynamic problems.

**System property variation determination**In this case, we are given a process that takes place under certain*.**known*constraints. We are required to determine how the system properties vary.**Interactions that cause change**. In these kinds of problems, the changes desired in the system properties are prescribed. We are required to determine the amount of external interactions that are needed to cause these changes — i.e., how to vary constraints to obtain the required final system state.**The best-path problem.**Here we are given a system with constraints and a desired variation. We are required to determine the best way to accomplish the change — i.e., the best way to reach a goal.

In science and engineering, mathematical rigor is of essence. The next sections will take us through the mathematics of thermodynamics.

In thermodynamics, a system is a spatial domain bounded for the purpose of describing a problem; while the surroundings are the entire spatial domain outside of the system. The communication between them is established through the of the system. The system and the surroundings make up the universe.

The system and the surroundings interact with each other. As we discussed above, one type of thermodynamic problem is that of predicting changes in a system due to interactions with its surroundings. A system is open if it can exchange mass with the surroundings, and closed if it does not exchange mass with the surroundings. A system is adiabatic if it does not exchange heat energy with the surroundings. We called a system isolated if there is neither heat nor mass crossing its boundaries.

Thermodynamic properties can be divided into two general classes: intensive and extensive properties. An *intensive property* is one whose value is independent of the size, extent, or mass of the system, and includes pressure, temperature, and density. By contrast, the value of an *extensive property* changes directly with the mass. Mass and volume are examples of extensive properties. Extensive properties per unit mass, such as specific volume, are intensive properties.

A system is homogeneous if it is has uniform properties throughout, i.e. a property such as density has the same value from point to point in a macroscopic sense. A phase is defined as a quantity of matter that is homogeneous throughout. Hence, a homogeneous system is, essentially, a single-phase system. A heterogeneous system is one with non-uniform properties, and hence, is made up of phases which can be distinguished from one another by the presence of interfaces.

Thestate is the thermodynamic coordinate of the system, specified by a number of intensive variables. The degree of freedom is the number of *intensive* variables needed to define the state of the system. State functions are those whose changes depend on their end states only and are independent of the path between them.

A process is the series of successive, intermediate states that the system goes through in order to go from an initial to a final state. A process is isothermal or isobaric if the temperatures or pressures of all successive steps are the same, respectively. A reversible process is one for which the exchange of energy between the system and its surroundings takes place under vanishing gradients or driving forces; that is, the properties of the system and surroundings are balanced. In a reversible process, each step of the process can be “reversed” and the original states of the system and surroundings can be restored. Any process that does not take place under infinitesimal gradients is irreversible. Strictly speaking, a reversible process is an idealization.

Thermodynamics cannot tell about the rate (kinetics) of a process, but it can tell whether or not it is possible for a process to occur. For this, we make use of the first and second laws of thermodynamics.

From our basic courses in thermodynamics, we recall that the first law of thermodynamics for a closed system is written as follows:

$$\partial W=PdV$$ (14.1)

where,

U = internal energy,

Q = heat added to or extracted from the system,

W = work done by or to the system.

If we want to improve the definition of the first law of thermodynamics stated in (14.1), we need to come up with an expression for the amount of work and heat. The amount of work need to accomplish a *reversible process* is given by the expression:

$$\partial Q=TdS$$ (14.2)

where:

P = pressure,

V = volume.

Additionally, we can compute the heat required to accomplish a reversible process by virtue of the second law of thermodynamics:

$$\partial Q=TdS$$ (14.3)

where:

T = temperature,

S = entropy.

We substitute (14.2) and (14.3) into (14.1) to get:

$$dU=TdS-PdV$$ (14.4)

which is the fundamental thermodynamic relationship used to compute changes in **Internal Energy (U)** for a closed system. This is only a restatement of the first law of thermodynamics.

Although equations (14.2) and (14.3) are applicable strictly to* reversible processes*, equation (14.4) is quite general and does not have such a constraint. Equation (14.4) applies to reversible and irreversible processes. Are you surprised by this? Okay, it is about time that we start to get a feeling for the implications of the fact that most thermodynamic properties are *state functions*. Internal energy (U) is a state function, and as such, its changes (dU) do not depend on the path that was taken (reversible/irreversible), but on the end points of process. Hence, if taking any path to compute “dU” is okay, why not take the reversible path? We do not have nice, explicit equations to describe work and heat for irreversible processes. Why should we bother? Generally speaking, “reversibility” is a thermodynamic trick that helps us to get away with many thermodynamic manipulations by taking advantage of the properties of state functions.

The formal, fundamental thermodynamic definition of **Enthalpy (H)** is the following:

H = U + P $\tilde{v}$ (14.5)

Enthalpy is a state function as well. If we are interested in computing changes in enthalpy, we write:

$$H=U+P\tilde{v}$$ (14.6)

Since we already have a way to compute dU (equation 14.4), we can now write the fundamental thermodynamic relationship used to compute changes of enthalpy in a closed system:

$$dH=dU=PdV=VdP$$

By the same token, the formal, fundamental definition of **Gibbs Free Energy (G)** is the following:

$$G=H=TS$$ (14.8)

from which we see that changes in this property may be calculated as:

$$dG=dH=TdS=SdT$$ (14.9a)

We now substitute (14.7) to get the fundamental thermodynamic relationship for changes in Gibbs free energy in a closed system:

$$dG=VdP=SdT$$ (14.9b)

We proceed with **Helmholtz Free Energy (A)** accordingly. Its definition:

$$A=U=TS$$ (14.10)

The expression of change,

$$dA=dU=TdS=SdT$$ (14.11)

We substitute (6.4) into it and get:

$$dA=-PdV-SdT$$ (14.12)

We have just derived the following fundamental thermodynamic relationships for fluids of constant composition:

$$dU=TdS-PdV$$ (14.4)

$$dH=TdS+VdP$$ (14.7)

$$dG=VdP-SdT$$ (14.9)

$$dA=-PdV-SdT$$ (14.12)

All these properties (U, H, G and A) are *state functions* and extensive properties of the system. Notice that the only assumption that we took throughout their development is that the system was closed (for the derivation of 14.4). Hence, these equations strictly apply to systems of constant composition.

A function of state is one in which the *differential change* is determined only by the end states and *not* by intervening states. Most thermodynamic variables are state functions and hence property changes are determined by the end states and not by the process path. __Notable exceptions are work and heat__.

The most common thermodynamic state functions with which we shall deal include

- Internal Energy (U),
- Entropy (S),
- Enthalpy (H),
- Helmotz Energy (A), and
- Gibbs Energy (G).

Given that f(x,y,z) is any *state function* that characterizes the system and (x,y,z) is a set of independent variable properties of that system, we know that any change $\Delta $ f will be only a function of the value of “f” at the final and initial states,

$$\Delta f={f}_{2}-{f}_{1}=f({x}_{2},{y}_{2},{z}_{2})-f({x}_{1},{y}_{1},{z}_{1})$$ (14.13)

Since f=f(x,y,z), we can mathematically relate the total differential change (df) to the partial derivatives $\frac{\partial f}{\partial x}$ ,$\frac{\partial f}{\partial y}$ , and $\frac{\partial f}{\partial z}$ of the function, as follows:

$$df={\left(\frac{\partial f}{\partial x}\right)}_{y,z}dx+{\left(\frac{\partial f}{\partial y}\right)}_{x,z}dy+{\left(\frac{\partial f}{\partial z}\right)}_{x,y}dz$$ (14.14)

where, in general:

${\left(\frac{\partial f}{\partial x}\right)}_{y,z}=$ the change of f with respect to x, while y and z are unchanged.

If we want to come up with the total change, $\Delta f$ , of a property (we want to go from 14.14. to 14.13), we integrate the expression in (14.14) to get:

$$\Delta f={f}_{2}-{f}_{1}=\underset{{x}_{1}}{\overset{{x}_{2}}{\int}}{\left(\frac{\partial f}{\partial x}\right)}_{y,z}dx+\underset{{y}_{{}_{1}}}{\overset{{y}_{2}}{\int}}{\left(\frac{\partial f}{\partial y}\right)}_{x,z}dy+\underset{{z}_{1}}{\overset{{z}_{2}}{\int}}{\left(\frac{\partial f}{\partial x}\right)}_{x,y}dz$$ (14.15)

Let us visualize this with an example. For a system of constant composition, its thermodynamic state is completely defined when two properties of the system are fixed. Let us say we have a pure component at a fixed pressure (P) and temperature (T). Hence, all other thermodynamic properties, for example, enthalpy (H), are fixed as well. Since H is only a function of P and T, we write:

$$H=H(P,T)$$ (14.16)

and hence, applying 6.2, any differential change in enthalpy can be computed as:

$$dH={\left(\frac{\partial H}{\partial P}\right)}_{T}dP+{\left(\frac{\partial H}{\partial T}\right)}_{P}dT$$ (14.17)

The total change in enthalpy of the pure-component system becomes:

$$\Delta H={H}_{2}-{H}_{1}=\underset{{P}_{1}}{\overset{{P}_{2}}{\int}}{\left(\frac{\partial H}{\partial P}\right)}_{T}dP+\underset{{T}_{1}}{\overset{{T}_{2}}{\int}}{\left(\frac{\partial H}{\partial T}\right)}_{P}dT$$ (14.18)

Now we are ready to spell out the *exactness condition*, which is the mathematical condition for a function to be a *state function*. The fact of the matter is, that for a function to be a *state function* — i.e., its integrated path shown in (14.15) is only a function of the end states, as shown in (14.13) — its total differential must be __exact__. In other words, if the total differential shown in (14.14) is exact, then f(x,y,z) is a *state function*. How do we know if a total differential is exact or not?

Given a function $\Psi $ (x,y,z),

$$d\Psi =M(x,y,z)dx+N(x,y,z)dy+Q(x,y,z)dz$$ (14.19a)

where:

$$M(x,y,z)={\left(\frac{\partial \Psi}{\partial x}\right)}_{y,z}$$ (14.19b)

$$N(x,y,z)={\left(\frac{\partial \Psi}{\partial y}\right)}_{x,z}$$ (14.19c)

$$Q(x,y,z)={\left(\frac{\partial \Psi}{\partial z}\right)}_{x,y}$$ (14.19d)

we say that $d\Psi $
is an __exact differential__ and consequently $\psi (x,y,z)$
a *state function* if *all* the following conditions are satisfied:

$${\left(\frac{\partial M}{\partial y}\right)}_{x,z}={\left(\frac{\partial N}{\partial x}\right)}_{y,z}$$ (14.20a)

$${\left(\frac{\partial N}{\partial z}\right)}_{x,y}={\left(\frac{\partial Q}{\partial y}\right)}_{x,z}$$ (14.20b)

$${\left(\frac{\partial M}{\partial z}\right)}_{x,y}={\left(\frac{\partial Q}{\partial x}\right)}_{y,z}$$ (14.20c)

Equations (14.20) are called the **exactness condition**.

Now we recall the fundamental thermodynamic relationships for closed systems, which we derived above:

$$dU\text{}=\text{}T\text{}dS\text{}\u2013\text{}P\text{}dV$$

$$dH\text{}=\text{}T\text{}dS\text{}+\text{}VdP$$

$$dG\text{}=\text{}V\text{}dP\text{}\u2013\text{}S\text{}dT$$

$$dA\text{}=\text{}\u2013\text{}P\text{}dV\text{}\u2013\text{}S\text{}dT$$

where U, H, G, and A are state functions. There is something remarkable about the above expressions: they allow for the direct calculation of the *change* in a state function as a function of *changes* in other two. An important lesson to be learned here: when dealing with thermodynamic state properties, we are most interested in *changes* in the value of state properties rather than their actual values.

As we have said, the above relationships allow us to visualize that the changes of each thermodynamic property are dependent on the change of two others in a closed system.

$$U\text{}=\text{}U\text{}\left(\text{}S\text{},\text{}V\text{}\right)$$

$$H\text{}=\text{}H\text{}\left(\text{}S\text{},\text{}P\text{}\right)$$

$$G\text{}=\text{}G\text{}\left(\text{}P,\text{}T\text{}\right)$$

$$A\text{}=\text{}A\text{}\left(\text{}V\text{},\text{}T\text{}\right)$$

Therefore, recalling what we did in equation (14.14), we express the total differential of each of these properties as:

$$dU={\left(\frac{\partial U}{\partial S}\right)}_{v}dS+{\left(\frac{\partial U}{\partial V}\right)}_{s}dV$$

$$dH={\left(\frac{\partial H}{\partial S}\right)}_{p}dS+{\left(\frac{\partial H}{\partial P}\right)}_{s}dP$$

$$dG={\left(\frac{\partial G}{\partial P}\right)}_{r}dP+{\left(\frac{\partial G}{\partial T}\right)}_{p}dT$$

$$dA={\left(\frac{\partial A}{\partial V}\right)}_{r}dV+{\left(\frac{\partial A}{\partial T}\right)}_{v}dT$$

Comparing these equations term to term, the following realizations can be made:

$$T={\left(\frac{\partial U}{\partial S}\right)}_{v};P=-{\left(\frac{\partial U}{\partial V}\right)}_{s}$$

$$T={\left(\frac{\partial H}{\partial S}\right)}_{p};V=-{\left(\frac{\partial H}{\partial P}\right)}_{s}$$

$$V={\left(\frac{\partial G}{\partial P}\right)}_{r};S=-{\left(\frac{\partial G}{\partial T}\right)}_{p}$$

$$P={\left(\frac{\partial A}{\partial V}\right)}_{r};S=-{\left(\frac{\partial A}{\partial T}\right)}_{v}$$

Additionally, we can go one step further. U, H, G, and A are state functions, and as such, their total differentials (equations 14.4, 14.7, 14.9, and 14.12) must be *exact*. Recall that for a total differential df=Mdx+Ndy to be an exact differential, it must satisfy the equation:

$${\left(\frac{\partial M}{\partial y}\right)}_{x}={\left(\frac{\partial N}{\partial x}\right)}_{y}$$

Equation (14.24) is the *exactness criteria* for a function of two independent variables. It was previously stated in (14.20) for a state function of three independent variables. Its application yields:

$${\left(\frac{\partial T}{\partial V}\right)}_{s}={\left(\frac{\partial P}{\partial S}\right)}_{v}$$

$${\left(\frac{\partial T}{\partial P}\right)}_{s}={\left(\frac{\partial V}{\partial S}\right)}_{p}$$

$${\left(\frac{\partial V}{\partial T}\right)}_{p}={\left(\frac{\partial S}{\partial P}\right)}_{r}$$

$${\left(\frac{\partial P}{\partial T}\right)}_{v}={\left(\frac{\partial S}{\partial V}\right)}_{r}$$

Equations (14.25) are known as *Maxwell’s relationships.* Maxwell’s relationships are very useful for manipulating thermodynamic equations. For instance, it is always desirable for practical purposes to express thermodynamic properties such as enthalpy (H) and entropy (S) as functions of measurable properties such as pressure (P) and temperature (T):

$$H\text{}=\text{}H\text{}\left(P,\text{}T\right)$$

$$S\text{}=\text{}S\text{}\left(P,\text{}T\right)$$

Starting with the total differential of H and S as a function of P and T, we can prove that the relationships between the parameters H and S and the parameters P and T are given by the expressions:

$$dH={C}_{p}dT+\left[V-T{\left(\frac{\partial V}{\partial T}\right)}_{p}\right]dP$$

$$dS={C}_{p}\frac{dT}{T}-{\left(\frac{\partial V}{\partial T}\right)}_{p}dP$$

Additionally, since these expressions for dH and dS must also be exact differentials, you could prove that the heat capacity at constant pressure (C_{P}) for an ideal gas (PV = RT) does not depend on pressure. The thermodynamic definition of C_{P} and C_{v} are:

$${C}_{p}={\left(\frac{\partial H}{\partial T}\right)}_{p}\text{Heatcapacityatconstantpressure}$$

$${C}_{v}={\left(\frac{\partial U}{\partial T}\right)}_{v}\text{Heatcapacityatconstantvolume}$$

The heat capacity at constant volume (C_{V}) for an ideal gas does not depend on pressure, either. You could prove this by proving first that C_{p}=C_{V}+R (R=universal gas constant) for ideal gases, using above tools.

Answer the following problems, and submit your answers to the drop box in Canvas that has been created for this module.

*Please note:*

- Your answers must be submitted in the form of a Microsoft Word document.
- Include your Penn State Access Account user ID in the name of your file (for example, "module2_abc123.doc").
- The due date for this assignment will be sent to the class by e-mail in Canvas.
- Your grade for the assignment will appear in the drop box approximately one week after the due date.
- You can access the drop box for this module in Canvas by clicking on the Lessons tab, and then locating the drop box on the list that appears.

- In you own words, state how you would explain the implications of the 1st law and 2nd law of thermodynamics. Assume that you need to explain this to a 5 year old child that has no idea about thermodynamic jargon.
- Suppose that most thermodynamic properties were
__not__state functions. What impact would that have in process design?