Numerical analysis of fluid-hammer waves by the method of characteristics