1 Fundamentals of Open Systems

In this section, we briefly present the fundamental setting for open thermodynamic systems. We focus on the case of simple systems in the sense of Stueckelberg, see [26].

1.1 Stueckelberg’s Formulation of Nonequilibrium Thermodynamics

In order to give a macroscopically dynamic theory to account for irreversible processes, we use the phenomenological approach to nonequilibrium thermodynamics developed by Stueckelberg [26]. This approach enables us to treat nonequilibrium thermodynamics as a natural extension of classical mechanics. We emphasize that this is a pure macroscopic and phenomenological approach deduced from the axiomatic formulation of the two laws, which does not aim to derive the equations for the open systems in terms of microscopic arguments. We refer to e.g. [8, 20, 21] for the systematic use of Stueckelberg’s formulation for several examples of closed thermodynamic systems.

Let us denote by \( \boldsymbol{\Sigma } \) a physical system and by \(\boldsymbol{\Sigma } ^\mathrm{ext}\) its exterior. Stueckelberg’s axiomatic formulation of the two laws are given as follows.

First Law: For every system \( \boldsymbol{\Sigma } \), there exists an extensive scalar state function E, called energy, which satisfies

$$\begin{aligned} \frac{d}{dt} E(t) = P^\mathrm{ext}_W(t)+P^\mathrm{ext}_H(t)+P^\mathrm{ext}_M(t), \end{aligned}$$
(1)

where t denotes time, \( P^\mathrm{ext}_W\) is the power associated with the work done on the system, \(P^\mathrm{ext}_H\) is the power associated to the heat transfer into the system, and \(P^\mathrm{ext}_M\) is the power associated with the matter transfer into the system.

Definition 1

For a given thermodynamic system, we employ the following terminology:

  • A system is said to be closed, if there is no exchange of matter, i.e., \(P^\mathrm{ext}_M(t)=0\). If \(P^\mathrm{ext}_M(t) \ne 0\), the system is said to be open.

  • A system is said to be adiabatically closed, if it is closed and there is no heat exchanges, i.e., \(P^\mathrm{ext}_M(t)=P^\mathrm{ext}_H(t)=0\).

  • A system is said to be isolated, if it is adiabatically closed and there is no mechanical power exchange, i.e., \(P^\mathrm{ext}_M(t)=P^\mathrm{ext}_H(t)=P^\mathrm{ext}_W(t)=0\).

From the first law, it follows that the energy of an isolated system is preserved.

Second Law: For every system \( \boldsymbol{\Sigma } \), there exists an extensive scalar state function S, called entropy, which obeys the following two conditions.

  1. (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)\ge 0, $$

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

  2. (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 \rightarrow +\infty }S(t)= \max _{ \rho \; \text {compatible}}S[\rho ]. $$

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

1.2 An Illustrative Example of Open Systems

We present here the fundamental setting for nonequilibrium thermodynamics of open systems with the help of an illustrative example. We recall that a thermodynamic system is called simple when one (scalar) thermal variable and a finite set of non-thermal variables are sufficient to describe entirely the state of the system. From the second law we can always choose the thermal variable to be the entropy. Recall also that the system is called open if it has a non-vanishing power exchange due to matter transfer with exterior. In this paper, we specifically focus on the case of simple and open systems.

A Piston-Cylinder System. Consider a single piston-cylinder system described in Fig. 1, where the cylinder contains an ideal gas and there exists a power exchange due to matter and heat transfer with the exterior, as well as a mechanical power exchange with the exterior by the piston. In addition, there is an internal irreversible process associated with the collision of the fluid particles on the piston, macroscopically described by a friction force, see [20].

Fig. 1.
figure 1

An example of a simple and open system: a piston with exterior ports and heat sources.

For such an open system, we can choose one entropy variable \(S \in \mathbb {R}\) as the thermodynamic variable and \(N \in \mathbb {R}\) as the number of moles of the chemical species in the compartment, while we denote the mechanical variable by \(q \in Q\), where Q is given by \(\mathbb {R}\). Let U(qSN) be the internal energy associated with the ideal gas contained inside of the cylinder. Let \(F^\mathrm{ext}\) be the external force acting on the system via the piston and let \(F^\mathrm{fr}\) be the friction force appearing in the irreversible process associated with the collision of the fluid particles.

Assume that the system has A ports, through which the matter flows out or into the system and also that there are B ports associated with heat sources. For the variables associated with these ports, we denote the chemical potential, temperature, and molar flow rate at the a-th port by \(\mu ^a\), \(T^a\), and \(\mathcal {J}^{a}\) \((a=1,...,A)\), respectively, and we denote the temperature and entropy flow rate at the b-th heat source by \(\bar{T}^b\) and \(\bar{\mathcal {J}}_{S}^{b}\) \((b=1,...,B)\), respectively. It is common that the thermodynamic quantities at the ports are given by the pressure and the temperature \(\mathsf {P}^a\), \(T^a\), from which the other thermodynamic quantities such as \(\mu ^a=\mu ^a(\mathsf {P}^a,T^a)\) or \(\mathsf {S}^a=\mathsf {S}^a(\mathsf {P}^a,T^a)\) can be computed by the state equations of the gas; see, for instance, [22]. Notice that these thermodynamic quantities at the ports are time-dependent in general.

Mass Balance Equation. For such an open system with A ports with a single chemical component, the mole balance equation is written as

$$\begin{aligned} \frac{d}{dt}N=\sum _{a=1}^A \mathcal {J}^a, \end{aligned}$$
(2)

where \(\mathcal {J}^a\) is the molar flow rate into the system through the a-th port, so that \(\mathcal {J}^a>0\) for flow into the system and \(\mathcal {J}^a<0\) for flow out of the system.

Energy Balance Equation. As matter enters or leaves the system, it may carry its internal, potential as well as kinetic energy. The energy flow rate at the a-th port is given by the product \(\mathsf {U}^a\mathcal {J}^a\), where \(\mathsf {U}^a\) and \(\mathcal {J}^a\) respectively denote the energy per mole (or molar energy) and the molar flow rate at the a-th port. Further, as matter enters or leaves the system, it may also exert work on the system that is associated with pushing the species into or out of the system. Hence the power exchange due to the mass transfer is given by

$$\begin{aligned} \begin{aligned} P^\mathrm{ext}_M&= \sum _{a=1}^A\mathcal {J}^a(\mathsf {U}^a+ \mathsf {P}^a\mathsf {V}^a)= \sum _{a=1}^A (\mathcal {J}^a\mu ^a +\mathcal {J}^a_ST^a). \end{aligned} \end{aligned}$$

Here \(\mathsf {P}^a\) and \(\mathsf {V}^a\) are the pressure and the molar volume of the substance flowing through the a-th port. Furthermore, \(\mathcal {J}^a_S:=\mathsf {S}^a\mathcal {J}^a\) is the entropy flow rate with \(\mathsf {S}_a\) the molar entropy at the a-th port and we have used the relation \(\mathsf {H}^a=\mathsf {U}^a+ \mathsf {P}^a\mathsf {V}^a= \mu ^a +T^a\mathsf {S}^a\), where \(\mathsf {H}^a\) indicates the molar enthalpy at the a-th port. The heat power exchange with exterior is given by

$$P^\mathrm{ext}_H=\sum _{b=1}^B \bar{\mathcal {J}}^b_S \bar{T}^b,$$

where \(\bar{\mathcal {J}}^b_S\) and \(\bar{T}^b\) respectively denote the entropy flow rate and the temperature at the b-th port. The mechanical power associated with the external force \(F^\mathrm{ext}\) is given by

$$P^\mathrm{ext}_W= \langle F^\mathrm{ext}, \dot{q}\rangle .$$

Thus, the first law for open system, i.e., the energy balance equation reads as

$$\begin{aligned} \frac{d E}{dt}=\langle F^\mathrm{ext}, \dot{q}\rangle +\sum _{a=1}^A (\mathcal {J}^a\mu ^a +\mathcal {J}^a_ST^a)+\sum _{b=1}^B \bar{\mathcal {J}}^b_S \bar{T}^b, \end{aligned}$$
(3)

where E is the total energy of the system.

Entropy Balance Equation. Regarding the second law for open systems, we have the entropy balance equation, namely, the rate of total entropy of the system, given by

$$\begin{aligned} \dot{S}=I + \sum _{a=1}^A \mathcal {J}^a_S + \sum _{b=1}^B \bar{\mathcal {J}}^b_S, \end{aligned}$$
(4)

where I is the rate of internal entropy production given by

$$\begin{aligned}&I=\! \underbrace{-\frac{1}{T}\langle F^\mathrm{fr }, \dot{q} \rangle {\sum _{b=1}^B}}_{\text {mechanical friction}}\! +\underbrace{\frac{1}{T} \sum _{a=1}^A\left[ \mathcal {J}^a\Big (\mu ^a- \mu \Big )+\mathcal {J}^a_S\Big ( T^a - T\Big )\right] }_{\text {mixing of matter flowing into the system}}\nonumber \\&\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad \;\; + \; \underbrace{\frac{1}{T}\sum _{b=1}^B \bar{\mathcal {J}}^b_S\Big (\bar{T}^b- T\Big )}_{\text {heating}}, \end{aligned}$$
(5)

with \(T:=\frac{\partial U}{\partial S}\) the temperature and \(\mu :=\frac{\partial U}{\partial N}\) the chemical potential. The second law imposes that the rate of internal entropy production I is always positive whereas the sign of the rate of entropy flow into the system due to the matter exchange through A ports and to the heat exchange through B ports (the second and third terms on the right-hand side of (4)) is arbitrary.

Equation of Motion for the Piston-Cylinder System. The Lagrangian of the system is given by \(L(q,\dot{q},S, N)=\frac{1}{2}m \dot{q}^2-U(q,S,N)\). We note that if we were applying the conventional Lagrange-d’Alembert principle

$$\begin{aligned} \delta \int _{t _1 }^{ t _2} L(q,\dot{q},S, N)dt+ \int _{t _1 }^{ t _2} \langle F^\mathrm{fr}+F^\mathrm{ext},\;\delta {q}\rangle dt=0, \end{aligned}$$
(6)

for all \(\delta {q}\) with the fixed endpoint conditions, we would get the following equation

$$\begin{aligned} \frac{d}{dt}\frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q}=F^\mathrm{fr}+F^\mathrm{ext}. \end{aligned}$$
(7)

In the Lagrange-d’Alembert principle (6) the friction force is treated as if it were external similarly to \(F^\mathrm{ext}\). However, the friction force is an essentially internal force and the power associated with the friction force does not appear on the right-hand side in the first law (3). It appears as a part of the internal entropy production rate given in (5), in conjunction with the second law (4). Thus, it is clear that there is a crucial flaw in the variational formulation (6) which uses the conventional Lagrange-d’Alembert principle. In addition this principle cannot provide all the required equations for nonequilibrium thermodynamics, namely, the mass balance equation (2), the entropy balance equation (4), the energy balance equation (3) as well as the equation of motion (7). In the next section, we present a general variational formulation for nonequilibrium thermodynamics of open systems that enables to formulate all of the required evolution equations.

2 A Variational Formulation for Open Systems

Before going into details on the variational formulation, we first present the fundamental setting for the Lagrangian formulation of nonequilibrium thermodynamics for a simple and open system. Our variational formulation is a generalized Lagrange-d’Alembert principle, which is an extension of the Hamilton principle of time-dependent nonholonomic systems with nonlinear constraints, see [10,11,12, 14]. This variational formulation is useful as a modelling tool, see [7, 9], and also useful to derive the main bracket formalisms in nonequilibrium thermodynamics, see [6, 17].

2.1 Fundamental Setting for Open Nonequilibrium Thermodynamics

Time-Dependent Lagrangians. As we mentioned, an open system is in general explicitly time-dependent. Hence the state variables that are required to describe the whole system are \( (t,q,v_{q},S,N)\in \mathbb {R} \times TQ\times \mathbb {R}\times \mathbb {R}, \) where the time t is explicitly included and \((q,v_{q})\in TQ\) indicate the state variables associated with the mechanical part of the system, where TQ denotes the tangent bundle of an n-dimensional configuration manifold Q.

Here we consider the variational formulation for simple and open thermodynamic systems by following [12]. Let L be a time-dependent Lagrangian defined on the extended state space, namely,

$$ L:\mathbb {R} \times TQ\times \mathbb {R} \times \mathbb {R} \rightarrow \mathbb {R} , \quad (t,q, v_{q},S, N) \mapsto L(t,q, v_{q},S, N), $$

which is usually given by the kinetic energy minus the internal energy of the system. For the open system of Fig. 1, the Lagrangian is simply given by \(L= \frac{1}{2}mv_{q}^{2}-U(q,S,N)\), which is not time-dependent, however we shall here consider a more general case in which L is given as a time-dependent function. Recall that the system is assumed to be subject to an external force \(F^\mathrm{ext}: \mathbb {R} \times TQ\times \mathbb {R}\times \mathbb {R} \rightarrow T^{*}Q\) and a friction force \(F^\mathrm{fr}: \mathbb {R} \times TQ\times \mathbb {R}\times \mathbb {R} \rightarrow T^{*}Q\). Recall also that the system has A ports, through which species can flow into or out of the system and B ports associated with heat sources.

Thermodynamic Displacements. An essential ingredient for our variational formulation of thermodynamics is the concept of thermodynamic displacements (see [10, 11, 14]). By definition, the thermodynamic displacement associated with an irreversible process is given by the primitive in time of the thermodynamic force (or affinity) of the process. For the process of heat transfer, such an affinity is given by the temperature T, and hence the thermodynamic displacement is defined as a variable \(\Gamma \) such that \(\dot{\Gamma }=T\). The variable \(\Gamma \) is known as a thermal displacement. For the process of mass transfer, the affinity is the chemical potential \(\mu \), and hence the thermodynamic displacement is defined as a variable W such that \(\dot{W}=\mu \). Here, by definition, we recall that the chemical potential and temperature are respectively given by \(\mu :=- \frac{\partial L}{\partial N}\) and \(T:= - \frac{\partial L}{\partial S}\). In addition to these thermodynamic displacements, our variational formulation also involves the variable \(\Sigma \), with entropy units, which is defined by the primitive in time of the rate of internal entropy production of the system. Note that \(\Sigma \) is distinct from S for open systems.

2.2 A Lagrangian Variational Formulation for Open Systems

In the context of the fundamental setting mentioned above, we have the following theorem giving the Lagrangian variational formulation for open systems:

Theorem 1

Suppose that \(q(t), S(t), \Gamma (t), \Sigma (t), W(t), N(t)\) are critical curves for the variational condition

$$\begin{aligned} \delta \int _{t _1 }^{ t _2} \!\Big [ L(t, q, \dot{q}, S,N) + \dot{W} N+ \dot{\Gamma }( S- \Sigma )\Big ] dt + \int _{t_1}^{t_2} \langle F^\mathrm{ext }, \delta q \rangle dt =0, \end{aligned}$$
(8)

subject to the kinematic (phenomenological) constraint

$$\begin{aligned} \frac{\partial L}{\partial S}\dot{\Sigma }= \langle F^\mathrm{fr }, \dot{q} \rangle +\sum _{a=1}^A \Big [\mathcal {J}^a(\dot{W}- \mu ^a) +\mathcal {J}_S^a(\dot{\Gamma }- T^a)\Big ] + \sum _{b=1}^B\bar{\mathcal {J}}^b_{S}(\dot{\Gamma }- \bar{T}^b), \end{aligned}$$
(9)

and for variations subject to the variational constraint

$$\begin{aligned} \frac{\partial L}{\partial S}\delta \Sigma = \langle F^\mathrm{fr }, \delta q \rangle + \sum _{a=1}^A \Big [\mathcal {J}^a \delta W +\mathcal {J}_S^a \delta \Gamma \Big ] + \sum _{b=1}^B\bar{\mathcal {J}}^b_{S} \delta \Gamma , \end{aligned}$$
(10)

with \(\delta q(t_1)=\delta q(t_2)=0\), \( \delta W(t_1)=\delta W(t_2)=0\), and \( \delta \Gamma (t_1)=\delta \Gamma (t_2)=0\).

Then q(t), S(t), N(t) are solutions of the generalized Lagrange-d’Alembert equations

$$\begin{aligned} \left\{ \begin{array}{l} \frac{d}{dt}\frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q}= F^\mathrm{fr} +F^\mathrm{ext}, \qquad \frac{d}{dt} N= \sum \limits _{a=1}^A \mathcal {J}^a,\\ \frac{\partial L}{\partial S}\Big (\dot{S} -\sum \limits _{a=1}^A \mathcal {J}_S^a- \sum \limits _{b=1}^B \bar{\mathcal {J}}^b_{S}\Big )= \langle F^\mathrm{fr }, \dot{q} \rangle \\ \quad -\sum \limits _{a=1}^A\left[ \mathcal {J}^a\Big (\frac{\partial L}{\partial N}+\mu ^a\Big )+\mathcal {J}^a_S\Big (\frac{\partial L}{\partial S}+ T^a\Big )\right] -\sum \limits _{b=1}^B \bar{\mathcal {J}}^b_S\Big (\frac{\partial L}{\partial S}+ \bar{T}^b\Big ), \end{array} \right. \end{aligned}$$
(11)

and \( \Gamma (t)\), W(t), \( \Sigma (t)\) satisfy

$$\begin{aligned} \dot{\Gamma }= - \frac{\partial L}{\partial S}, \qquad \dot{W}= - \frac{\partial L}{\partial N}, \qquad \dot{\Sigma }= \dot{S} -\sum _{a=1}^A \mathcal {J}_S^a- \sum _{b=1}^B \bar{\mathcal {J}}^b_{S}. \end{aligned}$$
(12)

Proof

This theorem is verified by a direct computation. By taking variations of the action integral in (8), integrating by parts, using \( \delta q(t_1)=\delta (t_2)=0\), \(\delta W(t_1)=\delta W(t_2)=0\), \(\delta \Gamma (t_1)=\delta \Gamma (t_2)=0\), together with the variational constraint (10), we obtain the system of evolution equations (11) for the curves q(t), S(t), N(t), together with the conditions (12) which imposes \( \Gamma (t)\) and W(t) to be the thermodynamic displacements and \( \Sigma (t)\) to be the primitive in time of the rate of internal entropy production of the system.   \(\square \)

We can recover all the relations developed in Sect. 1.2. Since the total energy is given from the given Lagrangian as \(E(t, q, \dot{q}, S,N)=\langle \frac{\partial L}{\partial \dot{q}}, \dot{q}\rangle -L\), the energy balance for this system is computed as

$$ \frac{d}{dt}E(t, q, \dot{q}, S,N)=-\frac{\partial L}{\partial t}+\underbrace{\left\langle F^\mathrm{ext}, \dot{q}\right\rangle }_{=P^\mathrm{ext}_W} \;+\; \underbrace{\sum _{a=1}^A (\mathcal {J}^a\mu ^a + \mathcal {J}_S^a T^a)}_{=P^\mathrm{ext}_M} \; + \;\underbrace{\sum _{b=1}^B \bar{\mathcal {J}}^b_S \bar{T}^b}_{=P^\mathrm{ext}_H}. $$

When the given Lagrangian does not explicitly depend on time t, the first law for the open system is recovered as in (3). Furthermore, it follows from the last equation in (11) that we can recover the entropy balance equation (4), where we get the rate of internal entropy production as \(I=\dot{\Sigma }\) in view of \(\dot{W}=- \frac{\partial L}{\partial N}= \mu \) and \(\dot{\Gamma }=- \frac{\partial L}{\partial S}=T\).

Remark 1 (Relation between the kinematic and variational constraints)

Note that the variational constraint (10) follows from the kinematic (phenomenological) constraint (9) by formally replacing the time derivatives \(\dot{\Sigma }\), \(\dot{q}\), \(\dot{W}\), \(\dot{\Gamma }\) by the corresponding virtual displacements \(\delta \Sigma \), \(\delta q\), \(\delta W\), \(\delta \Gamma \), while the time-dependent terms that depend uniquely on the exterior, namely, the terms \(\mathcal {J} ^a\mu ^a\), \(\mathcal {J} ^a_S T ^a \), and \( \bar{\mathcal {J}}^b_S \bar{T} ^b\) have to be removed in the variational constraint. In the following Sect. 3 concerning the Dirac formulation, we will clarify how this difficulty can be naturally solved in terms of the geometric setting of time-dependent mechanics.

3 Dirac Formulation for Time-Dependent Nonholonomic Systems of Thermodynamic Type

To develop the Dirac formulation for open systems in which there is a power exchange of matter between the system and the exterior, there are two distinct levels of essential difficulties in the treatment of the nonlinear constraints of thermodynamic type. First, the constraint becomes explicitly time-dependent. Second, the link between the kinematic (phenomenological) and variational constraints appearing in (8) and (9) is broken by additional terms that only depend on the exterior of the system. It is remarkable that both difficulties can be simultaneously solved by using the geometric setting of field theories as it applies to the case of time-dependent mechanics. In particular, the covariant Pontryagin bundle and the covariant generalized energy have to be employed instead of the Pontryagin bundle and the generalized energy in mechanics. In this setting, we show that the time-dependent nonlinear constraint associated with the entropy production in the open thermodynamic system can be naturally recovered from a Dirac dynamical system (also called a port-Dirac system, see [16]), in which a Dirac structure induced from a linear distribution on the covariant Pontryagin bundle is employed.

3.1 Time-Dependent Constraints of Thermodynamic Type

In this subsection, we first introduce an extended configuration manifold needed to treat the time-dependence in the kinematic and variational constraints. Then, we construct a systematic treatment of the kinematic and variational constraints for the class of time-dependent nonholonomic constraints of thermodynamic type which extends treatment of those constraints in isolated systems, see [13].

Extended Configuration Manifolds. Given a configuration manifold \(\mathcal {Q}\), we define the extended configuration manifold as

$$ \mathcal {Y} :=\mathbb {R}\times \mathcal {Q}\ni (t,x), $$

which can be regarded as a trivial fiber bundle over \(\mathbb {R}\), namely, \( \mathcal {Y} =\mathbb {R}\times \mathcal {Q}\rightarrow \mathbb {R}\), \((t,x)\mapsto t\). Note that this is known as the geometric setting of time-dependent mechanics in the context of classical field theories, where \(\mathcal {Y}=\mathbb {R}\times \mathcal {Q} \rightarrow \mathbb {R}\) is the configuration bundle in the field theory (see [18]).

Time-Dependent Variational and Kinematic Constraints. Consider the vector bundle \((\mathbb {R}\times T\mathcal {Q})\times _ \mathcal {Y} T \mathcal {Y} \rightarrow \mathcal {Y} \) over \(\mathcal {Y} \) whose fiber at \(y=(t,x) \in \mathcal {Y} \) is given by \(T_x\mathcal {Q} \times T_{(t,x)}\mathcal {Y} =T_x\mathcal {Q} \times (\mathbb {R}\times T_x\mathcal {Q})\). An element in the fiber at each \(y=(t,x)\) is denoted by \((v,\delta t, \delta x)\). A variational constraint is a subset

$$ C_V \subset (\mathbb {R}\times T\mathcal {Q})\times _\mathcal {Y} T \mathcal {Y} , $$

such that the set \(C_V(t,x,v)\), defined by

$$ C_V(t,x,v):=C_V\cap \left( \{(t,x,v)\}\times T_{(t,x)}\mathcal {Y} \right) , $$

for all \((t,x,v)\in \mathbb {R}\times T\mathcal {Q}\), is a vector subspace of \(T_{(t,x)}\mathcal {Y}\). A kinematic constraint is given by a submanifold of \(T \mathcal {Y}\) as

$$ C_K\subset T \mathcal {Y}. $$

In general, \(C_K\) and \(C_V\) are independent from each other.

Nonlinear Nonholonomic Constraints of Thermodynamic Type. For the case in which the given constraints \(C_V\) and \(C_K\) have no specific relation between them, one can develop the equations of motion by a variational formulation based on the generalized Lagrange-d’Alembert principle as in [2], while we cannot establish a formulation with Dirac structures in general, because of the existence of nonlinearity in the constraints. However, for the case of nonlinear nonholonomic constraints of thermodynamic type that typically appear in thermodynamics, a Dirac structure formulation can be developed by using the specific relation between \(C_{V}\) and \(C_{K}\) described below. We refer to [13] for the case of isolated systems.

Definition 2

A variational constraint \(C_V\subset (\mathbb {R}\times T\mathcal {Q})\times _\mathcal {Y} T \mathcal {Y} \) and a kinematic constraint \(C_K\subset T\mathcal {Y} \) are called nonlinear constraints of thermodynamic type if \(C_K\) is defined from \(C_V\) as

$$\begin{aligned} C_{K}=\big \{(t,x,\dot{t},\dot{x})\in T\mathcal {Y} \mid (t,x,\dot{t},\dot{x}) \in C_{V}(t,x,\dot{x}) \big \} \subset T\mathcal {Y} . \end{aligned}$$
(13)

In local coordinates, if the variational constraint \(C_V\) is given by

$$\begin{aligned}&C_{V}=\big \{(t, x, v, \delta {t}, \delta {x}) \in (\mathbb {R} \times T\mathcal {Q}) \times _{\mathcal {Y} } T\mathcal {Y} \mid \nonumber \\&\qquad \qquad \qquad \qquad \sum _{i=1}^{n}A_{i}^{r}(t,x,v)\delta x^{i} +B^{r}(t,x,v)\delta {t}=0,\; r=1,...,m\big \} \end{aligned}$$
(14)

for functions \(A^r:\mathbb {R}\times T \mathcal {Q}\rightarrow T^*\mathcal {Q}\) and \(B^r: \mathbb {R}\times T \mathcal {Q}\rightarrow \mathbb {R}\), \(r=1,...,m\), then the associated kinematic constraint \(C_K\) defined in (13) reads

$$\begin{aligned} C_{K}=\big \{(t,x,\dot{t} ,\dot{x}) \in T\mathcal {Y} \mid \sum _{i=1}^{n} A_{i}^{r}(t,x, \dot{x}) \dot{x}^{i} +B^{r}(t,x, \dot{x})\dot{t}=0,\; r=1,...,m \big \}. \end{aligned}$$

3.2 Dirac Structures on Covariant Pontryagin Bundles

In this subsection, we first introduce the covariant Pontryagin bundle by using the geometric setting of classical field theory and then we develop a time-dependent Dirac structure on the covariant Pontryagin bundle that is induced from the distribution \(C_V\) and a presymplectic form.

The Covariant Pontryagin Bundle. The construction of the geometric setting for time-dependent mechanics is based on that of field theory, see [18, 27]. In this case, the configuration bundle is the trivial bundle \( \mathcal {Y} =\mathbb {R}\times \mathcal {Q}\rightarrow \mathcal {X} =\mathbb {R}\). We have the following canonical identifications:

$$\begin{aligned} J^1\mathcal {Y} \cong \mathbb {R}\times T\mathcal {Q}, \quad J^1\mathcal {Y} ^\star \cong T^*\mathcal {Y}=T^*(\mathbb {R}\times \mathcal {Q}), \qquad \Pi \mathcal {Y} \cong \mathbb {R} \times T^* \mathcal {Q}, \end{aligned}$$

with \(J^1 \mathcal {Y} \rightarrow \mathcal {Y} \) the first jet bundle, \(J ^* \mathcal {Y} \rightarrow \mathcal {Y} \) the dual jet bundle, and \(\Pi \mathcal {Y} \rightarrow \mathcal {Y} \) the restricted dual jet bundle associated to \( \mathcal {Y} \rightarrow \mathcal {X} \). By analogy with the Pontryagin bundle in time-independent mechanics, we define the covariant Pontryagin bundle over \(\mathcal {Y} =\mathbb {R}\times \mathcal {Q}\) as

$$\begin{aligned} \pi _{(\mathcal {P}, \mathcal {Y} )}: \mathcal {P}=J^1\mathcal {Y} \times _\mathcal {Y} J^1\mathcal {Y} ^\star \rightarrow \mathcal {Y} =\mathbb {R}\times \mathcal {Q}, \end{aligned}$$

whose fiber at \(y=(t,x) \in \mathcal {Y} \) is denoted by \((v,\mathsf {p}, p)\). Therefore, for the covariant Pontryagin bundle over \(\mathcal {Y} =\mathbb {R}\times \mathcal {Q}\), we have the identification \(J^1\mathcal {Y} \times _\mathcal {Y} J^1\mathcal {Y} ^\star \cong (\mathbb {R}\times T\mathcal {Q})\times _\mathcal {Y} T^*\mathcal {Y}\).

Induced Distributions on the Covariant Pontryagin Bundle. From the given variational constraint \(C_V\subset J^1 \mathcal {Y} \times _\mathcal {Y} T \mathcal {Y} \), the distribution \(\Delta _\mathcal {P}\) on the covariant Pontryagin bundle is defined by

$$\begin{aligned} \Delta _{\mathcal {P}}(t,x,v,\mathsf {p}, p):=\big (T_{(t,x,v,\mathsf {p}, p)}\pi _{(\mathcal {P},\mathcal {Y} )}\big )^{-1}(C_{V}(t, x, v)) \subset T_{(t,x,v,\mathsf {p}, p)}\mathcal {P}. \end{aligned}$$
(15)

When \(C_V\) is locally described as in (14), the local expression of \(\Delta _\mathcal {P}\) is given by

$$\begin{aligned}&\Delta _{\mathcal {P}}(t,x,v,\mathsf {p}, p)=\big \{(\delta {t},\delta {x},\delta {v},\delta {\mathsf {p}}, \delta {p}) \in T_{(t,x,v,\mathsf {p}, p)}\mathcal {P} \mid \nonumber \\&\qquad \qquad \qquad \qquad \qquad \ \sum _{i=1}^{n}A_{i}^{r}(t,x,v)\delta {x}^{i} +B^{r}(t,x,v)\delta {t}=0,\;\; r=1,...,m\big \}. \end{aligned}$$
(16)

Dirac Structures on the Covariant Pontryagin Bundle. Associated with \(T^*\mathcal {Y} \), there is the canonical symplectic form \(\Omega _{T^*\mathcal {Y} }=-\mathbf {d}\Theta _{T^*\mathcal {Y} }\), where \(\Theta _{T^*\mathcal {Y} }\) is the canonical one-form on \(T^*\mathcal {Y} \). In local coordinates, we have

$$\Theta _{T^*\mathcal {Y} }=p_{i}dx^{i}+\mathsf {p}dt \quad \text {and} \quad \Omega _{T^*\mathcal {Y} }=dx^{i} \wedge dp_{i} + dt \wedge d\mathsf {p}.$$

Using the projection \(\pi _{(\mathcal {P}, T^{*}\mathcal {Y} )}:\mathcal {P} \rightarrow T^{*}\mathcal {Y} \), \((t,x,v,\mathsf {p}, p)\mapsto (t,x,\mathsf {p}, p)\) onto \(T^{*}\mathcal {Y} \), the presymplectic form on the covariant Pontryagin bundle is obtained as

$$\begin{aligned} \omega _{\mathcal {P}}=\pi _{(\mathcal {P}, T^{*}\mathcal {Y} )}^{*}\Omega _{T^{*}\mathcal {Y} }, \end{aligned}$$
(17)

with local expression \(\omega _{\mathcal {P}}=dx^{i} \wedge dp_{i} + dt \wedge d\mathsf{p}\).

Given the distribution \(\Delta _{\mathcal {P}}\) in (15) and the presymplectic form \(\omega _{\mathcal {P}}\) in (17), the induced Dirac structure \(D_{\Delta _{\mathcal {P}}}\) on \(\mathcal {P}\) is defined by, for each \(\mathrm {x}\in \mathcal {P}\),

$$\begin{aligned}&D_{\Delta _{\mathcal {P}}}(\mathrm {x})=\big \{(\mathfrak {u}_{\mathrm {x}}, \mathfrak {a}_{\mathrm {x}}) \in T_{\mathrm {x}}\mathcal {P} \times T_{\mathrm {x}}^{*}\mathcal {P} \mid \mathfrak {u}_{x} \in \Delta _{\mathcal {P}}(\mathrm {x}), \nonumber \\&\qquad \qquad \qquad \qquad \qquad \qquad \quad \; \langle \mathfrak {a}_{\mathrm {x}}, \mathfrak {v}_{\mathrm {x}}\rangle = \Omega _{\mathcal {P}}(\mathrm {x})(\mathfrak {u}_{\mathrm {x}}, \mathfrak {v}_{\mathrm {x}}),\;\forall \;\mathfrak {v}_{\mathrm {\mathrm {x}}} \in \Delta _{\mathcal {P}}(\mathrm {x})\big \}. \end{aligned}$$
(18)

When the local expression of the distribution is given as in (16), using local coordinates \(\mathrm {x}=(t,x,v,\mathsf {p}, p) \in \mathcal {P}\), \(\mathfrak {u}_{\mathrm {x}}=(u_t, u_x,u_v, u_{\mathsf {p}}, u_p)\in T_{\mathrm {x}}\mathcal {P}\), \(\mathfrak {v}_{\mathrm {x}}=( \delta {t}, \delta x, \delta {v}, \delta {\mathsf {p}}, \delta {p}) \in T_{\mathrm {x}}\mathcal {P}\), and \(\mathfrak {a}_{\mathrm {x}}=(\pi , \alpha , \beta , \gamma , w) \in T^{*}_{\mathrm {x}}\mathcal {P}\), the condition that an element \((\mathfrak {u}_{\mathrm {x}}, \mathfrak {a}_{\mathrm {x}}) \in T_{\mathrm {x}}\mathcal {P} \times T_{\mathrm {x}}^{*}\mathcal {P}\) belongs to the section of the induced Dirac structure

$$(\mathfrak {u}_{\mathrm {x}}, \mathfrak {a}_{\mathrm {x}}) \in D_{\Delta _{\mathcal {P}}}(\mathrm {x})$$

takes the following form:

$$\begin{aligned} \left\{ \begin{array}{l} u_x=w, \quad u_t=\gamma ,\quad \beta =0,\\ (t,x,u_t,u_x) \in C_{V}(t,x,v), \\ (u_{\mathsf {p}}+\pi , u_p+\alpha ) \in C_{V}(t,x,v)^{\circ }. \end{array} \right. \end{aligned}$$
(19)

In the above, \(C_{V}(t,x,v)^{\circ } \subset T^{*}_{(t,x)} \mathcal {Y} \) denotes the annihilator of \(C_{V}(t,x,v) \subset T_{(t,x)} \mathcal {Y} \), which is defined by

$$ C_{V}(t,x,v)^{\circ }=\big \{ \mathsf {a} \in T^{*}_{(t,x)} \mathcal {Y} \mid \langle \mathsf {a},\eta \rangle =0,\; \forall \;\eta \in C_{V}(t,x,v) \big \} $$

and hence the local coordinate expression of the annihilator is

$$ C_{V}(t,x,v)^{\circ }=\{(t,x, \pi , \alpha )\in T^*_{(t,x)} \mathcal {Y} \mid \pi =\lambda _rB^{r}(t,x,v) , \;\alpha =\lambda _r A_{i}^{r}(t,x,v),\;\lambda ^r\in \mathbb {R}\}. $$

Thus, the local coordinate expressions for (19) are given by

$$\begin{aligned} \left\{ \begin{array}{l} u_x^i=w^{i}, \quad u_t=\gamma ,\quad \beta _{i}=0,\\ \sum \limits _{i=1}^{n} A_{i}^{r}(t,x,v)u_x^{i} +B^{r}(t,x,v)u_t=0,\;\;r=1,...,m,\\ u_{\mathsf {p}}+\pi =\sum \limits _{r=1}^{m}\lambda _{r}B^{r}(t,x,v), \quad (u_p)_{i}+\alpha _{i}=\sum \limits _{r=1}^{m}\lambda _{r} A^{r}_{i}(t,x,v), \;\; i=1,...,n. \end{array} \right. \end{aligned}$$
(20)

We refer to [28] for the basic construction of the induced Dirac structure from a distribution in nonholonomic mechanics.

3.3 Dirac Dynamical Systems on the Covariant Pontryagin Bundle

In this subsection, we define a Dirac dynamical system by employing the induced Dirac structure and the covariant generalized energy on the covariant Pontryagin bundle. This is an example of the port-Dirac system, see [16].

The Covariant Generalized Energy. Given a time-dependent Lagrangian \( \mathcal {L} :J^1 \mathcal {Y} = \mathbb {R}\times T \mathcal {Q}\rightarrow \mathbb {R}\), we define the covariant generalized energy \(\mathcal {E}: \mathcal {P}\rightarrow \mathbb {R}\) on \(\mathcal {P}\) by

$$\begin{aligned} \mathcal {E}(t,x,v,\mathsf {p}, p)= \mathsf {p} + \langle p, v\rangle - \mathcal {L} (t,x,v). \end{aligned}$$
(21)

We also define the generalized energy \(E: \mathbb {R}\times (T\mathcal {Q}\oplus T^*\mathcal {Q})\rightarrow \mathbb {R}\) by

$$\begin{aligned} E(t,x,v,p)= \langle p, v\rangle - \mathcal {L} (t,x,v), \end{aligned}$$
(22)

which satisfies the relation \(\mathcal {E}= E+\mathsf {p}\). It is important to note that the generalized energy (22) is not induced by an intrinsic object for general field theories, as opposed to the covariant generalized energy (21). In our case, since the configuration bundle is trivial, the expression (22) is still well-defined.

External Forces. Let \(F^\mathrm{ext}: J^{1}\mathcal {Y}\rightarrow T^*\mathcal {Q}\) be an external force field, with \(F^\mathrm{ext}(t,x,v)\in T^*_x\mathcal {Q}\), for all \((t,x,v)\in J^{1}\mathcal {Y}\). Using the natural projection \(\pi _{(\mathcal {P}, \mathcal {Q})}: \mathcal {P} \rightarrow \mathcal {Q}\), \((t,x,v, \mathsf {p}, p) \mapsto x\), the external force field \(F^\mathrm{ext}\) on \(T^*\mathcal {Q}\) can be lifted as a horizontal one-form on \(\mathcal {P}\) as, for \((t,x,v, \mathsf {p}, p) \in \mathcal {P}\) and \(W \in T_{(t,x,v, \mathsf {p}, p)}\mathcal {P}\),

$$ \langle \widetilde{F}^\mathrm{ext}(t,x,v, \mathsf {p}, p) , W \rangle =\langle F^\mathrm{ext}(t, x,v), T_{(t,x,v, \mathsf {p}, p)}\pi _{(\mathcal {P}, \mathcal {Q})}(W)\rangle . $$

Locally, we have \(\widetilde{F}^\mathrm{ext}(t,x,v, \mathsf {p}, p)= \left( t,x,v, \mathsf {p}, p,0,F^\mathrm{ext}(t,x,v),0,0,0 \right) \).

Proposition 1

Given \(\Delta _\mathcal {P}\), \(\mathcal {L}(t,x,v)\), and \(F^\mathrm{ext}(t,x,v)\) as above, a curve of the form

$$\begin{aligned} \mathrm {x}(t)=(t,x(t),v(t),\mathsf {p}(t), p(t)) \end{aligned}$$
(23)

on the covariant Pontryagin bundle \(\mathcal {P}\) satisfies the condition for a time-dependent Dirac dynamical system

$$\begin{aligned} \big (\dot{\mathrm {x}}(t), \mathbf {d}\mathcal {E}({\mathrm {x}(t)})-\widetilde{F}^\mathrm{ext}(\mathrm {x}( t ))\big ) \in D_{\Delta _{\mathcal {P}}}({\mathrm {x}(t)}) \end{aligned}$$
(24)

if and only if it is a solution curve of

$$\begin{aligned} \mathbf {i}_{\dot{\mathrm {x}}}\Omega _{\mathcal {P}}-\mathbf {d}\mathcal {E}(\mathrm {x}) + \widetilde{F}^\mathrm{ext}(\mathrm {x})\in \Delta _{\mathcal {P}}(\mathrm {x})^{\circ },\;\; \dot{\mathrm {x}}\in \Delta _{\mathcal {P}}(\mathrm {x}). \end{aligned}$$
(25)

Proof

Using (18), we can easily compute the condition in (24) to derive the intrinsic equations of motion in (25) for the time-dependent Dirac dynamical system.   \(\square \)

Remark 2

In the above, the curve \(\mathrm {x}(t)\in \mathcal {P}\) in (23) is not an arbitrary curve in \(\mathcal {P}\) since its first component is t. In the language of field theory, it is a section of the covariant Pontryagin bundle seen as a bundle over \(\mathbb {R}\).

Local Coordinate Expressions. Let us derive the local coordinate expressions of the Dirac dynamical system. The differential of \(\mathcal {E}\) is given by

$$ \mathbf {d}\mathcal {E}(t,x,v,\mathsf {p},p)=\left( -\frac{\partial \mathcal {L} }{\partial t}, -\frac{\partial \mathcal {L} }{\partial x}, p-\frac{\partial \mathcal {L} }{\partial v}, 1, v \right) $$

and recall that the external force field is

$$ \widetilde{F}^\mathrm{ext}(t,x,v, \mathsf {p}, p)= \left( t,x,v, \mathsf {p}, p,0,F^\mathrm{ext}(t,x,v),0,0,0 \right) . $$

Therefore, using the expression (19) of the Dirac structure, the condition for the curve \(\mathrm {x}(t)\in \mathcal {P}\) to satisfy the Dirac dynamical system (24) can be written as:

$$\begin{aligned} \left\{ \begin{array}{l} \dot{x}=v, \qquad \dot{t}=1,\qquad p=\frac{\partial \mathcal {L} }{\partial v},\\ (t,x,\dot{t},\dot{x}) \in C_{V}(t,x,v),\qquad \left( \dot{\mathsf {p}}-\frac{\partial \mathcal {L} }{\partial t}, \dot{p}-\frac{\partial \mathcal {L} }{\partial x}-F^\mathrm{ext}\right) \in C_{V}(t,x,v)^{\circ }. \end{array} \right. \end{aligned}$$
(26)

By using the local expressions in (20), the equations of motion of the Dirac dynamical system in (26) take the form:

$$\begin{aligned} \left\{ \begin{array}{l} \dot{x}^i = v^i , \qquad \dot{t}=1,\qquad p_i-\frac{\partial \mathcal {L} }{\partial v^i}=0,\quad i=1,...,n,\\ \sum \limits _{i=1}^{n}A_{i}^{r}(t,x,v)\dot{x}^{i}+B^{r}(t,x,v)=0, \quad r=1,...,m,\\ \dot{p}_i-\frac{\partial \mathcal {L} }{\partial x^i}= \sum \limits _{r=1}^{m}\lambda _{r} A^{r}_i(t,x,v)+F_{i}^\mathrm{ext}(t,x,v), \\ \dot{\mathsf {p}}-\frac{\partial \mathcal {L} }{\partial t} = \sum \limits _{r=1}^{m}\lambda _{r}B^{r}(t,x,v). \end{array}\right. \end{aligned}$$
(27)

Note that \(\dot{t}=1\) is always satisfied and also that the last equation in (27) can be solved apart from the others (as an output equation). Therefore, the equations of motion (27) reduce to the following evolution equations for the curve \((x(t),v(t),p(t)) \in T\mathcal {Q} \oplus T^{*}\mathcal {Q}\):

$$\begin{aligned} \left\{ \begin{array}{l} \dot{x}^i=v^i, \qquad p_i=\frac{\partial \mathcal {L} }{\partial v^i}(t,x,v),\\ \dot{p}_i-\frac{\partial \mathcal {L} }{\partial x^i}(t,x,v)=\sum \limits _{r=1}^{m}\lambda _{r} A^{r}_i(t,x,v)+F_{i}^\mathrm{ext}(t,x,v),\;\;i=1,...,n,\\ \sum \limits _{i=1}^{n}A_{i}^{r}(t,x,v)\dot{x}^{i} +B^{r}(t,x,v)=0,\;\; r=1,...,m. \end{array} \right. \end{aligned}$$
(28)

Finally, the system of evolution equations (28) yields the following equations for the curve \(x(t)\in \mathcal {Q}\):

$$\begin{aligned} \left\{ \begin{array}{l} \frac{d}{dt}\frac{\partial \mathcal {L} }{\partial \dot{x}^i}-\frac{\partial \mathcal {L} }{\partial x^{i}}(t,x,\dot{x})=\sum \limits _{r=1}^{m}\lambda _{r} A^{r}_{i}(t,x,\dot{x})+F_{i}^\mathrm{ext}(t,x,v),\;\;i=1,...,n,\\ \sum \limits _{i=1}^{n}A_{i}^{r}(t,x,\dot{x})\dot{x}^{i} +B^{r}(t,x,\dot{x})=0,\;\;\; r=1,...,m, \end{array} \right. \end{aligned}$$
(29)

which are the Lagrange-d’Alembert equations with time-dependent nonlinear constraints. In particular, we notice that the second equation in (29) recovers the nonlinear kinematic constraints \(C_K\), although \(C_V\) was only used to introduce the Dirac structure \(D_{\Delta _\mathcal {P}}\). This is due to the special relation between the constraints \(C_V\) and \(C_K\) of thermodynamic type, see Definition 2.

The Lagrange-d’Alembert equations with time-dependent and nonlinear nonholonomic constraints given in (29) provide the general abstract setting for open simple thermodynamic systems, as will be illustrated in Sect. 4.

Energy Balance. For the covariant generalized energy \(\mathcal {E}(t,x,v ,\mathsf {p},p)\) defined in (21), we have the energy balance equation along the solution curve \(\mathrm {x}(t)=(t,x(t),v(t),\mathsf {p}(t), p(t)) \) of the Dirac dynamical system (27) as

$$\begin{aligned} \frac{d}{dt} \mathcal {E}(t,x,v,\mathsf {p},p)= \left\langle F^\mathrm{ext}(t,x,v), \dot{x} \right\rangle . \end{aligned}$$
(30)

Note that \(\mathcal {E}\) does not represent the total energy of the system. The total energy is represented by the generalized energy E in (22). In terms of E, we get from (30) the following equation:

$$\begin{aligned} \begin{aligned} \frac{d}{dt}E(t,x,v, p)&= - \frac{d}{dt}\mathsf {p}+ \left\langle F^\mathrm{ext}(t,x,v), \dot{x} \right\rangle \\&= - \frac{\partial L}{\partial t}(t,x,v) - \sum _{r=1}^{m}\lambda _{r}B^{r}(t,x,v) + \left\langle F^\mathrm{ext}(t,x,v), \dot{x} \right\rangle , \end{aligned} \end{aligned}$$
(31)

which yields the balance of energy for the Dirac dynamical system. Note that \(\frac{d}{dt}\mathsf {p}\) is interpreted as the power flowing out of the system. The first term on the right-hand side is uniquely due to the explicit dependence of the Lagrangian on time, while the second term is due to the affine character of the kinematic constraint, which will be interpreted later as the energy flowing in or out of the system through the external ports. For the case where there is no constraint, the energy balance equation of time-dependent mechanics is recovered (see [24]).

It is also interesting to note that the equation for \(\mathsf {p}\) is solved apart from the other equations. A natural initial condition for \(\mathsf {p}\) is \(\mathsf {p}(0)= - E(0)\), so that the covariant generalized energy vanishes, i.e., \(\mathcal {E}(t,x,v,\mathsf {p}, p)=0\) for all t, which is the generalized energy analogue of the super-Hamiltonian constraint (see, for instance, [18]).

Remark 3 (Time-Dependent Dirac dynamical systems)

It is noteworthy that (24) is called the condition for a time-dependent Dirac dynamical system, since the Dirac structure \(D_{\Delta _\mathcal {P}}\subset T\mathcal {P}\oplus T^*\mathcal {P}\) is time-dependent, being defined at each point \(\mathrm {x}=(t,x,v,\mathsf {p},p)\in \mathcal {P}\) of the covariant Pontryagin bundle where the time t is included as a variable. It is remarkable that the Dirac structure \(D_{\Delta _\mathcal {P}}\) can incorporate constraints that are time-dependent, nonlinear, as well as nonholonomic. From the field theoretic point of view, the time-dependent Dirac system that satisfies (24) can be interpreted as a special instance of a multi-Dirac formulation for constrained field theories that extends the multi-Dirac field theory developed in [27].

Remark 4 (A Lagrange-d’Alembert-Pontryagin principle)

Note that the equations (29) can be obtained from the following Lagrange-d’Alembert-Pontryagin principle:

$$\begin{aligned} \delta \int _{t_1}^{t_2} \Big [ \big \langle p, \dot{x} -v \big \rangle - \mathcal {L}(t,x,v) \Big ] + \int _{t_1}^{t_2} \left\langle F^\mathrm{ext}(t,x,v), \delta x \right\rangle dt \end{aligned}$$
(32)

subject to the kinematic constraints

$$\begin{aligned} \sum _{i=1}^{n}A_{i}^{r}(t,x,v)\dot{x}^{i} +B^{r}(t,x,v)=0,\;\; r=1,...,m \end{aligned}$$
(33)

and for variations subject to the variational constraints

$$\begin{aligned} \sum _{i=1}^{n}A_{i}^{r}(t,x,v)\delta x^ i=0,\;\; r=1,...,m \end{aligned}$$
(34)

with \(\delta x (t_1)=\delta x (t_ 2)=0\).

While this principle does yield the complete equations of motion (29), only a subset of the conditions associated to the Dirac dynamical system (27) are recovered; namely, the equation for \(\mathsf {p}\) is missing. We shall give below a Lagrange-d’Alembert-Pontryagin principle whose stationary conditions exactly coincide with the equations given by the Dirac dynamical system.

3.4 The Lagrange-d’Alembert-Pontryagin Principle on the Covariant Pontryagin Bundle

Associated with the Dirac dynamical systems, there exists an associated variational formulation which is called the generalized Lagrange-d’Alembert-Pontryagin principle, where the critical condition yields the time-dependent evolution equations obtained from the Dirac dynamical system.

The Lagrange-d’Alembert-Pontryagin Principle. We begin with introducing an action functional for arbitrary curves \(\mathrm {x}(\tau )\) on the covariant Pontryagin bundle \(\mathcal {P}\), namely,

$$\begin{aligned} \mathrm {x}(\tau )= (t(\tau ), x(\tau ), v(\tau ), \mathsf {p}(\tau ), p(\tau ))\in \mathcal {P}, \end{aligned}$$
(35)

rather than just on sections, while we will see that the critical curve is necessary a section up to a constant rescaling of time, i.e., \(t(\tau )=\tau + t_0\). Let us denote by \(\mathrm {x}'\) the derivative with respect to \(\tau \). For such curves \(\mathrm {x}( \tau )=(t( \tau ), x( \tau ),v( \tau ), \mathsf {p}(\tau ), p( \tau ))\) we consider the Lagrange-d’Alembert-Pontryagin principle

$$\begin{aligned} \delta \int _{\tau _{1}}^{\tau _{2}} \Big [ \big \langle \theta _{\mathcal {P}}(\mathrm {x}(\tau )), \mathrm {x}'(\tau )\big \rangle -\mathcal {E}(\mathrm {x}(\tau ))\Big ]d\tau + \int _{\tau _{1}}^{\tau _{2}} \langle \widetilde{F}^\mathrm{ext}(\mathrm {x}(\tau )) , \delta {\mathrm {x}}(\tau ) \rangle d\tau =0, \end{aligned}$$
(36)

subject to the kinematic and variational constraints

$$\begin{aligned} \mathrm {x}'( \tau ) \in \Delta _{\mathcal {P}}(\mathrm {x}(\tau ))\quad \text {and}\quad \delta {\mathrm {x}}( \tau ) \in \Delta _{\mathcal {P}}(\mathrm {x}( \tau )), \end{aligned}$$
(37)

with the endpoint conditions \(T\pi _{(\mathcal {P},Y)}(\delta \mathrm {x}(\tau _{1}))=T\pi _{(\mathcal {P},Y)}(\delta \mathrm {x}(\tau _{2}))=0 \).

Equivalently, the critical point condition (36) reads

$$ \left. \frac{d}{d\varepsilon }\right| _{\varepsilon =0}\int _{\tau _{1}}^{\tau _{2}} \Big [ \big \langle \theta _{\mathcal {P}}(\mathrm {x}_\varepsilon (\tau )), \mathrm {x}'_\varepsilon (\tau )\big \rangle -\mathcal {E}(\mathrm {x}_\varepsilon (\tau ))\Big ]d\tau + \int _{\tau _{1}}^{\tau _{2}} \langle \widetilde{F}^\mathrm{ext}(\mathrm {x}(\tau )) , \delta {\mathrm {x}}(\tau ) \rangle d\tau =0, $$

for \(\mathrm {x}_\varepsilon (\tau )=( t_\varepsilon (\tau ), x_\varepsilon (\tau ),v_\varepsilon (\tau ), \mathsf {p}_\varepsilon (\tau ), p_\varepsilon (\tau ))\) such that

$$ \delta \mathrm {x}(\tau )=\left. \frac{d}{d\varepsilon }\right| _{\varepsilon =0} \mathrm {x}_\varepsilon (\tau )=(\delta t(\tau ), \delta x(\tau ), \delta v(\tau ), \delta \mathsf {p}(\tau ), \delta p(\tau )) $$

satisfies the variational constraint given in the second equation of (37). Note that the above variations are not necessarily vertical. This variational condition yields the Lagrange-d’Alembert-Pontryagin equations as:

$$\begin{aligned} \mathbf {i}_{\mathrm {x}'(\tau )}\omega _{\mathcal {P}}-\mathbf {d}\mathcal {E}(\mathrm {x}(\tau )) + \widetilde{F}^\mathrm{ext}(\mathrm {x}(\tau ))\in \Delta _{\mathcal {P}}(\mathrm {x}(\tau ))^{\circ },\qquad {\mathrm {x}'(\tau )}\in \Delta _{\mathcal {P}}(\mathrm {x}(\tau )). \end{aligned}$$
(38)

On the other hand, note that the evolution equations for arbitrary curves \(\mathrm {x}(\tau )\in \mathcal {P}\) obtained from the condition of the Dirac dynamical system, namely,

$$\begin{aligned} \big (\mathrm {x}'(\tau ), \mathbf {d}\mathcal {E}(\mathrm {x}(\tau ))-\widetilde{F}^\mathrm{ext}(\mathrm {x}(\tau ))\big ) \in D_{\Delta _{\mathcal {P}}}(\mathrm {x}(\tau )) \end{aligned}$$
(39)

are equivalent with the equations in (38) obtained from the Lagrange-d’Alembert-Pontryagin principle (36) and (37).

Local Expressions. By noting the equalities

$$\begin{aligned} \begin{aligned} \big \langle \theta _{\mathcal {P}}(\mathrm {x}), \mathrm {x}'\big \rangle -\mathcal {E}(\mathrm {x})&= \big \langle p, x'\big \rangle + \mathsf {p} t'- \mathcal {E}(t,x,v,\mathsf {p},p)\\&= \big \langle p, x'-v\big \rangle + \mathsf {p}(t'-1)- \mathcal {L} (t,x,v), \end{aligned} \end{aligned}$$

the local expression for the Lagrange-d’Alembert-Pontryagin principle in (36)–(37) for a curve \(\mathrm {x}(\tau )\) given in (35) becomes

$$\begin{aligned} \begin{aligned}&\delta \int _{\tau _{1}}^{\tau _{2}} \Big [\big \langle p, x^{\prime } \big \rangle +\mathsf {p} t^{\prime } -\mathcal {E}\big (t,x,v,\mathsf {p},p\big )\Big ]d\tau + \int _{\tau _{1}}^{\tau _{2}} \langle F^\mathrm{ext}(t,x,v) , \delta {x} \rangle d\tau \\&=\delta \int _{\tau _{1}}^{\tau _{2}}\! \Big [\big \langle p, x' \!-\! v\big \rangle + \mathsf {p}(t' \!-\!1)\!-\! \mathcal {L} (t,x,v)\Big ]d\tau + \int _{\tau _{1}}^{\tau _{2}} \! \langle F^\mathrm{ext}(t,x,v) , \delta {x} \rangle d\tau \\&=0, \end{aligned} \end{aligned}$$
(40)

subject to the kinematic constraints

$$\begin{aligned} \sum _{i=1}^{n}A_{i}^{r}\big (t ,x ,v \big ){x^{\prime }}^{i} +B^{r}\big (t ,x ,v \big ) t^{\prime }=0, \;\; r=1,...,m, \end{aligned}$$
(41)

and for variations subject to the variational constraints

$$\begin{aligned} \sum _{i=1}^{n}A_{i}^{r}\big (t ,x ,v \big )\delta {x} ^{i}+B^{r}\big (t ,x ,v \big )\delta {t} =0, \;\; r=1,...,m. \end{aligned}$$
(42)

By direct computations, (40)–(42) yield the following equations

$$\begin{aligned} \left\{ \begin{array}{l} \dot{x}'^i=v^i, \quad t'=1, \quad p_i=\frac{\partial \mathcal {L} }{\partial v^i}(t,x,v),\\ p'_i-\frac{\partial \mathcal {L} }{\partial x^i}(t,x,v)=\sum \limits _{r=1}^{m}\lambda _{r} A_i^{r}(t,x,v) +F^\mathrm{ext}_i(t,x,v),\\ \sum \limits _{i=1}^{n}A_{i}^{r}(t,x,v)x'^{i} +B^{r}(t,x,v)=0,\\ \mathsf {p}'-\frac{\partial L}{\partial t} =\sum \limits _{r=1}^{m}\lambda _{r}B^{r}(t,x,v). \end{array} \right. \end{aligned}$$
(43)

These equations are the local coordinate expressions of (38). From the condition \(t'( \tau )=1\), we have \( t(\tau ) = \tau + t_0\), and hence the critical curve of (40) is of the form \(\mathrm {x}( \tau )= ( \tau + t_0, x( \tau ), v( \tau ), \mathsf {p}( \tau ), p( \tau ))\), for a constant \(t_0\) which can be set to zero by imposing the initial condition \(t_0:=t( 0)=0\), so that \(\mathrm {x}\) becomes a section. In this case (43) reduces to the system (27) associated to the time-dependent Dirac dynamical system (24) for sections.

We summarize the obtained statements in the following theorem.

Theorem 2 (Time-Dependent Dirac Dynamical Systems)

Given a variational constraint \(C_{V} \subset J^1 \mathcal {Y} \times _{\mathcal {Y} } T \mathcal {Y} \) as in (14), consider the induced Dirac structure \(D_{\Delta _ \mathcal {P}}\) on \(\mathcal {P}=J ^1 \mathcal {Y} \times _{\mathcal {Y} } T^{*} \mathcal {Y} \) as in (18). Let \(\mathcal {L} :J^1 \mathcal {Y} \rightarrow \mathbb {R} \) be a time-dependent Lagrangian and \(\mathcal {E} : \mathcal {P} \rightarrow \mathbb {R} \) be the associated covariant generalized energy. Let \(F^\mathrm{ext}: J^{1}\mathcal {Y}\rightarrow T^*\mathcal {Q}\) be an external force field. Then the following statements are equivalent:

  • The curve \(\mathrm {x}( \tau )=(t( \tau ),x( \tau ),v( \tau ),\mathsf {p}( \tau ), p( \tau )) \in \mathcal {P}\) satisfies the system

    $$ \mathbf {i}_{\mathrm {x}'}\omega _{\mathcal {P}}-\mathbf {d}\mathcal {E}(\mathrm {x}) +\widetilde{F}^\mathrm{ext}(\mathrm {x})\in \Delta _{\mathcal {P}}(\mathrm {x})^{\circ },\qquad \mathrm {x}' \in \Delta _{\mathcal {P}}(\mathrm {x}), $$

    which is locally given by (43).

  • The curve \(\mathrm {x}( \tau )=(t( \tau ),x( \tau ),v( \tau ),\mathsf {p}( \tau ), p( \tau )) \in \mathcal {P}\) is a solution of the Dirac dynamical system

    $$\begin{aligned} \big (\mathrm {x}'( \tau ), \mathbf {d}\mathcal {E}(\mathrm {x}( \tau ))-\widetilde{F}^\mathrm{ext}(\mathrm {x}(\tau ))\big ) \in D_{\Delta _{\mathcal {P}}}(\mathrm {x}( \tau )). \end{aligned}$$
  • The curve \(\mathrm {x}( \tau )=(t( \tau ),x( \tau ),v( \tau ),\mathsf {p}( \tau ), p( \tau )) \in \mathcal {P}\) is a critical point of the variational formulation

    $$\begin{aligned} \delta \int _{\tau _{1}}^{\tau _{2}} \Big [ \big \langle \theta _{\mathcal {P}}(\mathrm {x}(\tau )), \mathrm {x}'(\tau )\big \rangle -\mathcal {E}(\mathrm {x}(\tau ))\Big ]d\tau =0, \end{aligned}$$

    subject to the kinematic and variational constraints

    $$\begin{aligned} \mathrm {x}'( \tau ) \in \Delta _{\mathcal {P}}(\mathrm {x}( \tau ))\quad \text {and}\quad \delta {\mathrm {x}}( \tau ) \in \Delta _{\mathcal {P}}(\mathrm {x}( \tau )), \end{aligned}$$

    with the fixed endpoint conditions \(T\pi _{(\mathcal {P},Y)}(\delta \mathrm {x}(\tau _{1}))=T\pi _{(\mathcal {P},Y)}(\delta \mathrm {x}(\tau _{2}))=0 \).

Note that the kinematic constraints (41) are imposed on general curves \(\mathrm {x}( \tau ) \in \mathcal {P}\). On a critical curve we have \(x'=\dot{x}\) and \(t'=\dot{t}=1\) so that one recovers the kinematic constraints \(\sum _{i=1}^{n}A_{i}^{r}\big (t ,x ,v \big ){\dot{x}}^{i} +B^{r}\big (t ,x ,v \big ) =0\).

Remark 5 (Curves versus Sections)

So far we have employed arbitrary curves \(\mathrm {x}( \tau )=(t( \tau ),x( \tau ), v(\tau ), \mathsf {p}( \tau ),p( \tau ))\) for the variational formulation. However, we can assume that all critical curves \(\mathrm {x}( \tau )=(t( \tau ),x( \tau ), v(\tau ), \mathsf {p}( \tau ),p( \tau ))\) are sections, i.e., they are of the form \(\mathrm {x}( t)=(t,x(t), v(t), \mathsf {p}(t),p( t))\), with the first component being given by t. This is not a restriction since we have just seen above that the critical condition imposes, modulo a time translation, that critical curves are sections.

4 Dirac Formulation for Open Thermodynamic Systems

In this section we apply the Dirac dynamical system formulation for time-dependent nonholonomic systems with nonlinear constraints of thermodynamic type developed in Sect. 3 to the case of open thermodynamic systems.

4.1 Application to the Piston-Cylinder System with External Ports

We start by describing the geometric setting, the Lagrangian, and the constraints for the case of a simple and open thermodynamic system with external ports, in which the power exchange with exterior is due to matter transfer and heat sources.

Geometric Setting. Consider a simple and open systems with A exterior ports and B heat sources, such as the one illustrated in Fig. 1. Let Q be the configuration manifold of the mechanical part of the system with elements denoted q and let \(\mathbb {R}^{5}\) be the configuration space of the thermodynamic part of the system with elements \((S,N,\Gamma ,W,\Sigma ) \in \mathbb {R}^5\), where S is the entropy and N is the number of moles of the chemical species of the system. Recall that \(W \in \mathbb {R} \) and \(\Gamma \in \mathbb {R} \) denote the thermodynamic displacements that are defined such that \(\dot{W}=\mu \) and \(\dot{\Gamma }=T\), where \(\mu \) is the chemical potential and T is the temperature. Recall also that \(\Sigma \in \mathbb {R} \) denotes the internal entropy. Hence, the thermodynamic configuration space becomes

$$\mathcal {Q}=Q \times \mathbb {R}^{5}\ni x=(q,S,N,\Gamma ,W,\Sigma ).$$

Associated with the external ports, we have the time-dependent external variables \(p^a\), \(T^a\), \(\mathcal {J}^a\), \(a=1,...,A\) and \(\bar{T}^b\), \(\bar{\mathcal {J}}_{S}^b\), \(b=1,...,B\). We also consider an external force \(F^\mathrm{ext}: J^{1}\mathcal {Y} \rightarrow T^{*}\mathcal {Q}; \, (t,x,v) \mapsto F^\mathrm{ext}(t,x,v)\) and a friction force \(F^\mathrm{fr}: J^{1}\mathcal {Y} \rightarrow T^{*}\mathcal {Q}; \, (t,x,v) \mapsto F^\mathrm{fr}(t,x,v)\), where we recall that \(\mathcal {Y} =\mathbb {R}\times \mathcal {Q}\) with \((t,x) \in \mathcal {Y}\) and \(x=(q,S,N,\Gamma ,W,\Sigma )\).

We use the local coordinates \(v=(v_q,v_S,v_N,v_\Gamma , v_W, v_\Sigma )\) for \(v \in T_x\mathcal {Q}\), the local coordinates \((t,x,\delta {t},\delta {x}) \in T \mathcal {Y} \) with \(\delta x=(\delta q,\delta S,\delta N,\delta \Gamma , \delta W, \delta \Sigma )\in T_x\mathcal {Q}\) and the local coordinates \((t,x,\mathsf {p},p) \in T^{*} \mathcal {Y} \) with \(p=(p_q,p_S,p_N,p_\Gamma , p_W, p_\Sigma )\in T^*_x\mathcal {Q}\).

Augmented Lagrangians for Open Thermodynamic Systems. Consider the Lagrangian for the system given by a function \(L(t, q, \dot{q}, S,N)\) which can be time-dependent in general. Recall that \((q, \dot{q})\in TQ\) are the state variables of the mechanical part.

Given L, we define the time-dependent augmented Lagrangian \(\mathcal {L}:J^{1}\mathcal {Y}\rightarrow \mathbb {R}\) as

$$\begin{aligned} \mathcal {L}(t,x,\dot{x}):= L(t, q, \dot{q}, S,N) + \dot{W} N+ \dot{\Gamma }( S- \Sigma ). \end{aligned}$$
(44)

Concerning the augmented terms \(\dot{W} N + \dot{\Gamma }( S- \Sigma )\) in (44), the first part \(\dot{W} N(=\mu N)\) is the expression corresponding to the Gibbs free energy associated with the chemical substance, while the second part \(\dot{\Gamma }( S- \Sigma )\) can be interpreted as a constraint for the minimum power due to the entropy production associated with the exchange with the exterior, where S indicates the total entropy of the system and \(\Sigma \) the internal entropy production. Therefore, the term \(S-\Sigma \) corresponds to the part of the entropy of the system that is due to the exchange of entropy with exterior and where \(\dot{\Gamma }(=T)\) may be interpreted as a Lagrange multiplier.

Constraints for Open Thermodynamic Systems. In the general context of nonlinear nonholonomic constraints of thermodynamic type in Sect. 3, we choose the coefficients \(A^r_i(t,x,\dot{x})\) and \(B^r_i(t,x,\dot{x})\) in the constraints (14) as

$$\begin{aligned} \begin{aligned} A^r_i(t,x,\dot{x})\delta x^i&= - \frac{\partial L}{\partial S} \delta \Sigma \!+ \! \langle F^\mathrm{fr }, \delta q \rangle \!+\!\sum _{a=1}^A \Big (\mathcal {J}^a\delta W \!+\!\mathcal {J}_S^a\delta \Gamma \Big )\!+\!\sum _{b=1}^B \bar{\mathcal {J}}^b_{S}\delta \Gamma , \\ B^r_i(t,x,\dot{x})&=- \sum _{a=1}^A \Big (\mathcal {J}^a \mu ^a+ \mathcal {J}_S^aT^a\Big ) -\sum _{b=1}^{B} \bar{\mathcal {J}}^b _S\bar{T}^b. \end{aligned} \end{aligned}$$
(45)

It is important to recall that the molar flow rates \(\mathcal {J}^a\), the entropy flow rates \(\mathcal {J}^a_S\), \(\bar{\mathcal {J}}^b_S\), as well as the temperatures \(T^a\), \(\bar{T}^b\) and the chemical potentials \(\mu ^a\) at the A ports and the B ports are explicit functions of time such as \(\mathcal {J}^a=\mathcal {J}^a(t,x,\dot{x})\), \(T^a=T^a(t,x,\dot{x})\), and \(\bar{\mathcal {J}}^b_{S}=\bar{\mathcal {J}}^b_{S}(t,x,\dot{x})\).

A First Lagrange-d’Alembert-Pontryagin Principle. With the Lagrangian (44) and the choice for \(A_i^r\) and \(B^r\) given in (45), the Lagrange-d’Alembert-Pontryagin principle (32)–(34) recovers the Pontryagin version of the variational formulation (8)–(10) presented in Sect. 2.2.

4.2 Dirac Dynamical Systems on the Covariant Pontryagin Bundle

In this subsection, we demonstrate that the equations of motion for simple and open thermodynamic systems can be systematically developed in the context of Dirac systems.

The Presymplectic Form on the Covariant Pontryagin Bundle. Recall that the local coordinates for the covariant Pontryagin bundle \(\mathcal {P}=J^1 \mathcal {Y} \times _{ \mathcal {Y} } T^{*} \mathcal {Y} \) over \( \mathcal {Y} =\mathbb {R} \times \mathcal {Q}\) are given as \(\mathrm {x}=(t,x,v, \mathsf {p},p) \in \mathcal {P}\).

The one-form and presymplectic form \(\theta _\mathcal {P}=\pi _{(\mathcal {P}, T^{*}\mathcal {Y} )}^{*}\Theta _{T^{*}\mathcal {Y} }\) and \(\omega _\mathcal {P}=\pi _{(\mathcal {P}, T^{*}\mathcal {Y} )}^{*}\Omega _{T^{*} \mathcal {Y} }\) on \( \mathcal {P} \) induced from the canonical forms \( \Theta _{T^* \mathcal {Y} }\) and \( \Omega _{T^* \mathcal {Y} }\) on \(T^*\mathcal {Y} \), have the local expressions

$$\begin{aligned} \theta _{\mathcal {P}}&=pdx+\mathsf {p}dt\\&=p_q dq+ p_{S}dS+ p_{N}dN+ p_{\Gamma }d\Gamma + p_{W}dW+ p_{\Sigma }d\Sigma +\mathsf {p}dt,\\ \omega _{\mathcal {P}}&=dx \!\wedge \! dp+dt \wedge d\mathsf {p}\\&=dq \!\wedge \! dp_q \!+\! dS \!\wedge \! dp_{S} \!+\! dN \!\wedge \! dp_{N} \!+\! d\Gamma \!\wedge \! dp_{\Gamma } \!+\! dW \!\wedge \! dp_{W} \!+\! d\Sigma \!\wedge \! dp_{\Sigma } \!+\! dt \!\wedge \! d\mathsf {p}, \end{aligned}$$

where of course \(\omega _{\mathcal {P}}=-\mathbf {d}\theta _{\mathcal {P}}\) holds.

The Variational and Kinematic Constraints. By using the general definition of the variational constraint given in (14) in view of (45), we get

$$\begin{aligned}&C_{V}=\Big \{(t, x, v, \delta {t}, \delta {x}) \in J^1 \mathcal {Y} \times _{\mathcal {Y} } T\mathcal {Y} \;\Big |\; \frac{\partial L}{\partial S}\delta \Sigma = \langle F^\mathrm{fr }, \delta q \rangle \nonumber \\&\qquad \quad \,\, +\sum _{a=1}^A\big [\mathcal {J} ^a (\delta W-\mu ^a\delta t) + \mathcal {J} ^a_{S}(\delta \Gamma -T^a\delta t)\big ] + \sum _{b=1}^B\bar{\mathcal {J}}^b_{S}(\delta \Gamma -\bar{T}^b\delta {t})\Big \}, \end{aligned}$$
(46)

where the affine part of the constraint is now associated with \(\delta t\). Following the general construction of the kinematic constraint \(C_K\) in (13), the kinematic constraint becomes

$$\begin{aligned}&C_{K} =\Big \{ (t,x,\dot{t},\dot{x}) \in T\mathcal {Y} \;\Big |\; \frac{\partial L}{\partial S}\dot{\Sigma }= \langle F^\mathrm{fr }, \dot{q} \rangle \nonumber \\&\qquad \qquad \quad + \sum _{a=1}^A\big [\mathcal {J} ^a ( \dot{W} -\mu ^a\dot{t})+ \mathcal {J} ^a_{S}(\dot{\Gamma }- T^a\dot{t})\big ] + \sum _{b=1}^B\bar{\mathcal {J}}^b_{S}(\dot{\Gamma }-\bar{T}^b\dot{t})\Big \}, \end{aligned}$$

where the affine part of the constraint is now associated with \(\dot{t}\).

Dirac Structures for Open Thermodynamic Systems. As in (15), the variational constraint \(C_V\) induces a distribution \(\Delta _\mathcal {P}\) on \(\mathcal {P}\). Then, we can define the induced Dirac structure on \(\mathcal {P}\), i.e., \(D_{\Delta _{\mathcal {P}}} \subset T\mathcal {P} \oplus T^{*}\mathcal {P}\) from the distribution \(\Delta _{\mathcal {P}}\) and the presymplectic form \(\omega _{\mathcal {P}}\) as in (18).

In order to develop the local expressions of the Dirac structure from \(C_{V}\) in (46), we employ the following notations: For each \(\mathrm {x}=(t,x,v, \mathsf {p},p)\in \mathcal {P}\), we write \(\mathfrak {u}_{\mathrm {x}}=( \dot{t}, \dot{x}, \dot{v}, \dot{\mathsf {p}}, \dot{p})\in T_{\mathrm {x}}\mathcal {P}\) and \(\mathfrak {a}_{\mathrm {x}}=(\pi , \alpha , \beta , \gamma , w) \in T^{*}_{\mathrm {x}}\mathcal {P}\), where \(\dot{v}=( \dot{v}_q, \dot{v}_{S},\dot{v}_{N},\dot{v}_{\Gamma } , \dot{v}_{W}, \dot{v}_{\Sigma })\), \(\dot{p}=(\dot{p}_q, \dot{p}_{S}, \dot{p}_{N}, \dot{p}_{\Gamma }, \dot{p}_{W},\dot{p}_{\Sigma })\), \(\alpha =(\alpha _q, \alpha _{S},\alpha _{N}, \alpha _{\Gamma },\) \(\alpha _{W},\alpha _{\Sigma })\), \(\beta =(\beta _q, \beta _{S},\beta _{N}, \beta _{\Gamma }, \beta _{W},\beta _{\Sigma })\), and \(w=(w_q, w_{S},w_{N}, w_{\Gamma }, w_{W},w_{\Sigma })\).

The annihilator \(C_V(t,x,v)^\circ \subset T^* \mathcal {Y} \) of the variational constraint \(C_{V}(t,x,v) \subset T_{(t,x)} \mathcal {Y} \) is locally represented by

$$ C_{V}(t,x,v)^{\circ }=\{(t,x, \pi , \alpha )\in T^*_{(t,x)} \mathcal {Y} \mid \pi =\lambda _rB^{r}(t,x,v) , \;\alpha =\lambda _r A_{i}^{r}(t,x,v),\;\lambda ^r\in \mathbb {R}\}. $$

Hence, eliminating the Lagrange multiplier \(\lambda \) by substituting \(\lambda =\frac{\alpha _\Sigma }{\frac{\partial L}{\partial S}}, \) the annihilator may be given by the covectors \((t,x,\pi , \alpha )\in T^* \mathcal {Y} \) that satisfy the following conditions:

$$\begin{aligned} \begin{aligned}&\pi = \frac{\alpha _\Sigma }{\frac{\partial L}{\partial S}}\left[ \,\sum _{a=1}^{A}\left( \mathcal {J}^a\mu ^a+ \mathcal {J}_S^aT^a\right) +\sum _{b=1}^{B}\bar{\mathcal {J}}^b_{S}\bar{T}^b\right] ,\\&\alpha _q+ \frac{\alpha _\Sigma }{\frac{\partial L}{\partial S}}F^\mathrm{fr}=0,\quad \alpha _S=0,\quad \alpha _N=0,\\&\alpha _\Gamma + \frac{\alpha _\Sigma }{\frac{\partial L}{\partial S}}\left[ \,\sum _{a=1}^{A}\mathcal {J}^a_S +\sum _{b=1}^{B}\bar{\mathcal {J}}^b_{S}\right] =0,\quad \alpha _W+ \frac{\alpha _\Sigma }{\frac{\partial L}{\partial S}}\sum _{a=1}^{A}\mathcal {J}^a=0. \end{aligned} \end{aligned}$$
(47)

Using (19), (46) and (47), the condition that \((\mathfrak {u}_{\mathrm {x}}, \mathfrak {a}_{\mathrm {x}}) \in T_{\mathrm {x}}\mathcal {P} \times T^{*}_{\mathrm {x}}\mathcal {P}\) belongs to the section of the Dirac structure \(D_{\Delta _{\mathcal {P}}}\), i.e., the condition

$$\begin{aligned} \big (( \dot{t}, \dot{x}, \dot{v}, \dot{\mathsf {p}}, \dot{p}), (\pi , \alpha , \beta , \gamma , w)\big ) \in D_{\Delta _{\mathcal {P}}}(t,x,v,\mathsf {p}, p), \end{aligned}$$

is explicitly described by

$$\begin{aligned} \left\{ \begin{array}{l} \dot{t}=\gamma , \;\; \dot{q}= w_q,\;\; \dot{S}=w_{S},\;\;\dot{N}=w_{N},\;\;\dot{\Gamma }=w_{\Gamma },\;\;\dot{W}=w_{W},\;\;\dot{\Sigma }=w_{\Sigma },\\ \beta _q=\beta _{S}=\beta _{N}=\beta _{\Gamma }=\beta _{W}=\beta _{\Sigma }=0,\\ \dot{\mathsf {p}}+\pi =\frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+\alpha _{\Sigma })\left[ \,\sum \limits _{a=1}^{A}\left( \mathcal {J}^a\mu ^a+ \mathcal {J}_S^aT^a\right) +\sum \limits _{b=1}^{B}\bar{\mathcal {J}}^b_{S}\bar{T}^{b}\right] ,\\ \dot{p}_q + \alpha _q+ \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+\alpha _\Sigma )F^\mathrm{fr}=0,\qquad \dot{p}_{S}+\alpha _{S}=0,\qquad \dot{p}_{N}+\alpha _{N}=0,\\ \dot{p}_{\Gamma }+\alpha _{\Gamma } + \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+\alpha _{\Sigma })\left[ \,\sum \limits _{a=1}^A\mathcal {J} ^a_S+\sum \limits _{b=1}^B\bar{\mathcal {J}}^b_S\right] =0,\\ \dot{p}_{W}+\alpha _{W} + \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+\alpha _{\Sigma })\sum \limits _{a=1}^A\mathcal {J} ^a_S=0,\\ \frac{\partial L}{\partial S}\dot{\Sigma }\!=\! \langle F^\mathrm{fr }, \dot{q} \rangle \!+\! \sum \limits _{a=1}^A\big [\mathcal {J} ^{a} ( \dot{W} -\mu ^a\dot{t}) \!+\! \mathcal {J} ^{a}_{S}(\dot{\Gamma }- T^a\dot{t})\big ] \!+\! \sum \limits _{b=1}^B\bar{\mathcal {J}}^b_{S}(\dot{\Gamma }-\bar{T}^b\dot{t}). \end{array} \right. \end{aligned}$$
(48)

Covariant Generalized Energy and External Forces. Recall from (44) that the augmented Lagrangian on \(J^{1}\mathcal {Y}\) is given by \(\mathcal {L}(t,x,v)= L(t,q, v_q, S,N) + v_{W} N+ v_{\Gamma }( S- \Sigma )\). Therefore, the covariant generalized energy, see (21), is here given by

$$\begin{aligned} \mathcal {E}(t,x,v,\mathsf {p},p)&=\mathsf {p}+\langle p, v \rangle - \mathcal {L}(t,x,v)\\&=\mathsf {p} + \langle p_q, v_q \rangle + p_{S}v_{S}+p_{N}v_{N}\\&\qquad + (p_{\Gamma }+\Sigma - S) v_{\Gamma }+ (p_W-N)v_W+ p_\Sigma v_\Sigma - L(t,q,v_q,S,N). \end{aligned}$$

The differential of \(\mathbf {d}\mathcal {E}\) is obtained by

$$ \mathbf {d}\mathcal {E}(t,x,v,\mathsf {p},p)=\left( -\frac{\partial \mathcal {L}}{\partial t}, -\frac{\partial \mathcal {L}}{\partial x}, p-\frac{\partial \mathcal {L}}{\partial v}, 1, v \right) =(\pi , \alpha , \beta , \gamma , w), $$

where

$$\begin{aligned} \begin{aligned}&\pi =-\frac{\partial \mathcal {L}}{\partial t}=-\frac{\partial L}{\partial t}, \\&\alpha =-\frac{\partial \mathcal {L}}{\partial x}=\left( -\frac{\partial L}{\partial q},-v_\Gamma -\frac{\partial L}{\partial S},-v_W -\frac{\partial L}{\partial N}, 0, 0,v_\Gamma \right) ,\\&\beta =p-\frac{\partial \mathcal {L}}{\partial v}=\left( p_q-\frac{\partial L}{\partial v_q}, p_S, p_N, p_\Gamma +\Sigma -S, p_W-N, p_\Sigma \right) ,\\&\gamma =1,\; w=v=(v_q, v_S, v_N, v_\Gamma , v_W, v_\Sigma ). \end{aligned} \end{aligned}$$

Using \(\pi _{(\mathcal {P}, \mathcal {Q})}: \mathcal {P} \!\rightarrow \! \mathcal {Q}\), \((t,x,v, \mathsf {p}, p) \!\mapsto \! x\), the external force \(F^\mathrm{ext} : J^{1}\mathcal {Y}\rightarrow T^*\mathcal {Q}\) can be lifted as a horizontal one-form \(\widetilde{F}^\mathrm{ext}\) on \(\mathcal {P}\) by, for \(W \in T_{(t,x,v, \mathsf {p}, p)}\mathcal {P}\),

$$ \langle \widetilde{F}^\mathrm{ext}(t,x,v, \mathsf {p}, p) , W \rangle =\langle F^\mathrm{ext}(t, x,v), T_{(t,x,v, \mathsf {p}, p)}\pi _{(\mathcal {P}, \mathcal {Q})}(W)\rangle . $$

Dirac Dynamical Systems on \(\mathcal {P}\) for Open Thermodynamic Systems. The Dirac formulation for open systems is given in the following theorem.

Theorem 3 (Dirac Formulation of Open Systems)

Consider a simple and open thermodynamic system described as before with the Lagrangian L, molar flow rates \(\mathcal {J}^a\), entropy flow rates \(\mathcal {J}^a_S\), \(\bar{\mathcal {J}}^b_S\), external variables \(T^a\), \( \mu ^a\), \(\bar{T}^b\), and the external force \(F^\mathrm{ext}\). Consider the associated Dirac structure \( D_{ \Delta _ \mathcal {P} }\) as defined above.

If the curve \(\mathrm {x}(t)=(t,x(t),v(t),\) \(\mathsf {p}(t),p(t)) \in \mathcal {P}\), with \(x=(q,S, N, \Gamma , W, \Sigma )\), \(v=(v_{q},v_{S}, v_{N}, v_{\Gamma }, v_{W}, v_{\Sigma })\) and \(p=(p_{q},p_{S}, p_{N}, p_{\Gamma }, p_{W}, p_{\Sigma })\), is a solution curve of the Dirac dynamical system

$$\begin{aligned} \Big (\dot{\mathrm {x}}, \mathbf {d}\mathcal {E}(\mathrm {x})-\widetilde{F}^\mathrm{ext}(\mathrm {x})\Big ) \in D_{\Delta _{\mathcal {P}}}(\mathrm {x}), \end{aligned}$$
(49)

then the following evolution equations are satisfied:

$$\begin{aligned} \left\{ \begin{array}{l} p_q=\frac{\partial L}{\partial \dot{q}},\quad p_\Gamma = S-\Sigma ,\quad p_W=N,\\ \dot{\mathsf {p}}-\frac{\partial L}{\partial t}=-\sum \limits _{a=1}^{A}\left( \mathcal {J}^a\mu ^a+ \mathcal {J}_S^aT^a\right) -\sum \limits _{b=1}^{B}\bar{\mathcal {J}}^b_{S}\bar{T}^b,\\ \dot{p}_q=\frac{\partial L}{\partial q}+ F^\mathrm{fr}+F^\mathrm{ext},\quad \dot{p}_\Gamma = \sum \limits _{a=1}^A\mathcal {J}^a_S+\sum \limits _{b=1}^B\bar{\mathcal {J}}^b_S,\quad \dot{p}_W= \sum \limits _{a=1}^A\mathcal {J}^a,\\ \dot{\Gamma }= -\frac{\partial L}{\partial S},\quad \dot{W}= -\frac{\partial L}{\partial N},\\ \frac{\partial L}{\partial S}\dot{\Sigma }\! =\! \langle F^\mathrm{fr }, \dot{q} \rangle \!+\! \sum \limits _{a=1}^A\big [\mathcal {J} ^a ( \dot{W} \!-\!\mu ^a)\!+\! \mathcal {J} ^a_{S}(\dot{\Gamma }\!-\! T^a)\big ] \!+\! \sum \limits _{b=1}^B\bar{\mathcal {J}}^b_{S}(\dot{\Gamma }\!-\!\bar{T}^b), \end{array} \right. \end{aligned}$$
(50)

which are equivalently reduced to the evolution equations of simple and open thermodynamic systems given in (11).

Proof

Using the local expressions of the Dirac structure given in (48), we get the following system equations for the Dirac dynamical system:

$$\begin{aligned} \left\{ \begin{array}{l} \dot{t}=1, \; \;\dot{q}= v_q,\; \dot{S}=v_{S},\;\;\dot{N}=v_{N},\;\;\dot{\Gamma }=v_{\Gamma },\;\;\dot{W}=v_{W},\;\;\dot{\Sigma }=v_{\Sigma },\\ p_q-\frac{\partial L}{\partial v_q}=0, \; p_S=0,\; p_N=0,\; p_\Gamma +\Sigma -S=0,\; p_W-N\!=\!0,\; p_\Sigma =0,\\ \dot{\mathsf {p}}-\frac{\partial L}{\partial t}=\frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+v_\Gamma )\left[ \,\sum \limits _{a=1}^{A}\left( \mathcal {J}^a\mu ^a\!+\! \mathcal {J}_S^aT^a\right) \!+\!\sum \limits _{b=1}^{B}\bar{\mathcal {J}}^b_{S}\bar{T}^b\right] ,\\ \dot{p}_q - \frac{\partial L}{\partial q}+ \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+v_\Gamma )F^\mathrm{fr}= F^\mathrm{ext}, \quad \dot{p}_{S}-v_\Gamma -\frac{\partial L}{\partial S}=0,\\ \dot{p}_{N}-v_W-\frac{\partial L}{\partial N}=0,\\ \dot{p}_{\Gamma }+0+ \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+v_\Gamma )\left[ \,\sum \limits _{a=1}^A\mathcal {J} ^a_S+\sum \limits _{b=1}^B\bar{\mathcal {J}}^b_S\right] =0,\\ \dot{p}_{W}+0+ \frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+v_\Gamma )\sum \limits _{a=1}^A\mathcal {J} ^a_S=0,\\ \frac{\partial L}{\partial S}\dot{\Sigma }\! =\! \langle F^\mathrm{fr }, \dot{q} \rangle \!+\! \sum \limits _{a=1}^A\!\big [\!\mathcal {J} ^a ( \dot{W}\! -\!\mu ^a\dot{t}) \!+\! \mathcal {J} ^a_{S}(\dot{\Gamma }\!-\! T^a\dot{t})\big ] \!+\! \sum \limits _{b=1}^B\bar{\mathcal {J}}^b_{S}(\dot{\Gamma }\!-\!\bar{T}^b\dot{t}). \end{array} \right. \end{aligned}$$

Since \(p_S=0\), we have \(v_\Gamma =-\frac{\partial L}{\partial S}\) from an equation in the fourth line. From this and \(p_\Sigma =0\), we obtain \(\frac{1}{\frac{\partial L}{\partial S}}(\dot{p}_{\Sigma }+v_\Gamma )=-1\). Then we obtain the evolution equations in (50). By eliminating some variables and making further rearrangements, we can check that the evolution equations (50) are finally reduced to the Lagrange-d’Alembert equations for the open system given in (11).

Remark 6 (The Lagrange-d’Alembert-Pontryagin principle for open systems)

The variational formulation associated with the Dirac system formulation (49) for open systems is obtained directly from (40)–(42) by making the corresponding replacements. In particular it yields equations of motion (50).

Interpretation of the Thermodynamic Variables. The system of equations in (50) allows to make useful physical interpretations of the variables involved in the Dirac system formulation.

The two equations in the fourth line of (50) attribute to the variables \(\Gamma \) and W the meaning of thermodynamic displacements associated to the process of heat and matter transport.

The momentum \(p_W=N\) conjugate to W is interpreted as the number of moles in the system. Therefore, from the third equation in the third line of (50), the mass balance equation given in (2) can be recovered as

$$ \dot{p}_W=\sum _{a=1}^A\mathcal {J}^a. $$

The momentum \(p_\Gamma = S-\Sigma \) conjugate to \(\Gamma \) corresponds to the part of the entropy of the system that is due to the exchange of entropy with exterior. It follows from the second equation in the third line of (50) that its rate of change becomes

$$ \dot{p}_\Gamma = \dot{S}-\dot{\Sigma }= \sum _{a=1}^A\mathcal {J}^a_S+\sum _{b=1}^B\bar{\mathcal {J}}^b_S $$

and we recover the rate of total entropy change of the system as

$$\begin{aligned} \dot{S}=\dot{\Sigma }+ \dot{p}_\Gamma = I + \sum _{a=1}^A\mathcal {J}^a_S+\sum _{b=1}^B\bar{\mathcal {J}}^b_S. \end{aligned}$$
(51)

The internal entropy production \(\dot{\Sigma }=I\) is always positive by the second law of thermodynamics, while \(\dot{p}_\Gamma = \sum _{a=1}^A\mathcal {J}^a_S+\sum _{b=1}^B\bar{\mathcal {J}}^b_S\), giving the rate of entropy flowing from exterior into the system, has an arbitrary sign. It is noteworthy that equation (51) is usually denoted in the form

$$ dS= d_iS+ d_eS $$

in conventional physics textbooks (see, for instance, [5]), where dS denotes the infinitesimal change of the total entropy, \(d_iS\) the entropy produced inside the system and \(d_eS\) the entropy supplied to the system by its surroundings. In our formulation, it reads as

$$ d_iS=\dot{\Sigma }dt \quad \text {and}\quad d_eS= \dot{p}_\Gamma dt. $$

The momentum \(\mathsf {p}\) represents minus the rate of energy associated with the matter and heat exchange with the exterior through the ports. In fact, from the equation in the second line of (50), one obtains

$$ \frac{d}{dt}\mathsf {p}=\frac{\partial L}{\partial t} - \; \underbrace{\sum _{a=1}^A (\mathcal {J}^a\mu ^a + \mathcal {J}_S^a T^a)}_{=P^\mathrm{ext}_M}- \;\underbrace{\sum _{b=1}^B \bar{\mathcal {J}}^b_S \;\bar{T}^b}_{=P^\mathrm{ext}_H}. $$

Finally, associated with the momentum \(p_q= \frac{\partial L}{\partial v_q}\), the first equation in the third line of (50) represents the Lagrange-d’Alembert equations for the mechanical part of the system:

$$\begin{aligned} \left\{ \begin{array}{l} \frac{d}{dt}\frac{\partial L}{\partial v_q}=\frac{\partial L}{\partial q}+ F^\mathrm{fr}+F^\mathrm{ext},\\ \dot{q}= v_q. \end{array} \right. \end{aligned}$$

Energy Balance. Consider the total energy of the system given by

$$ E(t,q, \dot{q}, S, N)= \left\langle \frac{\partial L}{\partial \dot{q}}, \dot{q} \right\rangle - L(t,q, \dot{q}, S, N). $$

This energy coincides with the energy \(E(t,x,\dot{x})\), \(x=(q,S,N, \Gamma , W, \Sigma )\) defined from the augmented Lagrangian \( \mathcal {L}(t,x,\dot{x})=L(t,q, \dot{q}, S,N) + \dot{W} N+ \dot{\Gamma }( S- \Sigma )\) via the formula \( E(t,x,\dot{x})=\left\langle \frac{\partial \mathcal {L}}{\partial \dot{x}}, \dot{x} \right\rangle - \mathcal {L}(t,x,\dot{x})\). The energy balance equation is obtained as

$$ \begin{aligned} \frac{d}{dt} E&=\langle F^\mathrm{ext}, \dot{q} \rangle - \frac{d}{dt} \mathsf {p}\\&= - \frac{\partial L}{\partial t} + \underbrace{\langle F^\mathrm{ext}, \dot{q} \rangle {\sum _{b=1}^B}}_{=P^\mathrm{ext}_W}\; +\; \underbrace{\sum _{a=1}^A( \mathcal {J} ^a \mu ^a + \mathcal {J} ^a_S T^a)}_{=P^\mathrm{ext}_M} \;+\; \underbrace{\sum _{b=1}^B \bar{\mathcal {J}} ^b_S \bar{T}^b}_{=P^\mathrm{ext}_H}. \end{aligned} $$

Regarding the covariant generalized energy, we have \( \frac{d}{dt} \mathcal {E}= \frac{d}{dt} E+ \frac{d}{dt} \mathsf {p}= \left\langle F^\mathrm{ext}, \dot{q} \right\rangle \). For the case in which the given Lagrangian L does not depend on time t explicitly, we recover the first law for open systems given in (1) as:

$$ \frac{d}{dt} E=P^\mathrm{ext}_W+P^\mathrm{ext}_H+P^\mathrm{ext}_{M}. $$