Heat flow, work energy, chemical reactions, and thermodynamics: a dynamical systems perspective

In this paper, we combine the two universalisms of thermodynamics and dynamical systems theory to develop a dynamical system formalism for classical thermodynamics.


Introduction
There is no doubt that thermodynamics is a theory of universal proportions whose laws reign supreme among the laws of nature and are capable of addressing some of science's most intriguing questions about the origins and fabric of our universe. The laws of thermodynamics are among the most firmly established laws of nature and play a critical role in the understanding of our expanding universe. In addition, thermodynamics forms the underpinning of several fundamental life science and engineering disciplines, including biological systems, physiological systems, chemical reaction systems, ecological systems, information systems, and network systems, to cite but a few examples. While from its inception its speculations about the universe have been grandiose, its mathematical foundation has been amazingly obscure and imprecise (Truesdell (1969;1980); Arnold (1990); ). This is largely due to the fact that classical thermodynamics is a physical theory concerned mainly with equilibrium states and does not possess equations of motion. The absence of a state space formalism in classical thermodynamics, and physics in general, is quite disturbing and in our view largely responsible for the monomeric state of classical thermodynamics. In recent research,  combined the two universalisms of thermodynamics and dynamical systems theory under a single umbrella to develop a dynamical system formalism for classical thermodynamics so as to harmonize it with classical mechanics. While it seems impossible to reduce thermodynamics to a mechanistic world picture due to microscopic reversibility and Poincaré recurrence, the system thermodynamic formulation of  provides a harmonization of classical thermodynamics with classical mechanics. In particular, our dynamical system formalism captures all of the key aspects of thermodynamics, including its fundamental laws, while providing a mathematically rigorous formulation for thermodynamical systems out of equilibrium by unifying the theory of heat transfer with that of classical thermodynamics. In addition, the concept of entropy for a nonequilibrium state of a dynamical process is defined, and its global existence and uniqueness is established. This state space formalism of thermodynamics shows that the behavior of heat, as described by the conservation equations of thermal transport and as described by classical thermodynamics, can be derived from the same basic principles and is part of the same scientific discipline. Connections between irreversibility, the second law of thermodynamics, and the entropic arrow of time are also established in . Specifically, we show a state irrecoverability and, hence, a state irreversibility nature of thermodynamics. State irreversibility reflects time-reversal non-invariance, wherein time-reversal is not meant literally; that is, we consider dynamical systems whose trajectory reversal is or is not allowed and not a reversal of time itself. In addition, we show that for every nonequilibrium system state and corresponding system trajectory of our thermodynamically consistent dynamical system, there does not exist a state such that the corresponding system trajectory completely recovers the initial system state of the dynamical system and at the same time restores the energy supplied by the environment back to its original condition. This, along with the existence of a global strictly increasing entropy function on every nontrivial system trajectory, establishes the existence of a completely ordered time set having a topological structure involving a closed set homeomorphic to the real line giving a clear time-reversal asymmetry characterization of thermodynamics and establishing an emergence of the direction of time flow. In this paper, we reformulate and extend some of the results of . In particular, unlike the framework in  wherein we establish the existence and uniqueness of a global entropy function of a specific form for our thermodynamically consistent system model, in this paper we assume the existence of a continuously differentiable, strictly concave function that leads to an entropy inequality that can be identified with the second law of thermodynamics as a statement about entropy increase. We then turn our attention to stability and convergence. Specifically, using Lyapunov stability theory and the Krasovskii-LaSalle invariance principle, we show that for an adiabatically isolated system the proposed interconnected dynamical system model is Lyapunov stable with convergent trajectories to equilibrium states where the temperatures of all subsystems are equal. Finally, we present a state-space dynamical system model for chemical thermodynamics. In particular, we use the law of mass-action to obtain the dynamics of chemical reaction networks. Furthermore, using the notion of the chemical potential (Gibbs (1875;1878)), we unify our state space mass-action kinetics model with our thermodynamic dynamical system model involving energy exchange. In addition, we show that entropy production during chemical reactions is nonnegative and the dynamical system states of our chemical thermodynamic state space model converge to a state of temperature equipartition and zero affinity (i.e., the difference between the chemical potential of the reactants and the chemical potential of the products in a chemical reaction).

Mathematical preliminaries
In this section, we establish notation, definitions, and provide some key results necessary for developing the main results of this paper. Specifically, R denotes the set of real numbers, Z + (respectively, Z + ) denotes the set of nonnegative (respectively, positive) integers, R q denotes the set of q × 1columnvectors,R n×m denotes the set of n × m real matrices, P n (respectively, N n ) denotes the set of positive (respectively, nonnegative) definite matrices, (·) T denotes transpose, I q or I denotes the q × q identity matrix, e denotes the ones vector of order q, that is, e [1,...,1] T ∈ R q ,a n de i ∈ R q denotes a vector with unity in the ith component and zeros elsewhere. For x ∈ R q we write x ≥≥ 0( r e s p e c t i v e l y ,x >> 0) to indicate that every component of x is nonnegative (respectively, positive). In this case, we say that x is nonnegative or positive, respectively. Furthermore, R q + and R q + denote the nonnegative and positive orthants of R q ,thatis,ifx ∈ R q ,thenx ∈ R q + and x ∈ R q + are equivalent, respectively, to x ≥≥ 0a n dx >> 0. Analogously, R n×m + (respectively, R n×m + ) denotes the set of n × m real matrices whose entries are nonnegative (respectively, positive). For vectors x, y ∈ R q , with components x i and y i , i = 1,...,q,w eu s ex • y to denote component-by-component multiplication, that is, x • y [x 1 y 1 ,...,x q y q ] T . Finally, we write ∂S, • S,a n dS to denote the boundary, the interior, and the closure of the set S, respectively. We write · for the Euclidean vector norm, V ′ (x) ∂V(x) ∂x for the Fréchet derivative of V at x, B ε (α), α ∈ R q , ε > 0, for the open ball centered at α with radius ε,a n dx(t) →Mas t → ∞ to denote that x(t) approaches the set M (that is, for every ε > 0t h e r ee x i s t sT > 0 such that dist(x(t), M) < ε for all t > T,wheredist(p, M) inf x∈M p − x ). The notions of openness, convergence, continuity, and compactness that we use throughout the paper refer to the topology generated on D⊆R q by the norm · .As u b s e tN of D is relatively open in D if N is open in the subspace topology induced on D by the norm · .Ap o i n tx ∈ R q is a subsequential limit of the sequence that converges to x in the norm · . Recall that every bounded sequence has at least one subsequential limit. A divergent sequence is a sequence having no convergent subsequence. Consider the nonlinear autonomous dynamical systeṁ (1). We assume that, for every initial condition x(0) ∈D, the differential equation (1) possesses a unique right-maximally defined continuously differentiable solution which is defined on [0, ∞). Letting s(·, x) denote the right-maximally defined solution of (1) that satisfies the initial condition x(0)=x, the above assumptions imply that the map s : [0, ∞) ×D→D is continuous (Hartman, 1982, Theorem V.2.1), satisfies the consistency property s(0, x)=x, and possesses the semigroup property s(t, s(τ, x)) = s(t + τ, x) for all t, τ ≥ 0a n dx ∈D.G i v e n t ≥ 0a n dx ∈D,w ed e n o t et h em a ps(t, ·) : D→Dby s t and the map s(·, x) : [0, ∞) →Dby s x . For every t ∈ R,t h ema ps t is a homeomorphism and has the inverse s −t .
The orbit O x of a point x ∈Dis the set s x ([0, ∞)).As e tD c ⊆Dis positively invariant relative to (1) if s t (D c ) ⊆D c for all t ≥ 0 or, equivalently, D c contains the orbits of all its points. The set D c is invariant relative to (1) if s t (D c )=D c for all t ≥ 0. The positive limit set of x ∈ R q is the set ω(x) of all subsequential limits of sequences of the form ). In addition, for every x ∈ R q that has bounded positive orbits, ω(x) is nonempty and compact, and, for every neighborhood N of ω(x),t h er eexist s T > 0suchthats t (x) ∈N for every t > T ). Furthermore, x e ∈D is an equilibrium point of (1) if and only if f (x e )=0 or, equivalently, s(t, x e )=x e for all t ≥ 0. Finally, recall that if all solutions to (1) are bounded, then it follows from the Peano-Cauchy theorem (Haddad & Chellaboina, 2008, p. 76) that I x 0 = R.
Definition 2.1 (Haddad et al., 2010, pp. 9, 10) Let f =[f 1 ,..., f n ] T : D⊆R n + → R n .T h e nfi s essentially nonnegative if f i (x) ≥ 0, for all i = 1,...,n, and x ∈ R n + such that x i = 0,w h e r ex i denotes the ith component of x.

Interconnected thermodynamic systems: A state space energy flow perspective
The fundamental and unifying concept in the analysis of thermodynamic systems is the concept of energy. The energy of a state of a dynamical system is the measure of its ability to produce changes (motion) in its own system state as well as changes in the system states of its surroundings. These changes occur as a direct consequence of the energy flow between different subsystems within the dynamical system. Heat (energy) is a fundamental concept of thermodynamics involving the capacity of hot bodies (more energetic subsystems) to produce work. As in thermodynamic systems, dynamical systems can exhibit energy (due to friction) that becomes unavailable to do useful work. This in turn contributes to an increase in system entropy, a measure of the tendency of a system to lose the ability to do useful work. In this section, we use the state space formalism to construct a mathematical model of a thermodynamic system that is consistent with basic thermodynamic principles. Specifically, we consider a large-scale system model with a combination of subsystems (compartments or parts) that is perceived as a single entity.
For each subsystem (compartment) making up the system, we postulate the existence of an energy state variable such that the knowledge of these subsystem state variables at any given time t = t 0 ,together with the knowledge of any inputs (heat fluxes) to each of the subsystems for time t ≥ t 0 , completely determines the behavior of the system for any given time t ≥ t 0 .H e n c e , t h e (energy) state of our dynamical system at time t is uniquely determined by the state at time t 0 and any external inputs for time t ≥ t 0 and is independent of the state and inputs before time t 0 . More precisely, we consider a large-scale interconnected dynamical system composed of a large number of units with aggregated (or lumped) energy variables representing homogenous groups of these units. If all the units comprising the system are identical (that is, the system is perfectly homogeneous), then the behavior of the dynamical system can be captured by that of a single plenipotentiary unit. Alternatively, if every interacting system unit is distinct, then the resulting model constitutes a microscopic system. To develop a middle-ground thermodynamic model placed between complete aggregation (classical thermodynamics) and complete disaggregation (statistical thermodynamics), we subdivide the large-scale dynamical system into a finite number of compartments, each formed by a large number of homogeneous units. Each compartment represents the energy content of the different parts of the dynamical system, and different compartments interact by exchanging heat. Thus, our compartmental thermodynamic model utilizes subsystems or compartments to describe the energy distribution among distinct regions in space with intercompartmental flows representing the heat transfer between these regions. Decreasing the number of compartments results in a more aggregated or homogeneous model, whereas increasing the number of compartments leads to a higher degree of disaggregation resulting in a heterogeneous model. To formulate our state space thermodynamic model, consider the interconnected dynamical system G shown in Figure 1 involving energy exchange between q interconnected subsystems. Let E i : [0, ∞) → R + denote the energy (and hence a nonnegative quantity) of the ith subsystem, let S i : [0, ∞) → R denote the external power (heat flux) supplied to (or extracted from) the ith subsystem, let φ ij : R q + → R, i = j, i, j = 1,...,q, denote the net instantaneous rate of energy (heat) flow from the jth subsystem to the ith subsystem, and let σ ii : R q + → R + , i = 1,...,q, denote the instantaneous rate of energy (heat) dissipation from the ith subsystem to the environment. Here, we assume that φ ij : R q + → R, i = j, i, j = 1,...,q,andσ ii : R q + → R + , i = 1,...,q, are locally Lipschitz continuous on R q + and S i : [0, ∞) → R, i = 1,...,q,arebounded piecewise continuous functions of time.
An energy balance for the ith subsystem yields ( 2 ) or, equivalently, in vector form, Note that (2) yields a conservation of energy equation and implies that the energy stored in the ith subsystem is equal to the external energy supplied to (or extracted from) the ith subsystem plus the energy gained by the ith subsystem from all other subsystems due to subsystem coupling minus the energy dissipated from the ith subsystem to the environment. Equivalently, (2) can be rewritten aṡ ( 6 ) where E 0 [E 10 ,...,E q0 ] T , yielding a power balance equation that characterizes energy flow between subsystems of the interconnected dynamical system G. We assume that The above constraint implies that if the energy of the ith subsystem of G is zero, then this subsystem cannot supply any energy to its surroundings nor can it dissipate energy to the environment. In this case, w(E) − d(E), E ∈ R q + , is essentially nonnegative ). Thus, if S(t) ≡ 0, then, by Proposition 2.1, the solutions to (6) are nonnegative for all nonnegative initial conditions. See ; 2010) for further details. Since our thermodynamic compartmental model involves intercompartmental flows representing energy transfer between compartments, we can use graph-theoretic notions with undirected graph topologies (i.e., bidirectional energy flows) to capture the compartmental system interconnections. Graph theory (Diestel (1997); Godsil & Royle (2001)) can be useful in the analysis of the connectivity properties of compartmental systems. In particular, an undirected graph can be constructed to capture a compartmental model in which the compartments are represented by nodes and the flows are represented by edges or arcs. In this case, the environment must also be considered as an additional node. For the interconnected dynamical system G with the power balance equation (6), we define a connectivity matrix 1 C∈R q×q such that for ) and energy exchange is possible between any two subsystems of G. The next definition introduces a notion of entropy for the interconnected dynamical system G.
Definition 3.1 Consider the interconnected dynamical system G with the power balance equation (6). ( 7 ) and It follows from Definition 3.1 that for an isolated system G,t h a ti s ,S(t) ≡ 0a n dd(E) ≡ 0, the entropy function of G is a nondecreasing function of time. To see this, note thaṫ Proposition 3.1 Consider the isolated (i.e., S(t) ≡ 0 and d(E) ≡ 0) interconnected dynamical system G with the power balance equation (6). Assume that rank C = q − 1 and there exists an entropy function S : Furthermore, the set of nonnegative equilibrium states of (6) is given by The negative of the connectivity matrix, that is, -C, is known as the graph Laplacian in the literature.

Proof. If
..,q,and,sinceS is an entropy function of G, it follows that for all i, j = 1,...,q. Now, the result follows from the fact that rank C = q − 1.
Theorem 3.1 Consider the isolated (i.e., S(t) ≡ 0 and d(E) ≡ 0) interconnected dynamical system G with the power balance equation (6). Assume that rank C = q − 1 and there exists an entropy function , t ≥ t 0 , is a nondecreasing function of time, and hence, by the Krasovskii-LaSalle theorem ), E(t) → R {E ∈ R q + :Ṡ (E)=0} as t → ∞. Next, it follows from (8), Definition 3.1, and the fact that rank C = q − 1, that R = E ∈ R q + : where λ e ∂S ∂E 1 (E e ). Next, note that V(E e )=0, ∂V ∂E (E e )=− ∂S ∂E (E e )+λ e e T = 0, and, since S (·) is a strictly concave function, is a Lyapunov function for G and E e is a Lyapunov stable equilibrium of G. Finally, since, for every E 0 ∈ R n + , E(t) →E 0 as t → ∞ and every equilibrium point of G is Lyapunov stable, it follows from Proposition 2.2 that G is globally semistable with respect to R q + . In classical thermodynamics, the partial derivative of the system entropy with respect to the system energy defines the reciprocal of the system temperature. Thus, for the interconnected dynamical system G, represents the temperature of the ith subsystem. Condition (7) is a manifestation of the second law of thermodynamics and implies that if the temperature of the jth subsystem is greater than the temperature of the ith subsystem, then energy (heat) flows from the jth subsystem to the ith subsystem. Furthermore, if and only if φ ij (E)=0withC (i,j) = 1, i = j, i, j = 1,...,q, implies that temperature equality is a necessary and sufficient condition for thermal equilibrium. This is a statement of the zeroth law of thermodynamics.A sar e s u l t ,T h e o r e m3 . 1 shows that, for a strongly connected system G, the subsystem energies converge to the set of equilibrium states where the temperatures of all subsystems are equal. This phenomenon is known as equipartition of temperature (Haddad et al. (2010)) and is an emergent behavior in thermodynamic systems. In particular, all the system energy is eventually transferred into heat at a uniform temperature, and hence, all dynamical processes in G (system motions) would cease. The following result presents a sufficient condition for energy equipartition of the system, that is, the energies of all subsystems are equal. And this state of energy equipartition is uniquely determined by the initial energy in the system. Theorem 3.2 Consider the isolated (i.e., S(t) ≡ 0 and d(E) ≡ 0) interconnected dynamical system G with the power balance equation (6). Assume that rank C = q − 1 and there exists a continuously differentiable, strictly concave function f : R + → R such that the entropy function S : Then, the set of nonnegative equilibrium states of (6) is given by which implies that (7) is equivalent to and E i = E j if and only if φ ij (E)=0w i t hC (i,j) = 1, i = j, i, j = 1,...,q.H e n c e , −E T E is an entropy function of G. Next, with S (E)=− 1 2 E T E, it follows from Proposition 3.1 that log e (c + E i ), then it follows from Theorem 3.2 that E 0 = {αe : α ≥ 0} and the isolated (i.e., S(t) ≡ 0a n dd(E) ≡ 0) interconnected dynamical system G with the power balance equation (6) is semistable. In this case, the absolute temperature of the ith compartment is given by c + E i . Similarly, if S (E)=− 1 2 E T E, then it follows from Theorem 3.2 that E 0 = {αe : α ≥ 0} and the isolated (i.e., S(t) ≡ 0a n dd(E) ≡ 0) interconnected dynamical system G with the power balance equation (6) is semistable. In both these cases, E(t) → 1 q ee T E(t 0 ) as t → ∞. This shows that the steady-state energy of the isolated interconnected dynamical system G is given by 1 q ee T E(t 0 )= 1 q ∑ q i=1 E i (t 0 )e, and hence, is uniformly distributed over all subsystems of G. This phenomenon is known as energy equipartition ). The aforementioned forms of S (E) were extensively discussed in the recent book by  where S (E)=∑ q i=1 log e (c + E i ) and −S(E)= 1 2 E T E are referred to, respectively, as the entropy and the ectropy functions of the interconnected dynamical system G.

Work energy, free energy, heat flow, and Clausius' inequality
In this section, we augment our thermodynamic energy flow model G with an additional (deformation) state representing subsystem volumes in order to introduce the notion of work into our thermodynamically consistent state space energy flow model. Specifically, we assume that each subsystem can perform (positive) work on the environment as well as the environment can perform (negative) work on the subsystems. The rate of work done by the ith subsystem on the environment is denoted by d wi : R q + × R q + → R + , i = 1,...,q, the rate of work done by the environment on the ith subsystem is denoted by S wi : [0, ∞) → R + , i = 1,...,q, and the volume of the ith subsystem is denoted by V i : [0, ∞) → R + , i = 1,...,q. The net work done by each subsystem on the environment satisfies where p i (E, V), i = 1,...,q, denotes the pressure in the ith subsystem and V [V 1 ,...,V q ] T . Furthermore, in the presence of work, the energy balance equation (5) for each subsystem can be rewritten as where ..,q, denotes the net instantaneous rate of energy (heat) flow from the jth subsystem to the ith subsystem, σ ii : R q + × R q + → R + , i = 1,...,q, denotes the instantaneous rate of energy dissipation from the ith subsystem to the environment, and, as in Section 3, S i : [0, ∞) → R, i = 1,...,q, denotes the external power supplied to (or extracted from) the ith subsystem. It follows from (10) and (11) that positive work done by a subsystem on the environment leads to a decrease in internal energy of the subsystem and an increase in the subsystem volume, which is consistent with the first law of thermodynamics. The definition of entropy for G in the presence of work remains the same as in Definition 3.1 with S (E) replaced by S (E, V) and with all other conditions in the definition holding for every V >> 0. Next, consider the ith subsystem of G and assume that E j and V j , j = i, i = 1,...,q,are constant. In this case, note that and define It follows from (10) and (11) that, in the presence of work energy, the power balance equation (6) takes the new form involving energy and deformation stateṡ

E(t)=w(E(t), V(t)) − d w (E(t), V(t)) + S w (t) − d(E(t), V(t)) + S(t),
where Note that The power balance and deformation equations (14) and (15) represent a statement of the first law of thermodynamics. To see this, define the work L done by the interconnected dynamical system G over the time interval [t 1 , where [E T (t), V T (t)] T , t ≥ t 0 , is the solution to (14) and (15). Now, premultiplying (14) by e T and using the fact that e T w(E, V)=0, it follows that where ΔU = U(t 2 ) − U(t 1 ) e T E(t 2 ) − e T E(t 1 ) denotes the variation in the total energy of the interconnected system G overthetimeinterval[t 1 , t 2 ] and denotes the net energy received by G in forms other than work. This is a statement of the first law of thermodynamics for the interconnected dynamical system G and gives a precise formulation of the equivalence between work and heat. This establishes that heat and mechanical work are two different aspects of energy. Finally, note that (15) is consistent with the classical thermodynamic equation for the rate of work done by the system G on the environment. To see this, note that (15) can be equivalently written as dL = e T D −1 (E, V)dV, which, for a single subsystem with volume V and pressure p, has the classical form It follows from Definition 3.1 and (14)- (17) that the time derivative of the entropy function satisfieṡ Noting that dQ i [S i − σ ii (E)]dt, i = 1,...,q, is the infinitesimal amount of the net heat received or dissipated by the ith subsystem of G over the infinitesimal time interval dt,i t follows from (22) Inequality (23) is the classical Clausius inequality for the variation of entropy during an infinitesimal irreversible transformation. Note that for an adiabatically isolated interconnected dynamical system (i.e., no heat exchange with the environment), (22) yields the universal inequality which implies that, for any dynamical change in an adiabatically isolated interconnected system G, the entropy of the final system state can never be less than the entropy of the initial system state. In addition, in the case where (E(t), (24) is satisfied as a strict inequality for all (E, V) ∈ (R q + × R q + )\M e . Hence, it follows from Theorem 2.15 of  that the adiabatically isolated interconnected system G does not exhibit Poincarérecurrencein(R q + × R q + )\M e . Next, we define the Gibbs free energy,t h eHelmholtz free energy,a n dt h eenthalpy functions for the interconnected dynamical system G. For this exposition, we assume that the entropy of G is a sum of individual entropies of subsystems of G,thatis,

follows from Definition 3.1 and (22) that inequality
In this case, the Gibbs free energy of G is defined by the Helmholtz free energy of G is defined by and the enthalpy of G is defined by Note that the above definitions for the Gibbs free energy, Helmholtz free energy, and enthalpy are consistent with the classical thermodynamic definitions given by G(E, V)=U + pV − TS, F(E, V)=U − TS,a n dH(E, V)=U + pV, respectively. Furthermore, note that if the interconnected system G is isothermal and isobaric, that is, the temperatures of subsystems of G are equal and remain constant with and the pressure p i (E, V) in each subsystem of G remains constant, respectively, then any transformation in G is reversible. ThetimederivativeofG(E, V) along the trajectories of (14) and (15) is given bẏ which is consistent with classical thermodynamics in the absence of chemical reactions. For an isothermal interconnected dynamical system G, the time derivative of F(E, V) along the trajectories of (14) and (15) is given bẏ where L is the net amount of work done by the subsystems of G on the environment. Furthermore, note that if, in addition, the interconnected system G is isochoric,t h a ti s ,t h e volumesofea choft h esub syst emsofG remain constant, thenḞ(E, V)=0. As we see in the next section, in the presence of chemical reactions the interconnected system G evolves such that the Helmholtz free energy is minimized. Finally, for the isolated (S(t) ≡ 0a n dd(E, V) ≡ 0) interconnected dynamical system G,t h e time derivative of H(E, V) along the trajectories of (14) and (15) is given bẏ

Chemical equilibria, entropy production, and chemical thermodynamics
In its most general form thermodynamics can also involve reacting mixtures and combustion. When a chemical reaction occurs, the bonds within molecules of the reactant are broken, and atoms and electrons rearrange to form products. The thermodynamic analysis of reactive systems can be addressed as an extension of the compartmental thermodynamic model described in Sections 3 and 4. Specifically, in this case the compartments would qualitatively represent different quantities in the same space, and the intercompartmental flows would represent transformation rates in addition to transfer rates. In particular, the compartments would additionally represent quantities of different chemical substances contained within the compartment, and the compartmental flows would additionally characterize transformation rates of reactants into products. In this case, an additional mass balance equation is included for addressing conservation of energy as well as conservation of mass. This additional mass conservation equation would involve the law of mass-action enforcing proportionality between a particular reaction rate and the concentrations of the reactants, and the law of superposition of elementary reactions assuring that the resultant rates for a particular species is the sum of the elementary reaction rates for the species.
In this section, we consider the interconnected dynamical system G where each subsystem represents a substance or species that can exchange energy with other substances as well as undergo chemical reactions with other substances forming products. Thus, the reactants and products of chemical reactions represent subsystems of G with the mechanisms of heat exchange between subsystems remaining the same as delineated in Section 3. Here, for simplicity of exposition, we do not consider work done by the subsystem on the environment nor work done by the environment on the system. This extension can be easily addressed using the formulation in Section 4. To develop a dynamical systems framework for thermodynamics with chemical reaction networks, let q be the total number of species (i.e., reactants and products), that is, the number of subsystems in G,andletX j , j = 1,...,q,denotethejth species. Consider a single chemical reaction described by where A j , B j , j = 1,...,q,arethestoichiometric coefficients and k denotes the reaction rate.N o t e that the values of A j corresponding to the products and the values of B j corresponding to the reactants are zero. For example, for the familiar reaction X 1 , X 2 ,andX 3 denote the species H 2 ,O 2 ,andH 2 O, respectively, and A 1 = 2, A 2 = 1, A 3 = 0, B 1 = 0, B 2 = 0, and B 3 = 2. In general, for a reaction network consisting of r ≥ 1 reactions, the ith reaction is written as where, for i = 1,...,r, k i > 0 is the reaction rate of the ith reaction, ∑ q j=1 A ij X j is the reactant of the ith reaction, and ∑ q j=1 B ij X j is the product of the ith reaction. Each stoichiometric coefficient A ij and B ij is a nonnegative integer. Note that each reaction in the reaction network (34) is represented as being irreversible. 2 Reversible reactions can be modeled by including the reverse reaction as a separate reaction. The reaction network (34) can be written compactly in matrix-vector form as where X =[X 1 ,...,X q ] T is a column vector of species, k =[k 1 ,...,k r ] T ∈ R r + is a positive vector of reaction rates, and A ∈ R r×q and B ∈ R r×q are nonnegative matrices such that A (i,j) = A ij and B (i,j) = B ij , i = 1,...,r, j = 1,...,q. Let n j : [0, ∞) → R + , j = 1,...,q,d e n o t et h emole number of the jth species and define n [n 1 ,...,n q ] T . Invoking the law of mass-action (Steinfeld et al. (1989)), which states that, for an elementary reaction, that is, a reaction in which all of the stoichiometric coefficients of the reactants are one, the rate of reaction is proportional to the product of the concentrations of the reactants, the species quantities change according to the dynamics (Haddad et al. (2010); Chellaboina et al. (2009)) where K diag[k 1 ,...,k r ] ∈ P r and For details regarding the law of mass-action and Equation (36), see Erdi & Toth (1988); Haddad et al. (2010); Steinfeld et al. (1989); Chellaboina et al. (2009). Furthermore, let M j > 0, j = 1,...,q,denotethemolar mass (i.e., the mass of one mole of a substance) of the jth species, let m j : [0, ∞) → R + , j = 1,...,q, denote the mass of the jth species so that m j (t)=M j n j (t), t ≥ t 0 , j = 1,...,q,a n dl e tm [m 1 ,...,m q ] T . Then, using the transformation m(t)=Mn(t), where M diag[M 1 ,...,M q ] ∈ P q , (36) can be rewritten as the mass balance equatioṅ whereK diag In the absence of nuclear reactions, the total mass of the species during each reaction in (35) is conserved. Specifically, consider the ith reaction in (35) given by (34) where the mass of the reactants is ∑ q j=1 A ij M j and the mass of the products is ∑ q j=1 B ij M j . Hence, conservation of mass in the ith reaction is characterized as or, in general for (35), as Note that it follows from (38) and (40) that e Tṁ (t) ≡ 0. Equation (38) characterizes the change in masses of substances in the interconnected dynamical system G due to chemical reactions. In addition to the change of mass due to chemical reactions, each substance can exchange energy with other substances according to the energy flow mechanism described in Section 3; that is, energy flows from substances at a higher temperature to substances at a lower temperature. Furthermore, in the presence of chemical reactions, the exchange of matter affects the change of energy of each substance through the quantity known as the chemical potential.
The notion of the chemical potential was introduced by Gibbs in 1875-1878 (Gibbs (1875;1878)) and goes far beyond the scope of chemistry effecting virtually every process in nature (Baierlein (2001);Fuchs (1996);Job & Herrmann (2006)). The chemical potential has a strong connection with the second law of thermodynamics in that every process in nature evolves from a state of higher chemical potential towards a state of lower chemical potential. It was postulated by Gibbs (1875;1878) that the change in energy of a homogeneous substance is proportional to the change in mass of this substance with the coefficient of proportionality given by the chemical potential of the substance. To elucidate this, assume the jth substance corresponds to the jth compartment and consider the rate of energy change of the jth substance of G in the presence of matter exchange. In this case, it follows from (5) and Gibbs' postulate that the rate of energy change of the jth substance is given bẏ where μ j : R q + × R q + → R, j = 1,...,q, is the chemical potential of the jth substance. It follows from (41) that μ j (·, ·) is the chemical potential of a unit mass of the jth substance. We assume that if E j = 0, then μ j (E, m)=0, j = 1,...,q, which implies that if the energy of the jth substance is zero, then its chemical potential is also zero. Next,using (38) and (41), the energy and mass balance equations for the interconnected dynamical system G can be written aṡ where P(E, m) diag[μ 1 (E, m),...,μ q (E, m)] ∈ R q×q and where w(·), d(·),andS(·) are defined as in Section 3. It follows from Proposition 1 of Chellaboina et al. (2009) that the dynamics of (43) are essentially nonnegative and, since μ j (E, m)=0i fE j = 0, j = 1,...,q, it also follows that, for the isolated dynamical system G (i.e., S(t) ≡ 0a n dd(E) ≡ 0), the dynamics of (42) and (43) are essentially nonnegative. Note that, for the ith reaction in the reaction network (35), the chemical potentials of the reactants and the products are is a restatement of the principle that a chemical reaction evolves from a state of a greater chemical potential to that of a lower chemical potential, which is consistent with the second law of thermodynamics. The difference between the chemical potential of the reactants and the chemical potential of the products is called affinity (DeDonder (1927); DeDonder & Rysselberghe (1936)) and is given by Affinity is a driving force for chemical reactions and is equal to zero at the state of chemical equilibrium. A nonzero affinity implies that the system in not in equilibrium and that chemical reactions will continue to occur until the system reaches an equilibrium characterized by zero affinity. The next assumption provides a general form for the inequalities (44) and (45).
or, equivalently, Note that equality in (46) or, equivalently, in (47) characterizes the state of chemical equilibrium when the chemical potentials of the products and reactants are equal or, equivalently, when the affinity of each reaction is equal to zero. In this case, no reaction occurs andṁ(t)=0, t ≥ t 0 . Next, we characterize the entropy function for the interconnected dynamical system G with the energy and mass balance equations (42) and (43). The definition of entropy for G in the presence of chemical reactions remains the same as in Definition 3.1 with S (E) replaced by S (E, m) and with all other conditions in the definition holding for every m >> 0. Consider the jth subsystem of G and assume that E k and m k , k = j, k = 1,...,q, are constant. In this case, note that and recall that Next, it follows from (49) that the time derivative of the entropy function S (E, m) along the trajectories of (42) and (43) is given bẏ For the isolated system G (i.e., S(t) ≡ 0a n dd(E) ≡ 0), the entropy function of G is a nondecreasing function of time and, using identical arguments as in the proof of Theorem The entropy production in the interconnected system G due to chemical reactions is given by If the interconnected dynamical system G is isothermal, that is, all subsystems of G are at the same temperature where T > 0 is the system temperature, then it follows from Assumption 5.1 that Note that since the affinity of a reaction is equal to zero at the state of a chemical equilibrium, it follows that equality in (53) holds if and only if ν(E, m)=0forsomeE ∈ R q + and m ∈ R q + .
Proof. Since the dynamics of the isolated system G are essentially nonnegative, it follows from Proposition 2.1 that (E(t), m(t)) ∈ R q + × R which implies that the solution (E(t), m(t)), t ≥ t 0 , to (42) and (43) is bounded for all initial conditions (E 0 , m 0 ) ∈ R q + × R q + . Next, consider the functionṽ(E, m)=e T E + e T m −S(E, m), (E, m) ∈ R q + × R q + . Then it follows from (50) and (55) that the time derivative ofṽ(·, ·) along the trajectories of (42) and (43) satisfies˙ṽ (E, m)=e TĖ + e Tṁ −Ṡ (E, m) which implies thatṽ(·, ·) is a nonincreasing function of time, and hence, by the Krasovskii-LaSalle theorem ), (E(t), m(t)) →R {(E, m) ∈ R q + × R q + :v(E, m)=0} as t → ∞. Now, it follows from Definition 3.1, Assumption 5.1, and the fact that rank C = q − 1that which proves the result. Theorem 5.1 implies that the state of the interconnected dynamical system G converges to the state of thermal and chemical equilibrium when the temperatures of all substances of G are equal and the masses of all substances reach a state where all reaction affinities are zero corresponding to a halting of all chemical reactions. Next, we assume that the entropy of the interconnected dynamical system G is a sum of individual entropies of subsystems of G,thatis,S (E, m)=∑ q j=1 S j (E j , m j ), (E, m) ∈ R q + × R q + . In this case, the Helmholtz free energy of G is given by If the interconnected dynamical system G is isothermal, then the derivative of F(·, ·) along the trajectories of (42) and (43) is given bẏ with equality in (59) holding if and only if ν(E, m)=0forsomeE ∈ R q + and m ∈ R q + ,w h ic h determines the state of chemical equilibrium. Hence, the Helmholtz free energy of G evolves to a minimum when the pressure and temperature of each subsystem of G are maintained constant, which is consistent with classical thermodynamics. A similar conclusion can be arrived at for the Gibbs free energy if work energy considerations to and by the system are addressed. Thus, the Gibbs and Helmholtz free energies are a measure of the tendency for a reaction to take place in the interconnected system G, and hence, provide a measure of the work done by the interconnected system G.

Conclusion
In this paper, we developed a system-theoretic perspective for classical thermodynamics and chemical reaction processes. In particular, we developed a nonlinear compartmental