Optimal boundary control of the isothermal semilinear Euler equation for gas dynamics on a network

The analysis and boundary optimal control of the nonlinear transport of gas on a network of pipelines is considered. The evolution of the gas distribution on a given pipe is modeled by an isothermal semilinear compressible Euler system in one space dimension. On the network, solutions satisfying (at nodes) the so called Kirchhoﬀ ﬂux continuity conditions are shown to exist in a neighborhood of an equilibrium state. The associated nonlinear optimization problem then aims at steering such dynamics to a given target distribution by means of suitable (network) boundary controls while keeping the distribution within given (state) constraints. The existence of local optimal controls is established and a corresponding Karush-Kuhn-Tucker (KKT) stationarity system with an almost surely non-singular Lagrange multiplier is derived.


Introduction
In this paper we are interested in the analysis of optimal control problems for gas transport on a network of pipelines.For the sake of an introductory discussion, let us start by sketching the underlying state system in the simple case where the pipeline system consists of a single pipe only.Further, we state the optimization problem of interest.Once these mathematical formulations are at hand, we will set it in context in view of the currently ongoing energy transition from fossil fuels to all renewable energy sources.
Mathematically, a single pipe can be associated with the domain Ω = (0, L) where L > 0 denotes the length of the pipe.Given physical parameters c, α, λ, D and g, which will be discussed in detail later, for modeling the gas transport in that pipe consider the semilinear hyperbolic initial boundary value problem (IBVP): ) p(0, x) = p 0 , q(0, x) = q 0 (x), (1.1c) p(t, 0) = Φ 1 (t), q(t, L) = Φ 2 (t). (1.1d) This system is known as the isothermal Euler system for gas dynamics.It describes the evolution in time of a given initial gas pressure p 0 : Ω → R and gas flux distribution q 0 : Ω → R along the fixed pipe Ω.Within the scope of this work, the quantities Φ 1 , Φ 2 : (0, T ) → R acting on the boundary of the pipe domain Ω take the roles of controls which can be influenced in order to steer the gas dynamics in a desired way.Note that the system (1.1a)-(1.1b)can be derived from the compressible Euler system for an ideal gas by assuming constant temperature and a subsonic regime (i.e.gas velocity below the speed of sound c).For more details on the derivation we refer the interested reader to [8,ISO2 model] and [18,Sections 1 & 2].We also point out that models of the form (1.1) or similar appear in a number of contributions to the literature.In subsequent sections we will however only include references that are very close to our context.For a more general reference we refer here to the monograph [30].Suppose that the states p, q : (0, T ) × Ω → R are appropriate solutions of the system (1.1) and the given (non-empty, convex and closed) set U encodes constraints on the controls.Then consider the rather general optimization problem minimize J(Φ 1 , Φ 2 , p, q) subject to (s.t) Φ i ∈ U, i = 1, 2; and p, q solve (1.1); k p p(t, x) K p and k q q(t, x) K q for almost every (t, x) ∈ (0, T ) × Ω.
(P ) where J is an objective functional that one wishes to minimize.To ease our exposition, in this work we take J as the standard tracking-type functional which models the desire to reach a given target state over time while keeping the (average) cost of the control low.For more details see below.We also mention here that more general objectives can be used as long as they fulfill certain requirements.Further, k p , k q , K p , K q ∈ R with k p < K p and k q < K q yield point-wise almost everywhere bound constraints on the states p, q.
In view of this optimization task, one of the goals of this paper is to investigate the wellposedness of (P ) on a network of m pipes, allowing non-trivial controls to act only at the boundary of such a network.Concerning details on the latter notion we refer to the discussion in the following section.At internal network nodes the Kirchhoff law is imposed in order to balance inflow and outflow at such nodes.Once optimal solutions of (P ) are guaranteed, a natural next goal of this work is to derive a suitable stationarity system for characterizing such solutions via first-order conditions.
In connection with these research goals, one of the main challenges in our present study is associated with the analysis of the underlying state system which consists of nonlinear hyperbolic partial differential equations (PDEs) coupled via the Kirchhoff law on a network.Since pipes are connected by joints and in view of the dynamics of (P ), one needs to pay special attention to the structure of solutions and their regularity.This entails a careful choice of function spaces to enable suitable solution concepts.Another challenge stems from the non-linearity of (1.1) which renders the constrained problem (P ) non-convex, even if U is convex.As a consequence, both the proof of existence of optimal controls as well as their characterization via first-order systems require a careful analysis.
Next we connect the above mathematical setting to the wider application context of implementing a transition strategy from a current (often fossil fuel prone) energy portfolio to an (ideally) all renewable one.
In fact, natural gas still plays a central role in the current European energy scenario.The socalled European Green Deal [40] has set a net zero greenhouse gas emissions target for the year 2050.In this context, natural gas is the key common factor in all proposed transition strategies (from fossil to renewable energy sources) [39].It is transported through large pipeline networks whose complexity poses a challenge to currently known modeling and analysis techniques.The intricacy of this transmission system encompasses much more than just the various hardware structures in a given network [29] -which are generally difficult to represent as abstract mathematical objects and concepts that can be dealt with.Apart from the fact that the partial differential equations (PDEs) governing the dynamics of gas transport are nonlinear and hyperbolic, the understanding of gas markets is constantly confronted by the rapidly evolving European Commission's gas policies.Such changes are often interpreted as (state, operator ) constraints in regards to the structure of the gas network as well as limitations imposed by legislation.The latter usually changes the gas market's dynamics by adding or removing agents (buyers, sellers, etc) or by changing their logistics.An example of such change is the replacement of the point-to-point transport routes with the entryexit system for capacity booking and the establishment of a virtual trading point, which allows for transactions between agents that not necessarily have direct physical access to gas volumes [22].
In a realistic gas market, one has to deal with non-cooperative agents pursuing specific objectives subject to general (global) as well as individual (private) constraints.One example for such a global constraint would be the above model of the gas flow in a pipe (or a pipeline network, more generally).The controls may then be interpreted as the agents' decision variables; in (1.1), for instance, Φ 1 may belong to one agent (producer) and Φ 2 to another agent (wholesaler).Then, U in (P ) would encode private constraints affecting the agents.
This leads to modeling such a gas market as non-cooperative game.More precisely we will call this a generalized Nash equilibrium problem (GNEP); see, for instance, [11,12,17,22,26].We also refer to the seminal work [32], or [1,15] for instance, for further references.Note that the descriptor "generalized" is used here to emphasize that each agent's optimization problem has a feasible set that depends on the decisions of its competitors.Establishing the existence and a (firstorder) characterization of associated solutions (so-called Nash equilibria) for GNEPs are typically challenged when the agents' individual problems are non-convex or when the agents' problems are posed in infinite dimensional settings.The latter is for instance the case when the above PDE model of the gas network becomes a constraint.Let us point out that GNEPs with PDE constraints are a relatively recent problem class in the literature; see e.g.[9,16,17,24,25,27,34,35,36].In view of our focus on energy networks we mention that the theory in [25] is applied to study a GNEP for a gas market modeled by a simplified linear PDE for the gas transport.In [17], GNEPs are studied in the context of gas markets where the gas transport is modeled by a linearized and viscosity regularized version of the semilinear Euler equation (1.1), which is also the model of interest in this paper.
The main study object of this paper is the optimization problem which can be attributed to a single agent in the above GNEP context.It has the structure of (P ), but with the PDE for the gas transport posed on a tree-like network under the Kirchhoff law at interior nodes and possibly more than two controls.Let us further point out that (P ) is also of interest independent of the GNEP resp.market context, but rather it would entail optimal boundary control of a (passive) gas network.Such a viewpoint is of interest, e.g., in steering the physical network towards a target state in terms of gas distribution.
The two major contributions of this paper to the existing literature are the following ones: (i) Based on semigroup theory, we prove the existence of smooth (local) solutions to the semilinear Euler system (1.1) on a tree-like network and with coupling at interior nodes (joints) via the Kirchhoff law.Technically, our approach is based on [30], but under a weak smallness assumption of the boundary data (controls); here only in the space of continuous functions, rather than in C 1 .
(ii) Exploiting compactness properties of the image space of the control-to-state map, i.e., the solution map for the semilinear isothermal Euler system as a mapping of the boundary controls, existence of optimal controls for (P ) for the state system of (i) is established.Moreover, the regularity of our states allows us to derive a first-order optimality condition for characterizing a (local) solution with almost surely bounded Lagrange multipliers.
The rest of the paper is organized as follows: In Section 2 we introduce the configuration of our state system in detail.We also fix some notation for temporal and spatial regularity spaces and comment on some of their key properties used in this work.In section 3 we present (without proofs) and discuss our main results.In this way we hope to make the paper more accessible to the reader.The following sections are then devoted to the associated mathematical proofs.In fact, section 4 is concerned with the well-posedness of the state system, and in Section 5 we prove the existence of optimal controls as well as their first-order characterization.

The semilinear Euler system on a network of pipelines
Let G = (E, V) be a finite, directed and connected graph whose underlying undirected graph is a tree.We denote the set of m edges of G by E = {e 1 , • • • , e m } and the set of its n vertices by In this paper, G models the network of pipelines on which the analysis and the optimal boundary control of gas transport are of interest, respectively.Each edge e k represents a pipe and each vertex v k is either a junction or a boundary node, and since G is a directed graph, we identify the start and end points of a given pipe e k by 0 k and l k , respectively.
We decompose the set V of vertices into the following three distinct subsets: entry (source or provider) vertices, denoted by V ∂ − ; exit (sink or customer) vertices, denoted by V ∂ + ; and interior (junction) nodes, denoted by V • .For the analytical description of such subsets, we first distinguish interior and boundary vertices.For this purpose, define Notice that ξ k establishes a clear relationship between a given vertex v and every pipe of the network.Since inner nodes are connected to more than one pipe, by introducing the set κ(v) := {e k ∈ E : ξ k (v) = 0} we can identify inner and boundary vertices via Entry and exit vertices can also be characterized by ξ k .Indeed, we have An example of a network as described above is shown in Figure 1.Also, we refer to [20] for a similar description of such networks.
A pipe e k in G is assumed to have length L k > 0, and it is considered to be cylindrical with a circular cross section of diameter D k > 0. We also consider its associated friction coefficient λ k 0 and its inclination sin(α k ), α k ∈ (−π/2, π/2).It is typical to assume L k ≫ D k such that the gas dynamics are well described by one dimensional models [8].For each time instance t 0, the gas pressure and flux are functions from the finite interval [0, L k ] to R, respectively.As motivated in the introduction, the evolution of these distributions is assumed to obey the isothermal semilinear Euler system.We restate this system here, but now with a focus on introducing suitable initial and boundary data (for pipes connected to entry or exit vertices) and continuity conditions (for junctions).
For a fixed time horizon T > 0, define the open interval Ω k := (0, L k ) with product Ω := m k=1 Ω k , and let Q k T , Q T denote the cylinders Q k T := (0, T ) × Ω k and Q T := (0, T ) × Ω.On the k th -pipe, the Euler system relates the quantities, pressure p k = p k (t, x) and flux q k = q k (t, x) via the equations ) with where c denotes the sound speed, and g is the acceleration of gravity.Here and below, 'a.e.' stands for 'almost everywhere' in the sense of the Lebesgue measure.We shall assume that initially at time t = 0 the pressure and flux distributions in each pipe are given by an equilibrium or steady state (SS) solution of the corresponding counterpart of the Euler system.This assumption is standard in the context of boundary control of compressible Euler equations; see, for instance, [19] and [23].To compute the SS solution, we assume that the pressure is known at the entry vertex of each pipe and collect this information in the vector p in e = (p k in ) m k=1 .The constant SS mass flux vector is denoted by q e = (q k e ) m k=1 and the SS pressure p e = (p k e ) m k=1 is given, in each pipe, by We define p k out := p k e (L k ), p out e = (p k out ) m k=1 .Finally, the SS solution on each pipe is denoted by v k e (•) := (p k e (•), q k e (•)), and on the network by v e : Ω → R 2m , v e := ( v k e ) m k=1 .We shall assume that p in e and q e are such that each component of the SS solution is continuously differentiable on its respective domain and p k e is monotonically decreasing for all k with p k e (x) Moreover, we assume v e to be compatible with the pressure and flux continuity conditions that we wish solutions to enjoy.This will be further discussed below.
The condition on the continuity of the flux serves the fact that at each inner node of the network the amount of gas that streams in needs to flow out again.We model this by imposing the so-called Kirchhoff condition at each node.In our context the latter reads Concerning the continuity of the pressure we require the pressure to be stable at junctions, i.e., equal in all of the pipes meeting at a junction.Mathematically, we require that for any 1 j, k m and v ∈ V • such that both ξ k (v), ξ j (v) are nonzero The main goal of this paper is to study how controls acting on the boundary of the network can drive the SS solution (assumed to be the state at t = 0) to a given target distribution while satisfying fixed state constraints.We are going to assume that the pressure is controlled at the set V ∂ − of entry vertices and the flux is controlled at the set are given functions on (0, T ) of appropriate regularity.Again, this structure (pressure controlled at the entry and flux at the exit) is not new in the context of the (optimal) control of gas transport; see [10], for instance.
Notation.We now introduce the notation which we are going to use throughout the paper.For an open set O ⊂ R and 1 p < ∞, L p (O) denotes the space of Lebesgue measurable functions whose absolute value to the p th -th power is Lebesgue integrable.For p = ∞, the set L ∞ (Ω) denotes the set of Lebesgue measurable functions which are also almost everywhere bounded in O.When equipped with the norm is a Banach space.In the case p = 2, L 2 (O) is a Hilbert space if equipped with the standard inner product . The latter induces the norm • L 2 (O) .For a non-negative integer s we denote by W s,p (O) the Sobolev space of L p (O) functions whose distributional derivatives up to order s are also in L p (O).
With the norm is a Banach space.In the case p = 2, the associated spaces are also Hilbert spaces.It is then common to write H s (O) instead of W s,2 (O).The inner product induces the norm If I ⊂ R is an interval and X a Banach space, then we denote by C m (I; X) the set of X-valued functions u : I ⊂ R → X which are m-times continuously differentiable on I.When I is compact, then the space C m (I; X) when equipped with the norm For 1 p ∞ we denote by L p (I; X) the Bochner space of functions u : I ⊂ R → X such that t → u(t) X belongs to L p (I). Equipped with the norm for p = ∞, L p (I; X) is a Banach space, and if X ′ denotes the topological dual of X then [L p (I; X)] ′ = L q (I; X ′ ) where pq = p + q for 1 < p, q < ∞.If X is a Hilbert space then L 2 (I; X) is a Hilbert space when equipped with the inner product Similarly, W s,p (I, X) denotes the space of functions in L p (I, X) whose distributional derivatives up to order s are also in L p (I, X).With the norm When p = 2 and X is a Hilbert space, the Hilbert space W s,2 (I, X) is denoted by H s (I, X) and the inner product is given by Since, in our application context, on each pipe the description of the evolution is given by two functions -pressure and flux -and we have m pipes, we are led to work with Cartesian products of Lebesgue and Sobolev spaces.To ease notation, we use bold typeface (L, H, etc) to denote the products on each pipe and double-struck typeface (L, H, etc) when extending it to the network.
For the sake of convenient reference let us state the following definition where we write x k ∈ (0, L k ) = Ω k in order to refer to the space variable along the kth pipe.Definition 2.1.We say that the vector-valued function v : (0, T ) × Ω → R 2m is a solution of the isothermal semilinear Euler system if for each (i) each v k solves the corresponding system (2.3); (ii) the initial, boundary and continuity conditions are satisfied.
Later in the text we will also specify in which sense v k is required to solve the PDE on the kth pipe.For the time being, we are merely interested in structural aspects of our setting.Below we will also use and On the network, we let In view of regularity in time, given two Banach spaces X, Y , with X continuously embedded in Y , i.e., X ֒→ Y we define with the norm w In this paper we will often use the spaces defined above with X = H 1 (Ω) and Y = L 2 (Ω), or spaces of similar structure.A key observation related to this choice is that, due to the Aubin-Lions lemma [37,Corollary 4,p. 84] . Namely, we have with the second embedding being compact and with the second embedding being again compact.We finish this section by defining yet another important space for us used when showing the well-posedness of the semilinear Euler system.Given a compact set K ⊂ R 2m , we define for some fixed κ t , κ x > 0 (2.10)

Main results and discussion
As indicated in (P ), in our main optimal control problem we work with pointwise a.e box-constraints on the state.In this paper, we use K ⊂ R 2m to indicate this particular compact set.With and given a compact K ⊂ R 2m we introduce the K-admissible set Due to the structure of the nonlinearity in the Euler system, the compact set K cannot be arbitrary.This requires us to introduce the notion of suitable compact sets.Definition 3.1.Let K ⊂ R 2m be a compact set.We say that K is suitable for state constraint representation if there exists an element v e (x) ∈ int(K) for all x ∈ Ω and Throughout we invoke the following assumption concerning the initial state.
Assumption 3.1.The vectors q e and p in e are taken such that q k e , p k in , p k out > 0 for all 1 k m and the continuity conditions (2.5) and (2.6) are both satisfied.
We notice that Assumption 3.1 above is sufficient to guarantee that v e is continuously differentiable and each component is, in addition, strictly monotonically decreasing.However, to comply with the state constraints, we also needed to add the interiority condition on v e .
Let U ⊂ [H 2 (0, T )] 2m be defined by and let U 0 be defined as Notice that U 0 is a subspace of U and both are Hilbert spaces when endowed with the inner product of [H 2 (0, T )] 2m .We now define the set of admissible controls.
We say that Φ ∈ U belongs to U ad , the set of admissible controls, if for a fixed η > 0.
The smallness condition on κ U in (ii) above will be specified later.
Remark 3.1.Notice that U ad is a bounded, closed and convex subset of [H 2 (0, T )] 2m Remark 3.2.In this paper we work with a so called passive network.This means that non-zero controls act only on its boundary.The structure of the set U in (3.2) allows for the incorporation of non-passive elements like valves and compressor stations (see [19]) -at least from the abstract point of view -although their modeling would probably require smoothing techniques in order to impose pointwise state constraints.
Remark 3.3.In Section 2 we said that the boundary data were given functions of appropriate regularity.For studying the general well-posedness problem as we do in Section 4, boundary conditions are assumed to be fixed.However, when we study the control problem, those become the variable of interest.In any case, by appropriate regularity we mean that and belongs to U ad .
and notice that Φ + Φ e ∈ U ad for all Φ ∈ U η 0 .Moreover, by defining φ : U η 0 → U ad as φ(Φ) = Φ + Φ e we see that U η 0 and U ad are isomorphic.Now that all the relevant spaces have been introduced, we present a Sobolev embedding and interpolation theorem in one dimension.The version presented here is a combination of the Theorems 2.5.4 and 2.6.4 in [28, p. 90 and p. 94, respectively] and [31, p.19], adapted to our setting.
2m is continuous and the inequality holds for all Φ ∈ U.
It should be noted that we introduced the above with distinct indices.But particularly in Section 4, the various embeddings will be used without further explanation or possibly any reference to m.
In order to formulate our main results, we reintroduce our state equations in a unified abstract setting.For this we first formally introduce several abstract operators and some notation.Let B k 0 and B k 1 (x) act, formally, on a vector w = (w 1 , w 2 ) according to and define For the rest of the paper, we will not carry on the dependence of B k 1 on x ∈ R 2m .Next, recalling that γ k = g c 2 sin(α k ) we introduce operators A k and P k as and with domains to be appropriately defined after equation (3.17) below.Finally, with v k := (p k , q k ), and Then, for a (network)-boundary datum Φ ∈ U ad represented as in (3.5), the semilinear Euler system (2.3) can be rewritten as ) where (iv) both continuity conditions (2.6) and (2.5) are satisfied at all the inner nodes.
Let us next introduce the notion of a classical (smooth) solution.
Definition 3.3 (Classical solution).Let Φ ∈ U ad .We say that v : Ω × (0, T ) → R 2m is a classical solution of the semilinear Euler system with boudary condition given by Φ provided v ∈ X T (H 1 (Ω), L 2 (Ω)), v(0) = v e , is such that v k = (p k , q k ) solves the corresponding semilinear Euler system (2.3) and satisfies both, the boundary and the continuity conditions.
Notice that initial, boundary and continuity conditions have to be accounted for separately in the above definition.In this sense, the introduction of the abstract system (3.17)helps to simplify the analysis, because now both, the boundary and continuity conditions are embedded into the definition of the differential operator A. The main property of A allowing us to even consider the abstract version of the system is state below and discussed in detail in Section 4.
Of course, for the purpose of this study, the generation of a strongly continuous semigroup is enough.However, we chose to stated Theorem (3.3) in full strength since such properties come naturally in the proof of the generation results.Now, since A is the generator of a semigroup, the notion of classical solutions is borrowed from semigroup theory.
We work with the abstract formulation of the state system from now on.Based on this, we want to study the well-posedness of the following minimization problem: where T > 0, the compact set K is suitable (see Definition 3.1), v d ∈ int(V ad T,K ) is a given desired (gas) distribution, and σ > 0.
Our main theorem is the first step needed to study (P K T ) in the sense that it establishes its consistency, i.e., that there exists a time T > 0 such that the set of pairs (Φ, v) with v a classical solution is non-empty.Theorem 3.5 (Well-posedness of the state system).Let K be a suitable compact set and v e be a steady state solution of the semilinear Euler system (2.3) such that Assumption 3.1 is satisfied and let Φ ∈ U ad .Then, there exist Inspired by [21], the solution in Theorem 3.5 is built on semigroup theory (see [13,33]).However, in [21] the nonlinearity is not explicit and regularity properties such as Lipschitz continuity (with respect to the solution) are assumed, allowing the authors to apply standard results of [33] to obtain well-posedness.In our case, the nonlinearity is explicit and can possibly degenerate.The scope of our proof is not similar to the treatment of semilinear problems in [33], i.e., solutions are constructed as fixed points of contraction-maps whose formula come from the representation of the underlying linear abstract initial value Cauchy problem.The main reason is invariance: even on spaces away from the vacuum where some sort of Lipschitz continuity (w.r.t to the solution) is guaranteed for our nonlinearity, it is hard to construct sets on which a contraction self -map can be obtained.
Also, it is known that the interplay of smallness of time and data is standard.However, in our case it seems that smallness alone is not enough.As a consequence, our strategy lies in taking advantage of the structure of the initial data (taken as steady state solution) along with geometric properties provided by suitable (in the sense of Definition 3.1) compact sets.Theorem 3.5 allows us to define a control-to-state map Due to the embedding X T H 1 (Ω), L 2 (Ω) ֒→ V T , S may also be taken as a map from U ad to both L 2 (0, T ; L 2 (Ω)) and V T , respectively.However, for our later goal of studying differentiability properties of the control-to-state map, we need to restrict this map to U η 0 , i.e., we consider with S(Φ) := S(φ(Φ)) = S(Φ + Φ e ); see Remark 3.4.Consequently, the reduced version of (P K T ) can be written as The next goal is to obtain existence of optimal control for (rP K T ).This is often done by the direct method of the calculus of variations.For its application we need to establish several properties of the control-to-state map.Section 5.1 is dedicated to the corresponding analysis.The main property which renders the direct method applicable, is the following one: Proposition 3.6.The map S : The existence of optimal controls then follows.
Theorem 3.7 (Existence of optimal controls).The problem (rP K T ) admits an optimal solution.
Next we seek to establish a first-order characterization of optimal solutions.Such conditions are useful as they typically form the basis for developing numerical solution algorithms.For the pertinent first-order analysis we need to study differentiability properties of S as well as the existence and regularity of adjoint states.Both notions are essential for establishing so-called primal-dual first-order optimality conditions relying on (bounded) Lagrange multipliers.Proposition 3.8 (Differentiability of S).The map S is continuously Gâteaux differentiable when defined from U η 0 to either L 2 (0, T ; L 2 (Ω)) or V T .
Next, we want to characterize the derivative S ′ (Φ).For Φ ∈ U ad and K a suitable compact set, let ) and define as well as F(Φ) := (F k (Φ)) m k=1 .Now, for a given Φ ∈ U η 0 and h ∈ U 0 , we let Φ := Φ + Φ e and define the affine map Theorem 3.9.For each Φ ∈ U η 0 we have that S ′ (Φ, •) is a linear and continuous operator from where w Φ (h) is the solution of the first-order system ) Next, we establish the existence of adjoint states which allows us to characterize the gradient of the cost function J. First, for Φ ∈ U ad and K a suitable compact set define F (Φ) := F(Φ) * where the latter is taken as a (bounded) operator from L 2 (Ω) to itself.Further define the affine map g Proposition 3.10.There exists a unique solution p := p Φ ∈ C([0, T ]; L 2 (Ω)), called the adjoint state, to the problem ) Utilizing p Φ , we obtain the following representation of the gradient J ′ (Φ).
Our final goal is the characterization of an optimal control according to Theorem 3.7 via firstorder optimality conditions.Notice that if there are no state constraints, i.e.K = K in Theorem 3.5, then such conditions follow directly from Fermat's theorem and (3.22).However, the case of non-redundant state constraints is significantly more delicate.For deriving first-order conditions in this case we rely on the notion of normality (see, e.g., [3,4,7]) which we introduce next in our context.
Notice first that problem (rP (ii) there exists an unique adjoint state p Φ * associated to Φ * ; (iii) there exists a measure Λ ∈ M(Q T ) 2 such that the inequality holds for all y ∈ V 2 + ; (iv) there exists a real number ζ 0 such that the inequality holds for all Φ ∈ U η 0 .
Definition 3.4.We say that problem (rP K T ) is normal at Φ * provided we can take ζ = 1 in (3.24).
Most of the sufficient conditions to ensure normality involve some sort of regularity condition of the feasible set, a so-called constraint qualification.The Robinson-Zowe-Kurczyusz (RZK) regularity condition is particularly useful for our purposes.It requires the existence of a direction h ∈ U 0 such that It is slightly weaker than Slater's condition which requires S(Φ * ) ∈ int(V 2 + ) or, for instance, the surjectivity of S ′ (Φ * , •), both of which imply (3.25), but none of these can be guaranteed in our setting.Hence, in general, one cannot guarantee that our problem is normal.We can, however, prove that normality holds almost surely in the sense explained next.
Since int(V ad T,K ) = ∅, let v 0 ∈ int(V ad T,K ) and for every δ > 0 define the perturbed convex set Now, consider the perturbed problem We then have the following general result, which is an adaptation of [3, Theorem 2.2, p. 73].
Theorem 3.12.Let I ⊆ R * + be an interval such that for all δ ∈ I the perturbed problem (rP K,δ T ) admits a solution Φ δ .Then problem (rP K,δ T ) is normal at Φ δ for almost every δ ∈ I.
As a corollary, we have the final result of this paper.
Proof.Apply Theorem 3.12 with problem (rP K T ) perturbed around v e ∈ int(V ad T,K ).
Remark 3.5.Theorem 3.13 would still be true if we did not have an interior feasible point to perturb V ad T,K with.Indeed we see, by inspection of the proof of existence in Theorem 3.7, that problem (rP K,δ T ) will have a solution as long as V δ K contains a feasible point.Let v 0 be any interior point of V ad T,K (not necessarity feasible) and v be any feasible point (not necessarily interior).Of course if δ = 1 we have a feasible point: v.If δ = 1, one way to guarantee nonemptiness of the feasible set is to find T,K .For δ > 1 the above is true by convexity.One cannot go below 1 unless we assume v is interior, but we do not need the latter as Theorem 3.12 already implies that normality holds for almost every δ ∈ [1, +∞).

Local well-posedness of the state system
In this section we show that the state system, i.e. the semilinear Euler system with the Kirchhoff law, admits a classical solution.Our proof strategy relies on the following two main steps: • First we study the well-posedness of the linear system with fixed (or frozen) non-linearity, as well as its regularity and continuity properties; • then, via an iterative process, we construct a sequence of solutions (to associated linear problems) that will converge to the solution of the general semilinear system, invoking certain structural conditions.
Due to the hyperbolic character of the system, shock discontinuities are likely to occur in finite time.To avoid this (since we work with smooth initial and boundary data) we use a geometric argument to construct a small time T * during which solutions will remain smooth.We briefly explain the general idea.
Let us introduce another suitable compact set K such that K ⊂ K and v e ∈ K .Take r = r( K , K ) > 0 as the largest real number such that Notice that due to the definition of suitable compact sets, we can always find such a bound r.
then there exists a (maximal) time T > 0 such that v(t, •) ∈ B r (v e ) for all 0 t T .
The main goal, therefore, is to take a sequence {v k } of such functions with their corresponding { Tk } converging to a smooth solution v of the semilinear problem.The most difficult task is to show that the sequence { Tk } admits a uniform lower bound that is positive.Remark 4.1.Most of the proofs in this section will be based on estimates.To avoid overloaded notation, we use the symbol to indicate the presence of a constant that might depend on the fixed constants of the problem, but that do not play an important role in that particular step.

Linear analysis
We start with the main property of the differential operator A defined in (3.15).

Theorem 4.1. The operator
Proof.Let u ∈ D(A) and let P v be the representative of the pressure at node v ∈ V • .By the continuity conditions and considering the scaling of the L 2 -norm we compute whereby A is dissipative.By using the (equivalent) sum norm, it follows that , and then maximimality follows from, e.g, [14, Proposition 6.55, p. 314].
The exact same proof as above implies that −A : D(A) ⊂ L 2 (Ω) → L 2 (Ω) is maximal dissipative.This in turn yields the following corollary which is of particular interest for control problems.Proof.First recall that a closed operator (in Hilbert space) is maximal dissipative if and only if its dual is dissipative.We are going to use this fact.
We know that A and −A are maximal dissipative.Given u, v ∈ D(A) we have, in light of Theorem 4.1, that (Au, v) + (Av, u) = (A(u + v), u + v) − (Au, u) − (Av, v) = 0. Therefore, A * is an extension of −A.We now show that −A is also an extension of A * .
Let u ∈ D(A * ) with f = A * u and let g Proof.The proof is rather elementary.However, we present it here so we can fix quantities that will be later used when estimating the nonlinearity.For a given Φ ∈ U we denote Φ = (Φ k ) with each • For B 0 we have, for each k and By taking the maximum of the k constants above, we obtain B 0 L(U;H 1 (0,T ;H s (Ω))) .
• For B 1 we have, for each k, and and again, by taking the maximum of k constants, we obtain B 1 L(U;H 1 (0,T ;H s (Ω))) .
• For D t B 1 we have, for each k, as before, and whereby from where we obtain D t B 1 L(U;H 1 (0,T ;H s (Ω))) .
• For P we have, for each k and similarly, whereby from where we get P L(U;H 1 (0,T ;H s (Ω))) .
• Finally, for PB 1 we have, for each k and similarly, from where we get PB 1 L(U;H 1 (0,T ;H s (Ω))) .
We are now ready for the linear well-posedness result.
Next, we prove some Lipschitz-type inequalities for the function F.
Lemma 4.5.The map F maps we have the following inequalities: ) Proof.We prove the case m = 1 since the proof for the general m is an obvious extension of it.In this case the suitable compact set , and let us show that F(v) ∈ X T (H 1 (Ω), L 2 (Ω)).We start by showing F(v) ∈ C 1 ([0, T ]; L 2 (Ω)).Continuity in time follows from the fact that every function involved is continuous and p does not vanish in Q T .Membership in L 2 (Ω) follows by the Sobolev embedding H 1 (Ω) ֒→ L ∞ (Ω) ֒→ L 4 (Ω).Indeed, for each t, Now, since the function x → x|x| is continuously differentiable and p and q are both C 1 in time (with values in L 2 (Ω)) we have that the second component of F(v) can be differentiated in time.Moreover, ∂ ∂t q|q| p = 2|q|q t p − q|q|p t p 2 is again continuous in time due to continuity of all the functions involved.For membership in L 2 (Ω) we compute for each t ) is a corollary of the following lemma, which is an adaptation of [5, Corollary 8.10, p. 215], but we include a proof here for the reader's convenience.Lemma 4.6.Let Ω = (a, b), a, b ∈ R, a < b, and let u, v ∈ H 1 (Ω) be such that there exists ρ > 0 with v(x) ρ for all x ∈ Ω.Then u|u|/v ∈ H 1 (Ω) and as n → ∞.Since v(x) ρ for all x ∈ Ω and H 1 (Ω) ֒→ C(Ω), we can assume without loss of generality that v n (x) ρ/2 for all x ∈ Ω, which will be the case for any sequence converging to v in H 1 (Ω) and n large enough.
It follows by convergence that u To see this, recall that u n → u and v n → v also in C(Ω) as n → ∞, then the quantities are bounded by a common quantitity for all n.This readily implies Moreover, after some estimates one finds that there exists C > 0 such that which implies (4.16).This completes the proof, see [5,Remark 4,p. 204].
Then, for each t we have We now prove the estimates.Let w 1 = (u 1 , v 1 ) and w 2 = (u 2 , v 2 ).The estimates below hold for each t ∈ [0, T ], but for simplicity we omit the time argument in the intermediate steps.We have 1 Here C 1 0 (R) is the set of C 1 functions on R with compact support.
Also, we have Finally, similarly to above (by essentially exchanging time with space derivative) we have

Semilinear analysis
Let Φ ∈ U ad and define v 0 = v 0 (t, x) := v e and u 0 := v 0 − B 1 Φ.Let u 1 = u 1 (t, x) be the classical solution of guaranteed to exist by Theorem 4.4 since v e − B 1 Φ(0) ∈ D(A) and the forcing term With reference to r > 0 in (4.1) and For the time being, we assume that such a time exists and continue the construction. Let , and, by Lemma 4.5 it follows that Inductively, assuming that again guaranteed to exist by Theorem 4.4 since v e − B 1 Φ(0) ∈ D(A) and the forcing term With the same assumption on r, c 1 and κ U , let T k+1 > 0 be the largest time Again we assume that such a time exists for the time being.We then construct ).The next lemma yields that the sequence of times (T k ) as constructed above has a positive lower bound.Proof.The proof is by induction.Recall that T is a fixed large time.
We start by showing the base step (k = 1).To this end, notice that, since v e is a steady state solution for the Euler system, the function z := u 1 − u 0 ∈ X T (D(A), L 2 (Ω)) solves the abstract Cauchy problem Now, it follows from (3.10) that for 0 < ε ≪ 1/2 we have Whence, from (3.9) we obtain that for T small.From here we get T 1 .Since T 1 T , from (4.24) we get K and from (4.23) we get M .This proves the step k = 1 of the induction argument.We now assume that v k and u k satisfy (a), (b) and (c) in the statement for appropriate choices of K, M and T * .
The function z k+1 := u k+1 − u 0 ∈ X T * (D(A), L 2 (Ω)) solves the abstract Cauchy problem  We finish the argument by again using the interpolation inequality (3.10), i.e., for 0 < ε ≪ 1/2 we have for T * small.Since the last constant in (4.31) does not depend on T * , the proof follows.
The next lemma is crucial to guarantee that the constructed sequence has a limit.

Lemma 4.8 (Contraction)
. There exists T c , possibly smaller than T * , and 0 < δ < 1 such that the sequence (u k ) satisfies Proof.The proof is rather straightforward.Notice that if w k+1 := u k+1 − u k , then it follows by (4.27) that w k+1 satisfies the abstract Cauchy problem ) Then it follows from (4.5) and (4.12) that whereby the proof is complete for suitably chosen T c .
As a corollary of the previous lemma, we obtain convergence of (u k ).
Corollary 4.9.There exists u ∈ X Tc (D(A), L 2 (Ω)) such that Proof.Summing up inequality (4.32) we obtain, after rearranging, Moreover, by using w k+1 = u k+1 − u k in (4.33) for estimates, it follows from (4.6) that and from (4.7) Then adding (4.37) and (4.38) and summing up over k we have, after rearranging and using (4.36), for appropriate (smaller, if necessary) T c .From this it follows that there exists u ∈ X Tc (H 1 (Ω), L 2 (Ω)) such that u k → u in X Tc (H 1 (Ω), L 2 (Ω)).It follows from the construction that u ∈ D(A) and solves ) This completes the proof.
In order to complete the proof of Theorem 3.5, we recall that for each k, so does v(Φ).This justifies the definition of the control-to-state map S : U ad → X K Tc (H 1 (Ω), L 2 (Ω)) as in (3.18) as S(Φ) = v(Φ).
5 Optimal control problem
Proof.First, notice that the feasible set of (rP K T )is nonempty since it contains zero.This along with the non-negativity of J allow us to define d := inf{J(Φ); Φ is feasible} 0. (5.2) We want to show that d = J(Φ * ) for some feasible Φ * .
By properties of the infimum, there exists a sequence (Φ n ) of feasible controls such that J(Φ n ) → d in R as n → ∞.Since U η 0 is weakly closed, there exists Φ * ∈ U η 0 and a (non-relabeled) subsequence (Φ n ) such that Φ n ⇀ Φ * in U.By weak-to-strong continuity of S : U η 0 → L 2 (0, T c ; L 2 (Ω)) we have S(Φ n ) → S(Φ * ).Moreover, since Φ n is feasible for all n we have S(Φ n ) ∈ V ad Tc,K for all n and since K is compact, it follows that S(Φ * ) ∈ V ad Tc,K .Hence, Φ * is feasible.Now, weak-to-strong continuity of S implies weak-to-strong continuity of the first summand of J and the second summand is weakly lower semi-continuous.Therefore, we have and then Φ * is an optimal solution.
We now show that S : U η 0 → L 2 (0, T c ; L 2 (Ω)) is actually weak-to-strong continuous.For establishing this fact we need a series of lemmas.We start by showing a Lipschitz property.Lemma 5.2.By decreasing T c (if necessary), the map S : By (4.5) it follows that From (4.12) we obtain Now, by (4.6) it follows that and then from (4.14) we infer Using (4.7) along with (5.4) we have Therefore, adding (5.4), (5.5) and (5.6) and using Lemma 4.3 where necessary, we have and the proof is finished by noticing that S(Φ) = S( Φ), S(Ψ) = S( Ψ) and Φ − Ψ = Φ − Ψ.
In all the other results presented in this section, we work with a (possibly smaller) T c such that ) is Lipschitz continuous.An immediate corollary of the previous lemma is the strong-to-strong continuity of the map S : U η 0 → L 2 (0, T c ; L 2 (Ω)).The next essential lemma shows that S is weakly closed, i.e., given a sequence (Φ n ) ∈ U η 0 one has In order to prove weak-closedness of S we need to weaken the notion of solution for the semilinear Euler system.Below we introduce the notion of weak solutions for the semilinear abstract problem (3.17).To that end, let X F T ⊂ C([0, T ]; L 2 (Ω)) be the largest set with the following properties: (a) For all v ∈ X F T we have that F(v) is well defined and F(v) ∈ C([0, T ]; L 2 (Ω)); and (b) the map F is Lipschitz in C([0, T ]; L 2 (Ω)), i.e., there exists L > 0 such that Of course, the set X F T is nonempty.Indeed, it was proven in Lemma 4.5 that, for example, (iii) the function t → (v(t, •), z) belongs to [H 1 (0, T )] 2m for all z ∈ D(A); and (iv) for all z ∈ D(A) and t ∈ [0, T ] we have where u = v − B 1 Φ.
It is not difficult to see that a classical solution is weak and that a smooth weak solution is classical, so the definition is consistent.Since we already know that for reasonably chosen T c , local classical solution exists, it is clear that a weak solution also exists.When it comes to weak solutions, however, since we are making the solution space bigger, we might lose uniqueness, which is a key ingredient in the proof of weak-closedness of S. The set X F T here represents a set with conditions under which weak solutions are well defined and unique.We do not know whether it is the maximal set where weak solutions are unique, but it is big enough for our purposes.
Theorem 5.3.The semilinear Euler system admits at most one weak solution in X F T .
Proof.Assume v 1 , v 2 ∈ X F T are both weak solutions of (3.17) associated to the control Φ ∈ U ad .Of course they agree at t = 0. Define w := v 1 − v 2 and notice that, by definition, w is such that for all z ∈ D(A) and t ∈ [0, T ] we have Then, after integrating in time on (0, τ ) and recalling that w(0) = 0 we have , From this we estimate whereby the result follows from Gröwnwall's inequality.
We are now ready to show weak-closedness of S.
Remark 5.1.Notice that in the proof of the previous corollary the weak closedness of the map S is used to tie the limit of any weakly convergent subsequence of (S(Φ n )) -that in principle could converge to any function in L 2 (0, T ; L 2 (Ω)) -to S(Φ).

Adjoint states and differentiability of the control-to-state map
The following result is used to derive a formula for the gradient of J.It follows by [33,   hold for all Φ, Ψ ∈ U ad .Now, for a given Φ ∈ U η 0 and h ∈ U 0 , we let Φ := Φ + Φ e and define the affine map f Φ (h) : [0, T c ] × L 2 (Ω) → L 2 (Ω) by f Φ (h)(t, w) := F( Φ)w + (B + F( Φ)B 1 )h.We notice that by the regularity of the operators involved in its definition we have that f Φ (h) is continuous in the first variable and (uniformly) Lipschitz continuous w.r.t the second variable.It then follows from Proposition 5.7 that there exists a unique solution w := w Φ (h) ∈ C([0, T c ]; L 2 (Ω)) to the problem w t = (A + P)w + f Φ (h)(t, w), (5.18a) w(0) = 0. (5.18b) Now, let E Φ : U 0 → C([0, T c ]; L 2 (Ω)) be the operator that maps each h ∈ U 0 to E Φ (h) = w Φ (h) + B 1 h.The main theorem of this section establishes that E Φ characterizes the derivative of S. Before proving this result, we establish properties of E Φ .
In the next theorem, we assume without loss of generality that U η 0 ⊂ U op ⊂ U 0 where U op is an open set on which S is still well defined.This set can, for example, be constructed by defining a new U η 0 replacing η by η − ε and κ U by κ U − ε for a very small, but fixed ε > 0. We then define U op := φ −1 (int(U η 0 ), with U η 0 here being the original set.Proof.This amounts to show that, given Φ ∈ U op and an arbitrary (but fixed) h ∈ U 0 , the limit uniformly (in n) bounded in X Tc (H 1 (Ω), L 2 (Ω)).

Figure 1 :
Figure 1: Example of a network with m = 6 and n = 7.Notice that in this case V • = {v 2 , v 4 , v 5 }, V ∂ H s (O) .We denote by C(O) the set of functions u : O → R which are continuous on O and can be extended continuously to ∂O, the boundary of O.In the particular case where O = (a, b), with a, b ∈ R and a < b, we denote by M(O) the dual of C(O).It is well known that M(O) can be identified with the set of regular and finite Borel measures.More specifically (since we are in dimension one), any l ∈ M(O) can be uniquely (up to a countable set) represented by a function µ of bounded variation and such that µ(a) = 0 and l(f ) = b a f dµ for all f ∈ C(O).This justifies the duality pairing between M(O) and C(O) to be defined as µ, f M(O),C(O) = O f dµ.
is a classical solution of the semilinear Euler system with boundary condition given by Φ if and only if