Water Hammer in Excel

This Excel spreadsheet will calculate the maximum pressure surge when the valve at the end of a pipeline is closed.

When flow is suddenly stopped, flow inertia causes a pressure surge at the valve, with a shockwave propagating through the pipeline.  This  is also known as Water Hammer and can cause considerable damage.  Engineers need to know the maximum pressure surge to correctly design the pipe, valve andother fittings.

Water hammer is a common phenomenon. For example, the audible creaking when taps are shut off in kitchens or bathrooms results from the Water Hammer effect


These are the equations implemented in the spreadsheet.

where

  • K is the bulk modulus of the liquid (Pa)
  • ρ is the liquid density (kg m -3)
  • D is the pipe diameter (m)
  • t is the pipe wall thickness (m)
  • E is the Young's Modulus of the pipe (Pa)
  • c is the speed of sound in the pipe (m s-1)
  • Δv is the velocity of the liquid before the valve is shut  (m s-1)
  • ΔP is the maximum pressure (at the valve) generated by the valve closure(Pa)

Δv can be easily calculated by the Darcy-Weisbach equation. ΔP is also known as the Joukowsky Pressure.

These equations do not predict the pressure surge arising from column separation (which may be higher than the Joukowsky Pressure). Column separation references the breaking of liquid columns in filled pipes.

Download Excel Spreadsheet for Water Hammer

Dynamic Liquid Flow Between Coupled Tanks

This Excel spreadsheet models the transient flow of liquid between two tanks connected by a pipe.  Because of the momentum of the liquid, the height of liquid in each tank oscillates to an equilibrium.  Flow is opposed by pipe friction, and eventually the liquid level in each tank stabilises.


The dynamics are defined by the following differential equations, which are derived from a mass balance and momentum balance (ref: "Chemical Engineering Dynamics: An Introduction to Modelling and Computer Simulation" by John Ingham et al).


  • H1(t) and H2(t) are the height of liquid in each tank
  • A1 and A2 are the cross-sectional area of each tank
  • Q is the flowrate in the pipe (m3 s-1
  • ρ is the liquid density (kg m-3)
  • μ is the liquid viscosity (Pa s)
  • g is the gravitational constant (9.81 m s-2)
  • L is the length of the pipe (m)
  • D is the pipe diameter (m)
  • e is the pipe roughness (m)
  • Re is the Reynolds number
  • f is the friction factor (for Re < 2000, f is given by 64/Re, while for Re ≥ 2000 f is given by the Haaland equation)
The differential equations are solved in Excel with a simple finite difference Euler scheme, as described by these equations

The spreadsheet is straightforward to use.  Simply enter your parameters.


The spreadsheet will then calculate the flowrate in the pipe, and the change in liquid height in each tank over time. Note that the first row of the results (at t=0) contain the initial conditions.  These can be changed.


The spreadsheet also plots the liquid height in each tank over time.  As you can see, the level of each tank oscillates over time, with the flow being damped by friction.  Eventually,  the height of liquid in each tank reaches an equilibrium level.



Darcy-Weisbach Equation for Liquid Velocity in a Pipe

This Excel spreadsheet uses the Darcy-Weisbach equation to calculate liquid velocity in a pipe.  The Darcy-Weisbach equation describes the relationship between the pressure loss and liquid velocity in a pipe.

This is the equation employed in the spreadsheet.


  • ΔP is the pressure loss in the pipe (Pa)
  • ρ is the liquid density (kg m-3)
  • μ is the liquid viscosity (Pa s)
  • g is the gravitational constant (9.81 m s-2)
  • L is the length of the pipe (m)
  • D is the pipe diameter (m)
  • V is the liquid velocity (m s-1)
  • f is the Darcy Fanning friction factor
For laminar flow (Re<2000), the friction factor f is 64/Re (where Re is the Reynolds Number). Ror turbulent flow the friction factor is given by the Haaland equation (although the Colebrook equation can be used instead).


The calculation is iterative, and requires the use of Excel's Goal Seek. However, this is automated in the spreadsheet so you only have to click a button and some VBA initiates Goal Seek for you.


The Darcy-Weisbach equation should only be used for steady-state incompressible flow. It can also be used for open-channel flows by replacing the diameter with the 4 R, where R is the hydraulic diameter.  The hydraulic diameter is simply the cross-sectional area divided by the wetted perimeter.