An Artificial Compressibility Method for 1D Simulation of Open-Channel and Pressurized-Pipe Flow