## Modeling Water Hammer in MapleSim

Liquid flowing in a pipeline has inertia.  If a valve at the end of the pipeline suddenly closes, a pressure surge hits the valve, and travels through the pipeline at the speed of sound. The damping effect of fluid friction gradually attenuates the pressure wave.

This phenomenon is called water hammer and can cause damage significant damage, sometimes even rupturing the pipeline.

The pressure wave often produces audible sound. If you’ve ever heard groaning and creaking when you’ve shut your kitchen taps off, that’s water hammer.

Water hammer is described by the following partial differential equations. V(x,t) and P(x,t) are the velocity and pressure along the pipe, ρ is the liquid density, D is the pipe diameter, t is the pipe wall thickness, K is the liquid bulk modulus, E is the pipe Young’s modulus, and f is the friction factor.

These equations are solved using numerical techniques such as the method of characteristics.

Another method of modeling water hammer involves building a lumped parameter pipeline model with a tool like MapleSim.  The pipeline model can include effects such as

• Flow inertia
• Fluid friction (so that the pressure waves eventually dissipate)
• Pipe compliance (to model the flexing of the pipe under high pressure)
• Fluid compressibility (which can be significant at high pressure)

Figure 1 demonstrates a discretized pipeline in MapleSim with twenty nodes (the model can be downloaded here). Note the pressure source at one end, and the valve at the other end. Figure 1. Lumped Parameter Pipeline Model in MapleSim

Each subsystem consists of a compliant cylinder, a pipe, and a fluid inertia block (as illustrated in Figure 2) Figure 2. Lumped Parameter Pipeline Subsystem

A pipeline (of length L and volume V) with N nodes has

• N+1 pipes, each with a length L/(N+1)
• N+1 fluid inertia blocks, each with a length L/(N+1)
• N compliant cylinders, each with a volume V/N

Figure 3 plots the pressure at the end of a pipe for a valve that slams shut after 2 seconds. Table 1 gives the model parameters Table 1. Water Hammer Model Parameters Figure 3. Pressure Profile at End of Pipeline

The maximum pressure is about 5 x 106 Pa, with the liquid reaching an equilibrium flowrate of 0.1 m3 s-1 before the valve closes (the latter calculated from the Darcy-Weisbach equation).

The maximum pressure can crosschecked with the Joukowsky equation, which gives the greatest overpressure ΔP in a system subject to water hammer. Substituing the parameters from Table 1 into these equations and assuming ΔQ = 0.1 m3 s-1, gives ΔP = 5 x 106 Pa. This agrees with the prediction of the MapleSim model.

The magnitude of the pressure spike has to be carefully controlled to prevent damage to the pipeline. One method is to regulate the valve closure time - this is easily investigated with the MapleSim model.

Another method is with an accumulator. These are located near the valve, and allow liquid to enter when the pressure at the accumulator inlet increases beyond a threshold, essentially acting as a safety valve.  This attenuates the magnitude and frequency of the pressure waves.

MapleSim doesn’t offer a built-in accumulator block, but these are easily modeled with the custom component template by simply typing in the governing equations. Figure 4 illustrates typical equations for a spring-loaded accumulator as implemented in a custom component (this MapleSim model contains the component) Figure 4. Custom Component Equations for a Spring-Loaded Accumulator

Figure 5 demonstrates the pressure surge at the end of a pipeline with (black) and without (red) an accumulator. Figure 5. Pressure Profile With and Without an Accumulator ﻿