The most basic explanation is that water hammer occurs when a fluid in motion is suddenly forced to stop moving. The momentum of the fluid abruptly stopping creates a pressure wave that travels through the media within the pipe system, subjecting everything in that closed system to significant forces.
source/image: Practical Engineering
Hydraulic transients (also known as water hammer) can seem innocuous in a residential setting, but these spikes in pressure can cause major damage to large pipelines and industrial pipe networks.In this video, we briefly discuss how water hammer occurs and how engineers mitigate the effect./Practical Engineering
The most important way to prevent water hammer is to remove the water from the steam lines before passing the steam again through them.
Water is removed from the steam lines using drain connections.All the water should be drained out to make the lines clear.Water hammers can be solved by installing an air chamber which prevents water from generating waves that travel through the pipe.