
Water Hammer




When a valve at the end of a pipeline suddenly closes, a pressure surge hits the valve and travels along the pipeline. This is known as water hammer. This process is modeled by two partial differential equations (PDEs). The PDEs can be discretized along the spatial dimension to give a set of ordinary differential equations, ODEs. For a given set of parameters, this application solves the resulting ODEs numerically and plots the pressure dynamics at the valve.





Model


Water hammering can be described by the following PDEs:
where and are the velocity and pressure at position and time , friction ( ) is the friction factor at a given velocity, is the liquid density, is the pipe diameter, and 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 .
This application solves the discretized ODEs numerically.
>




Physical Parameters


Parameters

Liquid density

>



Bulk modulus

>



Viscosity

>



Pipe diameter

>



Wall thickness

>



Roughness

>



Length

>



Young's modulus

>



Crosssectional area

>



Pressure at start of pipeline

>



Effective modulus of system

>







Friction Factor


>




Steady State Flow Rate


Calculate the steady state pipeline velocity from the DarcyWeisbach equation:
>


 (4.1) 
>


 (4.2) 


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


During the initial two seconds, the velocity at the valve is at a steady state. After that, the velocity decreases exponentially to zero as the valve closes.
>


Pressure at the start and end of the pipeline:
>


Initial pressure and velocity distribution along the pipeline:
>


The velocity at node 0 is equal to the velocity at node 1 (because there are no derivatives involving node 0):
>




Solve the ODEs and Plot Pressure at Valve


>


>


Plot pressure dynamics at the valve:
>




Download Help Document
Was this information helpful?