HAMMER is a free program I used a few years ago to simulate water hammer in a water pipe.
From HAMMER read me file:
HAMMER is a program which simulates the effects of water hammer in a reservoir and pipeline system in which a valve at the downstream end is opened or closed by the user. The program is a product of the Urban Water Systems Group, School of Civil Engineering, Queensland University of Technology.
The program solves the differential equations of transient flow in a simple pipeline with a reservoir at the upstream end and a valve at the downstream end. The aim of the program is to provide a demonstration of the effects of water hammer in a simple pipe, reservoir and valve system. The method of characteristics is used in the solution of the differential equations.
The solution procedure adopted in the program is based on a method described by Victor L. Streeter and E. Benjamin Wylie, Fluid Mechanics, First SI Metric Edition, McGraw-Hill, 1983. A full discussion of the water hammer phenomenon, derivation of the differential equations, method of characteristics solution and boundary conditions are given in Sections 12.4 to 12.8 of this reference.
Computationally the pipeline is divided into 19 nodes, each of which is equally spaced along the length of the pipeline. There is also one node at each end of the pipeline. At the upstream node the reservoir boundary condition is defined, and at the downstream node the valve boundary condition is defined. Therefore, the pipeline is divided into 20 equal length sections of pipe. In the method of characteristics solution procedure the time step used is equal to the time it takes for an acoustical wave to travel from one node to the next.
The program HAMMER is completely interactive using the Microsoft WINDOWS Graphical User Interface. The user can change all of the parameters which describe the pipeline and reservoir system and the valve at the downstream end. The simulation of the water hammer caused by the operation of the valve can only be undertaken once all of the parameters describing the pipeline, reservoir and valve have been defined.
When running the simulation the pressure head and discharge at each node, and at each time step is written to an ASCII based text file. The file is written to the working directory, and is deleted when exiting the program. A permanent copy of the simulation file can also be saved to disk. A previously saved simulation file can be loaded into the program by the user at any time.
The results of the simulation, either pressure head or discharge can be visualised as either:
1) An animation of the water hammer wave as it travels back and forth along the pipeline,
2) A plot versus time at any point along the pipeline, or
3) An envelope of maximum and minimum values along the pipeline.
The solution procedure adopted in the program does not make any allowance for column separation, which occurs when the pressure in the pipeline reaches the saturated vapour pressure of the water. Therefore care should be taken when interpreting negative pressures produced by the program. Pressure heads around -10 m of water or less would not be produced in the physical system being modelled.
To run HAMMER you will require Microsoft WINDOWS Version 3.1 or later running on your system.