# A Lagrangian variational formulation for nonequilibrium thermodynamics. Part I: Discrete systems

François Gay-Balmaz, Hiroaki Yoshimura

► To cite this version:

François Gay-Balmaz, Hiroaki Yoshimura. A Lagrangian variational formulation for nonequilibrium thermodynamics. Part I: Discrete systems. Journal of Geometry and Physics, 2017, 111, pp.169-193. 10.1016/j geom phys. 2016.08.018 . insu-03727087

HAL Id: insu-03727087

https://insu.hal.science/insu-03727087v1

Submitted on 2 Jul 2025

**HAL** is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<table><tr><td>4 Variational formulation for the nonequilibrium thermodynamics of discrete systems</td><td>23</td></tr><tr><td>4.1 Nonequilibrium thermodynamics of general discrete systems</td><td>25</td></tr><tr><td>4.2 Formulation based on the free energy</td><td>28</td></tr><tr><td>4.3 The connected piston-cylinder problem</td><td>30</td></tr><tr><td>4.4 Thermodynamics of interconnected electric circuits</td><td>32</td></tr><tr><td>5 Conclusions</td><td>33</td></tr></table>

# 1 Introduction

**Some backgrounds and history.** Thermodynamics is a phenomenological theory which aims to *identify* and *describe* the relations between the observed *macroscopic* properties of a physical system with the help of fundamental laws, without aiming to explain the microscopic origin of these properties. The field of thermodynamics naturally includes macroscopic disciplines such as classical mechanics, fluid dynamics, and electromagnetism. In such a theory it is assumed that the macroscopic physical system can be described by a "small number" of variables whose value can be measured exactly. It is the goal of *statistical physics* to justify the principles of thermodynamics via microscopic properties and to provide methods to obtain the phenomenological coefficients appearing in the thermodynamic theory.

Historically, thermodynamics was first developed to treat almost exclusively equilibrium states and transition from one equilibrium state to another, in which change in temperature plays an important role. In this context, thermodynamics appeared mainly as a theory of heat and is viewed today as a branch of *equilibrium thermodynamics*. Such a classical theory, *that does not aim to describe the dynamic* evolution of the system, can be developed in a well established setting (Gibbs [1902]), governed by the well-known first and second laws (in their standard formulation found in any textbook on the subject). It is worth noting that classical mechanics, fluid dynamics and electromagnetism, being essentially dynamical theories, *can not* be treated in the context of the *classical equilibrium* thermodynamics, because, according to the general definition of thermodynamics mentioned at the beginning of this introduction, they belong to the subject of thermodynamics, also named *nonequilibrium thermodynamics*.

Much effort has been dedicated to the construction of a general setting for *nonequilibrium* thermodynamics. Although the groundwork was laid by the classical investigation of Clausius, Kelvin, Maxwell, and Rayleigh, the classical theory of nonequilibrium thermodynamics did not emerge until the work of Onsager (Onsager [1931]) on reciprocal relations connecting the coefficients which occur in the linear phenomenological equations relating irreversible fluxes and thermodynamic forces. These reciprocal relations were derived from time reversal invariance of *microscopic* equations of motion. Onsager's approach was followed by the contributions of Meixner, Prigogine, Coleman, Truesdell, among others (see e.g. the books de Groot and Mazur [1969], Truesdell [1969], Glansdorff and Prigogine [1971], Stueckelberg and Scheurer [1974], Biot [1975], Woods [1975], Lavenda [1978], Kondepudi and Prigogine [1998]).

While the theory of nonequilibrium thermodynamics is still today a very active subject in research, relevant with many disciplines of physics, chemistry, biology and engineering, one cannot say that it has reached a level of completeness. One of the reasons lies in the lack of a general Lagrangian variational formulation for nonequilibrium thermodynamics that would reduce to the classical Lagrangian variational formulation of mechanics in absence of irreversible processes. Various variational approaches have been proposed in relation with nonequilibrium thermodynamics. At the heart of most of them, is the *principle of least*
dissipation of energy by Onsager [1931], later extended in Onsager and Machlup [1953], Machlup and Onsager [1953], that underlies the reciprocal relations in the linear case. Another principle was formulated by Prigogine [1947], Glansdorff and Prigogine [1971] as a condition on steady state processes, known as the *principle of minimum entropy production*. Onsager's approach was generalized in Ziegler [1968] to the case of systems with nonlinear phenomenological laws. We refer to Gyarmati [1970] for reviews and developments of Onsager's variational principles, and for a study of the relation between Onsager's and Prigogine's principles. In this direction, we also refer to e.g. Lavenda [1978, §6] and Ichiyanagi [1994] for overviews on variational approaches to irreversible processes. Another important work was done by Biot [1975, 1984] in conjunction with thermoelasticity, viscoelasticity and heat transfer, where a *principle of virtual dissipation* in a generalized form of d'Alembert principle was used with various applications to nonlinear irreversible thermodynamics. It was noteworthy that this variational approach was restricted to *weakly irreversible systems* or *thermodynamically holonomic and quasi-holonomic* systems, which one can obtain by the assumption of isothermal systems or quasi-isothermal systems, namely, the assumption that the temperature remains constant and uniform enables us to simplify the required constraints associated with the rate of entropy production to be holonomic or quasi-holonomic, although Biot [1975] mentioned the relations between the rate of entropy production and state variables may be given as *nonholonomic constraints* (see, equation (8.7) on page 21).

More recently, Fukagawa and Fujitani [2012] showed a variational formulation of viscoelastic fluids, in which the internal conversion of mechanical power into heat power due to frictional forces was written as a nonholonomic constraint.

**Main features of our variational formulation.** The variational formulation for nonequilibrium thermodynamics developed in this present paper is completely distinct from the earlier variational approaches mentioned above, both in its physical meaning and in its mathematical structure, as well as in its goal. Roughly speaking, while most of the earlier variational approaches mainly underlie the equation for the rate of entropy production, aiming to justify the expression of the phenomenological laws governing the irreversible processes involved, our variational approach aims to underlie the *complete set of time evolution equations of the system*, in such a way that it extends the classical Lagrangian formulation in mechanics to nonequilibrium thermodynamic systems including irreversible processes.

This is accomplished by constructing a generalization of the *Lagrange-d'Alembert principle* of nonholonomic mechanics, where the entropy production of the system, written as the sum of the contribution of each of the irreversible processes, is incorporated into *nonlinear nonholonomic constraints*. As a consequence, all the *phenomenological laws* are encoded in the nonholonomic constraint, to which we naturally associate a *variational constraint* on the allowed variations of the action functional. A natural definition of the variational constraint in terms of the phenomenological constraint is possible thanks to the introduction of the concept of a *thermodynamic displacement*, which generalizes the concept of thermal displacement given by Green and Naghdi [1991] to all the irreversible processes. When irreversible processes are not taken into account, our variational formulation consistently recovers Hamilton's principle in Lagrangian mechanics.

One of the essential ideas in our approach may be given as follows. Consider the entropy production written in the generic form

$$I = \frac{1}{T} \sum_{\alpha} J_{\alpha} X^{\alpha},$$

where $X^{\alpha}$ denotes the *thermodynamic affinity* associated to an irreversible process and $J_{\alpha}$ is the corresponding *irreversible flux*. Our approach consists in associating to each irreversible
process the rate $\dot{\Lambda}^{\alpha}$ of a “new” quantity $\Lambda^{\alpha}$, called the *thermodynamic displacement*, such that $\dot{\Lambda}^{\alpha} = X^{\alpha}$. This allows us to define a *virtual quantity* $\delta\Lambda^{\alpha}$ for each of the irreversible process and to write the corresponding *admissible constraint* to be imposed on variations of the action functional associated to a Lagrangian of a given irreversible system.

Even in the simplest examples of discrete systems in which irreversible processes are included (such as pistons, chemical reactions, or electric circuits), our approach allows for an efficient way to derive the coupled evolution for the mechanical variables $(q, \dot{q})$ and the thermodynamic variable (entropy) $S$ by considering the following *nonholonomic Lagrangian variational formulation* for a Lagrangian $L(q, \dot{q}, S)$:

$$ \delta \int_{t_1}^{t_2} L(q, \dot{q}, S) dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}(q, \dot{q}, S), \delta q \rangle dt = 0, $$

holds for admissible variations $\delta q$ and $\delta S$ subject to the *variational constraint*

$$ \frac{\partial L}{\partial S}(q, \dot{q}, S) \delta S = \langle F^{\text{fr}}(q, \dot{q}, S), \delta q \rangle, $$

with the endpoints of $q(t)$ fixed and one imposes the *nonlinear nonholonomic constraints*:

$$ \frac{\partial L}{\partial S}(q, \dot{q}, S) \dot{S} = \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle - P_H^{\text{ext}}. \qquad (1.1) $$

Here $P_H^{\text{ext}}$ denotes the external heat power supply, $F^{\text{fr}}$ denotes the friction force, of phenomenological nature, and $T := -\frac{\partial L}{\partial S}$ is the temperature. The constraint (1.1) is thus a *phenomenological constraint* that encodes the entropy production of the system: $\dot{S} = I + \frac{1}{T} P_H^{\text{ext}}$, where $I = -\frac{1}{T} \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle$ is the *internal entropy production*.

Later, we will come back to this variational formulation and will show how the dynamics of various discrete systems such as mechanical systems with friction, matter transfer, chemical reactions and electric circuits can be derived from this variational formulation.

**Contributions of the paper.** The main contributions of this paper are as follows:

* Given a Lagrangian of the irreversible system, the phenomenological laws relating thermodynamic affinities and irreversible fluxes, and the power due to transfer of heat or matter between the system and the exterior, our variational formulation yields the time evolution equations for the nonequilibrium dynamics of this system in accordance with the two fundamental laws in Stueckelberg’s axiomatic formulation of thermodynamics.

* It is well known that the evolution equations of *classical mechanics* can be derived and studied by the Lagrangian formulation using the *critical action principle of Hamilton*. Such a formulation is especially well suited to study symmetries and naturally extends to mechanical systems with nonholonomic constraints and/or subject to external forces, via the *Lagrange-d'Alembert principle*. Our variational formulation is an *extension of this general setting to nonequilibrium thermodynamic systems*. In particular, it allows for the study of symmetries of the system and for the implementation of the reduction processes associated to these symmetries.

* The formulation unifies in a systematic way a wide class of examples appearing in nonequilibrium thermodynamics, ranging from electric circuits and matter transfer, to chemical reactions. It therefore helps the understanding of the analogy between various examples, which is of primordial importance for the future developments of nonequilibrium thermodynamics, whose main difficulties is essentially due to its *multiphysical character*.
* Being derived from a geometric point of view, the formulation automatically produces intrinsic (coordinate free) equations of motion. In particular, it provides a geometrically meaningful setting for the derivation of phenomenological laws among irreversible fluxes and thermodynamic forces.

## 2 Some preliminaries

In this section we present the fundamental laws of thermodynamics following the approach of Stueckelberg, we recall the definition of simple and discrete systems in thermodynamics, and we review the Lagrange-d'Alembert principle in nonholonomic mechanics. These notions are fundamental for our developments in Part II of the present paper, Gay-Balmaz and Yoshimura [2016].

**The fundamental laws of thermodynamics.** We follow the axiomatic formulation of thermodynamics developed by Stueckelberg around 1960 (see, for instance, Stueckelberg and Scheurer [1974]), which is extremely well suited for accounting for irreversible processes as a general macroscopic dynamic theory that extends classical mechanics to nonequilibrium thermodynamic systems. In his axiomatic approach, Stueckelberg introduced two state functions, the energy and the entropy obeying the two fundamental laws of thermodynamics, formulated as first order differential equations. The equations describing the dynamic evolution of the system can be derived by using exclusively the two fundamental laws in a systematic way. We refer to e.g. Gruber [1999], Ferrari and Gruber [2010], Gruber and Brechet [2011] for the systematic use of Stueckelberg's formulation in several examples.

**Stueckelberg's axiomatic formulation of thermodynamics.** Let us denote by $\Sigma$ a physical system and by $\Sigma^{\text{ext}}$ its exterior. The state of the system is defined by a set of mechanical variables and a set of thermal variables. State functions are functions of these variables.

**First law:** For every system $\Sigma$, there exists an extensive scalar state function $E$, called energy, which satisfies

$$ \frac{d}{dt} E(t) = P_W^{\text{ext}}(t) + P_H^{\text{ext}}(t) + P_M^{\text{ext}}(t), $$

where $t$ denotes time, $P_W^{\text{ext}}(t)$ is the power due to external forces acting on the mechanical variables of the system, $P_H^{\text{ext}}(t)$ is the power due to heat transfer, and $P_M^{\text{ext}}(t)$ is the power due to matter transfer between the system and the exterior.

### Thermodynamic systems:

Given a thermodynamic system, the following terminology is generally adopted:

* A system is said to be **closed** if there is no exchange of matter, i.e., $P_M^{\text{ext}}(t) = 0$.

* A system is said to be **adiabatically closed** if it is closed and there is no heat exchanges, i.e., $P_M^{\text{ext}}(t) = P_H^{\text{ext}}(t) = 0$.

* A system is said to be **isolated** if it is adiabatically closed and there is no mechanical power exchange, i.e., $P_M^{\text{ext}}(t) = P_H^{\text{ext}}(t) = P_W^{\text{ext}}(t) = 0$.

From the first law, it follows that the energy of an isolated system is constant.
**Second law:** For every system $\Sigma$, there exists an extensive scalar state function $S$, called *entropy*, which obeys the following two conditions (see Stueckelberg and Scheurer [1974], p.23)

(a) Evolution part:

If the system is adiabatically closed, the entropy $S$ is a non-decreasing function with respect to time, i.e.,

$$ \frac{d}{dt} S(t) = I(t) \geq 0, $$

where $I(t)$ is the entropy production rate of the system accounting for the irreversibility of internal processes.

(b) Equilibrium part:

If the system is isolated, as time tends to infinity the entropy tends towards a finite local maximum of the function $S$ over all the thermodynamic states $\rho$ compatible with the system, i.e.,

$$ \lim_{t \to +\infty} S(t) = \max_{\rho \text{ compatible}} S[\rho]. $$

By definition, the evolution of an isolated system is said to be reversible if $I(t) = 0$, namely, the entropy is constant. In general, the evolution of a system $\Sigma$ is said to be reversible, if the evolution of the total isolated system with which $\Sigma$ interacts is reversible.

The laws of thermodynamics are often formulated in terms of differentials, especially for equilibrium thermodynamics. Note that since $E$ is a state function, we can form its differential $dE$, which is an exact form on the state space. We can therefore write the left hand side of the first law of thermodynamics as

$$ \frac{d}{dt} E(t) = \langle dE(\zeta(t)), \dot{\zeta}(t) \rangle, $$

where $\zeta$ denotes the collection of all state variables and the vector $\dot{\zeta}$ on the state space is its time derivative. However, it is important to note that $P_W^{\text{ext}}$, $P_H^{\text{ext}}$ and $P_M^{\text{ext}}$ are not necessarily given in terms of the pairing between differential forms and vector fields. It turns out that in some particular situations they can be described in terms of such a pairing, but this is *not always case* in general, nor required by the fundamental laws of thermodynamics.

**Discrete systems and simple systems.** A discrete system $\Sigma$ is a collection $\Sigma = \cup_{A=1}^N \Sigma_A$ of a finite number of interacting simple systems $\Sigma_A$. By definition, following Stueckelberg and Scheurer [1974], a simple system<fnref n="1" /> $\Sigma$ is a macroscopic system for which one (scalar) thermal variable $\tau$ and a finite set $(\xi^1, ..., \xi^n)$ of mechanical variables are sufficient to describe entirely the state of the system. From the second law of thermodynamics, we can always choose $\tau$ as the entropy $S$.

We shall first present our Lagrangian formulation for the case of simple systems and we will illustrate it for four representative examples, namely, the case of mechanics coupled with one thermal equation, the case of chemical reactions, the case of matter transfer, and the case of a nonlinear RLC circuit. For simple systems, no internal heat transfer can occur. Then we shall extend our approach so that we can treat the case of an arbitrary discrete system $\Sigma = \cup_{A=1}^N \Sigma_A$, in which internal heat exchanges can occur. The theory will be illustrated with the examples of the two-cylinder problem and the thermodynamics of electric circuits.

<footnote n="1">¹In Stueckelberg and Scheurer [1974] they are called élément de système (French). We choose to use the English terminology simple system instead of system element.</footnote>
**The Lagrange-d'Alembert principle for nonholonomic mechanics.** As mentioned previously, our variational derivation of the equations of nonequilibrium thermodynamics is based on a *generalization* of the Lagrange-d'Alembert principle for *nonholonomic mechanical systems*. Before going into details, we will review the conventional variational formulations that have been developed in mechanics.

**Linear nonholonomic constraints.** Consider a mechanical system with an $n$ dimensional configuration manifold $Q$ and a Lagrangian function $L: TQ \to \mathbb{R}$ defined on the tangent bundle (velocity phase space, or state space) of the manifold $Q$. We will use the local coordinates $(q, \dot{q})$ for an element in $TQ$. We suppose that the motion is constrained by a regular distribution (i.e., a smooth vector subbundle) $\Delta_Q = \{\dot{q} \in T_qQ | \phi^a(q, \dot{q}) = \langle \omega^a(q), \dot{q} \rangle = 0\} \subset TQ$, where $\omega^a, a = 1, ..., r < n$ are given one-forms on $Q$ and the constraints are linear in velocity. We denote by $\Delta_Q(q) \subset T_qQ$ the vector fiber of $\Delta_Q$ at $q \in Q$. We recall that the constraint $\Delta_Q$ is holonomic if and only if for all $q \in Q$ there exists a submanifold $N \subset Q$ with $q \in N$ and such that $\Delta_Q|_N = TN$. Otherwise the constraint is said to be nonholonomic. We also assume that the system is subject to an exterior force, given by a fiber preserving map $F^{\text{ext}}: TQ \to T^*Q$, not necessarily linear on the fibers. Here $T^*Q$ denotes the cotangent bundle (momentum phase space) of $Q$. We shall denote by $\langle \alpha_q, v_q \rangle$ the pairing between $\alpha_q \in T_q^*Q$ and $v_q \in T_qQ$.

The equations of motion for *nonholonomic mechanics* are obtained by application of the *Lagrange-d'Alembert principle*

$$ \delta \int_{t_1}^{t_2} L(q, \dot{q}) dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}(q, \dot{q}), \delta q \rangle dt = 0, \quad (2.1) $$

where $\dot{q} \in \Delta_Q$ and the variations $\delta q$ are such that $\delta q \in \Delta_Q$ and with $\delta q(t_1) = \delta q(t_2) = 0$. The resulting equations are called the *Lagrange-d'Alembert equations*, which are given by

$$ \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} - F^{\text{ext}}(q, \dot{q}) = F^c, \quad \dot{q} \in \Delta_Q. \quad (2.2) $$

In the above, $F^c$ denotes constraint forces, which is expressed by using Lagrange multipliers $\lambda_a$ as $F^c = \lambda_a \omega^a(q) \in \Delta_Q^\circ(q)$, where $\Delta_Q^\circ = \{\alpha_q \in T^*Q | \langle \alpha_q, v_q \rangle = 0, \forall v_q \in \Delta_Q(q)\}$ is the annihilator of $\Delta_Q$. For an extended discussion of the Lagrange-d'Alembert equations for nonholonomic mechanics as well as for several references on the subject, see, for instance, *Bloch* [2003]. Here it is important to note that the Lagrange-d'Alembert principle (2.1) is only valid for the special case of *linear* nonholonomic constraints.

**Nonlinear nonholonomic constraints.** As we will see, our treatment of nonequilibrium thermodynamics involves *nonlinear nonholonomic constraints* and hence we cannot employ the conventional Lagrange-d'Alembert principle (2.1) for our purpose of formulating nonequilibrium thermodynamics. For the systems with nonlinear nonholonomic constraints, several variational formulations have been developed.

i) One can develop *Hamilton's variational principle* over the curves $q(t)$ satisfying the nonlinear nonholonomic constraints $C = \{(q, \dot{q}) \in TQ | \phi^a(q, \dot{q}) = 0\} \subset TQ$. Such a principle would use Lagrange multipliers $\lambda_a$ to construct an augmented Lagrangian $L(q, \dot{q}) + \lambda_a \phi^a(q, \dot{q})$ to yield Euler-Lagrange equations from the critical condition of the action integral. However, the resultant Euler-Lagrange equations *do not* describe the evolution equation for nonholonomic mechanics, but different dynamics called the *vakonomic mechanics* (see *Arnold* [1988]; *Jimenez and Yoshimura* [2015]), which are useful in optimal control problems. Even for the case of linear nonholonomic systems
in which there is no external force $F^{\text{ext}}(q, \dot{q})$, the Euler-Lagrange equations developed from Hamilton's principle for the augmented Lagrangian $L(q, \dot{q}) + \lambda_a \langle \omega^a(q), \dot{q} \rangle$ are essentially different from the Lagrange-d'Alembert equations (2.2) obtained from the Lagrange-d'Alembert principle (2.1). The difference between the two variational formulations lie in the way of taking variations; namely, in the Lagrange-d'Alembert principle, constraints are only imposed on the velocity $\dot{q}(t)$, i.e., at $\varepsilon = 0$, and on the variations $\delta q(t) = \frac{d}{d\varepsilon}\Big|_{\varepsilon=0} q_{\varepsilon}(t)$, while in the vakonomic formulation, the constraints are imposed on the velocity vectors of $q_{\varepsilon}(t)$ for all $\varepsilon$ in a neighborhood of 0. We also note that in the Lagrange-d'Alembert principle, the constraint $\Delta_Q$ has a double role. On one hand, it imposes kinematic constraints on the velocity $\dot{q}(t)$. On the other hand, it imposes variational constraints on the admissible variations $\delta q(t)$ of a curve $q(t)$.

ii) Some generalization of the Lagrange-d'Alembert principle to nonlinear nonholonomic mechanics was developed in Chetaev [1934], see also Appell [1911], Pironneau [1983]. In Chetaev's approach, the variational constraint is derived from the nonlinear constraint submanifold. Namely, given a nonlinear constraint $C_K = \{(q, \dot{q}) \in TQ \mid R^a(q, \dot{q}) = 0\} \subset TQ$, the variational constraint is defined by $C_V(q, \dot{q}) = \{(q, \dot{q}, \delta q) \in TQ \times_Q TQ \mid \mathbb{F}R(q, \dot{q}) \cdot \delta q = 0\}$, where $\mathbb{F}R$ denotes the fiber derivative of $R$. The variational formulation in Chetaev's approach is given by

$$\delta \int_{t_0}^{t_1} L(q, \dot{q}) dt = 0,$$

which holds for variations $\delta q \in C_V(q, \dot{q})$ and with $(q, \dot{q}) \in C_K$. The equations read

$$\frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = \lambda_a \frac{\partial R^a(q, \dot{q})}{\partial \dot{q}},$$

where $\lambda_a$ are Lagrangian multiplier. However, it has been pointed out in Marle [1998] that this principle does not always lead us to the correct equations of motion for mechanical systems and also that in general one has to consider the nonlinear constraint on velocities and the variational constraint as independent notions. Again, the nonequilibrium thermodynamics is the case to which one can not apply Chetaev's approach.

iii) A general geometric approach to nonholonomic systems with nonlinear and (possibly) higher order constraints has been developed by Cendra, Ibort, de León, and Martín de Diego [2004]. It generalizes both the conventional Lagrange-d'Alembert principle and Chetaev's approach. Given a nonlinear constraint $C_K \subset T^{(k)}Q$ and a variational constraint $C_V \subset T^{(l)}Q \times TQ$, where $k, l \in \mathbb{N}$ denote the order of derivative, the variational formulation is given by

$$\delta \int_{t_0}^{t_1} L(q, \dot{q}) dt = 0,$$

which holds for variations $\delta q \in C_V(q^{(l)})$ and with $q^{(k)} \in C_K$. It follows

$$\frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} \in C_V(q^{(l)})^{\circ}, \quad q^{(k)} \in C_K.$$

It is important to point out that for these generalizations, including Chetaev's approach, the energy may not be conserved along the solution of the equations of motion. This implies that this geometric approach includes the case of non-ideal constraints. From a mathematical point of view, our variational formulation for nonequilibrium thermodynamics in this paper falls into this general setting ($k = 1, l = 1$). Consistently with the first law, in our setting the constraints are ideal if and only if the system is isolated.
## 3 Variational formulation for nonequilibrium thermodynamics of simple systems

In order to present our formulation, let us first consider a simple and closed system, so $P_M^{\text{ext}} = 0$. In this case, the Lagrangian of the system is a function $L = L(q, \dot{q}, S) : TQ \times \mathbb{R} \to \mathbb{R}$. We assume that the system is subject to an exterior force $F^{\text{ext}} : TQ \times \mathbb{R} \to T^*Q$ so the associated mechanical power is $P_W^{\text{ext}} = \langle F^{\text{ext}}(q, \dot{q}, S), \dot{q} \rangle$. We also assume that there is a friction force $F^{\text{fr}} : TQ \times \mathbb{R} \to T^*Q$. The forces are assumed to be fiber preserving, that is, $F^{\text{ext}}(q, \dot{q}, S) \in T_q^*Q$ and $F^{\text{fr}}(q, \dot{q}, S) \in T_q^*Q$, for all $(q, \dot{q}) \in TQ$, for all $S \in \mathbb{R}$.

As before, we denote by $P_H^{\text{ext}}(t)$ the power due to heat transfer between the system and the exterior, where $t$ indicates time. Hence we note that $P_H^{\text{ext}}(t)$ is a time dependent function. This time dependence can arise through a dependence on the state variables $q(t)$, $\dot{q}(t)$, and $S(t)$, but an explicit dependence on time is also allowed. For simplicity, we have assumed that the exterior force $F^{\text{ext}}$ depends on time only through the state variables $(q(t), \dot{q}(t), S(t))$. However, this is not necessarily the case, and our formulation may include the more general case of an explicit dependence of $F^{\text{ext}}$ on time.

We shall show the following theorem, stating that the coupled differential equations describing the mechanical and thermal evolution of a simple closed system can be obtained by a generalization of the Lagrange-d'Alembert principle of nonholonomic mechanics with a nonlinear constraint given by the evolution part of the second law of thermodynamics in Stueckelberg's formulation. In absence of thermal effects, this principle recovers the Hamilton principle of classical mechanics.

**Theorem 3.1 (Variational formulation for nonequilibrium thermodynamics of closed simple systems).** Consider a simple closed system with Lagrangian $L : TQ \times \mathbb{R} \to \mathbb{R}$, external and friction forces $F^{\text{ext}}$, $F^{\text{fr}} : TQ \times \mathbb{R} \to T^*Q$, and external heat power $P_H^{\text{ext}}$. Suppose that the curve $(q(t), S(t))$ on $Q \times \mathbb{R}$, where $t \in [t_1, t_2] \subset \mathbb{R}$, satisfies the variational condition

$$ \delta \int_{t_1}^{t_2} L(q, \dot{q}, S)dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}(q, \dot{q}, S), \delta q \rangle = 0, \quad \text{VARIATIONAL CONDITION} \quad (3.1) $$

for the admissible variations $(\delta q(t), \delta S(t))$ of the curve $(q(t), S(t))$ subject to the constraint

$$ \frac{\partial L}{\partial S}(q, \dot{q}, S)\delta S = \langle F^{\text{fr}}(q, \dot{q}, S), \delta q \rangle, \quad \text{VARIATIONAL CONSTRAINT} \quad (3.2) $$

with $\delta q(t_1) = \delta q(t_2) = 0$, and with the nonlinear nonholonomic constraint

$$ \frac{\partial L}{\partial S}(q, \dot{q}, S)\dot{S} = \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle - P_H^{\text{ext}}. \quad \text{PHENOMENOLOGICAL CONSTRAINT} \quad (3.3) $$

Then, the curve $(q(t), S(t))$ satisfies the following evolution equations for the thermodynamics of the simple closed system

$$ \left\{ \begin{array}{l} \displaystyle \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = F^{\text{ext}}(q, \dot{q}, S) + F^{\text{fr}}(q, \dot{q}, S), \\[1em] \displaystyle \frac{\partial L}{\partial S} \dot{S} = \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle - P_H^{\text{ext}}. \end{array} \right. \quad (3.4) $$

**Proof.** The variational derivation of the equations of evolution proceeds as follows. Taking variations of the integral in (3.1), integrating by part and using $\delta q(t_1) = \delta q(t_2) = 0$, it follows

$$ \int_{t_1}^{t_2} \left( \left\langle \frac{\partial L}{\partial q}, -\frac{d}{dt} \frac{\partial L}{\partial \dot{q}} + F^{\text{ext}}, \delta q \right\rangle + \frac{\partial L}{\partial S} \delta S \right) dt = 0, $$
where the variations $\delta q$ and $\delta S$ have to satisfy the variational constraint (3.2) together with the nonholonomic constraint (3.3). Now, replacing $\frac{\partial L}{\partial S} \delta S$ by the virtual work expression $\langle F^{\text{fr}}(q, \dot{q}, S), \delta q \rangle$ according to (3.2), it provides the differential equation (3.4) for the simple closed system with *coupled mechanical and thermal processes*.

**Remark 3.2.** We first note that the explicit expression of the constraint (3.3) involves phenomenological laws for the friction force $F^{\text{fr}}$, this is why we refer to it as a *phenomenological constraint*. The associated constraint (3.2) is called a *variational constraint* since it is a condition on the variations to be used in (3.1). The constraint (3.2) follows from (3.3) by formally replacing the velocity by the corresponding virtual displacement, and by removing the contribution from the exterior of the system. Such a simple correspondence between the phenomenological and virtual constraints will still hold in the more general thermodynamic systems considered later. We also note that since (3.3) is a nonlinear constraint in general, our principle does not follow from the standard Lagrange-d'Alembert principle (2.1).

From a mathematical point of view our variational formulation (Theorem 3.1) falls into the setting studied in Cendra, Ibort, de León, and Martín de Diego [2004] for nonholonomic mechanics, while we emphasize that it does *not* follows Chetaev's approach, that is, if we derive the variational constraint from the nonlinear nonholonomic constraint (3.3) following Chetaev's approach, then we cannot obtain (3.2). As we shall see below, the *energy is preserved when the system is isolated*, i.e., when $P_W^{\text{ext}} = P_H^{\text{ext}} = P_M^{\text{ext}} = 0$, consistently with the first law of thermodynamics.

**The particular case.** In order to illustrate this formulation, let us consider the following particular form of the Lagrangian as

$$L(q, \dot{q}, S) := K_{\text{mech}}(q, \dot{q}) - U(q, S), \qquad (3.5)$$

where $K_{\text{mech}}: TQ \to \mathbb{R}$ denotes the kinetic energy of the mechanical part of the system (assumed to be independent of $S$) and $U: Q \times \mathbb{R} \to \mathbb{R}$ denotes the *potential energy*, which is a function of both the mechanical displacement $q$ and the entropy $S$. This situation will be illustrated with the example of a mass-spring system with friction in §3.1.

By introducing the *generalized internal forces*

$$F^{\text{int}}(q, S) := -\frac{\partial U}{\partial q}(q, S), \qquad (3.6)$$

we can rewrite the system (3.4) in terms of $K_{\text{mech}}$ and $U$ as

$$\left\{
\begin{array}{l}
\displaystyle \frac{d}{dt} \frac{\partial K_{\text{mech}}}{\partial \dot{q}} - \frac{\partial K_{\text{mech}}}{\partial q} = F^{\text{int}}(q, S) + F^{\text{ext}}(q, \dot{q}, S) + F^{\text{fr}}(q, \dot{q}, S), \\
\\
\displaystyle \frac{\partial U}{\partial S} \dot{S} = - \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle + P_H^{\text{ext}}.
\end{array}
\right.
\qquad (3.7)$$

Examples of such systems have been derived in Gruber [1997], Gruber and Brechet [2011] by using exclusively the first and second laws of thermodynamics in Stueckelberg and Scheurer [1974].

**Definition 3.3.** Given a Lagrangian $L: TQ \times \mathbb{R} \to \mathbb{R}$, the energy $E: TQ \times \mathbb{R} \to \mathbb{R}$ is defined by

$$E(q, \dot{q}, S) := \left\langle \frac{\partial L}{\partial \dot{q}}, \dot{q} \right\rangle - L(q, \dot{q}, S).$$
**Proposition 3.4.** Let $(q(t), S(t))$ be a solution curve of the simple thermodynamic system in (3.1). Then, the energy balance law holds along the curve

$$ \frac{d}{dt} E(q(t), S(t)) = P_W^{\text{ext}} + P_H^{\text{ext}}, \text{i.e.,} $$

where $P_W^{\text{ext}} = \langle F^{\text{ext}}, \dot{q} \rangle$.

**Proof.** By direct computations using the system (3.4), we obtain

$$ \frac{d}{dt} E = \left\langle \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q}, \dot{q} \right\rangle - \frac{\partial L}{\partial S} \dot{S} = P_W^{\text{ext}} + P_H^{\text{ext}}, \qquad (3.8) $$

which is consistent with the first law of thermodynamics. ■

Note that in the particular case of the Lagrangian (3.5), the energy decomposes as $E(q, \dot{q}, S) = E_{\text{mech}}(q, \dot{q}) + U(q, S)$, where $E_{\text{mech}}: TQ \to \mathbb{R}$, defined by $E_{\text{mech}}(q, \dot{q}) = \langle \frac{\partial K_{\text{mech}}}{\partial \dot{q}}, \dot{q} \rangle - K_{\text{mech}}(q, \dot{q})$ is the mechanical energy. It is instructive to consider the energy balances for both $E_{\text{mech}}$ and $U$. Using (3.6) and (3.7), we have

$$ \frac{d}{dt} E_{\text{mech}} = \langle F^{\text{fr}}, \dot{q} \rangle + \langle F^{\text{int}}, \dot{q} \rangle + \langle F^{\text{ext}}, \dot{q} \rangle = \langle F^{\text{fr}}, \dot{q} \rangle + \langle F^{\text{int}}, \dot{q} \rangle + P_W^{\text{ext}}, $$

$$ \frac{d}{dt} U = \frac{\partial U}{\partial S} \dot{S} + \left\langle \frac{\partial U}{\partial q}, \dot{q} \right\rangle = - \langle F^{\text{fr}}, \dot{q} \rangle - \langle F^{\text{int}}, \dot{q} \rangle + P_H^{\text{ext}}, $$

consistently with (3.8). Note that the internal and friction forces are thus responsible for exchanges between the mechanical and internal energies.

**Entropy production.** The temperature is given by minus the partial derivative of the Lagrangian with respect to the entropy, $T = -\frac{\partial L}{\partial S}$, which is assumed to be positive. So the second equation in (3.4) reads

$$ T \dot{S} = P_H^{\text{ext}} - \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle. $$

According to the second law of thermodynamics, for an adiabatically closed systems, i.e., when $P_H^{\text{ext}} = P_M^{\text{ext}} = 0$, the entropy is increasing. So the friction force $F^{\text{fr}}$ must be dissipative, that is $\langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle \le 0$, for all $(q, \dot{q}, S) \in TQ \times \mathbb{R}$. For the case in which the force is linear in velocity, i.e., $F^{\text{fr}}(q, \dot{q}, S) = -\lambda(q, S)(\dot{q}, -)$, where $\lambda(q, S) : T_q Q \times T_q Q \to \mathbb{R}$ is a 2 covariant tensor field, this implies that the symmetric part $\lambda^{\text{sym}}$ of $\lambda$ has to be positive. For a simple system, the **internal entropy production** is therefore of the form

$$ I(t) = -\frac{1}{T} \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle. $$

We will see later in §4 that for discrete systems $I(t)$ can have a more general expression.

**Remark 3.5 (Free energy formulation).** It is possible to write a variational formulation based on the free energy for simple systems. In this case the temperature, rather than the entropy, is seen as a primitive variable. This will be done later in §4.2 in the more general case of discrete (not necessarily simple) systems and needs the introduction of the new variables $\gamma$ and $\sigma$.

**Remark 3.6.** In the above macroscopic description, it is assumed that the macroscopically “slow” or collective motion of the system can be described by $q(t)$, while the time evolution of the entropy $S(t)$ is determined from the microscopically “fast” motions of molecules
through statistical mechanics under the assumption of the local equilibrium condition. It follows from statistical mechanics that the internal energy $U(q, S)$, given as a potential energy at the macroscopic level, is essentially coming from the total kinetic energy associated with the microscopic motion of molecules, which is directly related to the temperature of the system.

We now illustrate our Lagrangian variational formulation (Theorem 3.1) with various examples of simple systems. We first consider examples from mechanical systems coupled with thermodynamics. Then we treat the case of the nonequilibrium thermodynamics of chemical reactions, electric circuits. Finally, we also consider the case of matter diffusion transfer through a membrane as well as its coupling with chemical reactions.

## 3.1 Mechanical systems with thermodynamics

**Example: the one-cylinder problem.** Let us consider a gas confined by a piston in a cylinder as in Fig. 3.1. This is supposed to be a closed system (i.e., $P_M^{ext} = 0$). The state of the system can be characterized by the three variables $(x, \dot{x}, S)$. The equations of motion for dynamics of this system were derived in Gruber [1999] by using exclusively the two laws of thermodynamics, as formulated by Stueckelberg and Scheurer [1974]. Here we shall derive these equations by using the variational formulation of Theorem 3.1.

<figure><img src="image_2.png" /><figcaption>Figure 3.1: One-cylinder</figcaption></figure>

The Lagrangian is $L(x, \dot{x}, S) = K_{\text{mech}}(x, \dot{x}) - U(x, S) = \frac{1}{2}m\dot{x}^2 - U(x, S)$, where $m$ is the mass of the piston, $U(x, S) := U(S, V = Ax, N_0)$ is the internal energy of the gas$^2$, $N_0$ is the number of moles, $V = Ax$ is the volume, and $A$ is the area of the cylinder.

The temperature and the generalized internal force are respectively given by

$$T(x, S) = \frac{\partial U}{\partial S}(x, S), \quad \text{and} \quad F^{\text{int}}(x, S) = -\frac{\partial U}{\partial x}(x, S) = p(x, S)A,$$

where $p = -\frac{\partial U}{\partial V}$ is the pressure. The friction force reads $F^{\text{fr}}(x, \dot{x}, S) = -\lambda(x, S)\dot{x}$, where $\lambda(x, S) \ge 0$ is the phenomenological coefficient, determined experimentally. Hence, it follows

$$U(S, N, V) = U_0 e^{\frac{1}{cR} \left( \frac{S}{N} - \frac{S_0}{N_0} \right)} \left( \frac{N}{N_0} \right)^{\frac{1}{c}+1} \left( \frac{V_0}{V} \right)^{\frac{1}{c}}.$$

<footnote>$^2$The state functions for a perfect gas are $U = cNRT$ and $pV = NRT$, where $c$ is a constant depending exclusively on the gas (e.g. $c = \frac{3}{2}$ for monoatomic gas, $c = \frac{5}{2}$ for diatomic gas) and $R$ is the universal gas constant. From this, it is deduced that the internal energy reads</footnote>
from Theorem 3.1 that the phenomenological constraint is

$$ \frac{\partial U}{\partial S} \dot{S} = \lambda(x, S) \dot{x}^2 + P_H^{\text{ext}} $$

and the variational formulation reads

$$ \delta \int_{t_1}^{t_2} \left[ \frac{1}{2} m \dot{x}^2 - U(x, S) \right] dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}(q, \dot{q}, S), \delta q \rangle dt = 0, $$

subject to the variational constraint

$$ \frac{\partial U}{\partial S} \delta S = \lambda(x, S) \dot{x} \delta x. $$

It yields the time evolution equation of the coupled mechanical and thermal system for the one-cylinder problem:

$$ m \ddot{x} = p(x, S) A + F^{\text{ext}} - \lambda(x, S) \dot{x}, \quad T \dot{S} = \lambda(x, S) \dot{x}^2 + P_H^{\text{ext}}, $$

consistently with the equations derived by Gruber [1999, §4]. In particular, the balance of mechanical and internal energies are

$$ \frac{d}{dt} E_{\text{mech}} = p(x, S) A \dot{x} + F^{\text{ext}} \dot{x} - \lambda(x, S) \dot{x}^2, \quad \frac{d}{dt} U = -p(s, x) A \dot{x} + \lambda(x, S) \dot{x}^2 + P_H^{\text{ext}}, $$

by which one can easily verify the energy balance law $\frac{d}{dt} E = F^{\text{ext}} \dot{x} + P_H^{\text{ext}}$, where $E = E_{\text{mech}} + U$ is the total energy.

**Example: a mass-spring system with friction.** The nonequilibrium thermodynamics of a mass-spring system with friction was considered in Ferrari and Gruber [2010], see Fig. 3.2. In order to apply our approach, we consider the Lagrangian of the thermodynamic system given by $L(x, \dot{x}, S) = \frac{1}{2} m \dot{x}^2 - \frac{1}{2} k(S) x^2 - U(S)$, where $m$ is a mass and $k(S)$ is a spring constant. In general, $k$ does not depend very strongly on $S$ (or equivalently on temperature), but we have included this dependence here to illustrate the generality of our approach. The friction force is $F^{\text{fr}}(x, \dot{x}, S) = -\lambda(x, S) \frac{\dot{x}}{|\dot{x}|}$ and we assume that the system is subject to an external force $F^{\text{ext}}$. As before, the power due to heat transfer between the system and the exterior is denoted by $P_H^{\text{ext}}$. From the thermodynamic point of view, the microscopic variables have disappeared at the macroscopic level and have been replaced by the single variable $S$.

The temperature reads

$$ T(x, S) = - \frac{\partial L}{\partial S} = \frac{1}{2} \frac{\partial k}{\partial S} x^2 + \frac{\partial U}{\partial S}. $$

Since the internal energy does not depend on $x$, there is no generalized internal forces. The system (3.4) yields the time evolution equation of the coupled mechanical and thermal system:

$$ \frac{d}{dt} (m \dot{x}) = -k(S)x + F^{\text{ext}} - \lambda(x, S) \frac{\dot{x}}{|\dot{x}|}, \quad \dot{S} = \frac{1}{T} \lambda(x, S) |\dot{x}| + \frac{1}{T} P_H^{\text{ext}}. \quad (3.9) $$

The total energy is $E(x, \dot{x}, S) = \frac{1}{2} m \dot{x}^2 + \frac{1}{2} k(S) x^2 + U(S)$ verifies $\frac{d}{dt} E = P_W^{\text{ext}} + P_H^{\text{ext}}$.

Note that in general, we have $T = -\frac{\partial L}{\partial S}$ and not necessarily $T = \frac{\partial U}{\partial S}$, where $U(S)$ is the internal energy of the system. In the present example this is due to the fact that the mechanical potential energy also depends on $S$, through the coefficient $k(S)$. If the dependence of $k$ and $\lambda$ on $S$ can be neglected, then the first equation in (3.9) can be solved independently of the thermodynamic equation. This justifies the conventional study of friction in mechanics without taking into account the thermodynamic effects (Ferrari and Gruber [2010]).
<figure><img src="image_3.png" /><figcaption>Figure 3.2: Friction of a solid attached to a spring</figcaption></figure>

## 3.2 Electric circuits with entropy production

In any real (i.e., non-ideal) electric circuit, an *irreversible energy conversion from electrical energy into heat* occurs and hence leads to the *entropy production*. We shall describe the thermodynamics of such electric circuits by using our nonholonomic Lagrangian formulation.

In absence of thermodynamic effects, the Lagrangian formulation for electric circuits has been well established. It is based on the electric and magnetic energies in the circuit and the interconnection constraints expressed by the Kirchhoff laws. We refer to Chua and McPherson [1974] for the Lagrangian formulations of electric circuits. In particular, regarding the variational formulation as degenerate Lagrangian systems with KCL constraints and Dirac structures, see Yoshimura and Marsden [2006a,b,c].

Consider a serial nonlinear RLC circuit with a voltage source, as illustrated in Fig. 3.3, with one single entropy variable. The general case will be discussed in §4.

<figure><img src="image_4.png" /><figcaption>Figure 3.3: A nonlinear RLC circuit with a voltage source</figcaption></figure>

Since our formulation is well adapted for both linear and nonlinear circuit elements such as charge-controlled capacitors, current controlled inductors, current controlled resistors, etc., we shall directly consider the nonlinear case. Recall that the constitutive relations of these elementary circuit elements are respectively given by $V = V_C(q)$, and $\phi = \phi_L(I)$, $V = V_R(I)$, where $q$ is the charge, $I = \dot{q}$ is the current, $\phi$ is the magnetic flux, and $V_L = \dot{\phi}$ is the inductor voltage. The total energy stored in this circuit is

$$E(q, \dot{q}, S) = K_L(\dot{q}) + U_C(q) + U(S),$$

where $K_L(\dot{q})$ is the magnetic energy stored by the inductor, i.e., $\phi_L(\dot{q}) = \frac{\partial K_L}{\partial \dot{q}}$, $U_C(q)$ is the electric energy stored by the capacitor, i.e., $V_C(q) = \frac{\partial U_C}{\partial q}$, and $U(S)$ is the internal energy,
i.e., $T = \frac{\partial U}{\partial S}$. The Lagrangian of the nonlinear circuit is therefore given by

$$L(q, \dot{q}, S) = K_L(\dot{q}) - U_C(q) - U(S).$$

For the linear case, the constitutive relations are given by $V = \frac{1}{C}q$ and $\varphi = LI$, so that we recover the usual expressions $U_C(q) = \frac{1}{2C}q^2$ and $K_L(\dot{q}) = \frac{1}{2}L\dot{q}^2$.

In this simple case, the dissipative effect due to friction, which contributes to the entropy production, is modelled by a single resistor in series, so $F^{\text{fr}}(q, \dot{q}, S) = V_R(q, \dot{q}, S) = -R(q, S)\dot{q}$, where $R(q, S)$ is a positive coefficient of the resistance. The voltage source is given by an external force $F^{\text{ext}}(q, \dot{q}, S) = V^{\text{ext}}$ and we assume an external heat power $P_H^{\text{ext}}$.

The system (3.4) yields the equations

$$\frac{d}{dt}\varphi_L(\dot{q}) + V_C(q) = V_R(q, \dot{q}, S) + V^{\text{ext}}, \quad \dot{S} = -\frac{1}{T}V_R(q, \dot{q}, S)\dot{q} + \frac{1}{T}P_H^{\text{ext}},$$

where $V_R(q, \dot{q}, S) = -R(q, S)\dot{q}$ is dissipative, i.e., $V_R(q, \dot{q}, S)\dot{q} = -R(q, S)\dot{q}^2 \le 0$, for all $\dot{q}$. The entropy production can be rewritten exclusively in terms of the stored energy associated to the capacitor and the inductor as

$$\begin{aligned} \dot{S} &= -\frac{1}{T}V_R(q, \dot{q}, S)\dot{q} + \frac{1}{T}P_H^{\text{ext}} \\ &= \frac{1}{T}\left[\left(-\frac{d}{dt}\varphi_L(\dot{q}) - V_C(q) + V^{\text{ext}}\right)\dot{q} + P_H^{\text{ext}}\right] \quad (3.10) \\ &= \frac{1}{T}\left[-\frac{d}{dt}(K_L(\dot{q}) + U_C(q)) + P_W^{\text{ext}} + P_H^{\text{ext}}\right], \end{aligned}$$

where the equality $(\frac{d}{dt}\varphi_L(\dot{q}) + V_C(q))\dot{q} = \frac{d}{dt}(K_L(\dot{q}) + U_C(q))$ follows from a direct computation using the definitions of $\varphi_L$ and $U_C$. By analogy with mechanics, we denoted by $P_W^{\text{ext}} := V^{\text{ext}} \cdot \dot{q}$ the external "mechanical" power exerted by the voltage source.

For the linear case, the rate of entropy production obtained in (3.10) recovers usual expressions, see for example (17.1.25) and (17.1.26) in Kondepudi and Prigogine [1998] for the entropy production in real capacitors and inductors.

## 3.3 Dynamics of simple systems with chemical reactions

**Setting for chemical reactions.** Consider a system of several chemical components undergoing chemical reactions. Let $I = 1, ..., R$ be the chemical components and $a = 1, ..., r$ the chemical reactions. We denote by $N_I$ the number of moles of the component $I$. Chemical reactions may be represented by

$$\sum_{I} \nu'_{I} I \underset{a(2)}{\overset{a(1)}{\rightleftharpoons}} \sum_{I} \nu''_{I} I, \quad a = 1, ..., r, \quad (3.11)$$

where $a_{(1)}$ and $a_{(2)}$ are forward and backward reactions associated to the reaction $a$, and $\nu''_{I}$, $\nu'_{I}$ are forward and backward stoichiometric coefficients for the component $I$ in the reaction $a$. From this relation, the number of moles $N_I$ has to satisfy

$$\frac{d}{dt}N_I = \sum_{a=1}^{r} \nu_I^a \frac{d}{dt}\psi_a, \quad I = 1, ..., R, \quad (3.12)$$

where $\nu_I^a := \nu''_{I} - \nu'_{I}$, $\psi_a$ is the degree of advancement of reaction $a$, and $\dot{\psi}_a$ is the rate of the chemical reaction $a$. The mass conservation during each reaction is given by

$$\sum_{I} m_I \nu_I^a = 0 \quad \text{for } a = 1, ..., r \quad (\text{Lavoisier law}),$$
where $m_I$ is the molecular weight of component I.

The state of the system is given by the internal energy $U = U(S, N_1, ..., N_R, V)$, which is a function of the entropy $S$, the number of moles $N_1, ..., N_R$, and the volume $V$. The chemical potential of the component I is defined by

$$ \mu^I = \frac{\partial U}{\partial N_I} $$

and the temperature is given by $T = \frac{\partial U}{\partial S}$. The affinity associated to the reaction a is the state function defined by

$$ A^a = - \sum_{I=1}^{R} \nu_I^a \mu^I, \quad a = 1, ..., r. \qquad (3.13) $$

**I) Variational formulation for chemical reactions.** We shall now develop two variational formulations for the nonequilibrium thermodynamics of chemical reactions. We assume that the reaction is isochoric $V = V_0$ (constant) and closed $P_M^{\text{ext}} = 0$. The first formulation follows from Theorem 3.1 and uses the degree of advancement as a generalized coordinate. The second formulation, that we will present in Definition 3.7 below, needs the introduction of new variables, but it has the advantage to allow us to develop a corresponding version in the continuum case, which will be of crucial use in the case of a multicomponent fluid with chemical reactions in Part II, Gay-Balmaz and Yoshimura [2016].

**First approach.** We shall now show that the coupled reaction and thermal evolution of the system can be obtained via the variational formulation of Theorem 3.1. In order to do this, we shall first use the degree of advancement (or extent of reaction) $\psi_a$, $a = 1, ..., r$ as well as the entropy $S$ as the thermodynamic variables, which characterize the nonequilibrium thermodynamics of the chemical reactions.

It follows from the time integral of (3.12) that we have

$$ N_I(t) = N_I(t_1) + \nu_I^a \psi_a(t), \quad \psi_a(t_1) = 0. \qquad (3.14) $$

Replacing this expression in the internal energy, we define the Lagrangian by

$$ L(\psi_a, S) := -U(N_1, ..., N_R, V_0, S). $$

Note that although $\dot{\psi}_a$ do not appear in the Lagrangian, but only in the friction forces, the variables $\psi_a$ are regarded as generalized coordinates so that one can apply the variational formulation in Theorem 3.1 to this system of chemical reactions. It follows

$$ -\delta \int_{t_1}^{t_2} U(S, N_1, ..., N_R, V_0) dt = 0, $$

with phenomenological and variational constraints

$$ -\frac{\partial U}{\partial S} \dot{S} = \sum_{a=1}^{r} \mathcal{F}^{\text{fr } a}(\psi_a, \dot{\psi}_a, S) \dot{\psi}_a - P_H^{\text{ext}} \quad \text{and} \quad -\frac{\partial U}{\partial S} \delta S = \sum_{a=1}^{r} \mathcal{F}^{\text{fr } a}(\psi_a, \dot{\psi}_a, S) \delta \psi_a. $$

This variational formulation provides the evolution equations (3.4) given here by

$$ \left\{ \begin{array}{l} \displaystyle \frac{\partial U}{\partial \psi^a} = \mathcal{F}^{\text{fr } a}(\psi_a, \dot{\psi}_a, S), \\ \\ \displaystyle -\frac{\partial U}{\partial S} \dot{S} = \sum_{a=1}^{r} \mathcal{F}^{\text{fr } a}(\psi_a, \dot{\psi}_a, S) \dot{\psi}_a - P_H^{\text{ext}}. \end{array} \right. $$
In the above, the variables $\mathcal{F}^{\text{fr}a}(\psi_a, \dot{\psi}_a, S)$ are responsible for entropy increase, which may have the form

$$ \mathcal{F}^{\text{fr}a}(\psi_a, \dot{\psi}_a, S) = -\lambda^{ab}(\psi_a, S)\dot{\psi}_b, $$

where the symmetric part of the matrix $\lambda^{ab}$ is positive from the second principle. It follows from (3.13) that we have

$$ \frac{\partial L}{\partial \psi_a} = -\frac{\partial U}{\partial \psi_a} = -\frac{\partial N_I}{\partial \psi_a} \frac{\partial U}{\partial N_I} = -\sum_{I=1}^{R} \nu_I^a \mu^I = \mathcal{A}^a, $$

and hence the evolution equations read

$$ \mathcal{A}^a = \lambda^{ab} \dot{\psi}_b \text{ and } T\dot{S} = \lambda^{ab} \dot{\psi}_a \dot{\psi}_b + P_H^{\text{ext}}. $$

Assuming that the matrix $\lambda^{ab}$ is invertible, with its inverse denoted $\mathcal{L}^{ab}$, we can rewrite these equations as

$$ \dot{\psi}_a = \mathcal{L}_{ab} \mathcal{A}^b \text{ and } T\dot{S} = \mathcal{L}_{ab} \mathcal{A}^a \mathcal{A}^b + P_H^{\text{ext}}, \qquad (3.15) $$

which are the well-known coupled equations for chemical reactions and thermal evolution, see for example (3.45) in Gruber [1997].

**Second approach.** The previous approach, while simpler, is not well adapted for a generalization to the continuum case treated in Part II, Gay-Balmaz and Yoshimura [2016]. We shall now develop an alternative variational formulation for chemical reactions, inspired from Theorem 3.1, which allows such a generalization. This approach does not describe the evolution of the variables $\psi_a(t)$, but focus directly on the number of moles $N_I(t)$. To do this, let us define the new variables $W^I(t)$ and $\nu^a(t)$ such that

$$ \dot{W}^I = \mu^I \quad \text{and} \quad \dot{\nu}^a := -\mathcal{A}^a. \qquad (3.16) $$

These variables are *thermodynamic displacements* associated to the processes of matter transfer and chemical reactions. They are analogous to the thermal displacement associated to heat transfer and play a fundamental role in our variational approach.

The alternative variational formulation for chemical reactions is stated in the following definition.

**Definition 3.7 (Alternative variational formulation for chemical reaction dynamics).** Consider chemical reactions (3.11) and define the Lagrangian

$$ L(N_1, \dots, N_R, S) := -U(N_1, \dots, N_R, S, V_0), $$

where $U$ is the internal energy. Let $J_a^{\text{fr}} = J^{\text{fr}}(N_1, \dots, N_R, S)_a : \mathbb{R}^R \times \mathbb{R} \to \mathbb{R}$ be the friction rate of the chemical reactions $a = 1, \dots, r$ and let $P_H^{\text{ext}}$ be the heat power exchange between the system and the exterior. The alternative variational formulation is given by

$$ \delta \int_{t_1}^{t_2} \left( L(N_1, \dots, N_R, S) + \sum_{I=1}^{R} \dot{W}^I N_I \right) dt = 0, \quad \text{VARIATIONAL CONDITION} $$

where the admissible variations $\delta S$ and $\delta \nu^a$ are subject to

$$ \frac{\partial L}{\partial S} \delta S = \sum_{a=1}^{r} J_a^{\text{fr}} \delta \nu^a \quad \text{and} \quad \delta \nu^a = \sum_{I=1}^{R} \nu_I^a \delta W^I, \quad \text{VARIATIONAL CONSTRAINTS} $$
with $\delta W^I(t_i) = 0$ for $i = 1, 2$, and where the curves $S(t)$, $N_I(t)$, and $W^I(t)$ satisfy the nonholonomic constraints

$$ \frac{\partial L}{\partial S} \dot{S} = \sum_{a=1}^{r} J_a^{\text{fr}} \dot{\nu}^a - P_H^{\text{ext}}, \qquad \text{PHENOMENOLOGICAL CONSTRAINT} $$

$$ \dot{\nu}^a = \sum_{I=1}^{R} \nu_I^a \dot{W}^I. \qquad \text{CHEMICAL CONSTRAINTS} $$

By this principle, one deduces that the equations associated to the variations $\delta N_I$ and $\delta W^I$ are, respectively

$$ -\frac{\partial U}{\partial N_I} + \dot{W}^I = 0 \quad \text{and} \quad \dot{N}_I = J_a^{\text{fr}} \nu_I^a. \qquad (3.17) $$

Taking into account of the two nonholonomic constraints and the definition $A^a = -\nu_I^a \mu^I$, we obtain

$$ \dot{N}_I = J_a^{\text{fr}} \nu_I^a \quad \text{and} \quad T \dot{S} = J_a^{\text{fr}} A^a + P_H^{\text{ext}}. \qquad (3.18) $$

If we make the choice $J_a^{\text{fr}} = \mathcal{L}_{ab}A^b$, then the equations (3.18) are obtained from (3.15) by multiplying the first equation by the stoichiometric coefficients $\nu_I^a$. This eventually induces $J_a^{\text{fr}} = \dot{\psi}_a$.

## II) Variational formulation for simple systems with chemical reactions.
Let us consider the more general case of a mechanical system involving chemical reactions. As above, we assume that the system is closed $P_M^{\text{ext}} = 0$. This setting is well illustrated with the example of chemical reactions occurring in a piston-cylinder system, as illustrated in Fig. 3.4. We will see that our variational approach allows a very efficient treatment for the derivation of the evolution equations for the nonequilibrium thermodynamics of this system.

<figure><img src="image_5.png" /><figcaption>Figure 3.4: Piston-cylinder with chemical reactions</figcaption></figure>

As before, we will present two variational formulations. The first is based on Theorem 3.1. The second one generalizes Definition 3.7 and has a corresponding version in the continuum setting.

**First approach.** Assume that there are $R$ chemical components and $r$ chemical reactions. Let $\psi_a$ be the degree of advancement of reactions $a = 1, ..., r$ and $x$ the displacement of the piston from the bottom of the cylinder. We now apply the setting of Theorem 3.1 to the
system of the piston-cylinder with chemical reactions, where the state of the system is characterized by $(x, \dot{x}, S, \psi_a)$. The Lagrangian of this system is

$$L(x, \dot{x}, S, \psi_a) = \frac{1}{2} m \dot{x}^2 - U(S, N_1, \dots, N_R, V = Ax), \quad (3.19)$$

where as before $N_I(t) = N_I(t_0) + \nu_I^a \psi_a(t)$, $\psi_a(t_0) = 0$ and the cross sectional area of the cylinder $A = \text{const.}$ It follows from (3.4) that we can immediately obtain the equations of motion

$$\frac{d}{dt} \frac{\partial L}{\partial \dot{x}} - \frac{\partial L}{\partial x} = F^{\text{ext}} + F^{\text{fr}}, \quad -\frac{\partial L}{\partial \psi_a} = F^{\text{fr} a}, \quad \frac{\partial L}{\partial S} \dot{S} = F^{\text{fr}} \dot{x} + F^{\text{fr} a} \dot{\psi}_a - P_H^{\text{ext}},$$

for friction forces given by $F^{\text{fr}} = -\lambda \dot{x}$ and $F^{\text{fr} a} = -\lambda^{ab} \dot{\psi}_b$. From the expression (3.19) of the Lagrangian, the evolution equations are

$$m \ddot{x} = p A - \lambda \dot{x} + F^{\text{ext}}, \quad \dot{\psi}_a = \mathcal{L}_{ab} A^b \quad \text{and} \quad T \dot{S} = \lambda \dot{x}^2 + \mathcal{L}_{ab} A^a A^b + P_H^{\text{ext}},$$

where $p = p(x, \psi_a, S) = -\frac{\partial U}{\partial V}$ and we recall that $A^a = \frac{\partial L}{\partial \psi_a}$.

**Second approach.** This approach generalizes the variational formulation of Definition 3.7 to the case when chemical reactions are coupled to a mechanical system.

**Definition 3.8 (Alternative variational formulation for a simple system with chemical reactions).** Let $N_I, I = 1, \dots, R$ be the number of moles of chemical components associated with chemical reactions $a = 1, \dots, r$, given by (3.14). Let $L: TQ \times \mathbb{R} \times \mathbb{R}^R \to \mathbb{R}$ be the Lagrangian, $J^{\text{fr}}: TQ \times \mathbb{R} \to T^*Q$ the friction flow, and $P_H^{\text{ext}}$ the heat power exchange between the system and the exterior. Let $F^{\text{ext}}$ and $F^{\text{fr}}: TQ \times \mathbb{R} \to T^*Q$ be external and friction forces. The variational condition for a curve $(q(t), S(t), W^I(t), N_I(t))$ is given by

$$\delta \int_{t_1}^{t_2} \left( L(q, \dot{q}, S, N_I) + \sum_{I=1}^{R} \dot{W}^I N_I \right) dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}(q, \dot{q}, S), \delta q \rangle dt = 0, \quad (3.20)$$

where the variations $\delta q(t), \delta S(t)$, and $\delta W^I(t)$ are subject to the constraints

$$\frac{\partial L}{\partial S} \delta S = \langle F^{\text{fr}}(q, \dot{q}, S), \delta q \rangle + \sum_{a=1}^{r} J_a^{\text{fr}} \delta \nu^a \quad \text{and} \quad \delta \nu^a = \sum_{I=1}^{R} \nu_I^a \delta W^I, \quad (3.21)$$

with $\delta q(t_i) = 0$ and $\delta W^I(t_i) = 0$ for $i = 1, 2$, and where the curve $(q(t), S(t), W^I(t), N_I(t))$ satisfies the nonholonomic constraints

$$\frac{\partial L}{\partial S} \dot{S} = \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle + \sum_{a=1}^{r} J_a^{\text{fr}} \dot{\nu}^a - P_H^{\text{ext}} \quad \text{and} \quad \dot{\nu}^a = \sum_{I=1}^{R} \nu_I^a \dot{W}^I. \quad (3.22)$$

**Proposition 3.9.** Suppose that a curve $(q(t), S(t), W^I(t), N_I(t))$ satisfies the variational conditions (3.20), with respect to the variational constraints (3.21) and the phenomenological constraints (3.22). Then, the curve $(q(t), S(t), W^I(t), N_I(t))$ is a solution of the equations of motion for a simple system with chemical reactions:

$$\left\{
\begin{array}{l}
\displaystyle \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = F^{\text{ext}}(q, \dot{q}, S) + F^{\text{fr}}(q, \dot{q}, S), \\[2ex]
\displaystyle \dot{W}^I = -\frac{\partial L}{\partial N_I}, \quad \dot{N}_I = \sum_{a=1}^{r} J_a^{\text{fr}} \dot{\nu}_I^a, \qquad (3.23) \\[2ex]
\displaystyle \frac{\partial L}{\partial S} \dot{S} = \langle F^{\text{fr}}(q, \dot{q}, S), \dot{q} \rangle + \sum_{a=1}^{r} J_a^{\text{fr}} \dot{\nu}^a - P_H^{\text{ext}}.
\end{array}
\right.$$
**Proof.** By taking variations of the integral in (3.20), integrating by parts and using $\delta q(t_1) = \delta q(t_2) = 0$, the variational formulation of Definition 3.8 yields

$$ \int_{t_1}^{t_2} \left[ \left\langle \frac{\partial L}{\partial q} - \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} + F^{\text{ext}} + F^{\text{fr}}, \delta q \right\rangle + \left( \frac{\partial L}{\partial N_I} + \dot{W}^I \right) \delta N_I + \left( \sum_{a=1}^{r} J_a^{\text{fr}} \nu_I^a - \dot{N}_I \right) \delta W^I \right] dt = 0, $$

for all the variations $\delta q, \delta N_I$, and $\delta W^I$, where we used both variational constraints in (3.21). Then, we obtain (3.23). ■

The application of this approach to the system of Fig. 3.4 is left to the reader.

## 3.4 Dynamics of a simple system with diffusion due to matter transfer

1) Nonelectrolyte diffusion through a homogeneous membrane. We consider a system with diffusion due to (internal) matter transfer through a homogeneous membrane separating two reservoirs. We suppose that the system is simple (so it is described by a single entropy variable) and involves a single chemical component. We assume that the membrane consists of three regions; namely, the central layer denotes the membrane capacitance in which energy is stored without dissipation, while the outer layers indicate transition region in which dissipation occurs with no energy storage. We denote by $N^{(m)}$ the number of mole of this chemical component in the membrane and also by $N^{(1)}$ and $N^{(2)}$ the numbers of mole in the reservoirs 1 and 2, as shown in Fig. 3.5. Define the Lagrangian by $L(S, N^{(1)}, N^{(2)}, N^{(m)}) = -U(S, N^{(1)}, N^{(2)}, N^{(m)})$, where $U(S, N^{(1)}, N^{(2)}, N^{(m)})$ denotes the internal energy of the system and we suppose that the volumes are constant and the system is isolated. We denote by $\mu_{(k)} = \frac{\partial U}{\partial N^{(k)}}$ the chemical potential of the chemical components in the reservoirs ($k=1,2$) and in the membrane ($k=m$). We denote by $J^{(1)}$ the flux from the reservoir 1 into the membrane and $J^{(2)}$ the flux from the membrane into the reservoir 2.

<figure><img src="image_6.png" /><figcaption>Figure 3.5: Nonelectrolyte diffusion through a homogeneous membrane</figcaption></figure>

The variational condition for the diffusion process is provided by

$$ \delta \int_{t_1}^{t_2} \left( L(S, N^{(1)}, N^{(2)}, N^{(m)}) + \dot{W}_{(1)} N^{(1)} + \dot{W}_{(2)} N^{(2)} + \dot{W}_{(m)} N^{(m)} \right) dt = 0, \quad (3.24) $$

for admissible variations of the curve $(S(t), W_{(k)}(t), N^{(k)}(t))$ subject to the variational constraints

$$ \frac{\partial L}{\partial S} \delta S = J^{(1)}(\delta W_{(1)} - \delta W_{(m)}) + J^{(2)}(\delta W_{(m)} - \delta W_{(2)}) \quad \text{and} \quad \delta N^{(1)} + \delta N^{(2)} + \delta N^{(m)} = 0, \quad (3.25) $$
with $\delta W_{(k)}(t_i) = 0$, for $k = 1, 2, m$ and $i = 1, 2$, and where the curve $(S(t), W_{(k)}(t), N^{(k)}(t))$ is subject to the phenomenological and mass conservation constraints

$$ \frac{\partial L}{\partial S} \dot{S} = J^{(1)}(\dot{W}_{(1)} - \dot{W}_{(m)}) + J^{(2)}(\dot{W}_{(m)} - \dot{W}_{(2)}) \quad \text{and} \quad \dot{N}^{(1)} + \dot{N}^{(2)} + \dot{N}^{(m)} = 0. \quad (3.26) $$

By applying this variational formulation and using the first variational constraint, it follows

$$ \int_{t_1}^{t_2} \left( (J^{(1)} - \dot{N}^{(1)})\delta W_{(1)} + (-J^{(1)} + J^{(2)} - \dot{N}^{(m)})\delta W_{(m)} + (-J^{(2)} - \dot{N}^{(2)})\delta W_{(2)} \right. \\ \left. + \left(\dot{W}_{(1)} - \frac{\partial U}{\partial N^{(1)}}\right) \delta N^{(1)} + \left(\dot{W}_{(2)} - \frac{\partial U}{\partial N^{(2)}}\right) \delta N^{(2)} + \left(\dot{W}_{(m)} - \frac{\partial U}{\partial N^{(m)}}\right) \delta N^{(m)} \right) dt = 0. $$

Since the variations $\delta W_{(k)}$ are free, we have

$$ \dot{N}^{(1)} = J^{(1)}, \quad \dot{N}^{(m)} = -J^{(1)} + J^{(2)}, \quad \dot{N}^{(2)} = -J^{(2)}. \quad (3.27) $$

Using the second variational constraint, it follows $\dot{W}_{(1)} - \mu_{(1)} = \dot{W}_{(2)} - \mu_{(2)} = \dot{W}_{(m)} - \mu_{(m)}$ and so the first constraint in (3.26), in view of $T = -\frac{\partial L}{\partial S}$, reads

$$ -T\dot{S} = J^{(1)}(\mu_{(1)} - \mu_{(m)}) + J^{(2)}(\mu_{(m)} - \mu_{(2)}). \quad (3.28) $$

Equations (3.27) and (3.28) are consistent with those derived in Oster, Perelson, Katchalsky [1973, §2.2]. From the equations (3.27) and (3.28), we have $\frac{d}{dt}U = 0$, in agreement with the fact that the system is isolated.

**2) Coupling of chemical reactions and diffusion.** We now assume that the above system contains several chemical components $I = 1, \dots, R$ that can diffuse through the membranes and can undergo chemical reactions. We denote by $N_I^{(1)}, N_I^{(2)}, N_I^{(m)}$, the numbers of moles of the component $I$ in the reservoir 1, the reservoir 2, and the membrane $m$, respectively. Define the Lagrangian by $L(S, \{N_I^{(1)}, N_I^{(2)}, N_I^{(m)}\}) := -U(S, \{N_I^{(1)}, N_I^{(2)}, N_I^{(m)}\})$, where $U(S, \{N_I^{(1)}, N_I^{(2)}, N_I^{(m)}\}) := U(S, N_I^{(1)}, N_I^{(2)}, N_I^{(m)}, \dots, N_R^{(1)}, N_R^{(2)}, N_R^{(m)})$ the internal energy of the system. As before, the chemical potentials are denoted $\mu_{(k)}^I = \frac{\partial U}{\partial N_I^{(k)}}$.

<figure><img src="image_7.png" /><figcaption>Figure 3.6: Chemical reactions and diffusion through membranes</figcaption></figure>

The variational condition for chemical reactions and diffusion is given by

$$ \delta \int_{t_1}^{t_2} \left( L(S, \{N_I^{(1)}, N_I^{(2)}, N_I^{(m)}\}) + \sum_{I,k} \dot{W}_{(k)}^I N_I^{(k)} \right) dt = 0 \quad (3.29) $$
with respect to the variational constraints

$$ \frac{\partial L}{\partial S} \delta S = \sum_{I=1}^{R} \left( J_I^{(1)} (\delta W_{(1)}^I - \delta W_{(m)}^I) + J_I^{(2)} (\delta W_{(m)}^I - \delta W_{(2)}^I) \right) + \sum_{k,a} J_a^{\text{fr}(k)} \delta \nu_{(k)}^a, \quad (3.30) \\ \delta \nu_{(k)}^a = \sum_I \nu_I^a \delta W_{(k)}^I, \quad k=1,2,m, \quad a=1,...,r, $$

with $\delta W_{(k)}(t_i) = 0$, for $k = 1, 2, m$ and $i = 1, 2$, where one imposes the phenomenological constraints

$$ \frac{\partial L}{\partial S} \dot{S} = \sum_{I} \left( J_{I}^{(1)} (\dot{W}_{(1)}^{I} - \dot{W}_{(m)}^{I}) + J_{I}^{(2)} (\dot{W}_{(m)}^{I} - \dot{W}_{(2)}^{I}) \right) + \sum_{k,a} J_{a}^{\text{fr}(k)} \dot{\nu}_{(k)}^{a}, \quad (3.31) \\ \dot{\nu}_{(k)}^{a} = \sum_{I} \nu_{I}^{a} \dot{W}_{(k)}^{I}, \quad k=1,2,m, \quad a=1,...,r. $$

Taking the variations $\delta W_{(k)}^I$ yields

$$ \dot{N}_I^{(1)} = J_I^{(1)} + \sum_{a=1}^{r} J_a^{\text{fr}(1)} \nu_{aI}, \qquad \dot{N}_I^{(m)} = -J_I^{(1)} + J_I^{(2)} + \sum_{a=1}^{r} J_a^{\text{fr}(m)} \nu_I^a, \quad (3.32) \\ \dot{N}_I^{(2)} = -J_I^{(2)} + \sum_{a=1}^{r} J_a^{\text{fr}(2)} \nu_{aI}, \qquad I=1, \dots, R. $$

Using the variations $\delta N_I^{(k)}$, we obtain $\dot{W}_{(1)}^I = \mu_{(1)}^I$, $\dot{W}_{(2)}^I = \mu_{(2)}^I$, $\dot{W}_{(m)}^I = \mu_{(m)}^I$, and therefore the phenomenological constraint (3.31) becomes

$$ -T \dot{S} = \sum_{I} \left( J_{I}^{(1)} (\mu_{(1)}^{I} - \mu_{(m)}^{I}) + J_{I}^{(2)} (\mu_{(m)}^{I} - \mu_{(2)}^{I}) \right) - \sum_{k,a} J_{a}^{\text{fr}(k)} A_{(k)}^{a}, \quad (3.33) $$

where the affinity is defined by $A_{(k)}^a := - \sum_{I=1}^R \nu_I^a \mu_{(k)}^I$, $a = 1, ..., r$. Equations (3.32) and (3.33) recover those derived in Oster, Perelson, Katchalsky [1973, §VI]. Again, internal energy conservation $\frac{dU}{dt} = 0$ is obtained from (3.32) and (3.33) since the system is isolated.

**Remark 3.10.** Recall that in presence of chemical reactions, the mass conservation during each reaction arises from the condition $\sum_I m_I \nu_I^a = 0$ for $a = 1, ..., r$ (Lavoisier law), where $m_I$ is the molecular weight of component I. The variational formulation (3.29)–(3.30) for chemical reactions and diffusion is therefore consistent with the variational formulation (3.24)–(3.25) in absence of chemical reaction, as the mass conservation is already contained in the chemical constraint. Note also that the variational formulation (3.29)–(3.30) recovers the variational formulation of Definition 3.7 in absence of diffusion processes. Of course, one can easily develop a similar generalization of the variational formulation of Definition 3.8 in order to include diffusion processes. This yields the dynamical equations for simple systems involving the coupling of mechanical variables with chemical reactions and diffusion processes. A continuum version of such a variational formulation will be also developed in Gay-Balmaz and Yoshimura [2016] for a multicomponent fluid subject to the irreversible processes associated to viscosity, heat transport, (internal) matter transport, and chemical reactions.
## 4 Variational formulation for the nonequilibrium thermodynamics of discrete systems

We now consider the case of a closed discrete system $\Sigma = \cup_{A=1}^N \Sigma_A$, composed of interconnecting simple systems $\Sigma_A$ that can exchange heat and mechanical power, and interact with external heat sources $\Sigma_R$. As will be shown, we need to extend the formulation of Theorem 3.1 in order to take account of internal heat exchanges. Before presenting the variational formulation, we first review from Stueckelberg and Scheurer [1974] and Gruber [1997] the description of discrete systems.

By definition, a heat source of a system is uniquely defined by a single variable $S_R$. Therefore, its energy is given by $U_R = U_R(S_R)$, the temperature is $T^R := \frac{\partial U_R}{\partial S_R}$, so that $\frac{d}{dt}U_R = T^R \dot{S}_R = P_H^{R \to \Sigma}$, where $P_H^{R \to \Sigma}$ is the heat power flow due to heat exchange with $\Sigma$.

**Discrete systems.** The state of a discrete system is described by geometric variables $q \in Q_\Sigma$ and entropy variables $S_A, A = 1, ..., N$. Note that the entropy $S_A$ has the index $A$ since it is associated to the system $\Sigma_A$. The geometric variables, however, are not indexed by $A$ since in general they are associated to several systems $\Sigma_A$ that can interact. Note that in practice, it can be a difficult task to identify such independent geometric variables $q$ for a given complex (interconnected) discrete system. In this case, it is often useful to first consider the (in general) non independent geometric variables $q^A$ associated to each of the simple systems $\Sigma_A$, and subject to an interconnection constraint, see Remark 4.3. Such an approach also allows the treatment of nonholonomic interconnections, which is a more general situation that we do not consider in the present paper, see also Remark 4.3.

For discrete systems the variables $V_A$ and $N_A$ (volume and number of moles) are in general defined from (a subset of) the geometric variables, as we have seen in the examples of the piston problem ($V$ in terms of $x$) and chemical reactions ($N_A$ in terms of $\psi^a$, (3.14)).

As before, the action from the exterior is given by external forces and by transfer of heat. For simplicity, we ignore matter exchange in this section so, in particular, the system is closed. The external force reads $F^{\text{ext}} := \sum_{A=1}^N F^{\text{ext} \to A}$, where $F^{\text{ext} \to A}$ is the external force acting on the system $\Sigma_A$. The associated external mechanical power is $P_W^{\text{ext}} = \langle F^{\text{ext}}, \dot{q} \rangle = \sum_{I=1}^N \langle F^{\text{ext} \to A}, \dot{q} \rangle = \sum_{A=1}^N P^{\text{ext} \to A}$. The external heat power associated to heat transfer reads

$$P_H^{\text{ext}} = \sum_R P_H^{R \to \Sigma} = \sum_R \left( \sum_{A=1}^N P_H^{R \to A} \right) = \sum_{A=1}^N P_H^{\text{ext} \to A},$$

where $P_H^{R \to A}$ denotes the power of heat transfer between the external heat source $\Sigma_R$ and the system $\Sigma_A$, and $P_H^{R \to \Sigma} = \sum_{A=1}^N P_H^{R \to A}$ denotes the power of heat transfer between $\Sigma_R$ and the system $\Sigma$. In addition to the above external actions, there are also internal actions on every $\Sigma_A$ due to the mechanical and heat power from $\Sigma_B$. First, there are internal forces $F^{B \to A} = -F^{A \to B} : TQ_\Sigma \times \mathbb{R}^N \to T^*Q_\Sigma$ exerted by $\Sigma_B$ on $\Sigma_A$, with associated power denoted by $P_W^{B \to A} = \langle F^{B \to A}(q, \dot{q}, S_1, ..., S_N), \dot{q} \rangle$. Secondly, there are friction forces

$$F^{\text{fr}(A)} : TQ_\Sigma \times \mathbb{R}^N \to T^*Q_\Sigma \quad \text{with} \quad F^{\text{fr}} := \sum_{A=1}^N F^{\text{fr}(A)}$$

associated to $\Sigma_A$, i.e., involved in the entropy production $\dot{S}_A$. Finally there is an internal heat power exchange between $\Sigma_A$ and $\Sigma_B$, denoted by $P_H^{B \to A}$. We have

$$P_W^{B \to A} = -P_W^{A \to B} \quad \text{and} \quad P_H^{B \to A} = -P_H^{A \to B}.$$

An illustration of a discrete system is provided in Fig. 4.1.
<figure><img src="image_8.png" /><figcaption>Figure 4.1: An illustration of a discrete system</figcaption></figure>

**Irreversible internal heat transfer as a generalized friction.** Let us recall that from the first law and part (a) of the second law, it is shown (see e.g. Stueckelberg and Scheurer [1974]) that the internal heat power exchange can be described by

$$P_H^{B \to A} = \kappa_{AB}(q, S^A, S^B)(T^B - T^A),$$

where $\kappa_{AB} = \kappa_{BA} \ge 0$ is the heat transfer phenomenological coefficient. In order to include the irreversible effect of internal heat transfer in the variational formulation, it is useful to rewrite it in a form similar to the expression of the power associated to friction. Indeed, we can rewrite the total heat power supplied to A as

$$\sum_{B=1}^{N} P_H^{B \to A} = - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(q, \dot{q}, S^A, S^B) T^B, \quad (4.1)$$

where one may regard $J_B^{\text{fr}(A)}$ as a “friction force” associated with $\Sigma_A$ by setting

$$J_B^{\text{fr}(A)} := - \left( \kappa_{AB} - \delta_{AB} \sum_{C=1}^{N} \kappa_{AC} \right). \quad (4.2)$$

This eventually verifies

$$J_B^{\text{fr}} := \sum_{A=1}^{N} J_B^{\text{fr}(A)} = 0.$$

In view of the formula (4.1), one may interpret the temperatures $T^B$ as velocities. This may be achieved by introducing new variables $\Gamma^B$ such that $\dot{\Gamma}^B = T^B$. Green and Naghdi [1991] called such a variable $\Gamma$ a **thermal displacement**, which was originally developed by von Helmholtz [1884]. As to its historical details, see the Appendix of Podio-Guidugli [2009].

Further, in order to include this variable into the variational formulation, we also need to introduce the additional variables $\Sigma_A$, whose rate of change are associated to total entropy production. The complete physical meaning and roles of $\Sigma_A$ will be clarified in the more general context of continuum systems later.
## 4.1 Nonequilibrium thermodynamics of general discrete systems

With this discussion in mind, the generalization of Theorem 3.1 for arbitrary discrete closed systems reads as follows.

**Theorem 4.1 (Variational formulation for nonequilibrium thermodynamics of discrete systems).** Consider a discrete system with Lagrangian $L: TQ_{\Sigma} \times \mathbb{R}^N \to \mathbb{R}$, external, friction, and internal forces $F^{\text{ext} \to A}$, $F^{\text{fr}(A)}$, $F^{B \to A}: TQ_{\Sigma} \times \mathbb{R}^N \to T^*Q_{\Sigma}$, external heat power $P_H^{R \to A}$, and generalized friction $J_B^{\text{fr}(A)}$. Suppose that the curve $(q(t), S_A(t), \Gamma^A(t), \Sigma_A(t))$ satisfies

$$ \delta \int_{t_1}^{t_2} \left[ L(q, \dot{q}, S_1, \dots, S_N) + \sum_{A=1}^{N} (S_A - \Sigma_A) \dot{\Gamma}^A \right] dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}, \delta q \rangle dt = 0, \quad (4.3) $$

VARIATIONAL CONDITION

for the admissible variations of the curves $\delta q(t)$, $\delta \Gamma^A(t)$, $\delta \Sigma_A(t)$ subject to

$$ \frac{\partial L}{\partial S_A} \delta \Sigma_A = \langle F^{\text{fr}(A)}(...), \delta q \rangle + \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \delta \Gamma^B, \quad (\text{no sum on A}) \quad (4.4) $$

VARIATIONAL CONSTRAINTS

with $\delta q(t_i) = 0$ and $\delta \Gamma(t_i) = 0$, for $i = 1, 2$, and also that the curve $(q(t), S_A(t), \Gamma^A(t), \Sigma_A(t))$ satisfies the constraint

$$ \frac{\partial L}{\partial S_A} \dot{\Sigma}_A = \langle F^{\text{fr}(A)}(...), \dot{q} \rangle + \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B - P_H^{\text{ext} \to A}. \quad (4.5) $$

PHENOMENOLOGICAL CONSTRAINTS

Then, the curve $(q(t), S_A(t), \Gamma^A(t), \Sigma_A(t))$ satisfies the equations of evolution for the thermodynamics of a general discrete system:

$$ \left\{ \begin{array}{l} \displaystyle \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = \sum_{A=1}^{N} F^{\text{fr}(A)} + F^{\text{ext}}, \\[1.5em] \displaystyle \frac{\partial L}{\partial S_A} \dot{\Sigma}_A = \langle F^{\text{fr}(A)}(...), \dot{q} \rangle + \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B - P_H^{\text{ext} \to A}, \quad A = 1, \dots, N, \\[1.5em] \displaystyle \dot{S}_A = \dot{\Sigma}_A, \quad A = 1, \dots, N, \\[1.5em] \displaystyle \dot{\Gamma}^A = - \frac{\partial L}{\partial S_A}. \end{array} \right. \quad (4.6) $$

**Proof.** Taking the variations of the action integral and integrating by part, we have

$$ \int_{t_1}^{t_2} \left[ \left\langle \frac{\partial L}{\partial q} - \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} + F^{\text{ext}}, \delta q \right\rangle + \sum_{A=1}^{N} \left( \frac{\partial L}{\partial S_A} + \dot{\Gamma}^A \right) \delta S_A \right. \\ \left. + \sum_{A=1}^{N} (-\dot{\Gamma}^A \delta \Sigma_A) - \sum_{A=1}^{N} \delta \Gamma^A (\dot{S}_A - \dot{\Sigma}_A) \right] dt = 0. \quad (4.7) $$
Using the variational constraint (4.4) and the fact that $\frac{\partial L}{\partial S_A} \neq 0$, and collecting the terms associated to the variations $\delta q$ and $\delta \Gamma^A$, $\delta S_A$, one obtains

$$ \delta q : \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = F^{\text{ext}} - \sum_{A=1}^{N} \dot{\Gamma}^{A} \left( \frac{\partial L}{\partial S_{A}} \right)^{-1} F^{\text{fr}(A)}, \quad (4.8) $$

$$ \delta \Gamma^A : \dot{S}_A = \dot{\Sigma}_A - \sum_{B=1}^{N} \dot{\Gamma}^B \left( \frac{\partial L}{\partial S_B} \right)^{-1} J_A^{\text{fr}(B)}, \quad A = 1, \dots, N \quad (4.9) $$

$$ \delta S_A : \dot{\Gamma}^A = - \frac{\partial L}{\partial S_A}. \quad (4.10) $$

Since $\sum_{B=1}^{N} J_A^{\text{fr}(B)} = 0$, we can eventually deduce that $\dot{S}_A = \dot{\Sigma}_A$. Using (4.8)–(4.10), and (4.5), we obtain the equations of evolution for the thermodynamics of a general discrete system in (4.6). ■

System (4.6) can be rewritten as

$$ \left\{ \begin{aligned} & \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = \sum_{A=1}^{N} F^{\text{fr}(A)} + F^{\text{ext}}, \\ & \frac{\partial L}{\partial S_A} \dot{S}_A = \langle F^{\text{fr}(A)}(...), \dot{q} \rangle - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \frac{\partial L}{\partial S_B} - P_H^{\text{ext} \to A}, \quad A = 1, \dots, N, \end{aligned} \right. \quad (4.11) $$

where we recall that the condition (4.10) gives the desired velocity interpretation of the temperature,

$$ T^A = - \frac{\partial L}{\partial S_A} = \dot{\Gamma}^A $$

and, from (4.2), we have

$$ \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...)^T T^B = - \sum_{B=1}^{N} P_H^{B \to A} = - \sum_{B=1}^{N} \kappa_{AB}(...)(T^B - T^A) \quad \text{and} \quad P_H^{\text{ext} \to A} = \sum_{R} P_H^{R \to A}. $$

System (4.11) contains the general evolution equations for the nonequilibrium thermodynamics of a discrete system with no matter transfer. It generalizes the one obtained in Gruber [1997], see equation (3.129), following Stueckelberg and Scheurer [1974]. It is recovered by choosing $L(q, \dot{q}, S_1, \dots, S_N) = - \sum_{A=1}^{N} U^A(q, S_A)$, $A = 1, \dots, N$.

**Remark 4.2.** We will see later that the equality $\dot{S}_A = \dot{\Sigma}_A$ will no longer be true in the case of continuum systems.

**Remark 4.3 (Interconnection of discrete systems).** As we already mentioned earlier, we have assumed that the given mechanical constraints due to the interconnections between the simple systems $\Sigma_A$ are holonomic and are already solved to produce the independent geometric variables $(q, \dot{q})$ in the current variational formulation. There are more general cases of discrete systems in which nonholonomic constraints due to the mechanical interconnection have to be considered. For purely mechanical systems this issue has been considered from a variational perspective in Jacobs and Yoshimura [2014]. The extension of this approach to the setting of nonequilibrium thermodynamics will be explored in a future work.
**Energy balance and entropy production.** From (4.11), we obtain the energy balance

$$ \frac{d}{dt} E = P_W^{\text{ext}} + P_H^{\text{ext}}, $$

consistently with the first law, where $E(q, \dot{q}, S_1, ..., S_N)$ is the energy associated to the Lagrangian $L(q, \dot{q}, S_1, ..., S_N)$.

Being an *extensive* quantity, the **total entropy** of the system is given by $S = \sum_{A=1}^{N} S_A$. We thus obtain

$$ \frac{d}{dt} S = - \sum_{A=1}^{N} \frac{1}{T^A} \langle F^{\text{fr}(A)}(...), \dot{q} \rangle + \sum_{A=1}^{N} \sum_{B \neq A}^{N} \frac{1}{T^A} P_H^{B \to A} + \sum_{A=1}^{N} \frac{1}{T^A} P_H^{\text{ext} \to A}. \quad (4.12) $$

It follows from part (a) of the second law that the first two terms on the right hand side must be positive.

**Remark 4.4 (Internal entropy production).** Note that the *internal entropy production* for system $\Sigma^A$ is

$$ I^A = - \frac{1}{T^A} \langle F^{\text{fr}(A)}(...), \dot{q} \rangle, $$

and the internal entropy production for the *interconnected system* $\Sigma$ is given by

$$ I = \sum_{A=1}^{N} I^A + \frac{1}{2} \sum_{A,B=1}^{N} I^{AB} = \sum_{A=1}^{N} I^A + \frac{1}{2} \sum_{A=1}^{N} \sum_{B \neq A}^{N} \kappa_{AB}(q, S_A, S_B) \frac{(T^B - T^A)^2}{T^A T^B} \neq \sum_{A=1}^{N} I^A, $$

where $I^{AB} = P_H^{B \to A} (T^B - T^A) = \frac{1}{2} \kappa_{AB}(q, S_A, S_B) \frac{(T^B - T^A)^2}{T^A T^B}$. In this case the entropy production is due to both friction forces $F^{\text{fr}(A)}$ on each subsystem as well as to heat transfer between the simple subsystems.

**Remark 4.5 (External heat power).** Concerning the heat power due to external heat source, we also have $P_H^{R \to A} = \kappa_{AR}(q, S_A, S_R) (T^R - T^A)$, where we recall that $T^R = \frac{\partial U^R}{\partial S_R}$ is the temperature of the heat source $\Sigma^R$. From this we deduce that $\frac{1}{T^A} P_H^{R \to A} \geq \frac{1}{T^R} P_H^{R \to A}$ and, therefore, it follows from (4.12) that

$$ \frac{d}{dt} S \geq \sum_{A=1}^{N} \frac{1}{T^A} P_H^{\text{ext} \to A} = \sum_{A=1}^{N} \sum_{R} \frac{1}{T^A} P_H^{R \to A} \geq \sum_{A=1}^{N} \sum_{R} \frac{1}{T^R} P_H^{R \to A} = \sum_{R} \frac{1}{T^R} P_H^{R \to \Sigma}. \quad (4.13) $$

This property relates the entropy variation of the whole system to a property of the exterior of the system, namely, the heat sources $\Sigma^R$ (Gruber [1997]).

**Remark 4.6 (Reversibility).** Note that we have $\sum_R \dot{S}_R = - \sum_R \frac{1}{T^R} P_H^{R \to \Sigma}$. So, by the definition of reversibility and assuming that there is no entropy associated to the external forces, the evolution of this system is reversible if and only if we have equalities in (4.13). Therefore, by (4.13) and (4.12), the evolution is reversible if and only if

$$ T^1 = \dots = T^N = T^R, \text{ for all } R \quad \text{and} \quad F^{\text{fr}(A)} = 0, \text{ for all } A. $$

**Structures of the variational formulation.** For both discrete and continuum systems (the continuum case will be shown in Gay-Balmaz and Yoshimura [2016]), our variational formulation has the following structure:

* Our variational formulation of nonequilibrium thermodynamics is a generalization of the Hamilton variational principle of classical mechanics to the case in which irreversible effects associated with thermodynamics are included.
* The nonholonomic constraint is given by the entropy production of the system. In general, it consists of a sum of terms, each of them being the product of a thermodynamic affinity $X^\alpha$ and a thermodynamic flux $J_\alpha$ characterizing an irreversible process, the relation between them being given by phenomenological laws. It happens that in our formulation, we are able to attribute to each of the irreversible process a rate $\dot{\Lambda}^\alpha$ such that $\dot{\Lambda}^\alpha = X^\alpha$ (e.g. here $\dot{\Gamma}^A$ identified with the temperature $T^A$). It follows that the entropy production appears as a sum of internal (mechanical and thermodynamic) power due to generalized frictions (e.g. $\langle F^{\text{fr}(A)}, \dot{q} \rangle$ and $\langle J_B^{\text{fr}(A)}, \dot{\Gamma}^B \rangle$). The same idea will be developed in the case of continuum systems in Gay-Balmaz and Yoshimura [2016].

* The variational constraint is obtained by formally replacing all the rate variables $\dot{\Lambda}^\alpha$, or, in thermodynamic language, the thermodynamic affinities $X^\alpha = \dot{\Lambda}^\alpha$, by the corresponding virtual displacements $\delta\Lambda^\alpha$. In addition, in passing from the phenomenological constraint to the variational constraint, the effects from the exterior are removed.

**Remark 4.7.** The reader will observe that the equations (4.11) can be also obtained with a simpler variational formulation, namely, one of the type of Theorem 3.1 given as follows:

$$ \delta \int_{t_1}^{t_2} L(q, \dot{q}, S_1, \dots, S_N) dt + \int_{t_1}^{t_2} \langle F^{\text{ext}}, \delta q \rangle dt = 0, \quad (4.14) $$

with respect to variations $(\delta q(t), \delta S_A(t))$ subject to

$$ \frac{\partial L}{\partial S_A} \delta S_A = \langle F^{\text{fr}(A)}, \delta q \rangle, \quad (\text{no sum on } A) \quad (4.15) $$

and where the curve $(q(t), S_A(t))$ satisfies the constraint

$$ \frac{\partial L}{\partial S_A} \dot{S}_A = \langle F^{\text{fr}(A)}(...), \dot{q} \rangle + \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B - P_H^{\text{ext} \to A}. \quad (4.16) $$

This variational formulation is however less consistent from the physical point of view, since it interprets the whole expression $\sum_{B=1}^N J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B - P_H^{\text{ext}}$ as an external power, appearing only in the phenomenological constraint, and not present in the variational constraint. This is not consistent with the fact that $\sum_{B=1}^N J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B$ is associated to an internal irreversible process in the same way as $\langle F^{\text{fr}(A)}(...), \dot{q} \rangle$ and therefore it has to appear in both the phenomenological and variational constraints. In the continuum situation, it will be clear that the variational formulation given in Definition 4.1 (as opposed to one of the type (4.14)-(4.15)) is the one that is appropriate when internal heat transfer occurs.

## 4.2 Formulation based on the free energy

Let us consider a variational formulation in terms of the free energy, i.e., when the temperature, as opposed to the entropy, is chosen as a primitive variable. Recall that the *Helmholtz free energy* $\mathcal{F}$ is defined in terms of the internal energy by the Legendre transform

$$ \mathcal{F}(q, T) := U(q, S(q, T)) - TS(q, T), $$

where $S(q, T)$ is such that $\frac{\partial U}{\partial S}(q, S) = T$, for all $q, S$, and where, for simplicity, we do not explicitly write the dependence on the variables $V$ and $N$. In order to treat the nonequilibrium case, we now employ this partial Legendre transform to obtain a free energy Lagrangian.
**Definition 4.8.** Given a Lagrangian $L(q, \dot{q}, S)$, the free energy Lagrangian $\mathcal{L}$ is defined by

$$ \mathcal{L}(q, \dot{q}, T) := L(q, \dot{q}, S(q, T)) + TS(q, T), $$

where $S(q, T)$ is such that $-\frac{\partial L}{\partial S}(q, S) = T$, for all $q, S$, and we assumed that $\frac{\partial L}{\partial S}$ does not depend on $\dot{q}$, as it is the case in most physical examples.

For example, in the particular case of a Lagrangian of the form (3.5), i.e., $L(q, \dot{q}, S) := L_{\text{mec}}(q, \dot{q}) - U(q, S)$, we obtain the free energy Lagrangian as

$$ \mathcal{L}(q, \dot{q}, T) = L_{\text{mec}}(q, \dot{q}) - \mathcal{F}(q, T). \qquad (4.17) $$

**Theorem 4.9 (Variational formulation for discrete systems based on the free energy).** Let $\mathcal{L}: TQ_{\Sigma} \times \mathbb{R}^N \to \mathbb{R}$ be a free energy Lagrangian. Let $F^{\text{ext} \to A}, F^{\text{fr}(A)}, F^{B \to A}: TQ_{\Sigma} \times \mathbb{R}^N \to T^*Q_{\Sigma}$ be external, friction, and internal forces respectively. Let $J^{\text{fr}(A)}: TQ_{\Sigma} \times \mathbb{R}^N \to (\mathbb{R}^N)^*$ be generalized friction forces. Let $P_H^{R \to A}$ be an external heat power. Suppose that a curve $(q(t), S_A(t), T^A(t), \Gamma^A(t), \Sigma_A(t))$ holds the variational condition

$$ \delta \int_{t_1}^{t_2} \left( \mathcal{L}(q, \dot{q}, T^1, \dots, T^N) - \sum_{A=1}^{N} S_A T^A + \sum_{A=1}^{N} (S_A - \Sigma_A) \dot{\Gamma}^A \right) dt \\ + \int_{t_1}^{t_2} \langle F^{\text{ext}}, \delta q \rangle dt = 0, \quad \text{VARIATIONAL CONDITION} \qquad (4.18) $$

with respect to the admissible variations $\delta q, \delta S_A, \delta \Gamma^A, \delta \Sigma_A$ which are subject to

$$ T^A \delta \Sigma_A = - \langle F^{\text{fr}(A)}(...), \delta q \rangle - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \delta \Gamma^B, \quad (\text{no sum on } A) \qquad (4.19) $$

VARIATIONAL CONSTRAINTS

with $\delta q(t_i) = 0$ and $\delta \Gamma^A(t_i) = 0$ for $i = 1, 2$, where the curves $q(t), T^A(t), \Gamma^A(t), \Sigma_A(t)$ satisfy the constraint

$$ T^A \dot{\Sigma}_A = - \langle F^{\text{fr}(A)}(...), \dot{q} \rangle - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B + P_H^{\text{ext} \to A}. \qquad (4.20) $$

PHENOMENOLOGICAL CONSTRAINTS

Then, the curve $(q(t), S_A(t), T^A(t), \Gamma^A(t), \Sigma_A(t))$ satisfies the evolution equations for the thermodynamics of a discrete system:

$$ \left\{ \begin{array}{l} \displaystyle \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{q}} - \frac{\partial \mathcal{L}}{\partial q} = \sum_{A=1}^{N} F^{\text{fr}(A)} + F^{\text{ext}}, \\[1.5em] \displaystyle T^A \dot{\Sigma}_A = - \langle F^{\text{fr}(A)}(...), \dot{q} \rangle - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) \dot{\Gamma}^B + P_H^{\text{ext} \to A}, \quad A = 1, \dots, N, \\[1.5em] \displaystyle S_A = \frac{\partial \mathcal{L}}{\partial T^A}, \\[1.5em] \displaystyle \dot{\Gamma}^A = T^A, \\[1.5em] \displaystyle \dot{\Sigma}_A = \dot{\Sigma}_A. \end{array} \right. \qquad (4.21) $$
**Proof.** Equations of motion of a discrete system. Taking the variations of the action integral and integrating by part, we have

$$ \int_{t_1}^{t_2} \left[ \left\langle \frac{\partial \mathcal{L}}{\partial q} - \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{q}} + F^{\text{ext}}, \delta q \right\rangle + \sum_{A=1}^{N} \delta T^A \left( \frac{\partial \mathcal{L}}{\partial T^A} - S_A \right) \right. \\ \left. + \sum_{A=1}^{N} \delta S_A (-T^A + \dot{\Gamma}^A) - \sum_{A=1}^{N} \delta \Gamma^A (\dot{S}_A - \dot{\Sigma}_A) - \dot{\Gamma}^A \delta \Sigma_A \right] dt = 0. $$

Using the variational constraint, written in terms of $\delta\Sigma_A$ and using $T^A \neq 0$, we obtain

$$ \delta T^A : S_A = \frac{\partial \mathcal{L}}{\partial T^A}, \quad A = 1, \dots, N, \qquad (4.22) $$

$$ \delta S_A : \dot{\Gamma}^A = T^A, \quad A = 1, \dots, N. \qquad (4.23) $$

$$ \delta q : \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{q}} - \frac{\partial \mathcal{L}}{\partial q} = \sum_{A=1}^{N} \dot{\Gamma}^{A} (T^{A})^{-1} F^{\text{fr}(A)} + F^{\text{ext}}, \qquad (4.24) $$

$$ \delta \Gamma^A : \dot{S}_A = \dot{\Sigma}_A + \sum_{B=1}^{N} \dot{\Gamma}^B (T^B)^{-1} J_A^{\text{fr}(B)}, \quad A = 1, \dots, N. \qquad (4.25) $$

Since $\sum_{B=1}^{N} J_A^{\text{fr}(B)} = 0$, we obtain $\dot{S}_A = \dot{\Sigma}_A$. Using (4.23)–(4.25), and (4.20) we obtain (4.21), which are equivalent to (4.6). ■

Note that the condition (4.22) consistently defines the entropy as

$$ S_A = \frac{\partial \mathcal{L}}{\partial T^A} \quad \text{i.e.,} \quad S_A = -\frac{\partial \mathcal{F}}{\partial T^A} \quad \text{if } \mathcal{L} \text{ is of the special form } (4.17). $$

Note also that the condition (4.23) provides the desired velocity interpretation of the temperature $T^A = \dot{\Gamma}^A$. Thus, we obtain

$$ \left\{ \begin{array}{l} \displaystyle \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{q}} - \frac{\partial \mathcal{L}}{\partial q} = \sum_{A=1}^{N} F^{\text{fr}(A)} + F^{\text{ext}}, \\[1.5em] \displaystyle \frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial T^A} \right) = \frac{1}{T^A} \left[ - \left\langle F^{\text{fr}(A)}(...), \dot{q} \right\rangle - \sum_{B=1}^{N} J_B^{\text{fr}(A)}(...) T^B + P_H^{\text{ext} \to A} \right], \quad A = 1, \dots, N, \end{array} \right. \qquad (4.26) $$

which are equivalent with (4.11).

**Remark 4.10.** In this paper, we assume that the internal energy, the Helmholtz free energy and hence the associated Lagrangians are *not explicitly* dependent on the thermal displacement $\Gamma$. In general, the Lagrangian for nonequilibrium thermodynamics can be understood as a function of variables including explicitly *thermodynamic displacements* such as $W^I$, $\nu^a$ as well as $\Gamma$. This general setting will be interesting from the geometric viewpoint of nonequilibrium thermodynamics. We will explore in details this direction in a future work.

## 4.3 The connected piston-cylinder problem

We consider a piston-cylinder system composed of two connected cylinders which contain two fluids separated by an adiabatic or (internally) diathermic piston, as shown in Fig. 4.2. We assume that the system is isolated. Despite its apparent simplicity, this system has
attracted a lot of attention in the literature because there has been some controversy about the final equilibrium state of this system. We refer to Gruber [1999] for a review of this challenging problem and for the derivation of the time evolution of this system, based on the approach of Stueckelberg and Scheurer [1974]. The system Σ may be regarded as an

<figure><img src="image_9.png" /><figcaption>Figure 4.2: The two-cylinder problem</figcaption></figure>

interconnected system consisting of three simple systems; namely, the two pistons Σ₁, Σ₂ of mass m₁, m₂ and the connecting rod Σ₃ of mass m₃. As illustrated in Fig.4.2, x and y = D - l - x denote respectively the distance between the bottom of each piston to the top, where D is a constant. In this setting, we choose the variables (x, dot, S₁, S₂) (there is no entropy associated to Σ₃) to describe the dynamics of the interconnected system and the Lagrangian is given by

$$L(x, \dot{x}, S_1, S_2) = \frac{1}{2} M \dot{x}^2 - U_1(x, S_1) - U_2(x, S_2), \quad (4.27)$$

where M := m₁ + m₂ + m₃. The equations of evolution can be obtained either by the formulation of Definition 4.1 based on the entropy or by the formulation of Definition 4.9 based on the temperature. We shall choose the latter, and hence we consider the free energy Lagrangian associated to (4.27), given by

$$\mathcal{L}(x, \dot{x}, T^1, T^2) = \frac{1}{2} M \dot{x}^2 - \mathcal{F}_1(x, T^1) - \mathcal{F}_2(x, T^2),$$

where the Helmholtz free energies are given by $\mathcal{F}_1(x, T^1) = U_1(x, S_1) - T^1 S_1$ and $\mathcal{F}_2(x, T^2) = U_2(x, S_2) - T^2 S_2$. Since the system is isolated, $F^{\text{ext} \to A} = 0$ and $P_H^{\text{ext} \to A} = 0$, for all A = 1, 2, 3. We also have $P_H^{A \to 3} = 0$, $F^{\text{fr}(A)}(x, \dot{x}, T^A) = -\lambda_A(x, T^A)\dot{x}$, for all A = 1, 2, $F^{1 \to 2} = 0$, and $P_H^{2 \to 1} = \kappa(x, T^1, T^2)(T^2 - T^1)$, where $\kappa$ is the heat conductivity. Using $\frac{\partial \mathcal{F}_1}{\partial x} = -p_1(x, T^1)\alpha_1$ and $\frac{\partial \mathcal{F}_2}{\partial x} = p_2(x, T^2)\alpha_2$, where $p_1, p_2$ are the pressures of the fluids and $\alpha_1, \alpha_2$ are the areas of the cylinders, equations (4.11) yield the time evolution equations of the system as

$$\left\{
\begin{array}{l}
M \ddot{x} = p_1(x, T^1)\alpha_1 - p_2(x, T^2)\alpha_2 - (\lambda_1 + \lambda_2)\dot{x}, \\
T^1 \dot{S}_1 = \lambda_1 \dot{x}^2 + \kappa(x, T^1, T^2)(T^2 - T^1), \\
T^2 \dot{S}_2 = \lambda_2 \dot{x}^2 + \kappa(x, T^1, T^2)(T^1 - T^2), \\
S_1 = -\frac{\partial \mathcal{F}_1}{\partial T^1}, \quad S_2 = -\frac{\partial \mathcal{F}_2}{\partial T^2},
\end{array}
\right.$$

where $M := m_1 + m_2 + m_3$. These time evolution equations recover the equations of motion for the diathermic piston derived in Gruber [1999], (51)–(53). We have $\frac{d}{dt}E = 0$, where
$E = \frac{1}{2}M\dot{x}^2 + U_1(x, S_1) + U(x, S_2)$, consistently with the fact that the system is isolated. The rate of entropy production is

$$ \frac{d}{dt}S = \left( \frac{\lambda_1}{T^1} + \frac{\lambda_2}{T^2} \right) \dot{x}^2 + \kappa(x, T^1, T^2) \frac{(T^2 - T^1)^2}{T^1 T^2}. $$

The equations of motion for the adiabatic piston are obtained by setting $\kappa = 0$.

## 4.4 Thermodynamics of interconnected electric circuits

We explored a simple electric circuit with thermodynamics in §3.2. In this section, we shall apply our Lagrangian formulation to a case of interconnected electric circuits. Namely, we will show a generalization of the variational formulation in §3.2 to the case of several entropy variables and internal heat transfer.

Consider the interconnected electric circuit $\Sigma = \cup_{A=1}^3 \Sigma_A$ illustrated in Fig. 4.3. We assume that there is no heat transfer to the exterior, namely, $P_Q^{\text{ext}} = 0$, but there is heat transfer between the simple systems $\Sigma_A, A = 1, 2, 3$. Further, we assume that $P_M^{\text{ext}} = P_W^{\text{ext}} = 0$, i.e., the system is isolated. Following the general approach to discrete systems described above, since the system $\Sigma$ is decomposed into the simple systems $\Sigma_A$, we can appropriately choose charge and current variables $q, \dot{q}$ through Kirchhoff's current to describe $\Sigma$ and the entropy variables $S_A$ associated to each of the simple systems $\Sigma_A$. As before, we shall assume (possibly) nonlinear constitutive equations for circuit elements, namely, $\varphi = \varphi_L(I)$, $V = V_C(q)$, $V = V_{R_i}(I)$, $i = 1, 2, 3$. Let us denote by $\dot{q}^1, \dot{q}^2, \dot{q}^3$ the currents as indicated

<figure><img src="image_10.png" /><figcaption>Figure 4.3: An interconnected electric circuit</figcaption></figure>

on the figure. Since we have the KCL constraint $\dot{q}^1 = \dot{q}^2 + \dot{q}^3$, we can choose the charge variables $q = (q^2, q^3)$ and write $q^1(t) = q^2(t) + q^3(t) + q^0$, where $q^0$ denotes a constant charge. We denote by $\kappa_{AB}(...)$ the heat transfer coefficients between each of the systems. We thus have the following expressions

$$ \Sigma^1: L_1(q^2, q^3, \dot{q}^2, \dot{q}^3, S_1) = K_L(\dot{q}^2 + \dot{q}^3) - U_1(S_1), \quad F^{\text{fr}(1)}(...) = V_{R_1}(\dot{q}^2 + \dot{q}^3)(dq^2 + dq^3), \\ F^{\text{ext}\to 1}(...) = V^{\text{ext}}(dq^2 + dq^3), $$

$$ \Sigma^2: L_2(q^2, q^3, \dot{q}^2, \dot{q}^3, S_1) = -U_2(S_2), \quad F^{\text{fr}(2)}(...) = V_{R_2}(\dot{q}^2) dq^2, $$

$$ \Sigma^3: L_3(q^2, q^3, \dot{q}^2, \dot{q}^3, S_1) = -U_C(q^3) - U_3(S_3), \quad F^{\text{fr}(3)}(...) = V_{R_3}(\dot{q}^3) dq^3. $$
Applying the variational formulation in Definition 4.1, together with $L = L_1 + L_2 + L_3$, yields the evolution equations

$$ \frac{d}{dt} \varphi_L(\dot{q}^2 + \dot{q}^3) = V^{\text{ext}} + V_{R_1}(\dot{q}^2 + \dot{q}^3) + V_{R_2}(\dot{q}^2), $$

$$ \frac{d}{dt} \varphi_L(\dot{q}^2 + \dot{q}^3) + V_C(q^3) = V^{\text{ext}} + V_{R_1}(\dot{q}^2 + \dot{q}^3) + V_{R_3}(\dot{q}^3), $$

$$ \dot{S}_1 = -\frac{1}{T^1} V_{R_1}(\dot{q}^2 + \dot{q}^3)(\dot{q}^2 + \dot{q}^3) + \frac{1}{T^1} \kappa_{12}(T^2 - T^1) + \frac{1}{T^1} \kappa_{13}(T^3 - T^1), $$

$$ \dot{S}_2 = -\frac{1}{T^2} V_{R_2}(\dot{q}^2)\dot{q}^2 + \frac{1}{T^2} \kappa_{21}(T^1 - T^2) + \frac{1}{T^2} \kappa_{23}(T^3 - T^2), $$

$$ \dot{S}_3 = -\frac{1}{T^3} V_{R_3}(\dot{q}^3)\dot{q}^3 + \frac{1}{T^3} \kappa_{31}(T^1 - T^3) + \frac{1}{T^3} \kappa_{32}(T^2 - T^3). $$

One easily checks that $\frac{d}{dt}E = 0$, consistently with the fact that the system is isolated. The total entropy production reads

$$ \dot{S} = -\frac{1}{T^1} V_{R_1}(\dot{q}^2 + \dot{q}^3)(\dot{q}^2 + \dot{q}^3) - \frac{1}{T^2} V_{R_2}(\dot{q}^2)\dot{q}^2 - \frac{1}{T^3} V_{R_3}(\dot{q}^3)\dot{q}^3 + \sum_{A<B} \kappa_{AB} \frac{(T^B - T^A)^2}{T^A T^B}, $$

where $V_{R_A}(\dot{q}^i)\dot{q}^i \le 0$, for all $\dot{q}^i$, $A = 1, 2, 3$ and $i = 1, 2, 3$.

**Remark 4.11.** Note that in our approach we first imposed the KCL constraint $\dot{q}^1 = \dot{q}^2 + \dot{q}^3$ (which is holonomic) to eliminate the variable $q^1$ and then we applied the variational formulation (4.3) with variables $(q^2, q^3, S_1, S_2, S_3)$.

It is also possible to derive the same equations by keeping the dependent variables $q^1, q^2, q^3$ and treating the holonomic constraint $\dot{q}^1 = \dot{q}^2 + \dot{q}^3$ as an additional constraint besides the nonholonomic constraints (4.5) associated to entropy production. The equations are obtained by using the formulation (4.3) with the variational constraints $\delta q^1 = \delta q^2 + \delta q^3$ and (4.4). This approach will be pursued in a more general setting in a future work on the geometric description for the interconnection of thermodynamic systems.

# 5 Conclusions

In this paper, we have established a Lagrangian variational formulation for discrete systems including nonequilibrium thermodynamics. From a mathematical point of view, this variational formulation is an extension of the standard Lagrange-d'Alembert principle used in nonholonomic mechanics, but does not follow Chetaev's approach. In this extension, the nonholonomic constraint is nonlinear and is given by the expression of the entropy production associated to all the irreversible processes involved.

In order to obtain such a variational formulation, we have employed an analogy between thermodynamics and mechanics, in which the thermodynamic affinities are regarded as a rate of the thermodynamic displacement $\Lambda$, (i.e., $X^\alpha = \dot{\Lambda}^\alpha$), associated to each irreversible process. This allows us to formulate the associated variational constraint in a systematic way, namely, by replacing all the velocities by their corresponding virtual displacement $\delta\Lambda^\alpha$ and by removing the effect of the exterior of the system:

$$ J_{\alpha} \dot{\Lambda}^{\alpha} + P^{\text{ext}} \rightsquigarrow J_{\alpha} \delta \Lambda^{\alpha}. $$

Our variational formulation has thus a clear and systematic structure that appears to be common for the macroscopic description of the nonequilibrium thermodynamics of physical systems. It has been illustrated with examples from classical mechanics, electric circuits, chemical reactions, and matter transfer.
As we will show in the Part II of the paper (Gay-Balmaz and Yoshimura [2016]), our approach can be naturally extended to the case of continuum systems, in particular, we will consider the Navier-Stokes-Fourier equations and the more general case of the multicomponent viscous heat conducting fluid with chemical reactions and mass transfer.

Note that the examples that we consider in this paper are restricted to closed systems; namely, we have not shown examples of systems that include external matter transfer, although our variational formulation is also applicable to such open systems typically appearing in biology, mechanical engines, etc. The application to more complex systems including open systems will be explored as a future work.

**Acknowledgements.** The authors thank C. Gruber for extremely helpful discussions. F.G.B. is partially supported by the ANR project GEOMFLUID, ANR-14-CE23-0002-01; H.Y. is partially supported by JSPS (Grant-in-Aid for Scientific Research 26400408, Grant-in-Aid for Scientific Research 16KT0024), JST (CREST), Waseda University (SR 2014B-162, SR 2015B-183), the IRSES project "Geomech" (246981) within the 7th European Community Framework Programme, and the MEXT "Top Global University Project" at Waseda University.

## References

Appell, P [1911], Sur les liaisons exprimées par des relations non linéaires entre les vitesses, C.R. Acad. Sci. Paris, **152**, 1197-1199.

Arnold, V. I. [1988], *Dynamical Systems: Vol III*. Springer-Verlag, New York.

Biot, M. A. [1975], A virtual dissipation principle and Lagrangian equations in non-linear irreversible thermodynamics, *Acad. Roy. Belg. Bull. Cl. Sci.* **5** (61), 6-30.

Biot, M. A. [1984], New variational-Lagrangian irreversible thermodynamics with application to viscous flow, reaction-diffusion, and solid mechanics. *Adv. Appl. Mech.* **24**, 1-91.

Bloch, A. M. [2003], *Nonholonomic Mechanics and Control*, volume 24 of *Interdisciplinary Applied Mathematics*, Springer-Verlag, New York. With the collaboration of J. Baillieul, P. Crouch and J. Marsden, and with scientific input from P. S. Krishnaprasad, R. M. Murray and D. Zenkov.

Cendra, H., A. Ibort, M. de León, and D. Martín de Diego [2004], A generalization of Chetaev's principle for a class of higher order nonholonomic constraints, *J. Math. Phys.* **45**, 2785.

Chetaev, N. G. [1934], On Gauss principle, *Izv. Fiz-Mat. Obsc. Kazan Univ.*, **7**, 68-71.

Chua, L. O. and J. D. McPherson [1974], Explicit topological formulation of Lagrangian and Hamiltonian equations for nonlinear networks. *IEEE Trans. Circuits Syst.*, **21**, 277-286.

de Groot, S. R and P. Mazur [1969], *Nonequilibrium Thermodynamics*, North-Holland.

Ferrari, C. and C. Gruber [2010], Friction force: from mechanics to thermodynamics, *Europ. J. Phys.* **31**(5), 1159-1175.

Fukagawa, H. and Y. Fujitani [2012], A variational principle for dissipative fluid dynamics, *Prog. Theor. Phys.* **127**(5), 921-935.
Gay-Balmaz, F. and H. Yoshimura [2015], Dirac reduction for nonholonomic mechanical systems and semidirect products, *Advances in Applied Mathematics*, **63**, 131–213.

Gay-Balmaz, F. and H. Yoshimura [2016], A Lagrangian formulation for nonequilibrium thermodynamics. Part II: continuum systems

Gibbs, J. W. [1902], *Collected Works*, Scribner, New-York.

Glansdorff, P. and I. Prigogine [1971], *Thermodynamic Theory of Structure, Stability, and Fluctuations*, Wiley-Interscience.

Green, A. E. and P. M. Naghdi [1991], A re-examination of the basic postulates of thermomechanics, *Proc. R. Soc. London. Series A: Mathematical, Physical and Engineering Sciences*, **432**(1885), 171–194.

Gruber, C. [1997], *Thermodynamique et Mécanique Statistique*, Institut de physique théorique, EPFL.

Gruber, C. [1999], Thermodynamics of systems with internal adiabatic constraints: time evolution of the adiabatic piston, *Eur. J. Phys.* **20**, 259–266.

Gruber, C. and S. D. Brechet [2011], Lagrange equation coupled to a thermal equation: mechanics as a consequence of thermodynamics, *Entropy* **13**, 367–378.

Gyarmati, I. [1970], *Nonequilibrium Thermodynamics: Field Theory and Variational Principles*, Springer-Verlag, New York.

Ichiyanagi M. [1994], Variational principles in irreversible processes, *Phys. Rep.* **243**, 125–182.

Jacobs, H. and H. Yoshimura [2014], Tensor products of Dirac structures and interconnection in Lagrangian mechanics, *J. Geo. Mech.* **6**(1), 67–98.

Jimenez, F. and H. Yoshimura [2015], Dirac structures in vakonomic mechanics, *J. Geo. and Phys.* **94**, 158–178.

Kondepudi, D. and I. Prigogine [1998], *Modern Thermodynamics*, John Wiley & Sons.

Lavenda, B. H. [1978], *Thermodynamics of Irreversible Processes*, Macmillan, London.

Marle, C.-M. [1998], Various approaches to conservative and nonconservative non-holonomic systems, *Rep. Math. Phys.* **42**, 1/2, 211–229.

Onsager, L. [1931], Reciprocal relations in irreversible processes I, *Phys. Rev.* **37**, 405–426; Reciprocal relations in irreversible processes II, *Phys. Rev.* **38**, 2265–2279.

Onsager, L. and S. Machlup [1953], Fluctuations and irreversible processes, *Phys. Rev.* **91**, 1505–1512.

Onsager, L. and S. Machlup [1953], Fluctuations and irreversible processes II. Systems with kinetic energy. *Phys. Rev.* **91**, 1512–1515.

Oster, G. F., A. S. Perelson, A. Katchalsky [1973], Network thermodynamics: dynamic modelling of biophysical systems, *Quarterly Reviews of Biophysics*, **6**(1), 1–134.

Pironneau, Y. [1983], Sur les liaisons non holonomes non linéaires, déplacements virtuels à travail nul, conditions de Chetaev, Proceedings of the IUTAM-ISIMM Symposium on Modern Developments in Analytical Mechanics, Torino 1982, *Atti della Acad. della sc. di Torino*, **117**, 671–686.
Podio-Guidugli, P. [2009], A virtual power format for thermomechanics, *Continuum Mechanics and Thermodynamics*, **20**(8), 479-487.

Prigogine [1947], Etude thermodynamique des phénomènes irréversibles, Thesis, Paris: Dunod and Liège: Desoer.

Stueckelberg, E. C. G. and P. B. Scheurer [1974], *Thermocinétique phénoménologique galiléenne*, Birkhäuser, 1974.

Truesdell, C. [1969], *Rational Thermodynamics*, McGraw-Hill, New-York.

von Helmholtz, H. [1884], *Studien zur Statik monocyklischer Systeme. Sitzungsberichte der Königlich Preusschen Akademie der Wissenschaften zu Berlin*, 159-177.

Woods, L. C. [1975], *The Thermodynamics of Fluid Systems*, Clarendon Press Oxford 1975.

Yoshimura, H. and J. E. Marsden [2006a], *Dirac structures in Lagrangian mechanics. Part I: Implicit Lagrangian systems*, *J. Geom. and Phys.* **57**, 133-156.

Yoshimura, H. and J. E. Marsden [2006b], *Dirac structures in Lagrangian mechanics. Part II: Variational structures*, *J. Geom. and Phys.* **57**, 209-250.

Yoshimura, H. and J. E. Marsden [2006c], *Dirac structures and implicit Lagrangian systems in electric networks*, *Proc. of the 17th International Symposium on Mathematical Theory of Networks and Systems*, Paper WeA08.5, pages 1-6, July 24-28, 2006, Kyoto.

Ziegler, H. [1968], *A possible generalization of Onsager's theory*, in H. Barkus and L.I. Sedov (eds.), *Irreversible Aspects of Continuum Mechanics*, Springer, New York.