1 Gas Pipe Network Modeling and Discretization

Gas networks consist of pipes and active elements, such as compressor stations and valves. They are modeled as coupled systems of nonlinear partial differential and algebraic equations. Especially, the space discretization of the pipes might lead to large dimensional systems whose efficient simulation and optimization motivate the use of MOR. In the following we exploit a structure-preserving MOR approach for connected pipe subnetworks that is based on an appropriate space discretization, index and decoupling concepts and a port-Hamiltonian formulation.

Pipe Network Model

The topology of a pipe network can be modeled by a graph consisting of directed edges \(\mathscr {E}\) connecting nodes \(\mathscr {N}\) which we distinguish in those without and with pressure (boundary) conditions, \(\mathscr {N}_J\) and \(\mathscr {N}_S\), respectively. On each edge/pipe e the gas dynamics is described by simplified 1d Euler equations with friction—in terms of pressure and mass flow \(p^e, q^e: [x^e_{L},x^e_{R}] \times \mathbb {R}^+ \rightarrow \mathbb {R}\) satisfying

$$\displaystyle \begin{aligned} \partial_t p^e(x,t) = - \frac{c^2}{a} \partial_x q^e(x,t), \qquad \partial_t q^e(x,t) = - a \partial_x p^e(x,t) - \frac{\lambda c^2}{2a D} \frac{ q^e(x,t) | q^e(x,t)|}{ p^e(x,t)} \end{aligned} $$

with area a, and diameter D, and a possibly nonlinear friction factor λ, [3]. In particular, we presuppose an ideal gas such that the gas density ρ is expressed by ρ = c −2p with speed of sound c. Mass conservation and pressure continuity at the nodes are ensured by the coupling and boundary conditions, i.e.,

$$\displaystyle \begin{aligned} \sum\nolimits_{e \in \mathscr{E}(v)} n^e(v) q^e(v) = q^{v}_{dem}, \quad v \in \mathscr{N}& \\ p^e(v) = p^{e'}(v), \quad v \in \mathscr{N}_J, \qquad \qquad p^e(v) = p^{v}_{sup}, \quad v \in \mathscr{N}_{S}&, \end{aligned} $$

where \(\mathscr {E}(v)\) is the set of edges incident to the node v, and n e(v) ∈{1, −1, 0} depending on whether the pipe e starts or ends at the node v or none of both. The functions \(p^{v}_{sup}\) and \(q^{v}_{dem}\) prescribe pressure (supply) and flow (demand) at the boundary.

Space Discretization

Introducing \(p^{e}_{L/R}(t) \approx p^{e}(x_{L/R},t)\), \(q^{e}_{L/R}(t) \approx q^{e}(x_{L/R},t)\), approximating pressure and mass flow by linear functions on \([x^e_L, x^e_R]\), \(\varDelta _x^e=x^e_R-x^e_L\), and applying a central stencil for the friction term, we deal with the following two-point space discretization for a pipe

$$\displaystyle \begin{aligned} \begin{array}{rcl} \partial_t \frac{ p^{e}_L + p^{e}_R}{2} = - \frac{c^2}{a} \frac{q^{e}_R - q^{e}_L}{\varDelta_x^{e}}, \quad \partial_t \frac{ q^{e}_L + q^{e}_R}{2} = - a \frac{p^{e}_R - p^{e}_L}{\varDelta_x^{e}} - \frac{\lambda c^2}{4a D} \frac{ ( q^{e}_L +q^{e}_R ) | ( q^{e}_L +q^{e}_R ) |}{ ( p^{e}_L +p^{e}_R )}. \end{array} \end{aligned} $$

Finer spatial meshes can be certainly obtained straightforward by subdividing a long pipe into several short ones. Note that the first equation represents the space-discrete mass conservation: apart from a constant scaling the left side equals the integral over the density, and the right side equals the mass flux over the boundaries of \([x^e_L,x^e_R]\).

The overall network topology can be characterized by the incidence matrix \(\mathbf {A}_{\textit {all}} \in \mathbb {R}^{|\mathscr {N}| \times |\mathscr {E}|}\), \(\left [ \mathbf {A}_{\textit {all}} \right ]_{ij} = n^{e_j}(v_i)\). Without loss of generality we compose A all of the respective matrices \(\mathbf {A}_k \in \mathbb {R}^{|\mathscr {N}_k| \times |\mathscr {E}|}\) associated to the nodes in \(\mathscr {N}_k\), k ∈{J, S}. Let \(\mathbf {p}_k(t) \in \mathbb {R}^{|\mathscr {N}_k|}\) be the vector of node pressures belonging to \(\mathscr {N}_k\), k ∈{J, S}. Moreover, let the vectors of edge flows q +(t), \(\mathbf {q}_-(t) \in \mathbb {R}^{|\mathscr {E}|}\) be entrywisely defined by \([\mathbf {q}_\pm (t)]_j = ( q^{e_j}_R \pm q^{e_j}_L)/2\). Collecting all states in x and all boundary conditions (inputs) in u, our space-discretized pipe network model can be written as

$$\displaystyle \begin{aligned} \begin{array}{rcl} {} {\mathbf{E}} \frac{d}{dt} {\mathbf{x}}(t) &\displaystyle = {\mathbf{A}} {\mathbf{x}}(t) + {\mathbf{B}} \mathbf u(t), \qquad \mathbf{x} = \begin{pmatrix} \mathbf{p}_J, \mathbf{p}_S, \mathbf{q}_+, \mathbf{q}_- \end{pmatrix}^T, \quad \mathbf{u} =\begin{pmatrix} \mathbf{p}_{\textit{sup}}, \mathbf{q}_{\textit{dem}}\end{pmatrix}^T \end{array} \end{aligned} $$
(1)

with

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mathbf{E} = \begin{pmatrix} | \mathbf{A}_J^T |/2 &\displaystyle | \mathbf{A}_S^T |/2 &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{I} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} \end{pmatrix}, \quad \mathbf{A} = \begin{pmatrix} \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle - \mathbf{D}_2 \\ - \mathbf{D}_1 {\mathbf{A}_J}^T &\displaystyle -\mathbf{D}_1 {\mathbf{A}}_S^T &\displaystyle - \mathbf{D}_F &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle - \mathbf{I} &\displaystyle \mathbf{0} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{0} &\displaystyle -|\mathbf{A}_J| &\displaystyle - \mathbf{A}_J \end{pmatrix}, \quad \mathbf{B} = \begin{pmatrix} \mathbf{0} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{0} \\ \mathbf{I} &\displaystyle \mathbf{0} \\ \mathbf{0} &\displaystyle \mathbf{Q}_J \end{pmatrix} \end{array} \end{aligned} $$

and identity matrix I. Here, D 1, D 2 and D F are positive definite diagonal matrices, where D F particularly represents the friction. Note that nonlinear friction models result in state dependent matrices \(\tilde {\mathbf {D}}_F(\mathbf {x})\). In view of MOR in Sect. 2, we use here a linearization around the initial value, i.e., \(\mathbf {D}_F = \tilde {\mathbf {D}}_F(\mathbf {x}(0))\), however the subsequent analysis and decoupling could analogously be performed for a nonlinear model. The matrix Q J is sparse with some one-entries and represents the flow boundary conditions. The absolute value of a matrix is taken elementwisely.

General Input-Output System, Port-Hamiltonian Form

Consider an input-output system in state representation of the following form

$$\displaystyle \begin{aligned} \begin{array}{rcl} {} {\mathbf{E}} \frac{d}{dt} {\mathbf{x}}(t) = {\mathbf{A}} {\mathbf{x}}(t) + {\mathbf{B}} \mathbf u(t), \qquad \mathbf y(t) = {\mathbf{C}} {\mathbf{x}}(t). \end{array} \end{aligned} $$
(2)

The same mapping from the input u to the output y can be described by different state representations, but its characterization in the frequency space, i.e., the transfer function G(s) = C(s EA)−1B, if it exists, is unique.

Definition 1

A transfer function G sp with limsG sp (s) = 0 is called strictly proper. Any transfer function G can be additively decomposed into its strictly proper part and a remainder, the polynomial part G pol , i.e., G = G sp  + G pol .

An input-output system with a representation (2) with regular E is strictly proper.

Definition 2

An input-output system is called passive, if u and y have the same dimension and for all u it holds 0 ≤u T(t)y(t) for all t.

In the following we focus on a subclass of port-Hamiltonian systems. Port-Hamiltonian systems inherit passivity and stability, for a general overview see [5].

Lemma 1 ([5])

An input-output system in the form

$$\displaystyle \begin{aligned} \begin{array}{rcl} {} \mathbf{M} \frac{d}{dt} {\mathbf{e}}(t) = \left[ \mathbf{J} - \mathbf{R} \right] \mathbf{e}(t) + \mathbf{B} \mathbf{u}(t), \qquad \mathbf{y}(t) = \mathbf{B}^T \mathbf{e}(t) \end{array} \end{aligned} $$
(3)

with M = M T, J = −J T, R = R T, M > 0, R ≥ 0 is stable and passive. It is a regular linear port-Hamiltonian system in co-energy form.

Decoupled Formulation for Space-Discrete Pipe Network

For the pipe network we consider an input-output system (2) consisting of the state equation (1) and its power conjugated output y = −(q sup , p dem )T. Then y Tu corresponds to the product of pressure and mass flow at the boundaries and can be interpreted as the supplied power of the pipe system. Note that all these boundary quantities are required for the interconnection of a pipe (sub-)network with other (active) elements (cf. Sect. 3). Proceeding from (1) and using some refactorizations it can be shown that the strictly proper part of the system has a state representation as in (3), Lemma 1 with

$$\displaystyle \begin{aligned} &\mathbf{e}(t) = \begin{pmatrix} \mathbf{p}_J(t) + \tilde{\mathbf{M}}\mathbf{p}_S(t) \\ \mathbf{q}_+(t) \end{pmatrix}, \qquad \mathbf{M} = \begin{pmatrix} \left(|\mathbf{A}_J| \mathbf{D}_1 |\mathbf{A}_J|^T \right)/4 & \mathbf{0} \\ \mathbf{0} & \mathbf{D}_2^{-1} \end{pmatrix}, \\ &\mathbf{J} = \begin{pmatrix} \mathbf{0} & \mathbf{A}_J \\ - \mathbf{A}_J^T & \mathbf{0} \end{pmatrix} , \qquad \mathbf{R} = \begin{pmatrix} \mathbf{0} & \mathbf{0} \\ \mathbf{0} & -\mathbf{D}_2^{-1} \mathbf{D}_F \end{pmatrix}, \qquad \mathbf{B} = \begin{pmatrix} \mathbf{0} & - \mathbf{Q}_J \\ - \left( \mathbf{A}_S^T - \mathbf{A}_J^T \tilde{\mathbf{M}} \right) & \mathbf{0} \end{pmatrix},\\ &\text{where } \quad \tilde{\mathbf{M}} = \left(|\mathbf{A}|_J \mathbf{D}_1 |\mathbf{A}_J|^T \right)^{-1} |\mathbf{A}_J| \mathbf{D}_1^{-1} | \mathbf{A}_S|^T. \end{aligned} $$
(4)

Similarly, a topologically based representation of the polynomial part can be given. It is linear (regardless of the friction model) and also passive, [3]. Additionally, the tractability index of the system, which is 2, can be easily concluded, cf. also [2].

2 Model Order Reduction Framework

Starting from an input-output system of the form (2), the idea of projection based MOR is to find appropriate basis matrices \(\mathbf {V}, \mathbf {W}: \mathbb {R}^{N \times n}\), n ≪ N, both full column rank, such that the reduced low-dimensional model

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mathbf{W}^T {\mathbf{E}} \mathbf{V} \frac{d}{dt} {\mathbf{x}_r}(t) = \mathbf{W}^T {\mathbf{A}} \mathbf{V} {\mathbf{x}_r}(t) + \mathbf{W}^T {\mathbf{B}} \mathbf u(t), \qquad \tilde{\mathbf{y}}(t) = {\mathbf{C}} \mathbf{V} {\mathbf{x}_r}(t) \end{array} \end{aligned} $$

with transfer function G r is a good approximation of the full-order model. We use here a Pade-type approximation constructed by Krylov-subspace methods [1].

Definition 3

For appropriately dimensioned matrices S and R, the q-th Krylov-subspace is defined as \(\mathscr {K}_q(\mathbf {S}, \mathbf {R}) = \textit {range} \left ( \left [ \mathbf {R}, \, \mathbf {S} \mathbf {R}, \, \mathbf {S}^2 \mathbf {R}, \ldots , \mathbf {S}^{q-1} \mathbf {R} \right ] \right )\).

Theorem 1 ([1])

Let \(s_0 \in \mathbb {C}\) be fixed. A reduced model constructed by the projection ansatz with W = V , det(s 0E −A) ≠ 0, det(V T(s 0E −A)V) ≠ 0 and

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mathscr{K}_q \left( \left[ s_0 \mathbf{E} - \mathbf{A} \right]^{-1} \mathbf{E} , \left[ s_0 \mathbf{E} - \mathbf{A} \right]^{-1} \mathbf{B} \right) \subseteq \textit{range}(\mathbf{V}) \end{array} \end{aligned} $$

is a so-called Pade-type approximation with \((\mathbf {G} - \mathbf {G}_r)(s) = \mathscr {O}\left ( (s-s_0)^q \right )\).

Let blkdiag(A 1, A 2)Footnote 1 abbreviate the block-diagonal matrix with blocks A 1, A 2.

We distinguish three levels of structure-preserving model reduction methods:

Theorem 2

A projection-based MOR for the strictly proper part of the space-discrete pipe network (3)(4) preserves

  1. 1.

    …passivity and stability, if a Galerkin-type projection, i.e., V = W , is used.

  2. 2.

    …additionally Footnote 2 the block-structure, if additionally V = blkdiag(V 1, V 2).

  3. 3.

    …additionally the local mass conservation-property, if additionally for a factorization (e.g., Cholesky factorization) of M 11 = LL T:

    \(\mathbf {V}_{1} = \mathbf {L}^{-1} \tilde {\mathbf {V}}_{1}\) , \(\textit {range}(\tilde { \mathbf {V} }_{1}) \supseteq \textit {range}(\mathbf {L}^{-1} \begin {pmatrix} \left [ \mathbf {J}_{12} \mathbf {V}_{2} \right ] & \mathbf {B}_{1} \end {pmatrix} )\) , \(\tilde { \mathbf {V} }_{1} \mathit{\text{ orthogonal}}\).

Proof

To 1. and 2.: Since the port-Hamiltonian form (3) of Lemma 1 is kept under the projection, passivity and stability are inherited [5]—analogously the block structure.

To 3.: It needs to be shown that the prolongation of the reduced pressure p r onto the original grid fulfills a space discrete conservation law, which is mass conservation along the edges, and respectively at the nodes, i.e.,

$$\displaystyle \begin{aligned} \partial_t \frac{ \tilde{p}^{e}_L + \tilde{p}^{e}_R}{2} = - \frac{c^2}{a} \frac{\tilde{q}^{e}_R - \tilde{q}^{e}_L}{\varDelta_x^{e}} \text{ for }e \in \mathscr{E}, \quad \sum\nolimits_{e \in \mathscr{E}(v)} n^e(v) \tilde{q}^e(v) = q^{v}_{dem}, \quad v \in \mathscr{N}. \end{aligned} $$

Hereby, \( \tilde {\mathbf {p}} = \hat {\mathbf {V}} \mathbf {p}_r\) for a prolongation \(\hat {\mathbf {V}}\), and \(\tilde {q}^e_{R,L}\) can be interpreted as a mass flux over the boundaries of \([x_L^e , x_R^e ]\), if the mass conservation at the nodes holds. The latter can be deduced from the fact that only strictly proper parts are reduced, i.e., purely algebraic relations are kept in the reduced model. Therefore, it only remains to show that no projection error is introduced in the strictly proper part of the mass conservation along the edges. With some basic calculations, however, it can be shown that the reduction as suggested in 3. with V = blkdiag(V 1, V 2) leads (up to initial value projection errors) to equivalent models as a reduction with the basis blkdiag(I, V 2), which leads to ‘half-reduced models’. This finishes the proof. Summarizing, the reduction of point 3 can be read as follows: only the mass flow is directly reduced, whereby the mass conservation at the nodes is not violated for the prolongated reduced mass flows \(\tilde {q}^e_{R,L}\). Then the thereby induced low-order pressure and mass conservation-equation on the edges are used.

3 Simulation of Network with Active Element and Discussion

As test case for our MOR approach we consider a gas network of two pipe subnets with a compressor, see Fig. 1. The boundary conditions of the closed-loop system are chosen to be a pressure condition at the left end and a mass flow condition at the right end, both constant in time. We initialize the system with the corresponding steady state. The transient simulation is done with a simplified linear friction model (λ|q|/p)(x, t)q(x, t) ≈ (λ|q|/p)(x, 0)q(x, t) (cf. Sect. 1).

Fig. 1
figure 1

Exemplary gas network consisting of two pipe subnets and a compressor. All pipes have circular cross-sections with diameter D ∈ [1, 1.3] m. Both subnets together comprise about 290 km of pipe length: the pipes of net 1 are between 14 and 40 km, and the pipe of net 2 is 100 km long. Nodes with pressure and mass flow boundary conditions are marked in green and red, respectively

Compressor and Network Parameters

Let \(p_{v_i}, q_{v_i}\) be the pressure and mass flow at node v i , i = 1, 2 in Fig. 1. The compressor is driven by a pressure-difference control Δ p , which implies a nonlinear flow consumption, modeled as in [4] with compressor-specific constant c c , here c c  = 3.93, and isentropic coefficient γ = 1.25,

$$\displaystyle \begin{aligned} p_{v_2} - p_{v_1} = \varDelta_p, \qquad q_{v_2} - q_{v_1} = - c_c \left( \left( \frac{p_{v_2}}{p_{v_1}}\right)^{\frac{\gamma -1 }{\gamma}} -1 \right) q_{v_1}. \end{aligned} $$
(5)

The applied control Δ p is sketched in Fig. 2. We use c = 340 m/s as speed of sound and model the friction factor λ with the Chen-Formula [4] giving λ ∈ [0.008, 0.0095]. This means that all pipes are ‘technically rough’. The spatial discretization of the pipes is chosen as uniform with a step size of 0.5 km.

Fig. 2
figure 2

Pressure-difference control Δ p the compressor is driven with. It increases smoothly from 0 to 7 bar within 0.5 h

Coupling of Pipe Subnetworks

The compressor model (5) can be formulated as an input-output mapping y c  = F c (t, u c ) with \(\mathbf {u}_c = (-q_{v_1}, p_{v_2})^T\) and \(\mathbf {y}_c = (p_{v_1}, q_{v_2})^T\). We use an input-output coupling to interconnect the pipe subsystems to a closed-loop system. The coupling is realized by choosing the respective outputs of the compressor as inputs for net i at v i , and conversely the inputs of the compressor as outputs of the net i at v i , i = 1, 2 (i.e., power-conjugated output), see Fig. 1.

Numerical Results and Discussion

The suggested mass conservative MOR with expansion frequency s 0 = 0 is applied for an open-loop reduction of the two separate pipe subnetworks. To avoid projection errors in the initial values, we use the superposition principle to decompose these systems into a non-dynamic part and a homogeneous part, which is actually reduced. Figure 3 shows a comparison of the reduced and direct simulation results. High fidelity, together with a significant order reduction can be observed. The computations are particularly performed with Matlab solver ode15i.m with default settings.

Fig. 3
figure 3

Simulation results. Left: States over time at depicted nodes of the networks using a direct simulation with a strictly proper parts of the pipe nets of order (766 + 400). Right: Deviance of the direct and the reduced results. The reduced system has strictly proper parts of order (8 + 8)

Concluding, standard MOR methods yield usually poor results, depending on the parameters. This is in accordance with the well-known observation that discretizations of hyperbolic equations that do not conserve the most relevant physics of the underlying model in some discrete sense may lead to unreasonable results, e.g., instabilities. Our approach overcomes this limitation: our results demonstrate the applicability of MOR for gas network simulations within practically relevant parameter regimes, here for long ‘technically rough’ pipes. The key point is the use of structure preservation, and preliminary, an appropriate representation in terms of the decoupled formulation of Sect. 1.