Describe the phenomenon of 'water hammer' in a piping system and how to mitigate it.
Water hammer is a pressure surge or wave that occurs in a piping system when a fluid in motion is suddenly forced to stop or change direction. This sudden change in momentum creates a pressure wave that propagates through the piping system, often with considerable force. The most common cause is the rapid closure of a valve, but it can also be caused by the sudden starting or stopping of a pump. When a valve closes quickly, the fluid immediately upstream of the valve is stopped. However, the fluid further upstream continues to flow due to its inertia, compressing the fluid near the valve and creating a high-pressure wave. This wave travels back through the pipe at the speed of sound in the fluid. When the wave reaches a pipe end or another restriction, it reflects back, potentially causing further pressure fluctuations. These pressure surges can be several times higher than the normal operating pressure of the system, leading to pipe rupture, valve damage, and joint leaks. Several methods can be used to mitigate water hammer. One is to use slow-closing valves, which reduce the rate of change of flow and therefore the magnitude of the pressure surge. Another is to install surge tanks or accumulators, which provide a volume of compressible fluid (usually air or nitrogen) to absorb the pressure wave. Air chambers, strategically placed along the pipeline, also help to dampen the pressure fluctuations. Finally, proper pipe support and anchoring can help to withstand the forces generated by water hammer.