Water hammering can be described by the following PDEs:
where and are the velocity and pressure at position and time , friction ( ) is the friction factor at a given velocity, is the liquid density, is the pipe diameter, and is the effective bulk modulus of the system.
Discretizing the PDEs by replacing the spatial derivatives with a central difference approximation gives these equations:
where .
This application solves the discretized ODEs numerically.