1 Introduction

Modeling of chemical reaction networks has attracted much attention in the last decades due to its wide application in systems biology and chemical engineering. Previous work, such as [8, 14, 15], provides the foundation of a structural theory of isothermal chemical reaction networks governed by mass action kinetics. From then on, a series of papers about the modeling and analysis of mass action kinetics chemical reaction networks appeared (see [1, 16, 29, 35]). In most of these papers, the chemical reaction networks are assumed to take place under isothermal condition. Consequently, the influence of in/outflow of heat can not be taken into account. Hence, non-isothermal chemical reaction networks still pose fundamental challenges.

In this paper, we aim to use the port-Hamiltonian framework for the modeling of non-isothermal mass action kinetics chemical reaction networks. Port-Hamiltonian systems theory (PHS) has been intensively employed in the modeling and passivity-based control of electrical, mechanical and electromechanical systems (see [20, 30, 31]).

In [32, 33], a port-Hamiltonian formulation of isothermal mass action kinetics chemical reaction networks was provided. A first step to non-isothermal chemical reaction networks was taken in [36]. Here, based on the previous works [5, 7, 24, 25], a quasi port-Hamiltonian formulation for non-isothermal chemical reaction networks was developed.

The main contributions of the present paper are as follows. First, based on mass and energy balance equations, a port-Hamiltonian formulation for non-isothermal mass action kinetics chemical reaction networks which are detailed-balanced is developed. This formulation directly extends the port-Hamiltonian formulation of isothermal chemical reaction networks of [32, 33], in contrast with the quasi port-Hamiltonian formulation in [36]. It exhibits the energy balance and the thermodynamic principles in an explicit way. Based on the obtained port-Hamiltonian formulation, we provide a thermodynamic analysis of the existence and characterization of thermodynamic equilibria and their asymptotic stability. Being directly related with the energy and entropy functions, this port-Hamiltonian formulation is easily applicable to chemical and biological systems. The second contribution of this paper is the extension of the port-Hamiltonian formulation and the thermodynamic analysis to non-isothermal chemical reaction networks with external ports.

The structure of the paper is as follows. In Sect. 2, some notation will be introduced which will be used in the remainder of the paper. Section 3 surveys the main elements of non-isothermal chemical reaction networks. Section 4 develops the port-Hamiltonian formulation of non-isothermal chemical reaction networks, and shows how this formulation is in line with the main laws of thermodynamics. In Sect. 5, a thermodynamic analysis will be carried out, including the characterization of equilibria and their asymptotic stability. In Sect. 6, an example—a genetic protein synthesis circuit with internal feedback and cell-to-cell communication—is discussed as an illustration of the developed theory. Section 7 extends the previous results to non-isothermal chemical reaction networks with external ports.

2 Notation

\(\mathbb {R}^m\) denotes the space of m-dimensional real vectors, and \(\mathbb {R}^m_+\) the space of m-dimensional real vectors whose entries are all strictly positive. The element-wise natural logarithm \(\mathrm {Ln}:\mathbb {R}^m_+\rightarrow \mathbb {R}^m\), \(x\mapsto \mathrm {Ln}(x)\), is defined as the mapping whose ith component is given as \((\mathrm {Ln}(x))_i := \ln (x_i)\). Similarly, \(\mathrm {Exp}:\mathbb {R}^m_+\rightarrow \mathbb {R}^m\), \(x\mapsto \mathrm {Exp}(x)\), is the mapping whose ith component is given as \((\mathrm {Exp}(x))_i := \exp (x_i)\). Note that \(\mathrm {Exp}(x+z)=\mathrm {Exp}(x)\mathrm {Exp}(z)\), \(\mathrm {Ln}(xz)=\mathrm {Ln}(x)+\mathrm {Ln}(z)\), and \(\mathrm {Ln}(\frac{x}{z})=\mathrm {Ln}(x)-\mathrm {Ln}(z)\), where \(xz\in \mathbb {R}^m\) is the element-wise product \((xz)_i:=x_iz_i\), \(i=1,\dots ,m\), and \(\frac{x}{z}\in \mathbb {R}^m\) is the element-wise quotient \((\frac{x}{z})_i=\frac{x_i}{z_i}\), \(i=1,\dots ,m\). Also, we define the mapping \(\mathrm {Diag}:\mathbb {R}^m\rightarrow \mathbb {R}^{m\times m}\), \(v\mapsto \mathrm {Diag}(v)\), where \(\mathrm {Diag}(v)\) is the diagonal matrix with \((\mathrm {Diag}(v))_{ii}=v_i\). Finally, the \(i\times i\) identity matrix is denoted as \(\mathrm {I}_i\), the \(i\times i\) zero matrix is denoted as \(\mathbf {0}_{i\times i}\), while the \(i\times 1\) zero vector is denoted as \(\mathbf {0}_i\). The notation \(z^{tr}\) is used to denote the transpose of the vector z.

3 The chemical reaction network structure

In this section, we will survey the basic topological structure of chemical reaction networks which will be used in the following sections. Consider a chemical reaction network composed of r reactions, m species and c complexes, given by the following reversible reaction scheme:

$$\begin{aligned} \sum _{i=1}^{m}\alpha _{ij}A_{i}\overset{j}{\rightleftharpoons }\sum _{i=1}^{m}\beta _{ij}A_{i}, \quad j=1, \ldots , r \end{aligned}$$
(1)

with \(\alpha _{ij}\), \(\beta _{ij}\) being stoichiometric coefficients. The graph-theoretic formulation, according to [9, 11, 15], is to consider the chemical complexes defined by the left-hand and the right-hand sides of the chemical reactions, and to associate to each complex a vertex of a graph, while each reaction from left-hand to right-hand complex corresponds to a directed edge.

The concentrations of the species are denoted as \(x_i\), \(i=1,\dots ,m\), and the total vector of concentrations is denoted as \(x=[x_1,\dots ,x_m]^{tr}\). In order to capture the basic conservation laws of the chemical reactions, we define an \(m\times r\) matrix C, known as the stoichiometric matrix, whose (ij)th element is the signed stoichiometric coefficient of the ith species in the jth reaction. Similarly, to define the connection between the complexes of each chemical reaction, we define an \(m\times c\) matrix Z, called the complex stoichiometric matrix, whose \(\rho \)th column captures the expression of the \(\rho \)th complex in the ith chemical species. Any directed graph is characterized by an \(c\times r\) matrix B, called the incidence matrix, whose (ij)th element equals to \(-1\) if vertex i is the tail vertex of edge j and 1 if vertex i is the head vertex of edge j , while 0 otherwise. The relation between these three matrices for the graph of complexes is \(C=ZB\).

The dynamics of the chemical reaction network can now be written as

$$\begin{aligned} \dot{x}=Cv=ZBv, \end{aligned}$$
(2)

where v is the r-dimensional vector of reaction rates, whose jth element represents the jth reaction rate of the chemical reaction network. Each reaction is considered to be a combination of a forward reaction with forward rate equation and a reverse reaction with reverse rate equation, both given by mass action kinetics. Thus, the reaction rate of the jth reaction can be written as

$$\begin{aligned} v_j(x,T)=k_j^f(T)\prod _{i=1}^{m}x_i^{Z_{iSj}}-k_j^b(T)\prod _{i=1}^{m}x_i^{Z_{iPj}} \end{aligned}$$
(3)

where \(Z_i\rho \) is the \((i,\rho )\)th element of the complex stoichiometric matrix Z. Here, \(k_{j}^{f}(T)\), \(k_{j}^{b}(T)\) are the forward/backward rate reaction coefficients of the jth reaction defined by the Arrhenius equation ([4])

$$\begin{aligned} k_{j}^{f}(T)= & {} k_j^f\exp \left( -\frac{E^f_j}{RT}\right) \end{aligned}$$
(4)
$$\begin{aligned} k_{j}^{b}(T)= & {} k_j^b\exp \left( -\frac{E^b_j}{RT}\right) , \end{aligned}$$
(5)

where \(E_j^f\), \(E_j^b\) are the activation energies, \(k_j^f\) and \(k_j^b\) the forward and backward rate constants, and R is the Boltzmann constant. Using the element-wise natural logarithm \(\mathrm {Ln}(x)\) defined in Sect. 2, the jth element of rate equation vector can be equivalently written as

$$\begin{aligned} v_j(x,T)=k_{j}^{f}(T)\exp \left( Z^{tr}_{S_j}\mathrm {Ln}(x)\right) -k_{j}^{b}(T)\exp \left( Z^{tr}_{P_j}\mathrm {Ln}(x)\right) \end{aligned}$$
(6)

where \(Z_{S_j}\) and \(Z_{P_j}\) denote the columns of the complex stoichiometry matrix Z corresponding to the substrate complex \(S_j\) and the product complex \(P_j\) of the jth reaction.

4 The standard form of balanced mass action and balanced energy action for non-isothermal chemical reaction networks

In this paper, we will focus on detailed balanced mass action kinetics chemical reaction networks (see [10, 28, 34]). First, we assume that in the chemical reaction network, the equilibration following any reaction event is much faster that any reaction time scale. Thus, all intensive thermodynamic variables are well defined and equal everywhere in the system. Then, we assume that the chemical reaction network is closed and undergoes an adiabatic process. That means there is no heat or mass transfer between the system and external environment. Moreover, the chemical reaction network is isochoric so that the volume change can be neglected, i.e. \(dV=0\).

The definition of thermodynamic equilibrium for isothermal chemical reaction networks, see e.g. [32], is extended to non-isothermal networks as follows.

Definition 4.1

A vector of concentrations \(x^*\) is called an equilibrium for the dynamics \(\dot{x}=Cv(x,T)\) for a certain temperature T if \(Cv(x^*,T)=0\), and a thermodynamic equilibrium if \(v(x^*,T)=0\). A chemical reaction network \(\dot{x}=Cv(x,T)\) is called detailed-balanced if it admits a thermodynamic equilibrium for every temperature T.

In order to stress the dependence on T, the thermodynamical equilibrium will be denoted by \(x^*(T)\). The conditions for existence of a thermodynamic equilibrium will be discussed in Sect. 5.1. Throughout this section we assume that there exists at least one thermodynamic equilibrium, like in the isothermal case, see e.g. [32, 33]. We will use the existence of this thermodynamic equilibrium to develop a port-Hamiltonian formulation.

4.1 Mass balance equations

Let us recall the mass balance equations of a detailed balanced reaction network according to [32]. Let \(x^*(T)\in \mathbb {R}^m_+\) be a thermodynamic equilibrium for a certain temperature T, i.e.,

$$\begin{aligned} v(x^*(T),T)=0 \end{aligned}$$
(7)

Then we define the conductance \(\kappa _j(T)\) of the jth reaction as:

$$\begin{aligned} \kappa _j(T):=k_{j}^{f}\mathrm {Exp}\left( Z_{S_{j}}^{tr}\ln (x^*(T))-\frac{E_{j}^{f}}{RT}\right) =k_{j}^{b}\mathrm {Exp}\left( Z_{P_{j}}^{tr}\ln (x^*(T))-\frac{E_{j}^{b}}{RT}\right) \end{aligned}$$
(8)

Furthermore the reaction rate of the jth chemical reaction (6) can be rewritten as

$$\begin{aligned} v_j(x,T)=\kappa _j(T)\left[ \exp \left( Z^{tr}_{S_j}\mathrm {Ln}\left( \frac{x}{x^*(T)}\right) \right) -\exp \left( Z^{tr}_{P_j}\mathrm {Ln}\left( \frac{x}{x^*(T)}\right) \right) \right] \end{aligned}$$
(9)

Now define the \(r\times r\) diagonal matrix of conductances K(T) as

$$\begin{aligned} K(T):=\mathrm {diag}(\kappa _1(T),\dots ,\kappa _r(T)) \end{aligned}$$
(10)

Collecting all the reaction rates in (9) and employing the incidence matrix B defined in Sect. 3, the rate vector of a detailed balanced non-isothermal reaction network can be written as

$$\begin{aligned} v(x,T)=-K(T)B^{tr}\mathrm {Exp}\left( Z^{tr}\mathrm {Ln}\left( \frac{x}{x^*(T)}\right) \right) \end{aligned}$$
(11)

Hence the dynamics of a detailed balanced mass action kinetics reaction network can be expanded as

$$\begin{aligned} \begin{array}{ll} \dot{x}&{}=Cv(x,T)\\ &{}=-ZBK(T)B^{tr}\mathrm {Exp}\left( Z^{tr}\mathrm {Ln}\left( \frac{x}{x^*(T)}\right) \right) \\ &{}=-ZBK(T)B^{tr}\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ &{}=-ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{array} \end{aligned}$$
(12)

where \(\mu =RT\mathrm {Ln}(\frac{x}{x^*(T)})\) is the vector of chemical potentials and \(L:=BK(T)B^{tr}\) is the weighted Laplacian matrix for the reaction network graph, with weights given by the conductances \(\kappa _1(T),\dots ,\kappa _r(T)\).

Note that the value of the conductances \(\kappa _1(T),\dots ,\kappa _r(T)\) is not only dependent on the temperature T, but also on the choice of the thermodynamic equilibrium \(x^*(T)\). However, if the reaction network graph is connected, then for any other thermodynamical equilibrium \(x^{**}(T)\) for the same temperature T, there exists a positive constant d such that

$$\begin{aligned} K(x^{**}(T),T)= & {} dK(x^*(T),T) \end{aligned}$$
(13)
$$\begin{aligned} \mathrm {Exp}\left( Z^{tr}\mathrm {Ln}\left( \frac{x}{x^{**}(T)}\right) \right)= & {} \frac{1}{d}\mathrm {Exp}\left( Z^{tr}\mathrm {Ln}\left( \frac{x}{x^*(T)}\right) \right) \end{aligned}$$
(14)

This property of the matrix K has been proved in [32]. It implies that the dependence on \(x^*(T)\) is minor; choosing another thermodynamical equilibrium only involves a uniform scaling of K, and thus of L. Another well-known property of L is the fact that the matrix L is independent of the orientation of the graph [2].

4.2 Energy balance equations

In this section we will express the energy conservation for a closed chemical reaction network in order to encompass the thermodynamic properties of the system.

Assuming that in the system the variation of the volume may be neglected, i.e. \(dV=0\), Gibbs’ relation reduces to

$$\begin{aligned} dU=\mu ^{tr}dx+TdS \end{aligned}$$
(15)

where U denotes the internal energy, S the entropy, and the conjugated intensive variables are the chemical potential \(\frac{\partial U}{\partial x}=\mu \) and the temperature \(\frac{\partial U}{\partial S}=T\). This implies

$$\begin{aligned} \frac{dU}{dt}=\mu ^{tr}\frac{dx}{dt}+T\frac{dS}{dt} \end{aligned}$$
(16)

Using the Eq. (12), the first term on the right-hand side of (16) also equals

$$\begin{aligned} \mu ^{tr}\frac{dx}{dt}=-\,\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{aligned}$$
(17)

Since the system is considered to be isolated, the energy balance equation is

$$\begin{aligned} \frac{dU}{dt}=0 \end{aligned}$$
(18)

This implies that the second term in (17) equals

$$\begin{aligned} T\frac{dS}{dt}=\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{aligned}$$
(19)

In the next section we will combine these equations with (12) in order to derive a port-Hamiltonian formulation of non-isothermal and isolated reaction networks.

4.3 Port-Hamiltonian formulation

In this section, we show how Sects. 4.1 and 4.2 can be combined into a port-Hamiltonian formulation of the dynamics of detailed-balanced chemical reaction networks. Firstly, we define the state vector \(z=[\begin{array}{cc}x^{tr}&U\end{array}]^{tr}=\left[ \begin{array}{llll}x_{1}&\cdots&x_{m}&U\end{array}\right] ^{tr}\), where x is the vector of concentrations and U the internal energy. Then we define the Hamiltonian function \(H=-S\), where S is the entropy. Note that the Gibbs’ relation (15) can also be written in the entropy formulation

$$\begin{aligned} dS=\sum ^m_{i=1}\left( \frac{dS}{dx_i}\right) ^{tr}dx_i+\frac{dS}{dU}dU, \end{aligned}$$

where \(\frac{dS}{dx_i}=-\frac{\mu _i}{T}\) and \(\frac{dS}{dU}=\frac{1}{T}\) are the intensive thermodynamic variables conjugated to \(x_i\) and the internal energy U. This implies that the co-state vector corresponding to \(H=-S\) is

$$\begin{aligned} \frac{\partial H}{\partial z}=\frac{\partial (-S)}{\partial z}=\left[ \begin{array}{llll}\frac{\mu _{1}}{T}&\cdots&\frac{\mu _{m}}{T}&-\frac{1}{T}\end{array}\right] ^{tr} \end{aligned}$$
(20)

Note that \(\mu \) and T can be expressed as function of the components of this co-state vector. Now define the skew-symmetric matrix

$$\begin{aligned} \mathcal {J}\left( \frac{\partial H}{\partial z}(z)\right) :=\left[ \begin{array}{cc} \begin{array}{lll} 0 &{} \quad \cdots &{} \quad 0\\ \vdots &{} \quad \ddots &{} \quad \vdots \\ 0 &{} \quad \cdots \quad &{} \quad 0 \end{array} &{} TZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ -T\left( ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \right) ^{tr}&{} \quad 0 \end{array}\right] \end{aligned}$$
(21)

and the symmetric matrix

$$\begin{aligned} \mathcal {R}\left( \frac{\partial H}{\partial z}(z)\right) :=\left[ \begin{array}{cc} \begin{array}{lll} 0 &{} \quad \cdots &{} \quad 0\\ \vdots &{} \quad \ddots &{} \quad \vdots \\ 0 &{} \quad \cdots &{} \quad 0 \end{array} &{} \mathbf {0}_m\\ (\mathbf {0}_m)^{tr} &{}\quad T\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{array}\right] \end{aligned}$$
(22)

It follows that the dynamics of the non-isothermal mass action kinetics chemical reaction network (1) given by the mass balance equation (12) and the energy balance equation (18), can be written into quasi port-Hamiltonian form

$$\begin{aligned} \dot{z}=\left( \mathcal {J}\left( \frac{\partial H}{\partial z}(z)\right) -\mathcal {R}\left( \frac{\partial H}{\partial z}(z)\right) \right) \frac{\partial H}{\partial z}(z) \end{aligned}$$
(23)

As we will see in Sect. 4.4, \(T\mu ^{tr}ZL\mathrm {Exp}(\frac{Z^{tr}\mu }{RT})\ge 0\) and thus R is positive semi-definite. The formulation (23) is called ’quasi port-Hamiltonian’, since the structure matrices \(\mathcal {J}\) and \(\mathcal {R}\) depend on the co-state variables \(\frac{\partial H}{\partial z}=\frac{\partial (-S)}{\partial z}=\left[ \begin{array}{llll}\frac{\mu _{1}}{T}&\cdots&\frac{\mu _{m}}{T}&-\frac{1}{T}\end{array}\right] ^{tr}\), instead of on the state variables \(\left[ \begin{array}{llll}x_{1}&\cdots&x_{m}&U\end{array}\right] ^{tr}\) as in a standard port-Hamiltonian formulation. This formulation is comparable to the formulation of the mass balance and energy balance equations such as GENERIC, suggested in [18], or the port-Hamiltonian formulation with generating function being the availability function derived from the entropy function in [12].

4.4 Entropy balance equation

In this section, we shall relate the positive semi-definiteness of the dissipation matrix \(\mathcal {R}\) in (22) with the second law of thermodynamics. With this in mind let us compute the time-derivative of the entropy S

$$\begin{aligned} \begin{array}{ll} \frac{dS}{dt}&{}=\frac{\partial ^{tr} S(z)}{\partial z}\dot{z}\\ &{}=\left[ -\frac{\mu ^{tr}}{T} \frac{1}{T}\right] \left[ \begin{array}{cc} \mathbf {0}_{m\times m}&{} \quad TZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ -T\left( ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \right) ^{tr}&{} \quad -T\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ \end{array} \right] \left[ \begin{array}{c}\frac{\mu }{T}\\ frac{1}{T} \end{array}\right] \\ &{}=\frac{1}{T}\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ \end{array} \end{aligned}$$
(24)

Denote \(\gamma =\frac{Z^{tr}\mu }{RT}\). It has been shown in [28] (using the properties of the Laplacian matrix L) that for any \(\gamma \in \mathbb {R}^c\)

$$\begin{aligned} \gamma ^{tr}L\mathrm {Exp}(\gamma )\ge 0, \end{aligned}$$
(25)

while \(\gamma ^{tr}L\mathrm {Exp}(\gamma )=0\) if and only if \(B^{tr}\gamma =0\). Hence, the entropy balance equation becomes

$$\begin{aligned} \frac{dS}{dt}=R\gamma ^{tr}L\mathrm {Exp}(\gamma )=:\sigma \ge 0 \end{aligned}$$
(26)

Here \(\sigma \) is the irreversible entropy source term. Note that in Eq. (26), the time-derivative of the entropy S is deduced from the port-Hamiltonian formulation (23) defined in Sect. 4.3. It is consistent with Eq. (19), which is deduced from the Gibbs’ relation.

Furthermore, note that the positivity of the irreversible entropy source term is equivalent to the positive semi-definiteness of the dissipation matrix \(\mathcal {R}\) in (22). Indeed the only non-zero term of \(\mathcal {R}\) is the \((m+1,m+1)\)th element, denoted as \(\mathcal {R}_{m+1,m+1}\), which is related to the entropy source term as

$$\begin{aligned} \mathcal {R}_{m+1,m+1}=\sigma T^2 \end{aligned}$$
(27)

In summary, the quasi port-Hamiltonian representation of chemical reaction networks given in (21), (22) and (23) represents the mass and energy balance equations. Moreover from its structure, it implies the entropy balance equation. It differs from the expression of energy and entropy balance equations in [23], which are expressed for the non-equilibrium biochemical systems and in [27], where the free energy and entropy balance are considered in an isothermal case when the species are diluted in a solvent, which acts as a thermal bath, while the pressure P is set by the environment. It differs from the quasi port-Hamiltonian representation of the mass and entropy balance equations of chemical reaction networks in [26, 36], by the fact that it is based on the energy balance equation instead of on the entropy balance equation. Note that the description based on the energy balance equation is classical [6], and more easily derived than the description based on the entropy balance equation. Moreover, the quasi-port-Hamiltonian formulation given in (21), (22) and (23) fundamentally differs from the representation of chemical reaction networks as port Hamiltonian systems in [21] as well, by the fact that this quasi port-Hamiltonian representation is established on the whole space of concentration vectors instead of only locally around an equilibrium point, as in [21].

Finally the quasi port-Hamiltonian directly extends the port-Hamiltonian formulation of isothermal chemical reaction networks obtained in [32, 33] by including the energy balance equation.

5 Thermodynamic equilibria and asymptotic stability

The discussion in Sect. 4 is based on the assumption of existence of a thermodynamic equilibrium. Starting from the definition of a thermodynamic equilibrium of non-isothermal chemical reaction networks, we will derive in this section a full characterization of the set of equilibria, analogous to the case of isothermal chemical reaction networks in [32].

Subsequently, for stability analysis, we will use Lyapunov function as an availability function which is directly based on the quasi port-Hamiltonian representation given in (21), (22) and (23). Note that the use of availability functions for stability analysis is classical, see e.g. [12, 13, 19].

5.1 Thermodynamic equilibria

In this section, the existence of a thermodynamic equilibrium will be derived in the following linear-algebraic way [10]. Recall the definition of a thermodynamic equilibrium for non-isothermal chemical reaction networks from Sect. 4. Let \(z^{*}\) be a thermodynamic equilibrium under a certain temperature T, i.e., \(v(z^*)=0\). This implies that for any \(j=1,\dots ,r\),

$$\begin{aligned} k_j^f\exp \left( -\frac{E_j^f}{RT}\right) \exp \left( Z^{tr}_{Sj}\mathrm {Ln}(x^*)\right) -k_j^b\exp \left( -\frac{E_j^b}{RT}\right) \exp (Z^{tr}_{Pj}\mathrm {Ln}(x^*))=0 \end{aligned}$$

or equivalently

$$\begin{aligned} k_j^f\exp \left( -\frac{E_j^f}{RT}\right) \exp \left( Z^{tr}_{Sj}\mathrm {Ln}(x^*)\right) =k_j^b\exp \left( -\frac{E_j^b}{RT}\right) \exp \left( Z^{tr}_{Pj}\mathrm {Ln}(x^*)\right) \end{aligned}$$

These equations are referred to as the detailed-balance equations. Denote \(K_j^{eq}(T)=\frac{k_j^f}{k_j^b}\exp (\frac{E_j^b-E_j^f}{RT})\),

$$\begin{aligned} K_j^{eq}(T)=\frac{k_j^f}{k_j^b}\exp \left( \frac{E_j^b-E_j^f}{RT}\right) =\exp \left( Z^{tr}_{Pj}\mathrm {Ln}(x^*)-Z^{tr}_{Pj}\mathrm {Ln}(x^*)\right) \end{aligned}$$

Collecting all chemical reactions from 1 to r, and making use of the incidence matrix B, we obtain the following condition for a thermodynamical equilibrium \(x^*(T)\)

$$\begin{aligned} K^{eq}(T)=\mathrm {Exp}(B^{tr}Z^{tr}\mathrm {Ln}(x^*(T)))=\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^*(T))) \end{aligned}$$
(28)

where \(K^{eq}\) is the r-dimensional vector with jth element \(K_j^{eq}\), which is dependent on the temperature T. Therefore, for a given temperature T, there exists a thermodynamic equilibrium \(x^*(T)\in \mathbb {R}^m_+\) if and only if \(k_j^f>0\), \(k_j^b>0\) for all \(j=1,\dots ,r\), and

$$\begin{aligned} \mathrm {Ln}(K^{eq}(T))\in \mathrm {im}\,C^{tr} \end{aligned}$$

In general, the equilibrium concentration \(x^*(T)\) may not be unique. Let \(x^{**}(T)\) be another thermodynamic equilibrium for the same temperature T. Then

$$\begin{aligned} K^{eq}(T)=\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^{**}))=\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^*)) \end{aligned}$$
(29)

That is to say, for a certain temperature T, once one thermodynamic equilibrium \(x^*(T)\) is given, the whole set of thermodynamic equilibria at the same temperature T can be found. Furthermore, since \(dU=0\), we have \(U^*=U^{**}\). Denote \(z^{*}=(x^{*}(T), U^{*})\) and \(z^{**}(T)=(x^{**}(T), U^{**})\), then it follows that the set of thermodynamic equilibria at the same temperature T can be written as

$$\begin{aligned} {\varSigma }_{T}=\left\{ z^{**}=(x^{**}(T), U^{**})\vert C^{tr}\mathrm {Ln}(x^{**}(T))=C^{tr}\mathrm {Ln}(x^{*}(T)), U^*=U^{**}\right\} \end{aligned}$$
(30)

This directly extends the classical result for isothermal chemical reaction networks, see e.g. [32]. Note that the value of the terms \(\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^*))\) depend on temperature T, while the relation \(\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^{**}))=\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^*))\) is not dependent on temperature T.

Since \(K^{eq}(T)=\mathrm {Exp}(C^{tr}\mathrm {Ln}(x^{*}))\) as a function of T is monotone and injective, it follows that the set of thermodynamic equilibria \({\varSigma }_{T_1}\) is disjoint from \({\varSigma }_{T_2}\), i.e., \({\varSigma }_{T_1}\cap {\varSigma }_{T_2}=\emptyset \) for any \(T_1\ne T_2\).

5.2 Asymptotic stability

For isothermal chemical reaction networks, it was shown in [15, 32, 33], that the Gibbs’ free energy can be used as a Lyapunov function for proving asymptotic stability towards a unique equilibrium depending on the initial condition. In this section we aim at proving a similar result for the non-isothermal case based on the port-Hamiltonian formulation obtained in the previous section, employing the availability function. Note that this is different from [24, 36], where an energy-based availability function was employed.

We define the entropy based availability function as

$$\begin{aligned} A(z):=-S(z)+S(z^{o})+\frac{\partial ^{tr}S}{\partial z}(z^{o})(z-z^{o}) \end{aligned}$$
(31)

where \(z^o\) is a reference point taken as a thermodynamic equilibrium, cf. Sect. 4.

Theorem 5.1

Consider a detailed balanced chemical reaction network given by (21), (22) and (23), with \(A:\mathbb {R}^{m+1}_+\rightarrow \mathbb {R}\) given by (31). Then A has a strict minimum at \(z^o\) with \(A(z^o)=0\), while the time-derivative \(\frac{dA}{dt}\) is less than or equal to zero with equality only at \(z^o\).

Proof

For homogeneous mixtures, the entropy function is necessarily concave [3]. Moreover, the entropy is strict concave if at least one global extensive property (such as volume, total mass, or total mole number) is fixed [17]. Recall the assumption that the chemical reaction network is isochoric, i.e. \(dV=0\), so the entropy is strict concave and A has a strict minimum at \(z^o\). Moreover, the time derivative of A(z) is given as

$$\begin{aligned} \begin{array}{ll} \frac{dA}{dt}&{}=\frac{\partial A}{\partial z}(z)\dot{z}\\ &{}=-\left( \frac{dS}{dz}(z)-\frac{dS}{dz}(z^{o})\right) ^{tr}\frac{dz}{dt}\\ &{}=-\left[ \begin{array}{cc}\frac{(\mu ^o)^{tr}}{T^o}-\frac{(\mu )^{tr}}{T}&{} \quad \frac{1}{T}-\frac{1}{T^o}\\ \end{array}\right] \\ &{}\quad \times \left[ \begin{array}{cc} \mathbf {0}_{m\times m}&{}\quad TZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ -T\left( ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \right) ^{tr}&{}\quad -T\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ \end{array} \right] \left[ \begin{array}{c} \frac{\mu }{T}\\ -\frac{1}{T}\\ \end{array}\right] \\ &{}=-\left( \frac{\mu ^{tr}Z}{T}-\frac{(\mu ^o)^{tr}Z}{T^o}\right) L\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ &{}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )+R(\gamma ^{o})^{tr}L\mathrm {Exp}(\gamma )\\ \end{array} \end{aligned}$$
(32)

where \(\mu =RT\mathrm {Ln}\frac{x}{x^*}\) is the vector of chemical potentials, \(\mu ^o=RT^o\mathrm {Ln}\frac{x^o}{x^*}\), \(\gamma =\frac{Z^{tr}\mu }{RT}=Z^{tr}\mathrm {Ln}\frac{x}{x^*}\) and \(\gamma ^o=\frac{Z^{tr}\mu ^o}{RT^o}=Z^{tr}\mathrm {Ln}\frac{x^o}{x^*}\). Since \(x^*\) and \(x^o\) are both thermodynamic equilibria, we obtain from Eq. (29)

$$\begin{aligned}&C^{tr}\mathrm {Ln}(x^{o})=C^{tr}\mathrm {Ln}(x^{*})\\&\quad \Rightarrow C^{tr}\mathrm {Ln}\left( \frac{x^o}{x^*}\right) =(ZB)^{tr}\mathrm {Ln}\left( \frac{x^o}{x^*}\right) =\mathbf {0}_c\\&\quad \Rightarrow B^{tr}\left( Z^{tr}\mathrm {Ln}\left( \frac{x^o}{x^*}\right) \right) =B^{tr}\gamma ^o=\mathbf {0}_c \end{aligned}$$

Recall [28] that since L is a balanced weighted Laplacian matrix, for any \(\gamma \in R^c\), we have \(\gamma ^{tr}L\mathrm {Exp}(\gamma )\ge 0\), while \(\gamma ^{tr}L\mathrm {Exp}(\gamma )=0\) if and only if \(B^{tr}\gamma =0\). Hence

$$\begin{aligned} (\gamma ^o)^{tr}L\mathrm {Exp}(\gamma ^o)=0 \end{aligned}$$

Therefore the time derivative of A(z) satisfies

$$\begin{aligned} \frac{dA}{dt}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )\le 0\quad \end{aligned}$$

\(\square \)

Let the system converge to a point denoted as

$$\begin{aligned} z^*\in {\varSigma }_{T^*} \end{aligned}$$

and denote the equilibrium temperature associated with the equilibrium point \(z^*\) by \(T^*\). We know that at equilibrium the entropy is maximal, implying that

$$\begin{aligned} \frac{dS}{dt}\bigg |_{z=z^*}=0 \end{aligned}$$

This is a classical statement in Chemical Engineering, and is comparable with the statement in [27], where for isothermal systems the Gibbs’ free energy is minimized. According to Eq. (26), we have

$$\begin{aligned} \sigma \vert _{z=z^*}=0 \end{aligned}$$
(33)

and for an isolated system we have

$$\begin{aligned} dU=0 \end{aligned}$$
(34)

By using the Eqs. (33) and (34), the equilibrium point \(z^*\) and \(T^*\) can be determined. Then, by using a similar argument as in [11, 32] , the following theorem will imply the asymptotic stability towards the set \({\varSigma }_{T^*}\).

Theorem 5.2

Consider the detailed-balanced chemical reaction network (21), (22) and (23) with \(T\in \mathbb {R}_+\). Then for any \(x_1\in \mathbb {R}^{m+1}_+\), \(T_1\in \mathbb {R}_+\), there exists a unique \(x^*\in \mathbb {R}^{m+1}_+\) and \(T^*\in \mathbb {R}_+\), such that \(x^*-x_1\in \mathrm {im}\,C\), and \(z^*=(x^*,U^*(x^*,T^*))\in {\varSigma }_{T^*}\).

Proof

Let \(W=\mathrm {im}\,C\). Then \(W^\perp =\mathrm {ker}\,C^{tr}\). Let \(z_1(x_1,T_1),z^{**}(x^{**},T^*)\in \mathbb {R}^{m+1}_+\), where \(z^{**}(x^{**},T^*)\in {\varSigma }_{T^*}\) is a thermodynamic equilibrium for temperature \(T^*\). As proved in [11, 32], there exists a unique \(\beta \in \mathrm {ker}\,C^{tr}\) such that \(x^{**}\mathrm {Exp}(\beta )-x_1\in \mathrm {im}\,C\). Define \(z^*(x^*,T^*)\in \mathbb {R}^{m+1}_+\) with \(x^*=x^{**}\mathrm {Exp}(\beta )\). Clearly, \(C^{tr}\beta =C^{tr}\mathrm {Ln}(\frac{x^*}{x^{**}})=0\), which is in line with (29) so that \(z^*(x^*,T^*)\in {\varSigma }_{T^*}\). Moreover, we have \(x^*-x_1=x^{**}\mathrm {Exp}\beta -x_1\in \mathrm {im}\,C\).

Combining with Theorem 4.1, this implies that the equilibrium \(z^*\) is asymptotically stable with respect to all initial conditions in near \(z^*\). Hence the asymptotic stability of the quasi port-Hamiltonian system defined by (21), (22) and (23) is proved. \(\square \)

6 Example: a genetic circuit with internal feedback and cell-to-cell communication

The approach of the previous section will be illustrated on a chemical reaction network, taking place in a very common protein synthesis circuit in the cell of E. Coli in the large intestine of human beings [22]. When the cell of E.Coli receives a ’message’ from the environment (a kind of transcription process from extracellular space into the E. Coli cell), three chemical reactions will take place at the intercellular level:

$$\begin{aligned}&\mathrm {LuxR+AHL\rightleftharpoons LuxR-AHL}\\&\quad \mathrm {2(LuxR-AHL)\rightleftharpoons (LuxR-AHL)_2}\\&\quad \mathrm {(LuxR-AHL)_2+DNA\rightleftharpoons DNA-(LuxR-AHL)_2} \end{aligned}$$

When the chemical reaction network reaches an equilibrium state, the cell will send out a ‘message’ to the environment (a reversed transcription process). This is a very efficient gene circuit for adjustment of the concentrations on different kind of protein in the E. Coli cell, with internal feedback and cell-to-cell communication.

6.1 Modeling

Let us denote the concentration of the species \(\mathrm {LuxR}\), \(\mathrm {AHL}\), \(\mathrm {LuxR-AHL}\), \(\mathrm {(LuxR-AHL)_2}\), \(\mathrm {DNA}\) and \(\mathrm {DNA-(LuxR-AHL)_2}\) as \(x_1, \dots , x_6\). Hence, the state vector is defined as \(z=[x_1, \dots , x_6, U]^{tr}\) and the gradient vector of Hamiltonian function \(-S\) is given as \(\frac{d(-S)}{dz}=[\frac{\mu _1}{T}, \dots , \frac{\mu _6}{T}, \frac{1}{T}]^{tr}\). With \(m=6\), \(r=3\) and \(c=5\), the stoichiometric matrix \(C\in \mathbb {R}^{6\times 3}\) is written as

$$\begin{aligned} C=\left[ \begin{array}{ccc} -1&{} \quad 0&{} \quad 0\\ -1&{} \quad 0&{} \quad 0\\ 1&{} \quad -2&{} \quad 0\\ 0&{} \quad 1&{} \quad -1\\ 0&{} \quad 0&{} \quad -1\\ 0&{} \quad 0&{} \quad 1\\ \end{array}\right] \end{aligned}$$

The complex stoichiometric matrix \(Z\in \mathbb {R}^{6\times 5}\) becomes

$$\begin{aligned} Z=\left[ \begin{array}{ccccc} 1&{} \quad 0&{} \quad 0&{} \quad 0&{} \quad 0\\ 1&{} \quad 0&{} \quad 0&{} \quad 0&{} \quad 0\\ 0&{} \quad 1&{} \quad 0&{} \quad 0&{} \quad 0\\ 0&{} \quad 0&{} \quad 1&{} \quad 1&{} \quad 0\\ 0&{} \quad 0&{} \quad 0&{} \quad 1&{} \quad 0\\ 0&{} \quad 0&{} \quad 0&{} \quad 0&{} \quad 1\\ \end{array}\right] \end{aligned}$$

and the incidence matrix \(B\in \mathbb {R}^{5\times 3}\) is

$$\begin{aligned} B=\left[ \begin{array}{ccc} -1&{} \quad 0&{} \quad 0\\ 1&{} \quad -1&{} \quad 0\\ 0&{} \quad 1&{} \quad 0\\ 0&{} \quad 0&{} \quad -1\\ 0&{} \quad 0&{} \quad 1\\ \end{array}\right] \end{aligned}$$

Since the chemical reactions will take place naturally when the cell gets the ‘message’ from the environment, this means that the activation energies in Arrhenius equation are so small that they can be ignored, i.e., \(E_j^f=0, j=1,\dots ,r\) and \(E_j^b=0, j=1,\dots ,r\). Hence, the matrix of conductances K becomes independent of T and takes the form

$$\begin{aligned} K=\left[ \begin{array}{ccc} x^*_3&{} \quad 0&{} \quad 0\\ 0&{} \quad \frac{(x^*_3)^2}{35}&{} \quad 0\\ 0&{} \quad 0&{} \quad \frac{(x^*_3)^2x^*_5}{4900}\\ \end{array}\right] \end{aligned}$$

Therefore, the Laplacian matrix \(L=BKB^{tr}\in \mathbb {R}^{5\times 5}\) is equal to

$$\begin{aligned} L=\left[ \begin{array}{ccccc} x_3^*&{} \quad -x_3^*&{} \quad 0&{} \quad 0&{} \quad 0\\ -x_3^*&{} \quad x_3^*+\frac{2x_3^{*2}}{35}&{} \quad \frac{-2x_3^{*2}}{35}&{} \quad 0&{} \quad 0\\ 0&{} \quad \frac{-2x_3^{*2}}{35}&{} \quad \frac{2x_3^{*2}}{35}&{} \quad 0&{} \quad 0\\ 0&{} \quad 0&{} \quad 0&{} \quad \frac{x_3^{*2}x_5^*}{4900}&{} \quad \frac{-x_3^{*2}x_5^*}{4900}\\ 0&{} \quad 0&{} \quad 0&{} \quad \frac{-x_3^{*2}x_5^*}{4900}&{} \quad \frac{x_3^{*2}x_5^*}{4900}\\ \end{array} \right] \end{aligned}$$

which is independent of T. Therefore, the port-Hamiltonian formulation (23) for the genetic protein synthesis circuit is

$$\begin{aligned} \left[ \begin{array}{c}x_1\\ \vdots \\ x_6\\ U\end{array}\right] =\left[ \begin{array}{c}\\ \mathcal {J-R}\\ \\ \\ \end{array}\right] \left[ \begin{array}{c}\frac{\mu _1}{T}\\ \vdots \\ \frac{\mu _6}{T}\\ frac{1}{T}\end{array}\right] \end{aligned}$$

where the matrix \(\mathcal {J}(-\frac{dS}{dz})-\mathcal {R}(-\frac{dS}{dz})\) can be written as

$$\begin{aligned} \left[ \begin{array}{cc} \mathbf {0}_{6\times 6}&{} \quad p\\ p^{tr}&{} \quad (*)\\ \end{array}\right] \end{aligned}$$

where \(p=[\begin{array}{cccccc}p_1&p_2&p_3&p_4&p_5&p_6\end{array}]^{tr}\), with

$$\begin{aligned} p_1= & {} p_2=-Tx_3^*\left( \exp \left( \frac{\mu _1+\mu _2}{RT}\right) -\exp \frac{\mu _3}{RT}\right) \\ p_3= & {} Tx_3^*\left( \exp \left( \frac{\mu _1+\mu _2}{RT}\right) -\exp \frac{\mu _3}{RT}\right) -T\frac{x_3^{*2}}{35}\left( 2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT}\right) \\ p_4= & {} T\frac{x_3^{*2}}{35}\left( 2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT}\right) -T\frac{x_3^{*2}x_5}{4900}\left( \exp \left( \frac{\mu _4+\mu _5}{RT}\right) -\exp \frac{\mu _6}{RT}\right) \\ p_5= & {} p_6=-T\frac{x_3^{*2}x_5}{4900}\left( \exp \left( \frac{\mu _4+\mu _5}{RT}\right) -\exp \frac{\mu _6}{RT}\right) \end{aligned}$$

and \((*)=(\mu _1+\mu _2)[Tx_3^*(\exp (\frac{\mu _1+\mu _2}{RT})-\exp \frac{\mu _3}{RT}]+\mu _3[-Tx_3^*(\exp (\frac{\mu _1+\mu _2}{RT})-\exp \frac{\mu _3}{RT})+T\frac{x_3^{*2}}{35}(2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT})]+\mu _4[-T\frac{x_3^{*2}}{35}(2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT})+T\frac{x_3^{*2}x_5}{4900}(\exp (\frac{\mu _4+\mu _5}{RT})-\exp \frac{\mu _6}{RT})]+(\mu _5+\mu _6)[T\frac{x_3^{*2}x_5}{4900}(\exp (\frac{\mu _4+\mu _5}{RT})-\exp \frac{\mu _6}{RT})]\)

6.2 Equilibrium and Lyapunov function

At thermodynamic equilibrium \(v(z^*)=0\), it can be verified that the equilibrium set \({\varSigma }_{T}\) is the 3-dimensional set given as

$$\begin{aligned} \begin{array}{ll} {\varSigma }_{T}=&{}\left\{ \left( x^*_1, \dots , x^*_6, T^*\right) \big | x^*_1=\frac{150x^*_3}{x^*_2}, x^*_4=\frac{(x^*_3)^2}{35},x^*_6=\frac{(x^*_3)^2x^*_5}{4900},\right. \\ &{}\left. \ x^*_i\in \mathbb {R}^m_+, i=1\dots 6, T^*\in \mathbb {R}^m_+\right\} \\ \end{array} \end{aligned}$$

To study its asymptotic stability, we define the availability function as in (31),

$$\begin{aligned} A(z)=-S(z)+S(z^{})+\frac{\partial ^{tr}S}{\partial z}(z^{o})(z-z^{o}) \end{aligned}$$
(35)

where the reference point \(z^o\) is taken to be a thermodynamic equilibrium under the temperature T. We have \(A(z)=0\) at \(z=z^o\), and as discussed in Sect. 5.2, the time derivative of A(z) can be written as

$$\begin{aligned} \begin{array}{ll} \frac{dA}{dt}&{}=-\left( \frac{dS}{dz}-\frac{dS}{dz}(z^{o})\right) ^{tr}\frac{dz}{dt}\\ &{}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )+R\gamma ^{otr}L\mathrm {Exp}(\gamma )\\ &{}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )\le 0\\ \end{array} \end{aligned}$$
(36)

Therefore A(z) is a well-defined Lyapunov candidate. The port-Hamiltonian system (23) for the genetic protein synthesis circuit is asymptotically stable under temperature T.

7 Non-isothermal chemical reaction networks with ports

In many application areas, the chemical reaction networks under consideration are not isolated. That is to say, there exist mass exchange or heat exchange between the chemical reaction network and its environment.

In this section we will extend the port-Hamiltonian formulation for non-isothermal chemical reaction networks to the case of mass and heat exchange. As in the previous work (see [12, 13, 24, 26]) when modeling and control of the Continuous Stirred Tank Reactor (CSTR), we define ‘external ports’ as the inflow/outflow of a mixture. Furthermore, we suppose that the output flow is such that the volume and pressure are constant [4].

Then Eq. (2) can be rewritten as

$$\begin{aligned} \dot{x}=Cv+F_e-F_i \end{aligned}$$
(37)

where the vectors \(F_e\) and \(F_s\) are respectively the input and output concentration flows. The previous formulation (23) can be extended to the non-isothermal chemical reaction network with external ports as

$$\begin{aligned} \begin{array}{ll} \dot{z}&{}=\left( \mathcal {J}\left( \frac{dH}{dz}\right) -\mathcal {R}\left( \frac{dH}{dz}\right) \right) \frac{\partial H}{\partial z}(z)+\left[ \begin{array}{c}F_e-F_s\\ {\varDelta }U\\ \end{array}\right] \end{array} \end{aligned}$$
(38)

where as before the Hamiltonian function is given as \(H=-S\). The internal energy can be written as

$$\begin{aligned} U=\sum ^m_{i=1}x_i(c_{pi}(T-T_0)-u_{0i}) \end{aligned}$$

where \(c_{pi}\), \(u_{0i}\) \(T_0\) are respectively the heat capacity at constant pressure, reference molar energy and reference temperature. With constant volume and pressure the balance equation for the internal energy U can be written as

$$\begin{aligned} {\varDelta }U=Q+\sum ^m_{i=1}(F_{ei}h_{ei}-F_{si}h_{si}) \end{aligned}$$

where Q is the heat flux from the environment, and \(F_{ei}\) and \(F_{si}\) are the ith element of \(F_e\) and \(F_s\). Furthermore, \(h_{ei}\) and \(h_{si}\) are respectively the input and output specific enthalpies.

Note that in the port-Hamiltonian formulation for non-isothermal chemical reaction network with ports (38), we still use the thermodynamic equilibrium \(z^*(T)\) for the chemical reaction network without ports under given temperature T, as defined in Sect. 4.

As before, in order to verify the asymptotic stability, we define the availability Eq. (31) as:

$$\begin{aligned} A(z)=-S(z)+S(z^{o})+\frac{\partial ^{tr}S}{\partial z}(z^{o})(z-z^{o}) \end{aligned}$$
(39)

It then remains to prove that A(z) is a Lyapunov function. Obviously, we have \(A(z^{o})=0\).

Here, we assume that \({\varDelta }F=F_e-F_s\) is a vector which can be described by mass action kinetics. That is to say, it can be developed as

$$\begin{aligned} {\varDelta }F=-ZL'\mathrm {Exp}\left( Z^{tr}\mathrm {Ln}\frac{x}{x^*}\right) =-ZL'\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{aligned}$$

with \(L'=B'K'(B')^{tr}\) a constant balanced weighted Laplacian matrix corresponding to some incidence matrix \(B'\) and \({\varDelta }U=0\). Note that under this assumption, the external ports added to the network can be considered as another chemical reaction network, with the same complex Z, but with the different incidence matrix \(B'\) and different rate coefficients \(K'\).

Then the time derivative of A(z) becomes

$$\begin{aligned} \begin{array}{ll} \frac{dA}{dt}&{}=-\left( \frac{dS}{dz}-\frac{dS}{dz}(z^{o})\right) ^{tr}\frac{dz}{dt}\\ &{}=-\left[ \begin{array}{cc}\frac{\mu ^o}{T^o}-\frac{\mu }{T}&{}\quad \frac{1}{T}-\frac{1}{T^o}\end{array}\right] ^{tr}\\ &{}\quad \times \left( \left[ \begin{array}{cc} \mathbf {0}_{m\times m}&{}\quad TZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \\ -T\left( ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \right) ^{tr}&{}\quad -T\mu ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) \end{array} \right] +\left[ \begin{array}{c}{\varDelta }F\\ {\varDelta }U\end{array}\right] \right) \\ &{}=-\left( \frac{\mu }{T}-\frac{\mu ^o}{T^o}\right) ^{tr}ZL\mathrm {Exp}\left( \frac{Z^{tr}\mu }{RT}\right) +\left( \frac{\mu }{T}-\frac{\mu ^o}{T^o}\right) ^{tr}{\varDelta }F-\left( \frac{1}{T}-\frac{1}{T^o}\right) {\varDelta }U\\ &{}=-R(\gamma -\gamma ^o)^{tr}L\mathrm {Exp}(\gamma )-R(\gamma -\gamma ^o)^{tr}L'\mathrm {Exp}(\gamma )\\ &{}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )-R\gamma ^{tr}L'\mathrm {Exp}(\gamma )\\ \end{array} \end{aligned}$$

Since

$$\begin{aligned} -R\gamma ^{tr}L\mathrm {Exp}(\gamma )\le 0\\ -R\gamma ^{tr}L'\mathrm {Exp}(\gamma )\le 0 \end{aligned}$$

we have \(\frac{dA}{dt}\le 0\), and thus the port-Hamiltonian system for non-isothermal chemical reaction networks with ports is asymptotically stable for temperature T. Let us illustrate this on the following example.

7.1 Example: a genetic circuit with internal feedback and cell-to-cell communication (continued)

Recall the genetic protein synthesis circuit described in Sect. 1. Assume that there exists a port of flows \({\varDelta }F=-ZL'\mathrm {Exp}(Z^{tr}\mathrm {Ln}\frac{x}{x^*})\) with

$$\begin{aligned} L'=B\left[ \begin{array}{ccc} l_1&{} \quad 0&{} \quad 0\\ 0&{} \quad l_2&{} \quad 0\\ 0&{} \quad 0&{} \quad l_3\\ \end{array}\right] B^{tr}=\left[ \begin{array}{cccccc} l_1&{} \quad -\,l_1&{} \quad 0&{} \quad 0&{} \quad 0\\ -\,l_1&{} \quad l_1+2l_2&{} \quad -\,2l_2&{} \quad 0&{} \quad 0\\ 0&{} \quad -\,2l_2&{} \quad 2l_2&{} \quad 0&{} \quad 0\\ 0&{} \quad 0&{} \quad 0&{} \quad l_3&{} \quad -\,l_3\\ 0&{} \quad 0&{} \quad 0&{} \quad -\,l_3&{} \quad l_3\\ \end{array}\right] \end{aligned}$$

where \(l_1\), \(l_2\) and \(l_3\) are positive constants. The port-Hamiltonian formulation (23) extends to

$$\begin{aligned} \left[ \begin{array}{c}x_1\\ \vdots \\ x_6\\ U\end{array}\right] =\left[ \begin{array}{c}\\ \mathcal {J-R}\\ \\ \\ \end{array}\right] \left[ \begin{array}{c} \frac{\mu _1}{T}\\ \vdots \\ \frac{\mu _6}{T}\\ -\frac{1}{T}\\ \end{array}\right] +\left[ \begin{array}{c} \\ F_e-F_s\\ \\ {\varDelta }U\\ \end{array}\right] \end{aligned}$$

where the matrix \(\mathcal {J-R}\) is equal to

$$\begin{aligned} \left[ \begin{array}{cc} \mathbf {0}_{6\times 6}&{} \quad p\\ p^{tr}&{} \quad (*)\\ \end{array}\right] \end{aligned}$$

where \(p=[\begin{array}{cccccc}p_1&p_2&p_3&p_4&p_5&p_6\end{array}]^{tr}\), with

$$\begin{aligned} p_1= & {} p_2=-Tx_3^*\left( \exp \left( \frac{\mu _1+\mu _2}{RT}\right) -\exp \frac{\mu _3}{RT}\right) \\ p_3= & {} Tx_3^*\left( \exp \left( \frac{\mu _1+\mu _2}{RT}\right) -\exp \frac{\mu _3}{RT}\right) -T\frac{x_3^{*2}}{35}\left( 2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT}\right) \\ p_4= & {} T\frac{x_3^{*2}}{35}\left( 2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT}\right) -T\frac{x_3^{*2}x_5}{4900}\left( \exp \left( \frac{\mu _4+\mu _5}{RT}\right) -\exp \frac{\mu _6}{RT}\right) \\ p_5= & {} p_6=-T\frac{x_3^{*2}x_5}{4900}\left( \exp \left( \frac{\mu _4+\mu _5}{RT}\right) -\exp \frac{\mu _6}{RT}\right) \end{aligned}$$

with \((*)=(\mu _1+\mu _2)[Tx_3^*(\exp (\frac{\mu _1+\mu _2}{RT})-\exp \frac{\mu _3}{RT}]+\mu _3[-Tx_3^*(\exp (\frac{\mu _1+\mu _2}{RT})-\exp \frac{\mu _3}{RT})+T\frac{x_3^{*2}}{35}(2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT})]+\mu _4[-T\frac{x_3^{*2}}{35}(2\exp \frac{\mu _3}{RT}-2\exp \frac{\mu _4}{RT})+T\frac{x_3^{*2}x_5}{4900}(\exp (\frac{\mu _4+\mu _5}{RT})-\exp \frac{\mu _6}{RT})]+(\mu _5+\mu _6)[T\frac{x_3^{*2}x_5}{4900}(\exp (\frac{\mu _4+\mu _5}{RT})-\exp \frac{\mu _6}{RT})]\) , and

$$\begin{aligned} \left[ \begin{array}{c} F_e-F_s\\ {\varDelta }U\\ \end{array}\right] =\left[ \begin{array}{c} {\varDelta }F\\ 0\\ \end{array}\right] =\left[ \begin{array}{c} -ZL'\mathrm {Exp}(Z^{tr}\mathrm {Ln}\frac{x}{x^*})\\ 0\\ \end{array}\right] \end{aligned}$$

Then the availability function (39) can be rewritten as

$$\begin{aligned} A(z)=-S(z)+S(z^{o})+\frac{\partial ^{tr}S}{\partial z}(z^{o})(z-z^{o}) \end{aligned}$$
(40)

\(A(z^{o})=0\) and the time derivative of A(z) becomes

$$\begin{aligned} \begin{array}{ll} \frac{dA}{dt}&{}=-\left( \frac{dS}{dz}-\frac{dS}{dz}(z^{o})\right) ^{tr}\frac{dz}{dt}\\ &{}=-R\gamma ^{tr}L\mathrm {Exp}(\gamma )-\gamma ^{tr}L'\mathrm {Exp}(\gamma )\le 0\\ \end{array} \end{aligned}$$

Hence A(z) is a well-defined Lyapunov candidate. We conclude that the port-Hamiltonian system for genetic protein synthesis circuit with a specific port \({\varDelta }F\) is asymptotically stable for temperature T.

8 Conclusions and outlook

In this paper, a (quasi) port-Hamiltonian formulation has been developed for non-isothermal mass action kinetics chemical reaction networks. As an extensive result of the port-Hamiltonian formulation for isothermal chemical reaction network, and based on the mass balance and energy balance equations, this port-Hamiltonian formulation provides us a very explicit way to represent the chemical reaction networks and their thermodynamic properties, including the entropy balance and the conditions for the existence of thermodynamic equilibrium. As for the asymptotic stability, a comparable statement with the one in [27] has been found.

Moreover, this (quasi) port-Hamiltonian formulation and its thermodynamic analysis have been extended to non-isothermal chemical reaction networks with external ports. The results have been illustrated on a chemical reaction network in our body: the genetic circuit with internal feedback and cell-to-cell communication.

The focus of future work will be on the extension of current results to the modeling of interconnection of non-isothermal chemical reaction networks. Inspired by Rao and Esposito [27] and Qian and Beard [23], the interconnected port-Hamiltonian formulation will be considered as the combination of two driven (or chemostatted) chemical reaction networks with shared species.