# Exergy via GENERIC

For almost a year and a half now, I’ve been talking with @MarkusLohmayer about open systems in non-equilibrium thermodynamics. He has a framework which he calls EPHS (Exergetic Port-Hamiltonian Systems), and it’s only now that I’m starting to understand what mathematically exergy represents. The thing that I couldn’t understand was what the role of “reference thermodynamic potentials” was in EPHS, and how EPHS could be a fundamental theory of thermodynamics with these reference potentials hanging around. This is mostly I think a function of my mathematician’s brain being unable to simply accept things on faith; engineers seem to have very little trouble working with exergy without worrying about any of this.

Recently, however, I’ve come to understand the GENERIC formalism for non-equilibrium thermodynamics, and I think I am coming around to seeing how the exergetic approach can be derived from GENERIC, which hopefully means that I’m closer to understanding exergy. Most of the ideas that are in this post come from a combination of Markus’s papers (1,2) and additionally the first chapter of Beyond Equilibrium Thermodynamics on GENERIC systems.

The idea behind exergy is that it measures the amount of “useful work” that can be extracted from a system before it equilibriates with an environment. So the first step in understanding exergy is to understand this equilibriation process.

First, we start with a brief review of the GENERIC formalism. I’m going to just go over all the pieces at once, and then go back and give an intuition for what they mean. A GENERIC system is described by the following equation

\dot{x} = L(x) \frac{\delta E}{\delta x} + M(x)\frac{\delta S}{\delta x}

where x is a variable taking values in some (possibly infinite-dimensional) state space L(x) is an antisymmetric matrix, M(x) is a symmetric non-negative definite matrix, and E(x) and S(x) are scalar functions. We call L(x) the Poisson matrix, M(x) the friction matrix, E(x) the energy of the system, and S(x) the entropy of the system. We use \frac{\delta E}{\delta x} to denote the gradient of E; this notation is used to emphasize this this could be an infinite-dimensional system, and is standard in the literature.

Finally, we also have the degeneracy conditions of

\frac{\delta S}{\delta x} L(x) = 0

and

\frac{\delta E}{\delta x} M(x) = 0

GENERIC stands for “General Equation for Non-Equilibrium Reversible-Irreversible Coupling”. Essentially, one can think of a GENERIC system as consisting of some “reversible” dynamics, such as would come from classical mechanics or electromagnetics, and some “irreversible dynamics”, such as would come from resistive components like friction, resistors, diffusion, heat transfer, etc. The L(x) \frac{\delta E}{\delta x} component describes the reversible dynamics, and the M(x) \frac{\delta S}{\delta x} component describes the irreversible dynamics.

Each of L(x) and M(x) give rise to brackets of scalar functions, defined by

\{A,B\}(x) = \frac{\delta A}{\delta x} L(x) \frac{\delta B}{\delta x}

and

[A,B](x) = \frac{\delta A}{\delta x} M(x) \frac{\delta B}{\delta x}

The bracket \{A,B\} is the classical Poisson bracket. These brackets are useful in describing the evolution of scalar functions according to GENERIC:

\frac{d}{dt} A = \frac{\delta A}{\delta x} \dot{x}= \frac{\delta A}{\delta x}\left(L(x) \frac{\delta E}{\delta x} + M(x)\frac{\delta S}{\delta x}\right) = \{A,E\} + [A,S]

From this equation, we can investigate the evolution of energy and entropy. The equation for evolution of energy is

\frac{d}{dt} E = \{E,E\} + [E,S]

Then \{E,E\} = 0 by antisymmetry of L and [E,S] = 0 by the degeneracy condition, so energy is conserved. The equation for evolution of entropy is

\frac{d}{dt} S = \{S,E\} + [S,S]

By the degeneracy conditions, \{S,E\}=0, and because M(x) is non-negative definite, [S,S]\geq 0. Thus entropy always increases.

Now, the point of this post is to understand exergy. Exergy is defined to be “the amount of useful work which can be extracted from a system”. In the GENERIC setting, this is non-sensical, because there is no means for work to be extracted; the GENERIC equation presumes isolation. I have a hunch that a proper formalization of exergy can be derived from an open-systems perspective on GENERIC, which is in the works following the thread of Open classical mechanical systems via lenses. But for this post, we are just going to pretend to be a physicist, and play fast and loose with the math.

Assume that there are some quantities Q_1(x),\ldots,Q_n(x) which are strongly conserved by the evolution of the system. This means that

L(x) \frac{\delta Q_i}{\delta x} = M(x) \frac{\delta Q_i}{\delta x} = 0

Additionally assume that these quantities along with S(x) are sufficient to constrain the energy of the system. That is, assume that if \vec{c} \in \mathbb{R}^{n+1}, then E|_{(S,\vec{Q})^{-1}(\vec{c})} is constant. For example, in the case of a gas, we might have Q_1 = V, the volume of the gas, and Q_2 = N, the number of particles in the gas.

We assume that we can “get work out” of the system by exchanging these conserved quantities with the environment. The environment consists of “generalized bath systems” for each conserved quantity, in the sense of Compositional Thermostatics, including a heat bath at constant temperature \frac{1}{\theta_0}, but possibly also a “pressure bath” and “chemical potential bath”. In this context, we find equilibrium by maximizing the quantity

\Omega(x;\theta_0,\vec{\lambda}_0) = S(x) - \frac{1}{\theta_0}\left(E(x) + \sum_i \lambda^i_0 Q_i \right)

The \lambda^i_0 here are intensive quantities like pressure and chemical potential, but also perhaps others like voltage or force.

We then let the equilibrium point x_{\mathrm{eq}}(\theta_0, \vec{\lambda}_0) be defined by

x_{\mathrm{eq}}(\theta_0, \vec{\lambda}_0) = \underset{x}{\mathrm{argmax}} \; \Omega(x;\theta_0, \vec{\lambda}_0)

which we assume exists at a finite value of \Omega. We also generally assume that S is strictly concave, so that equilibrium point is unique. Note that \frac{\lambda_0^i}{\theta_0} and \frac{1}{\lambda_0} act like Lagrange multipliers here, so that at the point of equilibrium we have

\frac{\partial S}{\partial E} = \frac{1}{\theta_0}
\frac{\partial S}{\partial Q_i} = \frac{\lambda^i_0}{\theta_0}

We interpret this as implying that the system relaxes to an equilibrium where it matches intensive quantities with the environment.

Now, let’s see how much work we can get out of the system as it travels from x to x_\mathrm{eq}(\theta_0, \vec{\lambda}_0). Let \gamma be some path with \gamma(0) = x and \gamma(T) = x_{\mathrm{eq}}(\theta_0,\vec{\lambda}_0), and define

A(x) = \int_\gamma \mathrm{d}W

where \mathrm{d}W is a 1-form measuring the “useful power” we are getting out of the system as it tends toward equilibrium with the environment. To give a formula for \mathrm{d}W, assume that for each conserved quantity we can “exploit” the “generalized force differential” between the system and the environment to do some useful work. That is, if the system is hotter or colder than the environment, we can harvest the flow of entropy into the environment via a heat engine. If the system is at a higher or lower pressure than the environment, we can harvest the flow of volume into the environment via a turbine. If the system is at a higher or lower voltage than the environment, we can use the system to run some useful electronic circuit. And so on. We can measure these “generalized force differentials” via the difference between \frac{\partial E}{\partial Q_i} and \lambda_0^i, or in the case of heat differential, the difference between \frac{\partial E}{\partial S} and \theta_0.

This gives us a formula for \mathrm{d}W of

\mathrm{d}W = \left(\frac{\partial E}{\partial S} - \theta_0\right) \mathrm{d}S + \sum_i \left(\frac{\partial E}{\partial Q_i} - \lambda_0^i\right)\mathrm{d}Q_i

We can rewrite this as

\mathrm{d}W = \left(\frac{\partial E}{\partial S} \mathrm{d}S + \sum_i \frac{\partial E}{\partial Q_i} \mathrm{d}Q_i\right) - \left(\theta_0 \;\mathrm{d}S + \sum_i\lambda^i_0 \;\mathrm{d}Q_i\right)

By our assumption that E was constant when constrained to the joint level set of the Q_i and S, we have that

\mathrm{d}E = \left(\frac{\partial E}{\partial S} \mathrm{d}S + \sum_i \frac{\partial E}{\partial Q_i} \mathrm{d}Q_i\right)

Thus,

\mathrm{d}W = \mathrm{d}E - \left(\theta_0 \;\mathrm{d}S + \sum_i\lambda^i_0 \;\mathrm{d}Q_i\right)

This is simply a linear combination of exact 1-forms, so it is easy to integrate. Let

\Delta E(x) = E(x) - E(x_{\mathrm{eq}}(\theta_0, \vec{\lambda}_0))
\Delta Q_i(x) = Q_i(x) - Q_i(x_{\mathrm{eq}}(\theta_0, \vec{\lambda}_0))

Then,

A(x) = \int_\gamma \mathrm{d}E - \left(\theta_0 \;\mathrm{d}S + \sum_i\lambda^i_0 \;\mathrm{d}Q_i\right) = \Delta E(x) - \left(\theta_0 \; \Delta S(x) + \sum_i \lambda_0^i \; \Delta Q_i(x)\right)

This expression for exergy is 0 precisely when the system is at equilibrium with the environment, and no useful work can be produced from it.

Now, we think of exergy as a potential for the system. Therefore, just like energy or entropy, we don’t really care if we add or remove constants from it. Thus, we can use a simpler expression for the exergy, which drops out all of the constant terms referencing x_{\mathrm{eq}}(\theta_0, \vec{\lambda}_0):

A(x) = U(x) - (\theta_0 S(x) + \sum_{i} \lambda_0^i Q_i(x))

This is the form of exergy that shows up on Wikipedia (though, they use the letter B instead of A; I follow Markus’s lead in using A).

The beautiful thing about exergy is that, although I made all sorts of sketchy, shaky assumptions in deriving the form of exergy, I can use exergy to describe the evolution of the system without caring about how I derived it. Specifically,

\dot{x} = L(x)\frac{\delta E}{\delta x} + M(x)\frac{\delta S}{\delta x} = \left(L(x) - \frac{1}{\theta_0}M(x)\right)\left(\frac{\delta E}{\delta x} - \theta_0 \frac{\delta S}{\delta x}\right)

because by the degeneracy conditions the cross terms are 0. Then by strong conservation, we can also throw in the other terms in A to get

\dot{x} = \left(L(x) - \frac{1}{\theta_0}M(x)\right)\left(\frac{\delta E}{\delta x} - \theta_0 \frac{\delta S}{\delta x} - \sum_i \lambda_0^i\frac{\delta Q_i}{\delta x}\right) = \left(L(x) - \frac{1}{\theta_0}M(x)\right) \frac{\delta A}{\delta x}

This describes the evolution of the system purely in terms of the gradient of its exergy. Note that the only assumption I made about the Q_i now is that they are strongly conserved. From the perspective of “generating the evolution of the system”, then it appears to me that the exergy is highly non-canonical, and the choices of conserved quantities is essentially ad-hoc and only motivated by physical intuition.

However, exergy is highly interesting from an “operational” perspective. Namely, unlike entropy and energy, exergy can actually be measured by building a succession of ever more efficient devices for extracting energy from a given system via thermodynamic cycles that output the conserved quantities into the environment! Thus, I have some sympathy for the perspective that exergy is in fact the more fundamental quantity than energy and entropy, even though it seems somewhat ad-hoc in the way that I’ve presented it here. I’m not yet sure how to formalize “thermodynamic cycle” and “conserved quantity” and “environment”, but I think that once these are formalized, exergy will pop out naturally.

And, more importantly, exergy is highly useful in practice, as the success that Markus has had with his exergetic port-Hamiltonian systems has shown. So while there are still mysteries that I have about exergy, I hope that I now have enough intuition about it to allow me to help formalize the EPHS framework with an eye towards eventual computer implementation, so that engineers can access a powerful, flexible, and thermodynamically consistent system for modeling non-equilibrium thermodynamical systems.

1 Like

Dear Owen, nice post!

## criticism 1

I did not get what you meant with

Maybe it is correct and I just can’t figure out what it means and why you need it.

## criticism 2

Regarding having the following as conserved quantities, I don’t agree.

Both force and voltage are flow or effort quantities (infinitesimal, power), rather than state (absolute, energy) quantities.
Voltage is the flow quantity (i.e. rate of change of the state quantity) for the magnetic energy domain, just as force is the flow quantity for the kinetic energy domain. Both kinetic and magnetic are the same in a more abstract way of thinking about “mechanics” or “mechanistic evolution”. For instance in Lagrangian mechanics you have kinetic / magnetic minus potential / electric energy as the Lagrangian. The quantities Q_i however are state variables for an “internal energy”, which is a potential energy, but with physically-relevant degrees of freedom that are not fully resolved by macroscopic/mesoscopic modeling.

## on formalizing exergy

I agree that formalizing exergy demands an open-systems perspective and this is also the reason why the exergy perspective works for port-Hamiltonian systems, while the MaxEnt perspective is taken in the GENERIC literature.

It is important to keep in mind that the ideal device – whose job it is to quantify the available work my hypothetically extracting all of it – needs to have access to all “energy domains” (or essentially state variables).
In the EPHS language, energy domains correspond to junctions (where ports are connected), so you can think about adding an external port for each junction of the system of interest and then use them to interconnect this system with the ideal conversion device. This offers an intuitive, yet formal, way to picture how exergy is quantified.

In response to criticism 1: this is used for the equation

\mathrm{d}E = \frac{\partial E}{\partial S} \mathrm{d}S + \sum_i \frac{\partial E}{\partial Q_i} \mathrm{d}Q_i

When S and Q_i are held constant, so is E.

In response to criticism 2: I was comparing voltage and force to temperature/pressure! Those are all effort/flow quantities! Corresponding with voltage, we would have charge as state variable, and corresponding to force, we would have position.

It is so wild to me how there are a medium number of energy domains. I would expect that there would either be 2-3 canonical energy domains, or their would be infinitely many. The fact that there are around 6 is suspicious to me… But that is just superstition.

Sorry, I read and replied with too little time at hand and nothing good came out.

Concerning criticism 1, it was clear in your post, I just didn’t get the notation, although you wrote further below that it refers to the joint level set.
To me, assuming E to be a function of S and Q_1, \ldots, Q_n sounds more straightforward, though.

Concerning criticism 2, I still don’t agree, but not for the reasons I expressed. The quantities you mentioned (temperature, pressure, voltage, force) are all (supposed to be) effort quantities (i.e. differential of storage function) and you are hence completely correct when you say that the state variables (for the latter two) are charge and position/displacement.
In the case of charge, the reference state corresponding to equilibrium is simply no (separation of) charge, implying zero voltage. It hence makes no sense to say that the environment would have a “reference capacitor” with a non-zero voltage. Similarly, for the case of displacement, the reference state corresponding to equilibrium is the relaxed state, implying no force. It hence makes no sense for the environment to include a “reference spring” with a non-zero force.

Concerning your doubts about there being around 6 energy domains of the environment, I think that there are actually 2-3 canonical energy domains, namely entropy/heat, volume, and mass. Regarding mass, however, you can consider different chemical species. However, probably since I am not a chemical engineer, I don’t have experience in doing so.

I plan to soon post another reply to finally convince you that nothing is wild, suspicious, or resting on sketchy and shaky assumptions Neat. The way I got into talking to people about thermo that led to our paper was that I wanted to formalize the idea that exergy is the appropriate notion of entropy for open systems. Does this slogan sound right to you?

1 Like

Ah, I think that perhaps some of the confusion here comes from distinguishing the “one-port” and “two-port” versions of capacitors. In the “two-port” capacitor, the voltage is “global” in a sense, i.e. referenced to some other potential. In the “one-port” capacitor, the number is the voltage difference between the two ends of the capacitor, which is obviously reference-free.

So a similar consideration could happen for the displacement; there is a natural resting point for force.

But I think the fundamental difference is not one of kind, it is one of practicality. It is impractical to take the “natural resting point” for temperature to be 0 degrees kelvin, because, for instance, a gas chamber would have to expand infinitely for this to happen.

I think that I’m starting to understand that “exergy” is really a relative quantity. Specifically, it’s relative to “what procedures for extracting work are feasible in a certain environment.” Which is an eminently reasonable thing to be relative to, but of course is inherently ad-hoc.

In my perspective, no; first of all exergy is measured in units of energy, not units of entropy, and also open systems still have entropy!

Furthermore, weirdly enough, it’s perfectly valid to have isolated systems whose dynamics are generated by an exergy potential, even though exergy is defined relative to an environment.

But I’m interested in what lead you to think that exergy is entropy for open systems; I suspect that there’s an underlying intuition there that makes sense.

2 Likes

I want to use the EPHS language and a particular model to illustrate the meaning of exergy from a hopefully complementary angle.

## model

Consider the following system consisting of a cylinder-piston assembly together with an electric resistor inside the gas-filled interior and a spring which mostly counteracts the expansion of the gas. An EPHS model of the system can be defined via the following interconnection pattern:

Junctions represent energy domains, e.g. junction with label \mathtt{p_p} is the kinetic energy domain of the piston. At the junction the state variable is the momentum of the piston. The flow variables of the connected ports are forces which balance at the junction and the effort variables are all equal to the velocity of the piston.

Storage components in blue:

• \mathtt{int} (internal energy of the gas-filled interior)
• \mathtt{tc} (internal energy of the thermal capacity of the piston)
• \mathtt{m} (kinetic energy of the piston mass)
• \mathtt{spr} (potential energy of the spring)

Environment component \mathtt{env} in grey has two energy domains:

• \mathtt{v_e} (isobaric atmosphere with state variable being volume)
• \mathtt{s_e} (isothermal heat bath with state variable being entropy)

Reversible components in green:

• \mathtt{D_+} (coupling of hydraulic energy domain of interior \mathtt{v_i} and kinetic energy domain of piston \mathtt{p_p})
• \mathtt{D_-} (coupling of hydraulic energy domain of environment (i.e. atmosphere) and kinetic energy domain of piston)
• \mathtt{D_m} (coupling of potential energy domain of spring and kinetic energy domain of piston)

Irreversible components in red:

• \mathtt{res} (electrical resistance)
• \mathtt{tt1} (thermal transport between interior and piston)
• \mathtt{tt2} (thermal transport between piston and environment)
• \mathtt{fr} (friction of moving piston)

## exergy is a matter of storage and environment only

Now, the question is:
What is the exergy content of the system?

the reversible and irreversible components (which correspond to the Poisson matrix L and the friction matrix M in the GENERIC, respectively).
Instead, all ports of the storage components and the environment are exposed, such that an ideal conversion device can be connected, which will steer the system (including the reference environment) to its equilibrium state and thereby extract all the available work:

## exergy is extensive

Since exergy – just like energy – is an extensive quantity, it can be determined component by component and then added up. So let’s go.
We hence have to interconnect each storage component with the environment component and an ideal conversion device.

### 1. exergy content of the piston’s moving mass

Work is usually thought of as transfer of energy by forces.
Hence, the kinetic energy of the moving mass can be extracted as work just like that – no need for a conversion device and no way to interact with the environment. Consequently, the energy storage function of the mass is the same as its exergy storage function.

### 2. exergy content of the spring

For the spring, the ideal conversion device is already part of the model.
It’s the coupling of the potential and kinetic energy domains.
Again, since the energy is purely mechanical, no interaction with the environment.

Since the reversible component destroys no exergy,
Also here, the energy storage function of the spring is equal to its exergy storage function.

### 3. exergy content of the piston’s thermal capacity

Concerning the thermal capacity of the piston, its internal energy is a macroscopic model. Since not all microscopic information is present, practically feasible transfer of its energy is irreversible. The ideal conversion device \mathtt{icd} is a (hypothetical) Carnot engine and it brings the thermal reservoir into equilibrium with the environment. The work extracted via port \mathtt{p} is equal to the exergy content of the storage component \mathtt{tc}.

### 4. exergy content of the gas in the interior

Similarly, the exergy content of the gas enclosed in the interior is determined:

## remarks

Now a few words to line this up with Owen’s initial post:

The total entropy S is given as the sum of

• the entropy of the environment
• the entropy of the piston’s thermal capacity
• the entropy of the enclosed gas

The total volume V = Q_1 is given as the sum of

• the volume of the environment
• the volume of the enclosed gas

Here, n = 1, i.e. no further conserved quantities considered (as part of the environment).

It should be clear that in each of the four cases, the total entropy and the total volume is conserved. Obviously, the same then applies to the combined system.

I hope that this somehow helps.

1 Like

If you ask me, a capacitor is always a 1-port element and a voltage is always a potential difference. Potential is global in the sense that if you add a fixed constant to all potentials, the voltages in a circuit remain the same. What you call “ends” is are usually called terminals, but I don’t think you meant “2-terminal” when you said “2-port capacitor”.

So I guess I think it is very much a question of kind somehow: (separation of) charge / voltage and similarly displacement (from relaxed state) / force are physical quantities of such a kind that equilibrium demands voltage and force to be zero.

As you can seen in the example I posted, the exergy content of a system has nothing to do with

• its reversible dynamics
• its irreversible dynamics
• the energy domains it exposes via external ports

Therefore, it should not be so weird that the concept applies to both isolated and open systems.
Only if one wants to make the process of how the exergy content is assessed concrete, then the system’s storage component and environment need to be fully exposed.

Uh wait where does exergy for an isolated system come from? Just the U term? Sounds sus to me (in the sense that the name suggests it’s purely external, contrary to energy)

I think exergy is weird because is comes from an extra-theoretic counterfactual. I.e. you measure the exergy of a system by looking at the counterfactual where you broke it apart and accessed the energy in it directly rather than using the composition inherent in the theory to interact with it.

This of course makes physical sense, because you can actually take apart physical systems, and put them into contact with an environment. But mathematically it’s rather odd.

This seems a very interesting thought but I’m having a hard time understanding it. What does ‘access energy directly’ mean? You mean looking at the state variables directly?

It’s kind of like the difference between what you can get out of a company as a customer vs. via a hostile takeover. In a hostile takeover, you can access assets which are not otherwise for sale.

2 Likes