Water Hammer
Introduction
When a valve at the end of a pipeline closes suddenly, a pressure surge hits the valve, and travels along the pipeline. This is known as Water Hammer, and is described by the following PDEs
where V(x,t) and P(x,t) are the velocity and pressure at position x and time t, friction() is the friction factor at a given velocity, is the liquid density, Dia is the pipe diameter, and Ks 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 i = 1 ... N. This application solves the discretized ODEs numerically.
Physical Parameters
Liquid density, bulk modulus and viscosity
Pipe diameter, wall thickness, roughness, length, Young's Modulus and cross-sectional area
Pressure at start of pipeline
Effective modulus of system
Friction Factor
Steady State Flowrate
Calculate the steady-state pipeline velocity from the Darcy Weisbach Equation
Discretize the PDEs into ODEs
Number of nodes
Length of each node
Spatially discretized form of each PDE
Generate the entire set of ODEs
Initial and Boundary Conditions
For the first 2 seconds, the velocity at the valve is the steady-state velocity. After that, the velocity decreases exponentially to zero as the valve closes.
Pressure at start and end of pipeline
Initial pressure and velocity distribution along the pipeline
Velocity at node 0 is equal to velocity at node 1 (because there are no derivatives involving node 0)
Solve the ODEs and Plot Pressure at Valve
Plot pressure dynamics at valve