Coupling conditions for isothermal gas flow and applications to valves