Keywords

1 Variational Formulation of Non-simple Systems

Before exploring Dirac structures underlying the thermodynamics of non-simple systems, we review the variational setting of such non-simple systems by focusing on the internal irreversible processes associated with friction and heat conduction.

1.1 Setting for Thermodynamics of Non-simple Systems

Non-simple Systems with Friction and Heat Conduction. Consider an adiabatically closed system \(\mathbf {\Sigma }=\cup _{A=1}^P\mathbf {\Sigma }_A\) which consists of P simple thermodynamic systems \(\mathbf {\Sigma }_A\), in which we include the irreversible processes due to friction and heat conduction between subsystems. Here a simple thermodynamic system denotes a system that has only one variable to represent the thermodynamic state, usually denoted by entropy. Since \(\mathbf {\Sigma }\) is an interconnected system of simple subsystems \(\mathbf {\Sigma }_1,...,\mathbf {\Sigma }_P\), it becomes a “non-simple” system that has several entropy (or temperature) variables (see [7]) and we note that all the irreversible processes are internal. For each simple subsystem \(\mathbf {\Sigma }_A,\,A=1,...,P\), \(S_A \in \mathbb {R}\) indicates its entropy variable. Here, we assume that the mechanical configuration of \(\mathbf {\Sigma }\) is given by independent mechanical variables \(q=(q^{1},...,q^{n}) \in Q\), where Q is the mechanical configuration manifold of \(\mathbf {\Sigma }\).

Friction, Heat Conduction and External Forces. Let \(F^{\mathrm{ext}\rightarrow A}:T^*Q \times \mathbb {R}^P \rightarrow T^*Q\) be an external force that acts on \(\mathbf {\Sigma }_A\) and hence the total exterior force is \(F^\mathrm{ext}=\sum _{A=1}^P F^{\mathrm{ext}\rightarrow A}\). Let \(F^{\mathrm{fr} (A)}:T^*Q \times \mathbb {R}^P \rightarrow T^*Q\) be the friction forces associated with the irreversible processes of each subsystem \(\mathbf {\Sigma }_A\), which yield an entropy production for subsystem \(\mathbf {\Sigma }_A\). Associated with the heat exchange between \(\mathbf {\Sigma }_A\) and \(\mathbf {\Sigma }_B\), let \(J_{AB}\) be the fluxes such that for \(A\ne B\), \(J_{AB}=J_{BA}\) and for \(A=B\), \( J_{AA}:=- \sum _{B\ne A}J_{AB}, \) where \(\sum _{A=1}^PJ_{AB}=0\) for all B.

Thermodynamic Displacements. In our formulation, we introduce the concept of thermodynamic displacements, see [3, 4]. For the case of heat exchange, we define the thermal displacements \(\varGamma ^A\), \(A=1,...,P\) such that its time rate \(\dot{\varGamma }^A\) becomes the temperature of \(\mathbf {\Sigma }_A\). We also introduce a new variable \(\varSigma _A\) associated with the internal entropy production.

1.2 Variational Formulation of Non-simple Systems

The Lagrange-d’Alembert Principle for Non-simple Systems. Now we consider a variational formulation of Lagrange-d’Alembert type for non-simple systems with friction and heat conduction, which is a natural extension of Hamilton’s principle in mechanics (see [4]).

Given a Lagrangian \(L: TQ\ \times \mathbb {R}^P \rightarrow \mathbb {R}\) and an external force \(F^\mathrm{ext }: TQ\ \times \mathbb {R}^P \rightarrow T^{*}Q\), find the curves q(t), \(S_A(t)\), \(\varGamma ^A(t)\), \(\varSigma _A(t)\) which are critical for the variational condition

$$\begin{aligned} \delta \int _{t _1 }^{ t _2} \!\Big [ L\left( q, \dot{q}, S_A\right) + \dot{\varGamma }^A( S_A- \varSigma _A)\Big ] \mathrm{d}t + \int _{t_1}^{t_2} \left\langle F^\mathrm{ext }, \delta q \right\rangle \,\mathrm{dt} =0, \end{aligned}$$

subject to the phenomenological constraint

$$\begin{aligned} \frac{\partial L}{\partial S_A}\dot{\varSigma }_A = \left\langle F^{\mathrm{fr}(A)}, \dot{q} \right\rangle + J_{AB}\dot{\varGamma }^B, \quad \text {for A=1,...,P}, \end{aligned}$$
(1)

and for variations subject to the variational constraint

$$\begin{aligned} \frac{\partial L}{\partial S_A}\delta \varSigma _A = \left\langle F^{\mathrm{fr}(A)}, \delta q \right\rangle + J_{AB}\delta \varGamma ^B, \quad \text {for A=1,...,P}, \end{aligned}$$
(2)

with \(\delta q(t_1)=\delta q(t_2)=0\) and \( \delta \varGamma ^A(t_1)=\delta \varGamma ^A(t_2)=0\), \(A=1,...,P\).

By direct computations, we obtain the following evolution equations:

$$\begin{aligned} \left\{ \begin{array}{l} \displaystyle \frac{d}{dt} \frac{\partial L}{\partial \dot{q}}=\frac{\partial L}{\partial q} -\sum _{A=1}^P \frac{\dot{\varGamma }^A}{ \frac{\partial L}{\partial S_A} }F^{\mathrm{fr}(A)} + F^\mathrm{ext },\\[5mm] \displaystyle \frac{\partial L}{\partial S_A}+ \dot{\varGamma }^A=0, \quad A=1,...,P,\\[5mm] \displaystyle \dot{S}_A - \dot{\varSigma }_A +\sum _{B=1}^P \frac{\dot{\varGamma }^A}{ \frac{\partial L}{\partial S_A} }J_{BA}=0,\quad A=1,...,P. \end{array} \right. \end{aligned}$$
(3)

From the second equation in (3), the temperature of the subsystem \(\mathbf {\Sigma }_A\), i.e., \(T^A\) can be obtained as \( \dot{\varGamma }^A= -\frac{\partial L}{\partial S_A}=:T^A. \) Because \(\sum _{A=1}^PJ_{AB}=0\) for all B, the last equation in (3) yields \(\dot{S}_A = \dot{\varSigma }_A\). Hence, together with (1), we obtain the following Lagrange-d’Alembert equations for the curves q(t) and \(S_A(t)\):

$$\begin{aligned} \left\{ \begin{array}{l} \displaystyle \frac{d}{dt}\frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q}= \sum _{A=1}^P F^{\mathrm{fr}(A)} +F^\mathrm{ext} ,\\ \displaystyle \frac{\partial L}{\partial S_A}\dot{S}_A= \left\langle F^{\mathrm{fr}(A)},\dot{q} \right\rangle - \sum _{B=1}^P J_{AB}\left( \frac{\partial L}{\partial S_B} - \frac{\partial L}{\partial S_A}\right) ,\quad A=1,...,P . \end{array} \right. \end{aligned}$$
(4)

The First Law of Energy Balance. For the total energy \(E: TQ\ \times \mathbb {R}^P \rightarrow \mathbb {R}\) given by \( E\left( q, v_{q}, S_A\right) = \left\langle \frac{\partial L}{\partial v_{q}}\left( q, v_{q}, S_A\right) , v_{q} \right\rangle -L\left( q, v_{q}, S_A\right) , \) we have \(\frac{d}{dt}E= \left\langle F^\mathrm{ext}, \dot{q} \right\rangle = P_W^\mathrm{ext}\) along the solution curve of (4). If the Lagrangian is given by \( L(q, v, S_1,...,S_P)= \sum _{A=1}^P L_A(q,v, S_A), \) the evolution equations for \(\boldsymbol{\Sigma }_A\) are

$$ \frac{d}{dt}\frac{\partial L_A}{\partial \dot{q}}- \frac{\partial L_A}{\partial q}= F^{\mathrm{fr}(A)} +F^{\mathrm{ext}\rightarrow A}+\sum _{B=1}^PF^{B \rightarrow A}, \quad A=1,...,P, $$

where \(F^{B\rightarrow A}\) is the internal force exerted by \(\mathbf {\Sigma }_B\) on \(\mathbf {\Sigma }_A\). From Newton’s third law, we have \(F^{B\rightarrow A}=-F^{A\rightarrow B}\). Denoting by \(E_A\) the total energy of \(\mathbf {\Sigma }_A\), we have

$$\begin{aligned} \begin{aligned} \frac{d}{dt}E_A&= P_W^{\mathrm{ext}\rightarrow A} +\sum _{B=1}^P P^{B \rightarrow A}_W + \sum _{B=1}^P P_H^{B \rightarrow A}, \end{aligned} \end{aligned}$$
(5)

where \(P_W^{\mathrm{ext}\rightarrow A}= \left\langle F^{\mathrm{ext}\rightarrow A}, \dot{q} \right\rangle \) is the mechanical power that flows from the exterior into \(\mathbf {\Sigma }_A\), \(P^{B \rightarrow A}_W=\sum _{B=1}^P \left\langle F^{B \rightarrow A}, \dot{q} \right\rangle \) is the internal mechanical power that flows from \(\mathbf {\Sigma }_B\) into \(\mathbf {\Sigma }_A\), and \(P_H^{B \rightarrow A}=\sum _{B=1}^P J_{AB}\left( \frac{\partial L}{\partial S_B} - \frac{\partial L}{\partial S_A}\right) \) is the internal heat power from \(\mathbf {\Sigma }_B\) to \(\boldsymbol{\Sigma }_A\). It follows that the power exchange can be written as \( P_H^{B \rightarrow A}= J_{AB}(T^A-T^B). \) The Second Law and Internal Entropy Production. The total entropy of the system is \(S=\sum _{A=1}^PS_A\). Therefore, it follows from (4) that the rate of total entropy production of the system is given by

$$\begin{aligned} \dot{S}=-\sum _{A=1}^P\frac{1}{T^A} \left\langle F^{\mathrm{fr}(A)}, \dot{q} \right\rangle + \sum _{A<B}^{P}J_{AB}\left( \frac{1}{T^B}-\frac{1}{T^A} \right) (T^B-T^A), \end{aligned}$$

which becomes always positive because of the second law. This is consistent with the phenomenological relations of the form

$$\begin{aligned} F^{\mathrm{fr}(A)}_{i}=-\lambda ^A_{ij} \dot{q}^{j}\qquad \text {and}\qquad J_{AB}\frac{T^A-T^B}{T^AT^B}=\mathscr {L}_{AB}(T^B-T^A). \end{aligned}$$
(6)

In the above, \(\lambda ^A_{ij}\) and \(\mathscr {L}_{AB}\) are functions of the state variables, where the symmetric part of \(\lambda ^A_{ij}\) are positive semi-definite and with \(\mathscr {L}_{AB}\ge 0\) for all AB. From the second relation, we get \(J_{AB}= -\mathscr {L}_{AB}T^AT^B=-\kappa _{AB}\), with \(\kappa _{AB}=\kappa _{AB}(q, S_A, S_B)\) the heat conduction coefficients between \(\mathbf {\Sigma }_A\) and \(\mathbf {\Sigma }_B\).

2 Dirac Formulation of Non-simple Systems

In this section, we develop the Dirac formulation for the dynamics of non-simple systems by means of an induced Dirac structure the Pontryagin bundle; for the details, see [1, 5, 6].

2.1 Dirac Structures in Thermodynamics

Thermodynamic Configuration Space. For our class of non-simple systems, let \( \mathscr {Q}=Q \times V\) be a thermodynamic configuration space, where Q denotes the mechanical configuration space with mechanical variables \(q \in Q\) as before and \(V=\mathbb {R}^{P} \times \mathbb {R}^{P} \times \mathbb {R}^{P}\) is the thermodynamic space with thermodynamic variables \((S_{A}, \varGamma ^{A}, \varSigma _{A}) \in V\). We denote by \(x=(q, S_{A}, \varGamma ^{A}, \varSigma _{A})\) an element of \(\mathscr {Q}\), by (xv) an element in the tangent bundle \(T\mathscr {Q}\) where \(v=(v_{q}, v_{S_{A}}, v_{\varGamma ^{A}}, v_{\varSigma _{A}}) \in T_{x}\mathscr {Q}\), and by (xp) an element of the cotangent bundle \(T^{*}\mathscr {Q}\), where \(p=(p_{q}, p_{S_{A}}, p_{\varGamma ^{A}}, p_{\varSigma _{A}}) \in T^{*}_{x}\mathscr {Q}\).

Nonlinear Constraints of Thermodynamic Type. Let \(C_{V} \subset T \mathscr {Q} \times _ \mathscr {Q} T \mathscr {Q} \) be the variational constraint locally given as

$$\begin{aligned} \begin{aligned} C_{V}=\Bigg \{(x, v, \delta {x}) \in T \mathscr {Q}\times _ \mathscr {Q} T \mathscr {Q}\; \Biggr | \;&\frac{\partial L}{\partial S_A}\delta \varSigma _A = \left\langle F^{\mathrm{fr}(A)}, \delta q \right\rangle \\[-2mm]&+ \sum _{B=1}^PJ_{AB}\delta \varGamma ^B, A=1,...,P \Bigg \}. \end{aligned} \end{aligned}$$
(7)

For every \((x,v) \in T \mathscr {Q} \), we consider the subspace of \(T_x \mathscr {D} \) given by

$$ C_V(x,v):=C_V \cap \big ( \{(x,v)\} \times T_x \mathscr {Q} \big ) \subset T_x \mathscr {Q}. $$

The kinematic constraint associated to \(C_V\) is defined by

$$\begin{aligned} C_K=\{(x,v) \in T \mathscr {Q} \mid (x,v) \in C_V(x,v)\}, \end{aligned}$$
(8)

which is given locally as

$$\begin{aligned} \begin{aligned} C_{K}\!=\!\Bigg \{(x, v) \in T \mathscr {Q}\, \Biggr | \,\frac{\partial L}{\partial S_A}v_{\varSigma _A} \!\!=\! \left\langle F^{\mathrm{fr}(A)}, v_{q} \right\rangle \!+\! \sum _{B=1}^P J_{AB}v_{\varGamma ^B}, A=1,...,P \Bigg \}. \end{aligned} \end{aligned}$$
(9)

Variational and kinematic constraints \(C_V\) and \(C_K\) are called nonlinear constraints of thermodynamic type if they are related as in (8).

Note also that the annihilator of \(C_V(x,v) \subset T_x \mathscr {Q}\), defined by

$$\begin{aligned} \begin{aligned} C_{V}(x,v)^{\circ }=\left\{ (x, \zeta ) \in T ^{*}_{x}\mathscr {Q}\; \bigr | \; \left\langle \zeta , \delta {x} \right\rangle =0, \;\; \forall \delta {x} \in C_{V}(x,v) \right\} \subset T ^{*}_{x}\mathscr {Q}, \end{aligned} \end{aligned}$$

is given, in coordinates \(\zeta =(\zeta _{q}, \zeta _{S_{A}}, \zeta _{\varGamma ^{A}}, \zeta _{\varSigma _{A}}) \in T ^{*}_{x}\mathscr {Q}\), by

$$\begin{aligned} \begin{aligned} C_{V}(x,v)^{\circ }=\Bigg \{(x, \zeta ) \in T ^{*}_{x}\mathscr {Q}\; \Biggr | \;&\zeta _{q}+\frac{\zeta _{\varSigma _{A}}}{ \frac{\partial L}{\partial S_{A}}}F^{\mathrm{fr}(A)}=0, \quad \zeta _{S_{A}}=0,\\&\quad \zeta _{\varGamma _{A}}=\frac{\zeta _{\varSigma _{A}}}{ \frac{\partial L}{\partial S_{A}}}\sum _{B=1}^P J_{AB}, \;\; A=1,...,P \Bigg \}. \end{aligned} \end{aligned}$$

Dirac Structures on the Pontryagin Bundle. \(\mathscr {P} =\) T\(\mathscr {Q} \oplus \) T\({}^{ *}\!\mathscr {Q}\). The Pontryagin bundle \( \mathscr {P} \) is defined as the Whitney sum bundle of \( \mathscr {P} =T \mathscr {Q} \oplus T^* \mathscr {Q}\), with vector bundle projection, \(\pi _{( \mathscr {P} , \mathscr {Q} )}: \mathscr {P} =T \mathscr {Q} \oplus T^* \mathscr {Q} \rightarrow \mathscr {Q}\), \(\mathrm {x}=(x,v,p) \mapsto x\). Given a variational constraint \(C_V \subset T \mathscr {Q} \times _ \mathscr {Q} T \mathscr {Q} \) as in (7), we define the induced distribution \(\varDelta _ \mathscr {P}\) on \(\mathscr {P}\) by

$$\begin{aligned} \varDelta _ \mathscr {P} (x,v,p):= \left( T_{(x,v,p)} \pi _{(\mathscr {P} ,\mathscr {Q})} \right) ^{-1} (C_V(x,v))\subset T_{(x,v,p)}\mathscr {P} , \end{aligned}$$

for each \((x,v,p) \in \mathscr {P}\). Locally, this distribution reads

$$ \varDelta _ \mathscr {P} (x,v,p)=\big \{(x,v,p, \delta {x}, \delta {v}, \delta {p}) \in T_{(x,v,p)}\mathscr {P} \mid (x, \delta {x}) \in C_V(x, v)\big \}. $$

Further, the presymplectic form on \(\mathscr {P} \) is defined from the canonical symplectic form \( \varOmega _{T^*\mathscr {Q}}\) on \(T^*\mathscr {Q}\) as \( \varOmega _\mathscr {P} := \pi _{(\mathscr {P} ,T^{*}\mathscr {Q})} ^*\varOmega _{T^*\mathscr {Q}} \), which is locally given by using local coordinates \((x,v,p)=(q, S_{A}, \varGamma ^{A}, \varSigma _{A},v_{q}, v_{S_{A}}, v_{\varGamma ^{A}}, v_{\varSigma _{A}},p_{q}, p_{S_{A}}, p_{\varGamma ^{A}}, p_{\varSigma _{A}})\) for each \(\mathrm {x}=(x,v,p) \in \mathscr {P}\) as

$$ \varOmega _\mathscr {P}=dq \wedge dp_{q}+dS_{A} \wedge dp_{S_{A}}+d\varGamma _{A} \wedge dp_{\varGamma }+d\varSigma _{A} \wedge dp_{\varSigma _{A}}. $$

Definition 1

The Dirac structure \(D_{\varDelta _ \mathscr {P} }\) induced on \(\mathscr {P} \) from \(\varDelta _\mathscr {P} \) and \(\omega _\mathscr {P} \) is defined by, for each \(\mathrm {x} \in \mathscr {P}\),

$$\begin{aligned} \begin{aligned} D_{\varDelta _ \mathscr {P} }(\mathrm {x}) :&=\big \{ (u_{\mathrm {x}}, \alpha _{\mathrm {x}}) \in T_{\mathrm {x}}\mathscr {P} \times T^{*}_{\mathrm {x}}\mathscr {P} \; \mid \; u_{\mathrm {x}} \in \varDelta _ \mathscr {P} (\mathrm {x}) \; \text {and} \\&\qquad \qquad \left\langle \alpha _{\mathrm {x}},w_{\mathrm {x}} \right\rangle =\varOmega _{\mathscr {P} }(\mathrm {x})(u_{\mathrm {x}},w_{\mathrm {x}}) \; \; \text{ for } \text{ all } \; \; w_{\mathrm {x}} \in \varDelta _ \mathscr {P} (\mathrm {x}) \big \}. \end{aligned} \end{aligned}$$

Proposition 1

The local expression of the Dirac condition, for each \(\mathrm {x}=(x,v,p)\),

$$ \big ((x,v,p,\dot{x}, \dot{v}, \dot{p}),(x,v,p, \alpha , \beta , \gamma )\big ) \in D_{ \varDelta _ \mathscr {P} }(x,v,p) $$

is equivalent to

$$\begin{aligned} (x, \dot{x}) \in C_V(x,v), \quad \beta =0 , \quad \gamma =\dot{x}, \quad \dot{p} + \alpha \in C_V(x,v)^\circ . \end{aligned}$$

In coordinates \((\alpha , \beta , \gamma )=(\alpha _{q}, \alpha _{S_{A}}, \alpha _{\varGamma ^{A}}, \alpha _{\varSigma _{A}},\beta _{q}, \beta _{S_{A}},\beta _{\varGamma ^{A}}, \beta _{\varSigma _{A}},\) \(\gamma _{q}, \gamma _{S_{A}}, \gamma _{\varGamma ^{A}}, \gamma _{\varSigma _{A}})\), this condition reads as

$$\begin{aligned} \left\{ \begin{array}{l} \displaystyle \dot{p}_{q}+\alpha _{q}+(\dot{p}_{\varSigma _{A}}+\alpha _{\varSigma _{A}})\frac{1}{ \frac{\partial L}{\partial S_{A}}}F^{\mathrm{fr}(A)}=0,\;\;\dot{p}_{S_{A}}+\alpha _{S_{A}}=0,\\ \displaystyle \dot{p}_{\varGamma _{A}}+\alpha _{\varGamma _{A}}=\dot{p}_{\varSigma _{A}}+\alpha _{\varSigma _{A}}\frac{1}{ \frac{\partial L}{\partial S_{A}}}\sum _{B=1}^P J_{AB}, \\[6mm] \displaystyle \beta _{q}=0,\;\; \beta _{S_{A}}=0,\;\; \beta _{\varGamma ^{A}}=0,\;\; \beta _{\varSigma _{A}}=0,\\[3mm] \displaystyle \dot{q}=\gamma _{q},\; \dot{S}_{A}=\gamma _{S_{A}},\; \dot{\varGamma }_{A}=\gamma _{\varGamma ^{A}}, \; \dot{\varSigma }_{A}=\gamma _{\varSigma _{A}},\\[3mm] \displaystyle \frac{\partial L}{\partial S_A}\gamma _{\varSigma _{A}} \!\!=\! \left\langle F^{\mathrm{fr}(A)}, \gamma _{q} \right\rangle \!+\! \sum _{B=1}^P J_{AB}\gamma _{\varSigma _{B}}. \end{array} \right. \end{aligned}$$

2.2 Dirac Formulation for Thermodynamics of Non-simple Systems

Dirac Dynamical Systems on \(\mathscr {P} = \) T\(\mathscr {Q} \oplus \) T\({}^{ *}\!\mathscr {Q}\). For a given Lagrangian \(L\left( q, v_{q}, S_A\right) \) on \(TQ \times \mathbb {R}^{P}\), we introduce an augmented Lagrangian by \(\mathscr {L}(q,S_{A}, \varGamma ^{A}, \varSigma _{A}, v_{q}, v_{\varGamma ^{A}}):=L\left( q, v_{q}, S_A\right) + v_{\varGamma ^{A}}(S_{A}-\varSigma _{A}).\)

In the above, note that the augmented Lagrangian may be regarded as a (degenerate) Lagrangian function \(\mathscr {L}(x,v)\) on \(T\mathscr {Q}\). Further, define the generalized energy \(\mathscr {E}\) on \(\mathscr {P} = T\mathscr {Q} \oplus T^*\mathscr {Q}\) as

$$\begin{aligned} \mathscr {E} (x,v,p):= \left\langle p, v \right\rangle - \mathscr {L} (x,v). \end{aligned}$$

Given an external force \(F^\mathrm{ext}(q, v_{q}, S_A)\), which may be regarded as a map \(F^\mathrm{ext}: T\mathscr {Q} \rightarrow T^*\mathscr {Q}\), a horizontal one-form \(\widetilde{F}^\mathrm{ext} : \mathscr {P} \rightarrow T^{*}\mathscr {P}\) is induced by

$$\begin{aligned} \left\langle \widetilde{F}^\mathrm{ext}(x,v,p) , u \right\rangle = \left\langle F^\mathrm{ext}(x,v), T\pi _{( \mathscr {P} , \mathscr {Q} )}(u) \right\rangle , \quad \text {for all}\;\; u \in T_{(x,v,p)}\mathscr {P}. \end{aligned}$$
figure a

Along the solution curve \((x(t),v(t),p(t)) \in \mathscr {P} \) of the Dirac dynamical system in (10), the energy balance equation holds as

$$ \frac{d}{dt}\mathscr {E} (x,v,p)= \left\langle F^\mathrm{ext}(x,v), \dot{x} \right\rangle . $$

2.3 Example of the Adiabatic Piston

The Adiabatic Piston. Now we consider a piston-cylinder system that is consisted of two cylinders connected by a rod, each of which contains a fluid (or an ideal gas) and is separated by a movable piston, as in Fig. 1 (see [2]).

Fig. 1.
figure 1

The adiabatic piston problem

The system \(\mathbf {\Sigma } \) is an interconnected system that is composed of three simple systems; the two pistons \(\mathbf {\Sigma } _1 , \mathbf {\Sigma } _2 \) with mass \( m_1 , m _2 \) and the connecting rod \(\mathbf {\Sigma } _3 \) with mass \( m _3 \). As in Fig. 1, q and \(r=D-\ell -q\) denote the distances between the bottom and the top in each piston where \(D=\text {const}\). Choose the state variables \((q, v_{q} , S_1, S_2)\) (the entropy of \( \mathbf {\Sigma } _3 \) is constant), and the Lagrangian is

$$\begin{aligned} L(q, v_{q}, S _1, S _2 )= \frac{1}{2} M v_{q} ^2 -U_1 (q, S _1 )-U_2(q, S _2 ), \end{aligned}$$

where \(M:= m_1 + m _2 + m _3\), \(U_1(q,S_1):=\mathsf {U}_1(S_1, V_1= \alpha _1 q, N_1)\), and \(U_2(q, S_2):= \mathsf {U}_2(S_2, V_2= \alpha _2 r, N_2)\), with \(\mathsf {U}_i(S_i, V_i, N_i)\) the internal energies of the fluids, \(N_i\) the constant numbers of moles, and \(\alpha _i\) the constant areas of the cylinders, \(i=1,2\). As in (6), we have \(F^{\mathrm{fr} (A)}(q, \dot{q}, S_A )= - \lambda ^A \dot{q}\), with \(\lambda ^A=\lambda ^A(q,S^A)\ge 0\), \(A=1,2\) and \(J_{AB}=-\kappa _{AB}=:-\kappa \), where \(\kappa =\kappa (S_1,S_2,q)\ge 0\) is the heat conductivity of the connecting rod.

From the Dirac system formulation (11), we obtain the evolution equations as

$$ \left\{ \begin{array}{l} \displaystyle \dot{p}_{q}= \varPi _1 (q,S_1)\alpha _1 - \varPi _2(q,S_2) \alpha _2 - (\lambda ^1 + \lambda ^2 )\dot{q},\\[3mm] \displaystyle \dot{q}=v_{q}, \;\; p_{q}=Mv_{q},\\[3mm] \displaystyle T^1(q,S_1)\dot{S}_1= \lambda ^1 \dot{q}^2 +\kappa \left( T ^2(q,S_2)-T^1(q,S_1)\right) ,\\[3mm] \displaystyle T^2(q,S_2)\dot{S}_2= \lambda ^2\dot{q}^2 +\kappa \left( T^1(q,S_1)-T^2(q,S_2)\right) , \end{array} \right. $$

where \(T^i(q,S_i)=\frac{\partial U_i}{\partial S_i}(q,S_i)\), \(\frac{\partial U_1 }{\partial q}=-\varPi _1 (q, S_1)\alpha _1 \), and \( \frac{\partial U_2}{\partial q}=\varPi _2(q, S_2) \alpha _2 \).

Since the system is isolated, we recover the first law \( \frac{d}{dt} E=0\), where \(E= \frac{1}{2} M\dot{q}^2 +U_1(q,S_1)+U(q, S_2 )\). The second law is also recovered as

$$ \frac{d}{dt} S= \left( \frac{\lambda ^1}{T ^1} + \frac{\lambda ^2}{T ^2} \right) \dot{q}^2 + \kappa \frac{(T ^2 - T ^1 ) ^2 }{T ^1\,T ^2 } \ge 0. $$