  The stable operation of gas networks is an important optimization target.
While for this task commonly finite volume methods are used, we introduce a new
finite difference approach. With a summation by part formulation for the
spatial discretization, we get well-defined fluxes between the pipes. This
allows a simple and explicit formulation of the coupling conditions at the
node. From that, we derive the adjoint equations for the network simply and
transparently. The resulting direct and adjoint equations are numerically
efficient and easy to implement. The approach is demonstrated by the
optimization of two sample gas networks.
