Computation of two- and three-dimensional water hammer flows