In many urban areas of the developing world, piped water is supplied only
intermittently, as valves direct water to different parts of the water
distribution system at different times. The flow is transient, and may
transition between free-surface and pressurized, resulting in complex dynamical
features with important consequences for water suppliers and users. Here, we
develop a computational model of transition, transient pipe flow in a network,
accounting for a wide variety of realistic boundary conditions. We validate the
model against several published data sets, and demonstrate its use on a real
pipe network. The model is extended to consider several optimization problems
motivated by realistic scenarios. We demonstrate how to infer water flow in a
small pipe network from a single pressure sensor, and show how to control water
inflow to minimize damaging pressure gradients