Text this: Optimal model switching for gas flow in pipe networks.