Water Hammer - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Applications : applications/WaterHammer

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:

tVx,t+1ρxPx,t+frictionVx,t Vx,tVx,t2 Dia=0

xVx,t+1KstPx,t=0

where Vx,t and Px,t are the velocity and pressure at position x and time t, friction ( Vx,t ) 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:

 

ⅆⅆ tVit+1ρPi+1tPi1t2 Δx+frictionVit Vit Vi(t)2 Dia=0

 

Vi+1tVi1t2 Δx+1Ksⅆⅆ t Pit=0

 

where i=1..N.

This application solves the discretized ODEs numerically.

 

restart

Physical Parameters

Parameters

Liquid density

ρ1000:

Bulk modulus

K200106:

Viscosity

μ0.001:

Pipe diameter

Dia0.1:

Wall thickness

thick0.001:

Roughness

e0.0001:

Length

L25:

Young's modulus

E70109:

Cross-sectional area

A14evalfπDia2:

Pressure at start of pipeline

Psource0.5106:

Effective modulus of system

Ks11K+DiaEthick:

Friction Factor

frictionprocVlocal Rey&comma;fL&comma;fT&colon; option hfloat&colon;  if  typeV&comma;numeric then ReyDiaVρμ&colon; fL64Rey&colon; fT11.8log106.9Rey&plus;e3.7Dia1.112&colon;    if Rey&gt;0 and  Rey<2000 then       return fL&colon;    elif Rey2000 and Rey<4000 then       return fL&plus;fTfLRey200040002000    elif Rey4000 then       return fT    else       return 0    end if&semi;else return &apos;friction&apos;Vend ifend proc&colon;

Steady State Flow Rate

Calculate the steady state pipeline velocity from the Darcy-Weisbach equation:

VsteadyfsolvePsource=frictionVLDia&rho; V22

Vsteady:=14.19058741

(4.1)

QsteadyVsteadyA

Qsteady:=0.1114526129

(4.2)

Discretize the PDEs into ODEs

Number of nodes:

N30&colon;

Length of each node:

dxLN&colon;

Spatially discretized form of each PDE:

eq1diffcatV&comma;it&comma;t+1&rho;&apos;cat&apos;P&comma;i+1tcatP&comma;i1t2 dx+frictioncatV&comma;itcatV&comma;itcatV&comma;it2 Dia=0&colon;

eq2&apos;cat&apos;V&comma;i+1t&apos;cat&apos;V&comma;i1t2 dx+1KsdiffcatP&comma;it&comma;t=0&colon;

Generate the entire set of ODEs:

eqsseqeq1&comma;eq2&comma;i=1..N&colon;

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.

catV&comma;N&plus;1tVsteadyt<2Vsteady&ExponentialE;70 t2otherwise&colon;

Pressure at the start and end of the pipeline:

catP&comma;0tPsource&colon;catP&comma;N+1t0&colon;

Initial pressure and velocity distribution along the pipeline:

icseqcatP&comma;i0=PsourceidxLPsource&comma;i=1..N,         seqcatV&comma;i0=Vsteady&comma;i=1..N&colon;

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

catV&comma;0tV1t&colon;

Solve the ODEs and Plot Pressure at Valve

resdsolveeqs&comma;ic&comma;numeric&comma;output=listprocedure&comma;known=friction&comma; &apos;range&apos; &equals; 0..3&colon;

PNsubsres&comma;PNt&colon;

Plot pressure dynamics at the valve:

plotPNt&comma;t=0..3


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam