Keywords

1 Variational Formulation in Nonequilibrium Thermodynamics

In this section we review the variational formulations of isolated and open thermodynamic systems as extensions of the variational formulation of classical mechanics [2,3,4,5]. In a similar way to the Lagrange-d’Alembert principle of nonholonomic mechanics, the variational formulation consists of a critical action principle subject to two types of constraints: a kinematic constraints on the critical curve and a variational constraint on the variations to be considered in the critical action principle. For nonequilibrium thermodynamics, these two constraints are related in a specific way, which are referred to as constraints of thermodynamic type. The kinematic constraints are phenomeneological constraints since they are constructed from the thermodynamic fluxes \(J_ \alpha \) associated to the irreversible processes \( \alpha \) of the system, which are given by phenomenological expressions [1]. An important ingredient in the variational formulation is the concept of thermodynamic displacements \( \varLambda ^ \alpha \), such that \(\dot{ \varLambda }^ \alpha = X^ \alpha \), with \(X^ \alpha \) the thermodynamic force of the process \( \alpha \).

1.1 Variational Formulation in Mechanics

Consider a mechanical system with configuration manifold Q and Lagrangian \(L:TQ \rightarrow \mathbb {R} \), defined on the tangent bundle of Q. In absence of nonholonomic constraints and irreversible processes, the equations of motion are given by the Euler-Lagrange equations which arise from the Hamilton principle

$$\begin{aligned} \delta \int _{t_0}^{t_1}L(q, \dot{q})\mathrm{d}t=0 \end{aligned}$$
(1)

for arbitrary variations \( \delta q\) of the curve q(t) with \(\delta q_{t=t_0,t_1}=0\). Assume now that the system is subject to linear nonholonomic constraints on velocities given by a vector subbundle \( \varDelta \subset TQ\). The equations of motion for the nonholonomic system follow from the Lagrange-d’Alembert principle given as follows:

$$\begin{aligned} \delta \int _{t_0}^{t_1} L(q,\dot{q})\mathrm{d}t=0 \end{aligned}$$
(2)
$$\begin{aligned} \text {with} \quad \dot{q} \in \varDelta (q)\quad \text {and}\quad \delta q \in \varDelta (q). \end{aligned}$$
(3)

The first condition in (3) is the constraint on the critical curve q(t) of (2), called the kinematic constraint, while the second condition is the constraint on the variation \( \delta q\) to be considered in (2), called the variational constraint. In local coordinates, the constraints (3) take the form

$$\begin{aligned} A^l_i(q) \dot{q}^i=0 \quad \text {and}\quad A^l_i(q) \delta q^i=0, \quad l=1,...,N. \end{aligned}$$
(4)

1.2 Variational Formulation for Isolated Thermodynamic Systems

The variational formulation of isolated systems [2, 3] is an extension of the Hamilton principle (1) and the Lagrange-d’Alembert principle (2)–(3) which falls into the following abstract formulation. Let \( \mathcal {Q} \) be a manifold and \( \mathcal {L} : T \mathcal {Q} \rightarrow \mathbb {R} \) a Lagrangian. Let \(C_V\) be a variational constraint, i.e., a submanifold \(C_V \subset T \mathcal {Q} \times _ \mathcal {Q} T \mathcal {Q} \) such that the set \(C_V(x,v):= C_V\cap (\{(x,v)\} \times T_x \mathcal {Q} )\) is a vector subspace of \(T_x \mathcal {Q} \) for every \((x, v) \in T \mathcal {Q} \). We consider the variational formulation:

$$\begin{aligned} \delta \int _{t_0}^{t_1}\mathcal {L} (x, \dot{x})\mathrm{d}t=0 \end{aligned}$$
(5)
$$\begin{aligned} \text {with} \qquad \dot{x} \in C_V(x, \dot{x})\qquad \text {and}\qquad \delta x \in C_V(x, \dot{x}). \end{aligned}$$
(6)

In a similar way to (3), the first condition in (6) is a kinematic constraint on the critical curve x(t) while the second condition in (6) is a variational constraint. Variational and kinematic constraints related as in (6) are called constraints of the thermodynamic type. In local coordinates the constraints (6) take the form

$$ A^l_i(x, \dot{x}) \dot{x}^i=0 \qquad \text {and}\qquad A^l_i(x, \dot{x}) \delta x^i=0, \qquad l=1,...,N. $$

Example 1:

A Thermomechanical System. One of the simplest example of a thermodynamic system is the case of a mechanical system with only one entropy variable. The Lagrangian of this system is a function \(L:TQ \times \mathbb {R} \rightarrow \mathbb {R} \) depending on the position and velocity of the mechanical part of the system and on the entropy. A standard expression is \(L(q, \dot{q}, S)= \frac{1}{2} m|\dot{q} | ^2 - U(q,S)\) where U is an internal energy depending on both the position q and the entropy S of the system. We assume that the irreversible process is described by a friction force \(F^\mathrm{fr}:TQ \times \mathbb {R} \rightarrow T^*Q\). The variational formulation is

$$\begin{aligned} \delta \int _{t_0}^{t_1}L(q, \dot{q}, S)\mathrm{d}t=0, \qquad \text {subject to} \end{aligned}$$
(7)
$$\begin{aligned} \frac{\partial L}{\partial S} \dot{S} = \left\langle F^\mathrm{fr}, \dot{q} \right\rangle \quad \text {and}\quad \frac{\partial L}{\partial S} \delta S = \left\langle F^\mathrm{fr}, \delta q \right\rangle . \end{aligned}$$
(8)

It yields the equations of motion

$$\begin{aligned} \frac{d}{dt} \frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q}= F^\mathrm{fr}, \qquad \frac{\partial L}{\partial S} \dot{S} = \left\langle F^\mathrm{fr}, \dot{q} \right\rangle . \end{aligned}$$
(9)

One checks that the total energy \(E_\mathrm{tot}= \langle \frac{\partial L}{\partial \dot{q}}, \dot{q} \rangle -L\) is preserved by the equations of motion (9) while the entropy equation is \(\dot{S}= -\frac{1}{T} \left\langle F^\mathrm{fr}, \dot{q} \right\rangle \), where \(T= - \frac{\partial L}{\partial S}\) is the temperature. It is assumed that L is such that T is strictly positive. Hence, from the second law, \(F^\mathrm{fr}\) must be a dissipative force.

One easily checks that (7)–(8) is a particular instance of (5)–(6) with \(x=(q,S)\), \( \mathcal {L} (x, \dot{x})= L(q, \dot{q}, S)\), and \(C_V\) given from (8).

Example 2:

The Heat and Matter Exchanger. We consider a thermodynamic system made from several compartments exchanging heat and matter. We assume that there is a single species and we denote by \(N_A\) and \(S_A\) the number of moles and the entropy of the species in the compartment A, \(A=1,....,K\). The internal energies are given as \(U_A(S_A, N_A)\) where we assume that the volume of each compartment is constant. The variational formulation is based on the concept of thermodynamic displacement associated to an irreversible process, defined such that its time rate of change equals the thermodynamic force of the process. In our case, the thermodynamic forces are the temperatures \(T^A= \frac{\partial U}{\partial S_A}\) and the chemical potentials \( \mu ^A= \frac{\partial U}{\partial N_A}\), so the thermodynamic displacements are variables \(\varGamma ^A\) and \( W^A\) with \({\dot{\varGamma }} ^A= T^A\) and \( \dot{W}^A= \mu ^A\). We denote by \( \mathcal {J} ^{A \rightarrow B}\) the molar flow rate from compartment A to compartment B due to diffusion of the species. We also introduce the heat fluxes \(J_{AB}\), \(A\ne B\) associated to heat transfer and define \(J_{AA}:= - \sum _{A\ne B}J_{AB}\). The variational formulation for this class of systems is

$$\begin{aligned} \delta \int _{t_0}^{t_1} \Big [ L(S_1,...,S_K,N_1,...,N_K) + \sum _A\dot{W}^AN_A + \sum _A{\dot{\varGamma }} ^A (S_A- \Sigma _A ) \Big ] \mathrm{d}t=0 \end{aligned}$$
(10)
$$\begin{aligned} \begin{aligned} \frac{\partial L}{\partial S_A} \dot{\Sigma }_A&= \sum _BJ_{AB} {\dot{\varGamma }}^B + \sum _B\mathcal {J} ^{B \rightarrow A} \dot{W}^A,\quad A=1,...,K\\ \frac{\partial L}{\partial S_A} \delta \Sigma _A&=\sum _B J_{AB} \delta \varGamma ^B + \sum _B\mathcal {J} ^{B \rightarrow A} \delta W^A , \quad A=1,...,K. \end{aligned} \end{aligned}$$
(11)

In our case, the Lagrangian is \(L(S_1,...,S_K,N_1,...,N_K)=-\sum _A U_A(S_A,N_A)\) and from (10)–(11) one gets the system of equations

$$ \dot{N}_A = \sum _B \mathcal {J} ^{B \rightarrow A} ,\quad T^A\dot{S}_A = -\sum _B J_{AB}(T^B-T^A) - \sum _ B \mathcal {J} ^{B \rightarrow A} \mu ^A, \quad A=1,...,K, $$

together with \({\dot{\varGamma }} ^A= T^A\), \(\dot{W}^A= \mu ^A\), and \( \dot{\Sigma }_A= \dot{S}_A\). One checks that the total energy and number of moles are preserved while the total entropy satisfies

$$ \dot{S} = \sum _{A<B} \left( \frac{1}{T^B}- \frac{1}{T^A}\right) J_{AB} (T^B-T^A) +\sum _{A<B} \left( \frac{ \mu ^A}{T^A}- \frac{ \mu ^B}{T^B} \right) \mathcal {J} ^{B \rightarrow A}, $$

which dictates the phenomenological expressions for \(J_{AB}\) and \( \mathcal {J} ^{B \rightarrow A}\), see [5].

One easily checks that (10)–(11) is a particular case of (5)–(6) with \(x=(S_1,N_1, \varGamma ^1,W^1, \Sigma _1,...)\), with \( \mathcal {L} (x, \dot{x})\) given by the integrand in (10), and with \(C_V\) given by (11).

1.3 Variational Formulation for Open Thermodynamics Systems

The variational formulation of open systems [4] is an extension of the Hamilton principle (1), the Lagrange-d’Alembert principle (2)–(3), and the variational formulation (5)–(6) with constraints of thermodynamic type. It falls into the following abstract formulation.

Let \( \mathcal {Q} \) be a manifold and \( \mathcal {L} : \mathbb {R} \times T \mathcal {Q} \rightarrow \mathbb {R} \) be a Lagrangian, possibly time dependent. Let \( \mathcal {F} ^\mathrm{ext}: \mathbb {R} \times T \mathcal {Q} \rightarrow T^* \mathcal {Q} \) be a given exterior force. We consider a time dependent variational constraint \(C_V\) given by a submanifold \(C_V \subset ( \mathbb {R} \times T \mathcal {Q} )\times _{ \mathbb {R} \times \mathcal {Q} }T (\mathcal {Q} \times \mathbb {R} )\) such that the set \(C_V(t,x,v):= C_V\cap (\{(t,x,v)\} \times T_{(t,x)}( \mathbb {R} \times \mathcal {Q} ))\) is a vector subspace of \(T_{(t,x)}( \mathbb {R} \times \mathcal {Q}) \) for every \((t,x, v) \in \mathbb {R} \times T \mathcal {Q} \). It is thus locally defined with the help of functions \(A^l_i(t,x,\dot{x})\) and \(B^l(t,x,\dot{x})\). We consider the variational formulation:

$$\begin{aligned} \delta \int _{t_0}^{t_1}\mathcal {L} (t, x, \dot{x})\mathrm{d}t+ \int _{t_0}^{t_1} \left\langle \mathcal {F} ^\mathrm{ext}(t,x,\dot{x}), \delta x \right\rangle \mathrm{d}t=0, \qquad \text {subject to} \end{aligned}$$
(12)
$$\begin{aligned} A^l_i(t, x, \dot{x}) \dot{x}^i+ B^l(t, x,\dot{x})=0 \quad \text {and}\quad A^l_i(t, x, \dot{x}) \delta x^i=0, \qquad l=1,...,N. \end{aligned}$$
(13)

In a similar way to the previous cases, the first condition in (13) is a kinematic constraint on the critical curve x(t) while the second condition in (13) is a variational constraint. Variational and kinematic constraints related as in (6) in the time-dependent setting are also called constraints of the thermodynamic type.

Remark 1

The constraints in (13) are explicitly time dependent. Allowing this time dependence is important for the applications to open thermodynamic systems. Consistently with this, we have considered that both \( \mathcal {L} \) and \( \mathcal {F} ^\mathrm{ext}\) may be explicitly time dependent in (12), by defining them on \( \mathbb {R} \times T \mathcal {Q} \ni (t,x,\dot{x})\). It turns out that this time dependence is very natural if one considers the geometric setting underlying (12)–(13), see Remark 2.

Remark 2

The appropriate geometric setting underlying (12)–(13) is that of time dependent mechanics, seen as a special instance of the geometric setting of classical field theories. The basic object is the configuration bundle \( \mathcal {Y} \rightarrow \mathcal {X} \), here given by \( \mathcal {Y} = \mathbb {R} \times \mathcal {Q} \rightarrow \mathbb {R} \) where \( \mathcal {X} = \mathbb {R} \). Then, the Lagrangian in (12) is defined on the first jet bundle \(J^ 1 \mathcal {Y} = \mathbb {R} \times T \mathcal {Q} \) of \( \mathbb {R} \times \mathcal {Q} \rightarrow \mathbb {R}\) and the variational constraint \(C_V\) mentioned above is \(C_V \subset J^1 \mathcal {Y} \times _ \mathcal {Y} T \mathcal {Y} \), see [6].

2 Open Reacting Systems

In this section we show how the variational formulation (12)–(13) for open thermodynamic systems is used to model the dynamics of an open system exchanging heat and mass with the exterior and involving chemical reactions.

2.1 General Setting, Thermodynamic Forces and Displacements

We assume that the system involves R chemical species \(I=1,...,R\) and r chemical reactions \(a=1,...,r\). Chemical reactions may be represented by

$$ \sum _I {\nu '}_{I}^a\,I\; \mathrel {\mathop {\rightleftarrows }^{a _{(1)}}_{a _{(2)}}} \; \sum _I{\nu ''}^a_{I}\, I, \quad a=1,...,r, $$

where \(a_{(1)}\) and \(a_{(2)}\) are the forward and backward reactions associated to the reaction a, and \({\nu ''}^a _{I}\), \({\nu '}^a_I\) are the forward and backward stoichiometric coefficients. Mass conservation during each reaction is given by

$$ \sum _I m_I\nu ^a_{I}=0 \quad \text {for a=1,...,r}\;\; \text {(Lavoisier law)}, $$

where \(\nu ^a _{I}:= {\nu ''}^a_{I}- {\nu '}^a _{I}\) and \(m_I\) is the molecular mass of species I.

We denote by \(U=U(S, V, N_1,...,N_R)\) the internal energy of the system, written in terms of the entropy S, the volume V, and the number of moles \(N_I\) of each species \(I=1,...,R\).

We have already seen above the thermodynamic forces, displacements, and fluxes associated to heat and matter transfer. For chemical reactions, the thermodynamic forces are the affinities of the reactions defined by

$$ \mathcal {A} ^a= - \sum _I \nu ^a _{I} \mu ^I, \quad a=1,...,r. $$

Following our definition, the corresponding thermodynamic displacement, denoted \( \nu ^a\), satisfies

$$ \dot{\nu }^a = - \mathcal {A} ^a, \quad a=1,...,r. $$

The thermodynamic fluxes are the rates of extent denoted \(J_a\) given by phenomenological laws, see Sect. 2.4.

We assume that the system has several ports through which species can flow into or out of the system. To fix the ideas, we assume that for each species there is one inlet (i) and one outlet (o) with corresponding molar flow rates into the system denoted \( \mathcal {J} _I^i>0\) and \( \mathcal {J} _I^o<0\), \(I=1,...,R\). The associated entropy flow is \( \mathcal {J} _{S,I}^k= \mathcal {J} _I^k\mathsf {S}_I^k\), where \(\mathsf {S}_I^k\) is the molar entropy of species I at \(k=i,o\). We also assume that there is a heat source with entropy flow rate \( \mathcal {J} _{S,h}\). We denote by \( \mu _k^I\), \(T_k^I\), \(k=i,o\), the chemical potentials and temperatures at the ports and by \(T^h\) the temperature of the heat source.

2.2 Variational Setting

Following the general approach mentioned above, the variational formulation is:

$$\begin{aligned} \small \delta \int _{t_0}^{t_1} \Big [ L(q, \dot{q}, S, N_1,...,N_R) + \sum _I\dot{W}^IN_I + {\dot{\varGamma }} (S- \Sigma ) \Big ] \mathrm{d}t + \int _{t_0}^{t_1} \left\langle F^\mathrm{ext}, \delta q \right\rangle \mathrm{d}t=0 \end{aligned}$$
(14)

with kinematic and variational constraints

$$\begin{aligned} \begin{aligned} \frac{\partial L}{\partial S} \dot{\Sigma }&= \left\langle F^\mathrm{fr}, \dot{q} \right\rangle + \sum _a J_a \dot{\nu }^a + \sum _{I,k} \left( \mathcal {J}_I^k ( \dot{W}^I - \mu ^I_k) + \mathcal {J} _{S,I}^k( {\dot{\varGamma }} - T_k^I) \right) + \mathcal {J} _{S,h} ({\dot{\varGamma }} - T^h)\\ \dot{\nu }^a&= \sum _I\nu ^a_I \dot{W}^I \end{aligned} \end{aligned}$$
(15)
$$\begin{aligned} \begin{aligned} \frac{\partial L}{\partial S} \delta \Sigma&= \left\langle F^\mathrm{fr}, \delta q \right\rangle + \sum _a J_a \delta \nu ^a+ \sum _I^k \left( \mathcal {J}_I^k \delta W^I + \mathcal {J} _{S,I}^k \delta \varGamma \right) + \mathcal {J} _{S,h} \delta \varGamma \\ \delta \nu ^a&=\sum _I \nu ^a_I \delta W^I. \end{aligned} \end{aligned}$$
(16)

We note that the variational constraint (16) follows from the phenomenological constraint (15) by formally replacing the time derivatives \(\dot{\Sigma }\), \(\dot{q}\), \(\dot{\nu }^a\), \(\dot{W}^I\), \({\dot{\varGamma }}\) by the corresponding virtual displacements \(\delta \Sigma \), \(\delta q\), \( \delta \nu ^a \), \(\delta W^I\), \(\delta \varGamma \), and by removing all the terms that depend uniquely on the exterior, i.e., the terms \(\mathcal {J} _I^k\mu ^I_k\), \(\mathcal {J}_{S,I} ^kT ^I_k \), and \( \mathcal {J} _{S,h}T ^h\). This is consistent with the general setting in (13).

Taking variations of the integral in (14), integrating by parts, and using \( \delta q(t_0)=\delta q(t_1)=0\), \(\delta W^I(t_0)=\delta W^I(t_1)=0\), and \(\delta \varGamma (t_0)=\delta \varGamma (t_1)=0\) and using the variational constraint (16), we get the following conditions:

$$\begin{aligned} \begin{aligned}&\delta q:\, \frac{d}{dt}\frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q} = F^\mathrm{fr}+F^\mathrm{ext}, \qquad \delta \varGamma : \,\dot{S}=\dot{\Sigma }+\sum _{I,k}\mathcal {J}_{S,I}^k + \mathcal {J}_{S,h},\\&\delta N_I: \,\dot{W}^I= -\frac{\partial L}{\partial N_I}, \quad \delta S: \,{\dot{\varGamma }} = -\frac{\partial L}{\partial S}, \quad \delta W^I:\,\dot{N}_I= \sum _k\mathcal {J}_I^k + \sum _aJ_a \nu ^a_I . \end{aligned} \end{aligned}$$
(17)

By the third and fourth equations the variables \(\varGamma \) and \(W^I\) are thermodynamic displacements. Using (15), we get the following system of evolution equations for the curves q(t), S(t), \(N_I(t)\):

$$\begin{aligned} \left\{ \begin{array}{l} \displaystyle \frac{d}{dt}\frac{\partial L}{\partial \dot{q}}- \frac{\partial L}{\partial q}= F^\mathrm{fr} +F^\mathrm{ext},\quad \quad \quad \frac{d}{dt} N_I= \sum _k\mathcal {J}_I^k + \sum _a J_a \nu ^a_I,\\ \displaystyle \frac{\partial L}{\partial S}\Big (\dot{S} -\sum _{I,k}\mathcal {J}_{S,I}^k - \mathcal {J}_{S,h}\Big )= \left\langle F^\mathrm{fr} , \dot{q} \right\rangle - \sum _{a,I} J_a \nu ^a_I \frac{\partial L}{\partial N_I} \\ \displaystyle \qquad - \sum _{I,k}\left[ \mathcal {J}_I^k\Big (\frac{\partial L}{\partial N_I}+\mu ^I_k\Big )+\mathcal {J}_{I,S}^k\Big (\frac{\partial L}{\partial S}+ T_k^I\Big )\right] -\mathcal {J}_{S,h}\Big (\frac{\partial L}{\partial S}+ T^h\Big ). \end{array} \right. \end{aligned}$$
(18)

2.3 The First and Second Law of Thermodynamics

The energy balance for this system is computed as

$$ \frac{d}{dt}E= \left\langle F^\mathrm{ext}, \dot{q} \right\rangle + \mathcal {J}_{S,h} T^h + \sum _{I,k} (\mathcal {J}_I^k\mu ^I_k + \mathcal {J}_{S,I}^k T^I_k)=: P^\mathrm{ext}_W + P^\mathrm{ext}_H+ P^\mathrm{ext}_M, $$

with the three terms representing the power associated to the transfer of mechanical work, heat, and matter into the system, respectively. From the last equation in (18), the entropy equation reads

$$\begin{aligned} \dot{S}=I + \sum _{I,k} \mathcal {J}_{S,I}^k + \mathcal {J}_{S,h}, \end{aligned}$$
(19)

where I is the rate of internal entropy production given by

(20)

From the second equation in (17) and from (19) we obtain the interpretation of the variable \( \Sigma \), namely, \(\dot{\Sigma }= I\) is the rate of internal entropy production. The second and third terms in (19) represent the entropy flow rate into the system associated to the ports and the heat sources. The second law requires \(I\ge 0\), whereas the sign of the rate of entropy flow into the system is arbitrary. Of course, at the outlet in which \( \mu ^I_o= \mu ^I\) and \(T_o^I=T^I\), the corresponding entropy production term vanishes. The second term in (19) can be written in terms of the molar enthalpy \(\mathsf {H}_I^k\) of species I at \(k=i,o\), as \(\frac{1}{T} \sum _{I}^k \mathcal {J}_I^k\big (\mathsf {H} ^ I_k- T\mathsf {S}^ I_k - \mu ^I\big )\).

2.4 Entropy Production Associated to Chemical Reactions

We give here the expression of the entropy production for elementary chemical reactions in a form general enough to cover the case of real gas mixtures and non-isothermal chemical reactions.

For a mixture of gas, the affinity of a reaction can be written in the form

$$ \mathcal {A} ^a(T,p,N_1,...,N_R)=RT \ln \Big ( K^\circ _a(T)\prod _{A}\left( f_A/p_0\right) ^{ -\nu _A^a} \Big ), $$

where the state function \(f_A\) is the fugacity of component A, \(p_0\) is a standard or reference pressure, and

$$ K^\circ _a(T):= \exp \Big (- \frac{1}{RT} \sum _A \nu _A^a \mu ^A _0(T,p_0)\Big ) $$

is the thermodynamic equilibrium constant of reaction a, with \( \mu ^A_0\) the chemical potential of component A seen as a perfect gas. The quotient \(\mathsf {a}_A= f_A/p_0\) is the activity of component A, defined with respect to the prefect gas reference state. The rates of extend \(J_a\) have the general expression

$$ \frac{J_a}{V}= R_f^a-R_r^a= k_f^a(T) \prod _{A=1}^R \mathsf {a}_A^{{\kappa '}_A^a}- k_r^a(T) \prod _{A=1}^R \mathsf {a}_A^{{\kappa ''}^a_A} $$

with \(R_f^a\), \(R_r^a\) the forward and reverse reaction rates, \(k_f^a\), \(k_r^a\) the forward and reverse rate constants, and \({\kappa '}^a _A\), \( {\kappa ''}^a_A\) the order of the reactants and of the products [7]. The quantities \(k_f^a\), \(k_r^a\) are given by phenomenological expressions, the most widely used being the Arrhenius equation, and satisfy the condition \(K^\circ _a (T)= k^a_f(T)/k^a_r(T)\). For elementary reactions, we have \({\kappa '}^a _A={\nu '}^a _A\), \({\kappa '}^a _A={\nu '}^a _A\), hence the entropy production term in (20) associated to chemical reactions is

$$ \frac{1}{T} \sum _a J_a \mathcal {A} ^a = \sum _aVR \left( R_f^a- R_r^a\right) \ln \frac{R_f^a}{R_r^a} \ge 0. $$

Remark 3

The Lagrangian variational formulation presented above can be transformed into the Hamiltonian setting when the given Lagrangian is nondegenerate with respect to the mechanical variable. We will show the Hamiltonian variational formulation for thermodynamics as a future work.