Liouville geometry of classical thermodynamics

In the contact-geometric formulation of classical thermodynamics distinction is made between the energy and entropy representation, which can be resolved by taking homogeneous coordinates for the intensive variables. This results in a geometric formulation on the cotangent bundle of the manifold of extensive variables, where all geometric objects are homogeneous in the cotangent variables. The resulting geometry is studied in-depth. Additional homogeneity with respect to the extensive variables, corresponding to the classical Gibbs-Duhem relation, is treated within the same geometric framework.

On the other hand, as discussed in [5], the contact-geometric formulation of thermodynamics makes a distinction between the energy and the entropy representation of the same thermodynamic system. By itself this need not be considered as a major flaw since the two representations are conformally equivalent. Nevertheless, it was shown in [5], and later in [36,27,37], that an attractive point of view that is merging the energy and entropy representation is offered by the extension of contact manifolds to symplectic manifolds. Compared with the odd-dimensional contact manifold this even-dimensional symplectic manifold has one more degree of freedom, called a gauge variable in [5]. From a thermodynamics perspective it amounts to replacing the intensive variables by their homogeneous coordinates. In fact, this symplectization of contact manifolds is rather well-known in differential geometry [2,25]; dating back to [20]. As argued in [37], the extension of contact manifolds to symplectic manifolds, in fact to cotangent bundles without zero section, has additional advantages for the geometric formulation of thermodynamics as well. First, it yields a clear distinction between the extensive and intensive variables of the thermodynamic system. Secondly, it enables the definition of port-thermodynamic systems, which are thermodynamic systems that interact with their environment via either power or entropy flow ports. Finally, symplectization has computational benefits; as was already argued within differential geometry by Arnold [2,3].
The present paper aims at providing an in-depth treatment of the resulting geometry of thermodynamic systems, continuing the earlier investigations in [36,37] and building upon [2,3,25]. Starting point are cotangent bundles without zero section, endowed with their natural one-form; also called the Liouville form 1 . Instead of considering the symplectic geometry derived from the symplectic form ω = dα, where α is the Liouville form, a smaller set of geometric objects will be defined solely based on this Liouville form. The resulting geometry is called Liouville geometry. In particular, it will be shown how a particular class of Lagrangian submanifolds (called Liouville submanifolds) can be defined as maximal submanifolds on which the Liouville form is zero. Furthermore, a particular type of Hamiltonian vector fields is defined consisting of vector fields which leave the Liouville form invariant. All these geometric objects have the property that they are homogeneous in the cotangent variables. As a result they are in one-to-one correspondence with objects on the underlying contact manifold (of dimension one less). We will study in detail the generating functions of Liouville submanifolds and the homogeneous Hamiltonian functions of this special type of Hamiltonian vector fields, and relate them to their contact geometry counterparts. Continuing upon [37] it will be shown how this leads to the definition of a port-thermodynamic system, and its projection to the contact manifold. Finally we will focus on an additional homogeneity structure, present in some thermodynamic systems, corresponding to homogeneity in the extensive variables. This leads to a new geometric view on the classical Gibbs-Duhem relation, and a subsequent projection to an even-dimensional space.
The rest of the paper is structured as follows. In Section 2 it is discussed, using the example of a simple gas, how thermodynamics leads to the study of cotangent bundles over the base space of extensive variables, with cotangent variables being the homogeneous coordinates for the intensive variables. The resulting Liouville geometry of a general cotangent bundle without zero section, and its projection to contact geometry, is studied in Section 3. Then Section 4 provides the definition of port-thermodynamic systems using Liouville geometry, and its projection to a contact-geometric description. Section 5 discusses homogeneity with respect to the extensive variables, the Gibbs-Duhem relation, and its geometric formalization. Finally, Section 6 contains the conclusions.

From Gibbs' fundamental thermodynamic relation to contact geometry
Consider a simple thermodynamic system such as a mono-phase, single constituent, gas in a confined compartment with volume V and pressure P at temperature T . It is well-known that the state properties of the gas are described by a 2-dimensional submanifold of the ambient space R 5 (the thermodynamic phase space) with coordinates E (energy), S (entropy), V , P , and T . Such a submanifold characterizes the properties of the gas (e.g., an ideal gas, or a Van der Waals gas), and all of them share the following property. Define the Gibbs one-form on the thermodynamic phase space R 5 as Then θ is zero restricted to the submanifold characterizing the state properties. This is called Gibbs' fundamental thermodynamic relation. It implies that the extensive variables E, S, V and the intensive variables T, P are related in a specific way. Geometrically this is formalized by noting that the Gibbs oneform θ defines a contact form on R 5 , and that any submanifold L capturing the state properties of the thermodynamic system is a submanifold of maximal dimension restricted to which the contact form θ is zero. Such submanifolds are called Legendre submanifolds of the contact manifold (R 5 , θ). By expressing the extensive variable E as a function E = E(S, V ) of the two remaining extensive variables S and V , Gibbs' fundamental relation implies that the Legendre submanifold L specifying the state properties is given as Hence L is completely described by the energy function E(S, V ), whence the name energy representation for (2). On the other hand, there are other ways to represent L. If L is parametrizable by the variables T, V (instead of S, V as in (2)), then one defines the partial Legendre transform of E(S, V ) with respect to S as where S is solved from T = ∂E ∂S (S, V ). Then L is also described as A is known as the Helmholtz free energy, and is one of the thermodynamic potentials derivable from the energy function E(S, V ); see e.g. [14]. Two other possible parametrizations of L (namely by S, P , respectively by T, P ) correspond to two more thermodynamic potentials, namely the enthalpy H(S, P ) and the Gibbs' free energy G(T, P ), resulting in similar expressions for L.
In general [2,25], a contact manifold (M, θ) is an odd-dimensional manifold equipped with a contact form θ. A one-form θ on a (2n+1)-dimensional manifold M is a contact form if and only around any point in M we can find coordinates (q 0 , q 1 , · · · , q n , γ 1 , · · · , γ n ) for M , called Darboux coordinates, such that Equivalently, θ is a contact form if θ ∧ (dθ) n is nowhere zero on M . A Legendre submanifold of a contact manifold (M, θ) is a submanifold of maximal dimension restricted to which the contact form θ is zero. The dimension of any Legendre submanifold of a (2n + 1)-dimensional contact manifold is equal to n.
In fact, we will use throughout this paper the slightly generalized definition of a contact manifold as given in e.g. [2], where the contact form θ is only required to be defined locally. What counts is the contact distribution; the 2ndimensional subspace of the tangent space at any point of M defined by the kernel of the contact form θ at this point. This turns out to be the appropriate concept for the thermodynamic phase space being a contact manifold 2 .
Apart from the above parametrizations of the Legendre submanifold L, corresponding to an energy function E(S, V ) and its Legendre transforms, there is still another, although very similar, way of describing L. This alternative option is motivated from a modeling point of view. Namely, often thermodynamic systems are formulated by first listing the balance laws for the extensive variables apart from the entropy S, and then expressing S as a function S = S(E, V ). This leads to the entropy representation of the submanifold L ⊂ R 5 , given as Analogously the case of the energy representation E = E(S, V ), one may consider thermodynamic potentials obtained by partial Legendre transform of S(E, V ). Geometrically the entropy representation corresponds to the modified Gibbs contact form which is obtained from the original Gibbs contact form θ in (1) by division by −T (called conformal equivalence). In this way the Gibbs fundamental relation is rewritten as θ| L = 0, and the intensive variables become 1 T , P T .

From contact to Liouville geometry
The contact-geometric view on thermodynamics, directly motivated by Gibbs' fundamental thermodynamic relation, has two shortcomings: (1) Switching from the energy representation E = E(S, V ) to the entropy representation S = S(E, V ) corresponds to replacing the Gibbs form θ by the modified Gibbs form θ in (7), and thus leads to a similar, but different, contactgeometric description.
(2) The contact-geometric description does not make a clear distinction between, on the one hand, the extensive variables E, S, V and, on the other hand, the intensive variables T, −P (energy representation), or 1 T , P T (entropy representation). In fact, given a contact form θ there are many Darboux coordinates q 0 , q 1 , q 2 , p 1 , p 2 for R 5 such that θ = dq 0 − p 1 dq 1 − p 2 dq 2 , where q 0 , q 1 , q 2 are not necessarily obtained by a transformation of only the extensive variables E, S, V .
The way to remedy these shortcomings is to extend the contact manifold by one extra dimension to a symplectic manifold, in fact a cotangent bundle, with an additional homogeneity structure. This construction is rather well-known in differential geometry [2,25], but was advocated within a thermodynamics context only in [5], and followed up in [36,37]. For a simple thermodynamic system with extensive variables E, S, V and intensive variables T, −P , the construction amounts to replacing the intensive variables T, −P by their homogeneous coordinates p E , p S , p V with p E = 0, i.e., Equivalently, the intensive variables 1 T , P T in the entropy representation are represented as This means that the two contact forms θ = dE − T dS + P dV and θ = dS − 1 T dE − P T dV are replaced by a single symmetric expression, namely by The one-form α is nothing else than the canonical Liouville one-form on the cotangent bundle T * R 3 , with R 3 the space of extensive variables E, S, V . Thus the thermodynamic phase space R 5 has been replaced by T * R 3 . More precisely, by definition of homogeneous coordinates the vector (p E , p S , p V ) is different from the zero vector, and hence the space with coordinates E, S, V, p E , p S , p V is actually the cotangent bundle T * R 3 minus its zero section; denoted as T * R 3 . Any 2-dimensional Legendre submanifold L ⊂ R 5 describing the state properties is now replaced by a 3-dimensional submanifold L ⊂ T * R 3 , given as It turns out that L is a Lagrangian submanifold of T * R 3 with symplectic form ω := dα, with an additional property of homogeneity. Namely, whenever (E, S, V, p E , p S , p V ) ∈ L, then also (E, S, V, λp E , λp S , λp V ) ∈ L, for any nonzero λ ∈ R. Such Lagrangian submanifolds turn out to be fully characterized as maximal manifolds restricted to which the Liouville one-form α = p E dE + p S dS + p V dV is zero, and will thus be called Liouville submanifolds of T * R 3 . As we will see in the next section the extension of contact manifolds to cotangent bundles, replacing the intensive variables by their homogeneous coordinates, also leads to a natural homogeneous Hamiltonian dynamics on the extended space T * R 3 . This does not only facilitate the analysis, but has clear computational advantages as well. In fact, all computations become standard operations on cotangent bundles and in Hamiltonian dynamics. In the words of Arnold [3]: one is advised to calculate symplectically (but to think rather in terms of contact geometry).
All of this is immediately extended from the thermodynamic phase space R 5 with coordinates E, S, V, T, P to general thermodynamic phase spaces. For instance, in the case of multiple chemical species the Gibbs form θ extends to dE − T dS + P dV − k µ k dN k , where N k and µ k , k = 1, · · · , s, are the mole numbers, respectively, chemical potentials of the k-th species. Correspondingly, the thermodynamic phase R 5 × R 2s is replaced by the cotangent bundle without zero-section T * R 3+s , with extensive variables E, S, V, N 1 , · · · , N s and Liouville form where µ 1 = p1 −pE , · · · , µ s = ps −pE .

Liouville geometry
This section is concerned with the general definition and analysis of geometric objects on the cotangent bundle without zero section, which project to the underlying contact manifold. Since everything is based on the Liouville form this will be called Liouville geometry. In particular, we will deal with Liouville submanifolds and homogeneous Hamiltonian dynamics.

Cotangent bundles and the canonical contact manifold
In the previous section it was indicated how the thermodynamic phase space can be extended to a cotangent bundle, without its zero section, by the use of homogeneous coordinates for the intensive variables. Furthermore, it was shown how in this way the energy and entropy representation are unified, and how this provides a geometric definition of extensive and intensive variables. Conversely, in this subsection we will start with a general cotangent bundle without zero section, and show how this leads to the canonical contact manifold serving as thermodynamic phase space. Consider a thermodynamic system with total space of extensive variables, including energy E and entropy S, given by the manifold Q. Then consider the cotangent bundle T * Q without its zero section. The Liouville one-form α on T * Q is defined as follows. Consider η ∈ T * Q, X ∈ T η T * Q, and define where pr : T * Q → Q is the bundle projection. Then ω := dα, with d exterior derivative, is the canonical symplectic form on T * Q. Furthermore, the Euler vector field Z is defined as the unique vector field satisfying This also implies L Z α = α, with L denoting Lie derivative.
In coordinates α, ω and Z take the following simple form. Let dim Q = n + 1, with local coordinates q 0 , · · · , q n , and let p 0 , · · · , p n be the corresponding coordinates for the cotangent spaces T * q Q. Then Based on T * Q we may define a canonical contact manifold in the following way [2]. For each q ∈ Q and each cotangent space T * q Q consider the projective space P(T * q Q), given as the set of rays in T * q Q, that is, all the non-zero multiples of a non-zero cotangent vector. Thus the projective space P(T * q Q) has dimension n, and there is a canonical projection π q : T * q Q → P(T * q Q), where T * q Q denotes the cotangent space without its zero vector. The fiber bundle of the projective spaces P(T * q Q), q ∈ Q, over the base manifold Q will be denoted by P(T * Q). Furthermore, denote the bundle projection obtained by considering π q : T * q Q → P(T * q Q) for every q ∈ Q by π : T * Q → P(T * Q).
As detailed in [2,3,37,36], P(T * Q) defines a canonical 3 contact manifold of dimension 2n+1. The contact manifold P(T * Q) will serve as the thermodynamic phase space for the thermodynamic system with space of external variables Q.
Given natural coordinates q 0 , · · · , q n , p 0 , · · · , p n for T * Q, we may select different sets of local coordinates for P(T * Q) and corresponding different expressions of the projection π : T * q Q → P(T * q Q). In fact, whenever p 0 = 0 we may express the projection π q : T * q Q → P(T * q Q) by the map where This means that with θ a locally defined contact form on P(T * Q). Clearly, the same can be done for any of the other coordinates p i , defining different contact forms. For example, if p 1 = 0 we may express π q : T * q Q → P(T * q Q) also by the map where so that In the thermodynamics context of Section 2, with q 0 = E, q 1 = S, and thus p 0 = p E , p 1 = p S , the first option corresponds to the energy representation and the second to the entropy representation. Importantly, there is a direct correspondence between all geometric objects (functions, Legendre submanifolds, vector fields) on the contact manifold P(T * Q) with the same objects on T * Q endowed with an additional homogeneity property in the p variables. A key element in this is Euler's theorem on homogeneous functions; see e.g. [37].
Moreover, if K is homogeneous of degree r in p, then all its derivatives ∂K ∂pi (q, p), i = 0, 1, · · · , n, are homogeneous of degree r − 1 in p. Furthemore K : T * Q → R is homogeneous of degree 0 in p if and only if L Z K = 0, and homogeneous of degree 1 in p if and only if L Z K = K, where Z is the Euler vector field and L denotes Lie derivation.
Since until Section 5 homogeneity will always refer to homogeneity in the p-variables we will often simply talk about 'homogeneity'.
Obviously, functions K : T * Q → R which are homogeneous of degree 0 in p are those functions which project under π to functions on P(T * Q), i.e., K = π * K with K : P(T * Q) → R. In the next two subsections we will consider two more classes of objects which project to P(T * Q).

Liouville submanifolds
Legendre submanifolds of the canonical thermodynamic phase space P(T * Q) are in one-to-one correspondence with Liouville submanifolds 4 of T * Q, defined as follows.
Recall that L is a Lagrangian submanifold of T * Q if ω = dα is zero on L and dim L = dim Q (or, equivalently, ω is zero on L and L is maximal with respect to this property.) The following proposition shows that Liouville submanifolds are actually Lagrangian submanifolds of T * Q with an additional homogeneity property.
Proof. First of all note that the homogeneity property (24) for any two vector fields X 1 , X 2 . Hence, for any X 1 , X 2 tangent to L we obtain dα(X 1 , X 2 ) = 0, implying that L is a Lagrangian submanifold. Furthermore, by (14) dα(Z, X) = α(X) = 0, for all vector fields X tangent to L. Because L is a Lagrangian submanifold this implies that Z is tangent to L (since a Lagrangian submanifold is a maximal submanifold restricted to which ω = dα is zero.) (If). If L is Lagrangian and satisfies (24), then Z is tangent to L, and thus (26) holds for all vector fields X tangent to L, implying that α is zero restricted to L.
Remark 3.5. It also follows that L ⊂ T * Q is a Liouville submanifold if and only if it is a maximal submanifold on which α is zero.
Liouville submanifolds of T * Q are in one-to-one correspondence with Legendre submanifolds of the canonical contact manifold P(T * Q). Recall that a submanifold of a (2n + 1)-dimensional contact manifold is a Legendre submanifold [2,25] if the locally defined contact form θ is zero restricted to it, and its dimension is equal to n (the maximal dimension of a submanifold on which θ is zero). This implies as well a one-to-one correspondence between generating functions of Legendre submanifolds L ⊂ P(T * Q) and generating functions of Liouville submanifolds L ⊂ T * Q with π −1 ( L). Recall from [25,2] that any Legendre submanifold L ⊂ P(T * Q) with Darboux coordinates q 0 , q 1 , · · · , q n , γ 1 , · · · , γ n can be represented as for some disjoint partitioning I ∪ J = {1, · · · , n} and some function F (q I , γ J ), called a generating function for L. Here γ J is the vector with elements γ ℓ = p ℓ −p0 , ℓ ∈ J, and γ J ∂ F ∂γJ is shorthand notation for ℓ∈J γ ℓ ∂ F ∂γ ℓ . Conversely any submanifold L as given in (27), for any partitioning I ∪J = {1, · · · , n} and function F (q I , γ J ), is a Legendre submanifold. This implies that the corresponding Liouville submanifold L = π −1 ( L) is given as where This is immediately verified by exploiting the identities Thus F (q I , p 0 , p J ) is a generating function of L. Conversely, any Liouville submanifold as in (28) for some p 0 (possibly after renumbering the index set {0, 1, · · · , n}) and generating function F as given in (29) for some F (q I , γ J ), with I ∪ J = {1, · · · , n} and γ J = − pJ p0 defines a Liouville submanifold of T * Q. Note that the generating function F (q I , p 0 , p J ) = −p 0 F (q I , pJ −p0 ) as in (29) for the Liouville submanifold L is homogeneous of degree 1 in p. The correspondence (29) between the generating function F (q I , p 0 , p J ) of the Liouville submanifold L = π −1 ( L) and the generating function F (q I , γ J ) of the Legendre submanifold L is of a well-known type in the theory of homogeneous functions. Indeed, for any function K(q, p) that is homogeneous of degree 1 in p, we can define K(q, γ 1 , · · · , γ n ) := K(q, −1, γ 1 , · · · , γ n ), implying that K(q, p 0 , p 1 , · · · , p n ) = −p 0 K(q, Finally note that the correspondence between the Liouville submanifold L and the Legendre submanifold L and their generating functions can be obtained for any numbering of the set {0, 1, · · · , n}, and thus for any choice of p 0 . This provides other coordinatizations of the same Legendre submanifold L ⊂ P(T * Q).
The representation of L either in energy or in entropy representation is an example of this.

Homogeneous Hamiltonian and contact vector fields
For any function K : T * Q → R the Hamiltonian vector field X K on T * Q is defined by the standard Hamiltonian equationṡ or equivalently, ω(X K , −) = −dK. Note that since dα(Z, ·) = α, we have α(X K ) = dα(Z, X K ) = L Z K = K. Hence a Hamiltonian K is homogeneous of degree 1 in p if and only if Furthermore Proposition 3.7. If K : T * Q → R is homogeneous of degree 1 in p then its Hamiltonian vector field X K satisfies Conversely, if the vector field X satisfies L X α = 0, then X = X K where the function K := α(X) is homogeneous of degree 1 in p.
Thus the Hamiltonian vector fields with a Hamiltonian homogeneous of degree 1 in p are precisely the vector fields that leave the Liouville form α invariant. For simplicity of exposition the Hamiltonians K : T * Q → R that are homogeneous of degree 1 in p, and their corresponding Hamiltonian vector fields X K , will be simply called homogeneous in the sequel.
Note that by Theorem 3.2 (Euler's theorem) the expressions ∂K ∂pi (q, p), i = 0, 1 · · · , n, are homogeneous of degree 0 in p since K is homogeneous of degree 1 in p. Hence the dynamics of the extensive variables q in (33) is invariant under scaling of the p-variables, and thus expressible as a function of q and the intensive variables γ. In fact, any homogeneous Hamiltonian vector field projects to a contact vector field on the thermodynamic phase space P(T * Q), and conversely any contact vector field on P(T * Q) is the projection of a homogeneous Hamiltonian vector field on T * Q. This can be seen from the following computations. Consider a homogeneous Hamiltonian vector field X K . Since K is homogeneous of degree 1 in p we can write as in (32) K(q, p) = −p 0 K(q, p1 −p0 , · · · , pn −p0 ), with K(q, γ) as defined in (31). This means that the equations (33) of the Hamiltonian vector field X K take the forṁ where γ j = pj −p0 , j = 1, · · · , n. Combining witḣ this yields the following projected dynamics on the contact manifold P(T * Q) with coordinates (q, γ) This is recognized as the contact vector field [25] with contact Hamiltonian K. Indeed, given a contact form θ the contact vector field X K with contact Hamiltonian K is defined through the relations 5 for some function ρ K (depending on K). The first equation in (40) expresses the condition that the contact vector field leaves the contact distribution (the kernel of the contact form θ) invariant. Equations (40) for θ = dq 0 − γ 1 dq 1 · · · − γ n dq n and K(q, γ) can be seen to yield the same equations as in (39); see [25,11] for details. Conversely, any contact vector field with contact Hamiltonian K(q, γ) defines a homogeneous Hamiltonian vector field on T * Q with homogeneous Hamiltonian −p 0 K(q, p1 −p0 , · · · , pn −p0 ). As before, the coordinate expression (39) of the contact vector field depends on the numbering of the homogeneous coordinates p 0 , p 1 , · · · , p n ; i.e., the choice of p 0 . In the thermodynamics context this is again illustrated by the choice of either the energy or entropy representation (corresponding to choosing p 0 = p E or p 0 = p S ). The projectability of any homogeneous Hamiltonian vector field X K to a contact vector field X K on P(T * Q) also follows from the following proposition, and the fact that the projection π : T * Q → P(T * Q) is along the Euler vector field Z.
Although homogeneous Hamiltonian vector fields are in one-to-one correspondence with contact vector fields, typically computations for homogeneous Hamiltonian vector fields are much easier than the corresponding computations for their contact vector field counterparts. First note the following properties proved in [37,36]. (b) If K 1 is homogeneous of degree 1 in p, and K 2 is homogeneous of degree 0 in p, then {K 1 , K 2 } is homogeneous of degree 0 in p.
(c) If K 1 , K 2 are both homogeneous of degree 0 in p, then {K 1 , K 2 } is zero.
Using property (a) we may define the following bracket where K is the contact Hamiltonian corresponding to the homogeneous Hamiltonian K as in (40). The bracket { K 1 , K 2 } J is equal to the Jacobi bracket of the contact Hamiltonians K 1 , K 2 ; see e.g. [25,7,2] for the coordinate expressions of the Jacobi bracket. The Jacobi bracket is obviously bilinear and skewsymmetric. Furthermore, since the Poisson bracket satisfies the Jacobi-identity, so does the Jacobi bracket. However, the Jacobi bracket does not satisfy the Leibniz rule; i.e., in general the following equality does not hold See also [39] for additional information on the Jacobi bracket.

Hamilton-Jacobi theory of Liouville and Legendre submanifolds
Recall that any homogeneous Hamiltonian vector field X K on T * Q leaves invariant the Liouville form α and that Liouville submanifolds are maximal submanifolds on which α is zero. It follows that for any Liouville submanifold L and any time t ∈ R the evolution of L along the homogeneous Hamiltonian vector field X K given as where φ t : T * Q → T * Q is the flow map at time t ≥ 0 of X K , is also a Liouville submanifold. Applied to the Liouville submanifold characterizing the state properties of a thermodynamic system this means that the flow of a homogeneous Hamiltonian vector field transforms the Liouville submanifold to another Liouville submanifold at any time t ≥ 0. For example, the Liouville submanifold corresponding to an ideal gas may be continuously transformed into the Liouville submanifold of a Van der Waals gas. This point of view was explored in [29,30,32]. Furthermore, cf. (29), let F (q I , p 0 , p J ) := −p 0 F (q I , pJ −p0 ), with I ∪ J = {1, · · · , n}, be the generating function of L, then it follows that for any t ≥ 0 the generating function G(q I , p 0 , p J , t) := −p 0 G(q I , pJ −p0 , t) of the transformed Liouville submanifold φ t (L) satisfies the Hamilton-Jacobi equation In case of the evolution of a general Lagrangian submanifold under the dynamics of a general Hamiltonian vector field this is classical Hamilton-Jacobi theory (see e.g. [1,2]), which directly specializes to Liouville submanifolds and homogeneous Hamiltonian vector fields. Furthermore, the generating functions G(q I , γ J , t) of the corresponding Legendre submanifolds φ t (L) satisfy the Hamilton-Jacobi equation (see also [8]) Note furthermore that φ t (L) = φ t ( L), where φ t is the flow map at time t of the contact vector field X K . This implies as well the following result concerning invariance of Liouville and corresponding Legendre submanifolds, which will be one of the starting points for the definition of port-thermodynamic systems in the following section. Furthermore let L ⊂ T * Q be a Liouville submanifold, and L ⊂ P(T * Q), with L = π −1 ( L), the corresponding Legendre submanifold. Then the following statements are equivalent: 1. The homogeneous Hamiltonian vector field X K leaves L invariant.
2. The contact vector field X K leaves L invariant.
3. K is zero on L.
4. K is zero on L.

Port-thermodynamic systems
So far the geometric description of classical thermodynamics has been concerned with the state properties; starting from Gibbs' fundamental relation. Since these state properties are intrinsic to any thermodynamic system, they should be respected by any dynamics (thermodynamic processes). Hence any dynamics of an actual thermodynamic system should leave invariant the Liouville and Legendre submanifold characterizing the state properties [31,33,6,37]. Furthermore, desirably this should be the case for all possible state properties of the thermodynamic system, i.e., for all Liouville and Legendre submanifolds. This suggests that the dynamics on the canonical thermodynamic phase space P(T * Q) should be a contact vector field X K , and the corresponding dynamics on T * Q should be a homogeneous Hamiltonian vector field X K . Because of its simplicity, we first focus on the homogeneous Hamiltonian description. Consider a thermodynamic system with constitutive relations (state properties) specified by a Liouville submanifold L ⊂ T * Q. Respecting the geometric structure means that the dynamics is a Hamiltonian vector field X K on T * Q, with K homogeneous of degree 1 in the p-variables. Furthermore, since the state properties captured by L are intrinsic to the system, the homogeneous Hamiltonian vector field X K should leave L invariant. By Proposition 3.10 this means that the homogeneous Hamiltonian K governing the dynamics should be zero on L. Furthermore, we will split K into two parts, i.e., where K a : T * Z → R is the homogeneous Hamiltonian corresponding to the autonomous dynamics due to internal non-equilibrium conditions, while K c = (K c 1 , · · · , K c m ) is a row vector of homogeneous Hamiltonians (called control or interaction Hamiltonians) corresponding to dynamics arising from interaction with the surrounding of the system. This second part of the dynamics will be supposed to be affinely parametrized by a vector u of control or input variables (see however [37] for an example of non-affine dependency). This means that all (m + 1) functions K a , K c 1 , · · · , K c m are homogeneous of degree 1 in p and zero on L.
By invoking Euler's homogeneous function theorem (cf. Theorem 3.2) homogeneity of degree 1 in p means where the functions ∂K a ∂pi , as well as the elements of the m-dimensional row vectors of partial derivatives ∂K c ∂pi , i = 0, 1, · · · , n, are all homogeneous of degree 0 in the p-variables. (Hence, as noted before, the dynamics of the extensive variables can be expressed as a function of the extensive variables and the intensive variables.) The class of allowable autonomous Hamiltonians K a is further restricted by the First and Second Law of thermodynamics. Since the energy and entropy variables E, S are among the extensive variables q 0 , q 1 , · · · , q n , let us denote q 0 = E, q 1 = S. With this convention, the evolution of E in the autonomous dynamics X K a arising from non-equilibrium conditions is given byĖ = ∂K a ∂p0 . Since by the First Law the energy of the system without interaction with the surrounding (i.e., for u = 0) should be conserved, this implies that necessarily ∂K a ∂p0 | L = 0. Similarly,Ṡ in the autonomous dynamics X K a is given by ∂K a ∂p1 . Hence by the Second Law necessarily ∂K a ∂p1 | L ≥ 0. These two constraints need not hold for the control (interaction) Hamiltonians K c . In fact, the analogous terms in the control Hamiltonians may be utilized to define natural output variables. First option is to define the output vector as the m-dimensional row vector (p for power) Then it follows that along the complete dynamics X K on L, with K = K a +K c u, Thus y p is the vector of power-conjugate outputs corresponding to the input vector u. We call the pair (u, y p ) the power port of the system. Similarly, by defining the output vector as the m-dimensional row vector (e for 'entropy flow') it follows that along the dynamics Hence y e is the output vector which is conjugate to u in terms of entropy flow. The pair (u, y e ) is called the flow of entropy port of the system. The above discussion is summarized in the following definition of a portthermodynamic system.  37]). Consider the manifold of extensive variables Q. A portthermodynamic system on Q is a pair (L, K), where L ⊂ T * Q is a Liouville submanifold describing the state properties, and K = K a + K c u, u ∈ R m , is a Hamiltonian on T * Q, homogeneous of degree 1 in p, and zero restricted to L, which generates the dynamics X K . Furthermore, let q = (q 0 , q 1 , · · · , q n ) with q 0 = E (energy), and q 1 = S (entropy). Then K a is required to satisfy ∂K a ∂p0 | L = 0 and ∂K a ∂p1 | L ≥ 0. The power conjugate output vector of the portthermodynamic system is defined as y p = ∂K c ∂p0 , and the entropy flow conjugate output vector as y e = ∂K c ∂p1 . Note that any port-thermodynamic system on T * Q immediately defines a corresponding system on the thermodynamic phase space P(T * Q). Indeed, since L ⊂ T * Q is a Liouville submanifold it projects to a Legendre submanifold L ⊂ P(T * Q). Furthermore, since K is homogeneous of degree 1 in p it has the form K(q, p) = −p 0 K(q, γ), γ j = pj −p0 , j = 1, · · · , n, with K(q, γ) = K a (q, γ) + K c (q, γ)u the contact Hamiltonian of the energy representation. This contact Hamiltonian is zero on L, and the dynamics X K projects to the contact vector field X K that leaves invariant L. Similarly, we can write K(q, p) = −p 1 K(q,γ), γ j = pj −p1 , j = 0, 2 · · · , n, with K(q,γ) the contact Hamiltonian of the entropy representation. Furthermore, by Euler's theorem both the power conjugate output y p and the entropy flow conjugate output y e are homogeneous of degree 0, and thus project to functions on P(T * Q). Finally, in the energy representation we can rewrite the power conjugate output as Similarly for the entropy flow conjugate output y e = ∂K c ∂p1 = n ℓ=0,2γ ℓ ∂ K c ∂γ ℓ (q,γ)− K c (q,γ). Finally note that the constraints imposed on K a by the First and Second law can be written in contact-geometric terms as Example 4.2 (Gas-piston-damper system). Consider a gas in a thermally isolated compartment closed by a piston. Assume the thermodynamic properties of the system to be fully covered by the properties of the gas. The extensive variables are given by energy E, entropy S, volume V , and momentum of the piston π. The state properties of the system are described by the Liouville submanifold L with generating function (in energy representation) −p E U (S, V ) + π 2 2m , where U (S, V ) is the energy of the gas, and π 2 2m the kinetic energy of the piston with mass m. This defines the state properties Assume the damper is linear with damping constant d. The dynamics of the gas-piston-damper system, with piston actuated by a force u, is given by X K , where the homogeneous Hamiltonian K : T * R 4 → R is given as which is zero on L. The power-conjugate output y p = π m is the velocity of the piston. In energy representation the description projects to the thermodynamic phase space P(T * R 4 ) = {(E, S, V, π, T, −P, v)}, with γ S = T (temperature), γ V = −P (pressure), and γ π = v (velocity of the piston) as follows. First note that L projects to the Legendre submanifold This yields the following dynamics of the extensive variableṡ while the intensive variables satisfyṪ Similarly for the entropy representation.
In composite thermodynamic systems, there is typically no single energy or entropy. In this case the sum of the energies needs to be conserved by the autonomous dynamics, and likewise the sum of the entropies needs to be increasing. A simple example is the following; see [37] for further information.
Taking u i as the incoming heat flow into the i-th compartment corresponds to while K a i = 0. This defines the flow of entropy conjugate outputs as y ei = 1 (reciprocal temperatures). The conducting wall is described by the interconnection equations (with λ Fourier's conduction coefficient) relating the incoming heat flows u i and reciprocal temperatures y i , i = 1, 2, at both sides of the conducting wall. This leads to (setting E(S 1 , S 2 ) := E 1 (S 1 ) + E 2 (S 2 ), p E1 = p E2 =: p E , cf. [37]) to the autonomous dynamics generated by the homogeneous Hamiltonian Hence the total entropy on the Liouville submanifold Interestingly, while the Hamiltonians in standard Hamiltonian systems (such as in mechanics) represent energy, the Hamiltonians K in the above examples are dimensionless (in the sense of dimensional analysis). This holds in general. Furthermore, it can be verified that the contact Hamiltonian of its projected dynamics (a contact vector field) has dimension of power in case of the energy representation (with intensive variables T, −P ), and has dimension of entropy flow in case of the entropy representation (with intensive variables 1 T , P T ). Together with the fact that the dynamics of a thermodynamic system is captured by the dynamics restricted to the invariant Liouville submanifold, this emphasizes that the interpretation of the Hamiltonian dynamics X K is rather different from the Hamiltonian formulation of mechanical (or other physical) systems.
Finally, let us recall the well-known correspondence [25,2] between Poisson brackets of Hamiltonians K 1 , K 2 , and Lie brackets of their corresponding Hamiltonian vector fields, i.e., In particular, this property implies that if the homogeneous Hamiltonians K 1 , K 2 are zero on the Liouville submanifold L, and thus by Proposition 3.10 the homogeneous Hamiltonian vector fields X K1 , X K2 are tangent to L, then also [X K1 , X K2 ] is tangent to L, and therefore the Poisson bracket {K 1 , K 2 } is also zero on L. Together with Proposition 3.9 this was crucially used in the controllability and observability analysis of port-thermodynamic systems in [38].

Homogeneity in the extensive variables and Gibbs-Duhem relation
In many thermodynamic systems, when taking into account all extensive variables, there is an additional form of homogeneity; now with respect to the extensive variables q. To start with, consider a Liouville submanifold L with generating function −p 0 F (q 1 , · · · , q n ). Recall that if q 0 denotes the energy variable, then F (q 1 , · · · , q n ) equals the energy q 0 expressed as a function of the other extensive variables q 1 , · · · , q n . Assume that the manifold of extensive variables Q is the linear space 6 Q = R n+1 . Homogeneity with respect to the extensive variables means that the function F is homogeneous of degree 1 in q 1 , · · · , q n . This implies by Euler's theorem (Theorem 3.2) that F = n j=1 q j ∂ F ∂qj . Hence on the corresponding Legendre submanifold L = π(L) we have F = n j=1 γ j q j , and thus By Gibbs' relation this implies that on L n j=1 q j dγ j = 0, which is known as the Gibbs-Duhem relation; see e.g. [24,18]. The relation implies that the intensive variables γ j on L are dependent. More generally this can be formulated in the following geometric way.
Definition 5.1. Let Q = R n+1 with linear coordinates q. A Liouville submanifold L ⊂ T * R n+1 is homogeneous with respect to the extensive variables q if (q 0 , q 1 , · · · , q n , p 0 , · · · , p n ) ∈ L ⇒ (µq 0 , µq 1 , · · · , µq n , p 0 , · · · , p n ) ∈ L (69) Using the same theory as exploited before for homogeneity with respect to the p-variables, cf. Proposition 3.4, homogeneity of L with respect to q is equivalent to the vector field W := n i=0 q i ∂ ∂qi being tangent to L. Hence, using the same argumentation as in Proposition 3.4, not only the Liouville form α = n i=0 p i dq i is zero on L, but also the one-form This could be called the generalized Gibbs-Duhem relation.
Proposition 5.2. The Liouville submanifold L is homogeneous with respect to the extensive variables q if and only if β = n i=0 q i dp i is zero on L. Let L have generating function −p 0 F (q I , γ J ) for some partitioning {1, · · · , n} = I ∪J.
Then L is homogeneous with respect to the extensive variables q if and only if if I is non-empty and F (q I , γ J ) is homogeneous of degree 1 in q I . Furthermore, if L is homogeneous with respect to the extensive variables q, then n i=0 q i p i = 0, for all (q, p) ∈ L (71) Proof. As mentioned above, the first statement follows from the same reasoning as in Proposition 3.4, swapping the p and q variables. Equivalence of homogeneity of L with respect to q to F (q I , γ J ) being homogeneous of degree 1 in q I directly follows from the expression of L in (27) in case I = ∅, while clearly homogeneity of L fails if I = ∅. Finally, if both α = n i=0 p i dq i and β = n i=0 q i dp i are zero on L, then d( ∂pi is tangent to L necessarily this constant is zero. In a contact-geometric setting, an identity similar to (71) was noticed in [22]. A related scenario, explored in [9], is the case that L is a Lagrangian submanifold which is non-mixing: there exists a partitioning {0, 1, · · · n} = I ∪ J such that q J = q J (q I ), p I = p I (p J ) for all (q I , q J , p I , p J ) ∈ L. Then L being Lagrangian amounts to Since the left-hand side only depends on q I and the right-hand side only on p J , this means that both sides are constant, implying that q J = Aq I , p I = −A ⊤ p J for some matrix A. Hence L is obviously satisfying (71), and is actually the product of two orthogonal linear subspaces; one in Q = R n+1 and the other in the dual space Q * = R n+1 .
Furthermore, if the state properties captured by L are homogeneous with respect to q, it is natural to require the dynamics to be homogeneous with respect to q as well. Thus one requires the Hamiltonian K(q, p) governing the dynamics to be homogeneous of degree 1, not only with respect to p, but also with respect to q, i.e., K(µq, p) = µK(q, p), for all 0 = µ ∈ R Equivalently (analogously to Proposition 3.7) one requires X K to satisfy Similarly to Proposition 3.8, this implies Hence the flow of X K commutes both with the flow of the Euler vector field Z = n i=0 p i ∂ ∂pi and with the vector field W = n i=0 q i ∂ ∂qi . We have seen before that projection along Z yields the contact vector field X K , with K(q, p) = −p 0 K(q, γ), γ j = pj −p0 , j = 1, · · · , n, where (q, γ) ∈ R n+1 × P(R n+1 ). Subsequent projection along W to the reduced space P(R n+1 ) × P(R n+1 ) can be computed as follows. First write as above K(q, γ) = q 1K (ǫ, γ), ǫ j = q j q 1 , j = 0, 2, · · · , n Then compute, analogously to (30) Combining, analogously to (38), with the expressioṅ this yields the following 2n-dimensional dynamics on the reduced thermodynamic phase space P(R n+1 ) × P(R n+1 ) ǫ j = ∂K ∂γj − ǫ j n ℓ=1 γ ℓ ∂K ∂γ ℓ −K , j = 0, 2, · · · , ṅ γ j = − ∂K ∂ǫj + γ j n ℓ=0,2 ǫ ℓ ∂K ∂ǫ ℓ −K , j = 1, 2 · · · , n, whereK is determined by K(q, p) = −p 0 q 1K (ǫ, γ), ǫ = q 0 q 1 , q 2 q 1 · · · , q n q 1 , γ = p 1 −p 0 , · · · , p n −p 0 Obviously, if q 0 represents entropy the same expressions hold with different interpretation of ǫ 0 , ǫ 2 , · · · , ǫ n . Note that the 2n-dimensional dynamics (83) consists of standard Hamiltonian equations with respect to the HamiltonianK, together with extra terms. In view of (54), the first part of these extra terms for the autonomous termK a , i.e., n ℓ=1 γ ℓ ∂K a ∂γ ℓ −K a , is zero on L. As a final remark it can be noted that while the above reduction from L and X K toL and the dynamics (83) was done via L and X K (the contact-geometric description on the thermodynamic phase space), the same outcome is obtained by instead first projecting onto P(R n+1 ) × R n+1 along W , and then projecting onto P(R n+1 ) × P(R n+1 ) along Z. Said otherwise, this alternative route involves a different intermediate contact geometric description on the contact manifold P(R n+1 ) × R n+1 with coordinates ǫ 0 , ǫ 2 , · · · , ǫ n , p 0 , · · · , p n .

Conclusions
The geometric formulation of classical thermodynamics gives rise to a specific branch of symplectic geometry, coined as Liouville geometry, which is closely related to contact geometry. A detailed treatment of Liouville submanifolds and their generating functions has been provided. The same has been done for homogeneous Hamiltonian vector fields, extending the treatment in e.g. [2,3,25]. For the formulation of the Weinhold and Ruppeiner metrics in this setting we refer to [37]. The interpretation of the resulting Hamiltonian formulation of port-thermodynamic systems turns out to be rather different from Hamiltonian formulations of other parts of physics, such as mechanics. In particular, the state properties of the thermodynamic system define a Liouville submanifold, which is left invariant by the Hamiltonian dynamics. Furthermore, the Hamiltonian is dimensionless, while its corresponding contact Hamiltonians have dimension of power (energy representation) or entropy flow (entropy representation). An open modeling problem concerns the determination of the Hamiltonian governing the dynamics. A partial answer is given in [37], where it is shown how the Hamiltonian of a thermodynamic system can be derived from the Hamiltonians of the constituent thermodynamic subsystems. In Section 5 another type of homogeneity has been considered; this time with respect to the extensive variables, corresponding to the classical Gibbs-Duhem relation. It has been shown how this gives rise to a further projected dynamics on the product of the ndimensional projective space with itself. The precise geometric interpretation and properties of the reduced dynamics (83) deserve further study.