Boundary controlled irreversible port-Hamiltonian systems

Boundary controlled irreversible port-Hamiltonian systems (BC-IPHS) on 1-dimensional spatial domains are defined by extending the formulation of reversible BC-PHS to irreversible thermodynamic systems controlled at the boundaries of their spatial domains. The structure of BC-IPHS has clear physical interpretation, characterizing the coupling between energy storing and energy dissipating elements. By extending the definition of boundary port variables of BC-PHS to deal with the dissipative terms, a set of boundary port variables are defined such that BC-IPHS are passive with respect to a given set of conjugated inputs and outputs. As for finite dimensional IPHS, the first and second principle are satisfied as a structural property. Several examples are given to illustrate the proposed approach.


Introduction
The control of processes in Chemical Engineering is a highly difficult problem due to the nonlinearities induced as well by their thermodynamic properties as their flux relations. One very fruitful approach for the synthesis of nonlinear controllers is to use the properties of the dynamical models arising from first principle modeling such as symmetries, invariants and more generally balance equations of particular thermodynamic potential functions such as the entropy. These balance equations may be used as dissipation inequalities in passivity-based control as introduced in Willems (1972) and is now a well-developed branch of control (van der Schaft, 2000;Brogliato et al., 2020).
In the case of chemical engineering processes, various thermodynamic potentials, such as the entropy or Helmholtz free energy, may be used as storage functions in a dissipation inequality (Alonso and Ydstie, 1996) and may be used for control design methods based on Lyapunov control functions (Christofides and Daoutidis, 1998;Christofides, 2001) and passivity Ydstie, 1996, 2001;Alonso et al., 2002;Schaum et al., 2018).
The derivation of these Lyapunov functions and control Lyapunov functions are in most cases, based on the axioms of Equilibrium and Irreversible Thermo-dynamics and the structure of the dynamical models for these systems. A variety of such "thermodynamic" dynamical models have been suggested which are generalization of gradient control systems (Cortés et al., 2005), Lagrangian control systems (Ortega et al., 1998), Hamiltonian control systems (Brockett, 1977;van der Schaft, 1986;Nijmeijer and van der Schaft, 1990), (Marsden, 1992, chap. 7) or Port Hamiltonian systems (Maschke and van der Schaft, 1992;van der Schaft and Maschke, 1995;Duindam et al., 2009;van der Schaft and Jeltsema, 2014) in the sense that they should account both for the conservation of the total energy and for the irreversible entropy production.
A first class of these thermodynamic control systems is defined by pseudo-gradient systems Favache et al., 2011), meaning that they are redefined with respect to a pseudo-metric, in a very similar way as suggested for electrical circuits in Brayton and Moser (1964); Smale (1972). A second class of systems is defined as metriplectic systems (sum of Hamiltonian and gradient systems) with one or two generating functions (Grmela andÖttinger, 1997;Öttinger and Grmela, 1997;Mushik et al., 2000;Ramirez. et al., 2009;Hoang et al., 2011Hoang et al., , 2012. A third class of systems is defined as nonlinearly constrained Lagrangian systems (Gay-Balmaz and Yoshimura, 2018). A fourth class of systems is defined as implicit Hamiltonian control systems, in the sense that they are defined on a submanifold of some embedding space (the Thermodynamic Phase space or its symplectic extension), by control Hamiltonian systems defined on contact manifolds (Mrugala et al., 1991;Eberard et al., 2007;Ramirez et al., 2013bRamirez et al., ,a, 2017aMerker and Krüger, 2013) or their symplectization (van der Schaft and Maschke, 2018).
In this paper we shall be interested in another class, namely the Irreversible port-Hamiltonian System (IPHS) which were suggested in (Ramirez et al., 2013b) as an extension of port-Hamiltonian systems using a quasi-Poisson bracket and still embedding the irreversible entropy creation. For processes described by lumped models it has been shown that the formalism encompasses a large and general class of irreversible thermodynamic systems, such as heat-exchangers, chemical reactions, chemical reaction networks and coupled mechanic-thermodynamic systems (Ramirez et al., 2013c). Moreover, using the definition of the availability function (Keenan, 1951;Alonso and Ydstie, 2001) the IPHS structure has recently been employed to exploit the thermodynamic properties of irreversible processes to derive non-linear passivity based controllers  . This paper extends the IPHS formulation to systems defined on 1-dimensional spatial domains building on the framework of boundary controlled PHS (van der Schaft and Maschke, 2002) using the formulation on 1D spaces (Le Gorrec et al., 2005;Jacob and Zwart, 2012) with the aim of using the passivity-based and geometric control design methods, such as methods based on invariance (Godasi et al., 2002), Casimir functions (Macchelli et al., 2017;Macchelli et al., 2020) or (non)-linear dynamic boundary control (Ramirez et al., 2014a(Ramirez et al., , 2017b.
Note that a first approach in this line was given in  for a diffusion process.
The paper is organized as follows. In Section 2 a 1-D isentropic fluid, with and without dissipation, is presented as motivating example to contextualize the proposed irreversible model. Section 3 presents the main contribution of the paper, namely the definition of boundary controlled IPHS on a 1D spatial domain. Section 4 gives two important lemmas regarding the passivity of the system, namely the energy conservation and the irreversible entropy production. In Section 5 the IPHS model of a general diffusion-reaction process is presented, and finally in Section 6 some conclusions and comments on future work are given. An Appendix with the basic definitions of boundary controlled PHS is also included. Let us first consider the dynamic behavior of an 1-D isentropic fluid in Lagrangian coordinates, also known as p-system, and recall its Port Hamiltonian formulation (Maschke and van der Schaft, 2005). The 1-D spatial domain is the interval [a, b] ∋ z, a, b ∈ R, a < b. Using as state variables the specific volume φ(t, z) and the velocity υ(t, z) of the fluid, the dynamical model of the fluid is given by the mass balance equation (expressed in terms of the specific volume) and the momentum balance equation (expressed in terms of the velocity seen as "momentum density") where p(φ) is the pressure of the fluid. The Hamiltonian formulation is obtained by considering the total energy of the system which consists in the sum of the kinetic and the internal energy, denoting the internal energy density by u(φ) The variational derivative of the total energy yields δH δυ = υ and δH δφ = ∂u ∂φ = −p and the system (1)-(2) may be written as the Hamiltonian system ∂φ ∂t ∂υ ∂t where P 1 = 0 1 1 0 and P 1 ∂ ∂z is a Hamiltonian operator (Olver, 1993;van der Schaft and Maschke, 2002). Considering an open system, when there is mass and energy flow through the boundary (at the points a and b), the Hamiltonian system (3) is completed with a pair of boundary port input and output (v, y) as follows . It is direct to verify that this choice of inputs and outputs satisfies (A.2), hence the change of energy of the system is given byḢ(t) = y ⊤ (t)v(t).

The isentropic fluid: the irreversible case
Consider that there is dissipation in the system given by viscous damping. The balance equations are then given by where τ is the viscous tensor defined as τ = −μ ∂υ ∂z , witĥ µ the viscous damping coefficient. The system contains dissipation or rather a irreversible phenomenon induced by the viscosity of the fluid. Therefore we account for the thermal domain and consider Gibbs' equation du = −pdφ + T ds where s denotes the entropy density and T the temperature. The total energy of the system is still the sum of the kinetic and the internal energy The mass balance (4) and momentum balance equations (5) are then augmented with the entropy balance equation and the system of balance equations may be written as the quasi-Hamiltonian system As the operator depends on the co-energy variable T , it is only a quasi-Hamiltonian operator.
In the following section this latter formulation will be used to define boundary controlled irreversible port-Hamiltonian systems, extending the framework originally proposed in Ramirez et al. (2013b) for irreversible thermodynamic systems on finite dimensional spaces to systems defined on infinite dimensional spaces.

Boundary controlled IPHS
In this section, we introduce the Irreversible Boundary Port Hamiltonian System (IPHS) defined on a 1D spatial domain z ∈ [a, b], a, b ∈ R, a < b. The state variables of the system are the n+1 extensive variables 1 .
The following partition of the state vector shall be considered: the first n variables by x = [q 1 , . . . , q n ] ⊤ ∈ R n and the entropy density by s ∈ R. The thermodynamic properties of the system are expressed by Gibbs' equation (Callen, 1985), which we give here in its local form with pairs of specific energy-conjugated variables (Duindam et al., 2009, Chapter 3) where T is the temperature, conjugated to the entropy density, and the variables p i denote the intensive variables, which are conjugated to the q i variables. Gibbs' equation is here understood in a general context in order to account for coupled thermoelectro/magnetic/mechanical systems. Gibbs' equation is equivalent to the existence of an energy functional where h(x, s) is the energy density function. The total entropy functional is denoted by The following pseudo (locally defined) brackets will be used to define the thermodynamic driving forces of the system for some smooth functions Γ, Ω and G.
We shall first define a system of balance equations in terms of an Irreversible (quasi-)Hamiltonian system.

Definition 1. An infinite dimensional IPHS undergoing m irreversible processes is defined by the PDE
∂ ∂t where P 0 = −P ⊤ 0 ∈ R n×n , P 1 = P ⊤ 1 ∈ R n×n , g s ∈ R, G 0 ∈ R n×m , G 1 ∈ R n×m with m the number of states involved in the entropy production. R 0 ∈ R m×1 , R 1 ∈ R m×1 and r s ∈ R stand for the vectors of modulated driving forces with Remark 2. Definition 1 is an extension of the definition of IPHS for finite dimensional systems presented in Ramirez et al. (2013b,c) for thermodynamic systems defined on 1D spatial domains. In fact it is not difficult to verify that if finite dimensional system is considered only the zero order operator matrix is present in (7) and Definition 1 reduces to d dt which is equivalent to the definition in Ramirez et al. (2013b,c) for the case m = 1 or Ramirez et al. (2014b for m > 1. Remark 3. The pseudo-brackets (6) define the thermodynamic driving forces of the process. Notice that when considering a finite dimensional system (6) is equal to the pseudo-bracket defined in Ramirez et al. (2013b,c) for lumped IPHS.
In the following definition the above system is completed with boundary port variables.

Definition 4. A boundary controlled IPHS (BC-IPHS) is an infinite dimensional IPHS according to Definition 1 equipped with boundary inputs and outputs, defined as the linear combinations of the boundary port variables, respectively
where the boundary port variables are with and where Ξ 1 and Ξ 2 satisfy Ξ ⊤ 2 Ξ 1 + Ξ ⊤ 1 Ξ 2 = 0 and Ξ ⊤ 2 Ξ 2 + Ξ ⊤ 1 Ξ 1 = I. Remark 5. Definition 4 proposes an extension of the boundary port variables defined in Le Gorrec et al. (2005) for (reversible) BC-PHS to deal with nonreversible systems. Indeed, the vector of boundary port-variables (8) is composed by the vector of intensive variables and the vector of modulated driving forces. On the other hand the matrix (9), which is defined by the reversible structure matrix P 1 and the irreversible structure matrices G 1 and g s , define the admissible parametrization to obtain the boundary inputs and outputs. Notice that when no irreversible phenomena is present, and thus the entropy coordinate is not considered, Definition 1 and 4 define a BC-PHS (Le Gorrec et al., 2005) (see also the Appendix A).
respectively the entropy flux and the temperature at each boundary.

Energy and entropy balance equations
BC-IPHS encode the first and second principle of Thermodynamics, i.e., the conservation of the total energy and the irreversible production of entropy as stated in the following lemmas.

Lemma 8. (Conservation of energy) The total energy balance isḢ
which leads, when the input is set to zero, toḢ = 0 in accordance with the first principle of Thermodynamics.
Proof. The variation of the total energy with respect to time iṡ where we have used the skew symmetry of the matrix of zero order operators with P e defined in (9). Using the parametrization proposed in (Le Gorrec et al., 2005;Le Gorrec et al., 2006) (P e is potentially not full rank), it is possible to write with Ξ i , M P and P 1p defined in Definition 4, from where it is obtained thatḢ = y(t) ⊤ u(t).
Lemma 9. (Irreversible entropy production) The total entropy balance is given bẏ where y s and v s are the entropy conjugated input/output and σ t is the total internal entropy production. This leads, when the input is set to zero, toṠ = b a σ t dz ≥ 0 in accordance with the second principle of Thermodynamics.
Proof. Let's consider the total entropy balancė The first three terms define the internal entropy production related to the operators of order zero and one where σ 0i and σ 1i are, respectively, the zero and first order internal entropy productions due to the i-th irreversible thermodynamic processes, and σ s is the internal entropy production due to entropy (heat) flux. Since the total internal entropy production is the sum of the internal entropy production of all irreversible processes σ t = m i (σ 0i + σ 1i + σ s ) we havė s (a, t)) .
from where we have that the supply rate y ⊤ s (a, t)), representing the entropy flux at the boundaries. Hence, the total entropy variation is equal to the internal entropy production minus what is flowing in/out through the boundaries.

Example: the diffusion-reaction process
Diffusion-reaction processes are systems in which the changes in the mole number per unit volume are due to transport of particles, through processes such as diffusion and convection, and due to chemical reactions. This is the case for instance for tubular reactors (Horn and Jackson, 1972;Feinberg, 1987;Aris, 1989;Kondepudi and Prigogine, 1998;Sandler, 2006). Consider a diffusion-reaction process without convection involving n species and j chemical reactions, described by the following set of PDEs where c i is the molar concentration per unit volume of the i-th specie, s is the entropy density, f i = − L i T ∂µ i ∂z corresponds to the molar flux of the i-th specie, f s = − λ T ∂T ∂z to the entropy flux, L i is the diffusion coefficients of the i-th specie, λ is heat conduction coefficient, ν ki is the stoichiometric coefficient of the reactant i in the kth reaction and r k is the reaction rate of the k-th reaction. The thermodynamic driving force of the k-th chemical reaction is the chemical affinity of the k-th reaction A k = − n i=1ν ki µ i , where µ i is the chemical potential of the i-th specie. The internal entropy production of the process is due to irreversible diffusion, heat conduction and to the chemical reactions. In (11) the internal entropy production terms are respectively, for diffusion of the i-th species, σ r k = 1 T r k A k = n−1 i=1ν ki r k µ i for the k-th chemical reaction and σ s = − 1 T f s ∂T ∂z = λ T 2 ∂T ∂z 2 for heat conduction.

The IPHS model
Proposition 10. Consider the diffusion-reaction process with x = [c 1 , . . . , c n ] ⊤ ∈ R n . Then (11) can be written as the infinite dimensional IPHS (Definition 1) ∂ ∂t The modulating function of the mass diffusion of the i-th species is A j > 0, {S |G 0 j |U} = A j and the matrix of the operator of order zero G 0 = I n .
Furthermore, consider the following set of boundary inputs and outputs, respectively,

vector of fluxes, then (12) with (13) is a BC-IPHS (Definition 4).
Proof. It is straightforward to verify that the pseudobrackets related to mass and heat diffusion correspond to the respective thermodynamic driving forces. The non-linear functions γ ci and γ s are positive since the mass diffusion coefficients L i , the thermal conductivity coefficient λ and the temperature are always positive.
For the thermodynamic driving force of the chemical reaction, consider in a first instance only the j-th reaction term. The pseudo-bracket for the j-th chemical reaction is On the other hand from De Donder's fundamental equation (Prigogine and Defay, 1954) it has been shown in (Ramirez et al., 2013b) that γ r j = 1

T r j
A j > 0. The same applies for the other reactions. Regarding the boundary inputs and outputs, we have that since P 1 = 0, G 1 = I n and g s = 1. This implies M p = P ep = M = P e , hence choosing the parametrization we obtain the boundary inputs/outputs (13).

A simple application case
Consider a simple diffusion-reaction process on z ∈ [a, b] involving only two species and obeying the following reaction scheme This simple reaction involves four irreversible thermodynamic processes, related to the mass diffusion of species A and B, the heat diffusion and the chemical reaction. The thermodynamic parameters of the diffusionreaction process are the mass diffusion coefficients L A and L B , the thermal conductivity coefficient λ and the stoichiometric coefficientsν A = −1 andν B = 1. The state vector is in this case x = [c A , c B ] ⊤ and s, and according to Proposition 10 the BC-IPHS formulation of (14) is The conjugated inputs and outputs are, respectively, i.e., the incoming and outgoing flows of matter and entropy evaluated at the boundaries and the intensive variables evaluated at the boundaries. From Lemma 8 the energy balance is given bẏ while by Lemma 9 the entropy balance iṡ We observe that the total internal entropy production is ∂z , {S |U} = ∂T ∂z and {S |G 0 (:, i)|U} = A correspond, respectively, to the thermodynamic driving forces of mass and heat diffusion and chemical reactions. The diffusion-reaction process is hence given by the composition of the IPHS formulation of the diffusion process and the chemical reaction together with the mass and heat flows.

Conclusion
Boundary controlled irreversible port-Hamiltonian systems (BC-IPHS) on 1-dimensional spatial domains have been defined (Definition 1 and 4) by extending the formulation of reversible BC-PHS to irreversible thermodynamic systems controlled at the boundaries of their spatial domains. The structure of BC-IPHS has clear physical interpretation, characterizing the coupling between energy storing and energy dissipating elements, furthermore, the irreversible nature of the model is precisely expressed by the thermodynamic driving forces. By extending the definition of boundary port variables of BC-PHS to deal with the dissipative terms, a set of boundary port variables have been defined such that BC-IPHS are passive with respect to a given set of conjugated inputs and outputs. It is interesting to notice that when no irreversible phenomena is present, and thus the entropy coordinate is not considered, Definition 1 and 4 define a BC-PHS. As for finite dimensional IPHS, the first and second principle are satisfied (Lemmas 8 and 9) as a structural property. The proposed formulation has been illustrated on the examples of an isentropic fluid, with and withot dissipation, heat conduction and a diffusion-reaction process. Future work will study the extension of passivity based boundary control design methods to BC-IPHS. existence and uniqueness of solutions for the linear case, and to perform control synthesis for the general class of PHS (Le Gorrec et al., 2005;Jacob and Zwart, 2012;Ramirez et al., 2014a;Macchelli et al., 2017;Ramirez et al., 2017b). One interesting feature of PHS is that they are applicable to hyperbolic and parabolic systems, however the PHS formulation of parabolic systems leads necessary to an implicit system.