Tools › Fluids and Heat Transfer › Pipe Flow › Pipe Network Solver


Pipe Network Solver

Steady flow of a liquid in a looped or branched pipe network: junctions with demands, reservoirs or other points of fixed hydraulic grade, pipes with Darcy–Weisbach or Hazen–Williams friction, minor-loss coefficients and optional check valves, and pumps with a curve h = h0 − r Qn fitted to the shutoff head and one or two more points. The network is typed as text, one node, pipe or pump per line, and solved by the global gradient method of Todini and Pilati as documented in the EPANET 2 Users Manual (EPA/600/R-00/057). The page reports the flow, velocity, head loss, friction factor and Reynolds number of every pipe, the hydraulic grade and pressure at every node, the operating point of every pump, the supply drawn from each source, the continuity and loop-energy residuals with the iteration history, and the hydraulic grade line along a chosen path. The default is the tutorial network of the EPANET manual, whose printed link flows, velocities and unit head losses (Figure 2.7) the page reproduces.

  • Looped or branched networks of up to 40 nodes and 60 links, typed as text; several reservoirs or fixed-grade points

  • Darcy–Weisbach friction (Colebrook or Swamee–Jain, laminar and transitional flow treated) or Hazen–Williams; minor losses; check valves

  • Pumps as links with a fitted curve; operating point, head and hydraulic power of each

  • Global gradient method with a convergence report, continuity and loop-energy residuals, hydraulic grade line plot

Pipe Network Solver


Unit System: /

Network




Nodes (one per line. Junction: id elevation demand. Fixed grade: id res grade [elevation])


Pipes (one per line: id from to length diameter roughness-or-C [K] [cv])


Pumps (one per line: id from to shutoff-head Q1 h1 [Q2 h2]; a hyphen for the shutoff head gives the single-point curve)


Units of the Typed Numbers






Fluid (viscosity in cP = mPa⋅s)



Hydraulic Grade Line Plot



×

Pipe Network Solver

Method, Input Format, Assumptions and Checks

Scope

The tool finds the steady flow of a liquid in a network of pipes and pumps: branched (a tree), looped, or both, fed from one or several points of known hydraulic grade. It answers the questions a small hydraulic model is built for: how the flow divides between parallel paths, what pressure is left at each node, where a pump operates against the network, how much each source supplies. A network may have up to 40 nodes and 60 links. It is a snapshot at one set of demands and one set of tank levels; time-varying analysis, control valves and water quality are outside its scope.

Input format

The network is typed as text, one item per line, numbers separated by spaces, tabs or commas; text after a # is ignored. Ids are numbers or short names of letters, digits, dots, hyphens and underscores.

Nodes. A junction is written id elevation demand. The demand is the flow leaving the network at the node (a negative demand is an inflow; blank is zero). A point of fixed hydraulic grade, such as a reservoir, a tank at a known level or a connection of known pressure, is written id res grade, optionally followed by its elevation, in which case a pressure is reported there. The grade is the water surface elevation of an open tank, or elevation plus pressure head elsewhere. Every demand is multiplied by the Demand Factor.

Pipes. id from to length diameter roughness-or-C, optionally followed by the sum K of the minor-loss coefficients of the pipe and by the word cv for a check valve that lets flow pass from the first node to the second only. The sixth number is the Hazen–Williams C when that formula is chosen and the wall roughness otherwise. A positive flow in the results runs from the first node to the second.

Pumps. id from to shutoff-head Q1 h1, optionally followed by a second curve point Q2 h2. A hyphen in place of the shutoff head asks for the single-point curve described below. A pump adds head from its first node to its second and passes no reverse flow.

Units. The typed numbers carry no units; the unit selects say what they are (length for elevations, grades, pipe lengths and pump heads; diameter; roughness; flow; and the pressure unit of the results). The factors come from the site's unit dictionary. The density goes through the dictionary as an ordinary input; the viscosity is a plain number in centipoise (1 cP = 0.001 Pa⋅s). The USCS / SI switch converts the density and nothing else: the network keeps the units chosen on the selects.

Head loss in a pipe

With V = Q / A the mean velocity, the head lost between the ends of a pipe is the friction loss plus the minor loss, taken in the direction of the flow:

Darcy–Weisbach: h = (f L / D + K) V² / (2 g), with the friction factor f a function of the Reynolds number Re = ρ V D / μ and the relative roughness ε / D.

Hazen–Williams: h = 10.67 L Q1.852 / (C1.852 D4.871) + K V² / (2 g), in meters and m³/s. The constant is the 4.727 of the EPANET manual's Table 3.1 (feet and ft³/s) moved to SI units. The formula was fitted to water in turbulent flow; the page reports the Reynolds number of each pipe and cautions when it falls below 4,000. The friction factor column then shows the Darcy factor that would give the same loss, for comparison only.

Friction factor. Below Re = 2,000 the flow is laminar and f = 64 / Re. Above Re = 4,000 the tool uses either the Colebrook equation, 1/√f = −2 log10[ε / (3.7 D) + 2.51 / (Re √f)], iterated to convergence, or the Swamee–Jain explicit approximation f = 0.25 / {log10[ε / (3.7 D) + 5.74 / Re0.9]}², which is what EPANET uses. Between 2,000 and 4,000 a cubic in Re joins the two laws: with Swamee–Jain it is Dunlop's cubic as printed in Appendix D of the EPANET manual; with Colebrook it is the cubic that matches the value and the slope of 64 / Re at 2,000 and of the Colebrook factor at 4,000 (Dunlop's constants are tied to Swamee–Jain). Real flow in this range may be laminar or turbulent; the cubic is a smooth bridge that keeps the solution unique, not a measurement. The manual prints the Swamee–Jain formula with "Ln"; the logarithm is to base 10, as the manual's own constant −0.86859 = −2 / ln 10 confirms.

Check valve. A pipe marked cv carries flow one way only. In the equations a reverse flow meets a very large resistance, so it falls to nothing; the pipe is reported closed when a head difference holds the valve shut.

Pumps

A pump is a link whose head gain falls with flow as h = h0 − r Qn. With the shutoff head h0 and one point (Q1, h1), n = 2 and r = (h0 − h1) / Q1². With two points, n = ln[(h0 − h1) / (h0 − h2)] / ln(Q1 / Q2). With a hyphen for the shutoff head the EPANET single-point rule applies: the shutoff head is 4/3 of the design head and the head falls to zero at twice the design flow, which again gives n = 2. The operating point of each pump comes out of the network solution; the hydraulic power is ρ g Q h. A pump that would have to add more than its shutoff head is closed, as if it had a check valve, and the page says so. Beyond the flow at which the curve reaches zero head the formula gives a negative gain and the page cautions that the pump is off its curve.

Solution: the global gradient method

The unknowns are the flow in every link and the hydraulic grade at every junction. They satisfy continuity at each junction (inflow − outflow = demand) and the head-loss relation of each link (Hfrom − Hto = h(Q), with h negative for a pump). Todini and Pilati's gradient method, set out in Appendix D of the EPANET 2 Users Manual, applies Newton's method to both sets together. With trial flows Q, each link is linearized with p = 1 / (dh/dQ) and y = p h(Q). The junction grades then solve the symmetric linear system A H = F, where Aii is the sum of p over the links at junction i, Aij = −p of the link joining i and j, and Fi collects the imbalance of the corrected trial flows, the demand and the terms p H of links to fixed-grade nodes. The flows are then updated by Q ← Q − y + p (Hfrom − Hto), and the steps repeat. After the first step the flows satisfy continuity; the iterations remove the energy error.

The tool starts, as EPANET does, from a velocity of 1 ft/s in every pipe and the design flow in every pump. It differs from EPANET 2.0 in two ways that do not change the answer: the slope dh/dQ includes the change of the friction factor with flow, and iteration continues to a much tighter tolerance (the page states it). If the energy error stops falling, the flow step is halved until it does.

Residual checks

Three residuals of the reported solution are printed. The continuity residual is the largest flow imbalance at a junction. The energy residual is the largest difference between the grade drop across a link and the head loss of its flow. The loop check is made from the flows alone, without the solved grades: head losses are summed around each independent loop, where they must cancel, and along a path between each pair of fixed-grade nodes, where the sum must equal the difference of the two grades. These are the conditions a Hardy Cross calculation balances by hand, so the table can be checked against one.

What it assumes

Steady, incompressible, single-phase flow in full pipes; a single liquid of one density and viscosity; demands that are delivered whatever the pressure; fixed grades at the sources; pump curves of the power-law form; minor losses proportional to the velocity head of their pipe; velocity heads at the nodes neglected, as is usual in network analysis, so that "hydraulic grade" is elevation plus pressure head.

When it misleads

Because demands are fixed, the model will deliver water to a node whose pressure it reports as negative; a real system would not, and the page flags every node below atmospheric pressure. A snapshot says nothing about tanks filling or emptying, pressure surges or pump start-up. The Hazen–Williams C depends on diameter and velocity more than the formula admits and does not apply to liquids other than water or to slow flow. Friction factors between Re = 2,000 and 4,000 are an interpolation. The power-law pump curve is a fit: check the operating point against the maker's curve, and add efficiency and NPSH separately (the Pipe Flow tool has an NPSH calculation). A zone that draws no flow and is joined to the rest only through check valves or stopped pumps has no defined grade; the page flags it rather than invent one. Roughness, C values and minor-loss coefficients are the real uncertainty of any hydraulic model, usually far larger than the numerical error reported here.

Checks

The default case is the tutorial network of the EPANET 2 Users Manual (Tables 2.1 and 2.2, page 14): a reservoir, a pump delivering 150 ft at 600 gal/min, eight Hazen–Williams pipes in two loops and a tank. The manual prints the link flows, velocities and unit head losses of this network in its Figure 2.7 (page 21), and the tool reproduces all 24 printed numbers, for example 617.42 gal/min in pipe 1 and −90.09 gal/min in pipe 5. Two details of the manual had to be settled by calculation: the figure corresponds to a tank level of 4 ft, the value entered on page 19 (page 14 says 3.5 ft), and to demands at half the values of Table 2.1, the first multiplier of the demand pattern the tutorial adds in its next section. With 3.5 ft, or with the base demands, the printed flows are not reproduced.

The other checks are closed forms (Hagen–Poiseuille flow between two tanks, the explicit Colebrook solution for the flow at a known head loss, Hazen–Williams pipes in series and in parallel, a pump against a laminar pipe, a tree solved by continuity, a balanced bridge) and an independent solution written with scipy that uses junction grades as its only unknowns and no linearization in common with the tool: a two-loop grid with Colebrook, Swamee–Jain and a viscous oil, a pump with a check valve, and 60 seeded random networks with several sources, check valves and pumps. The second and third examples of the page are illustrations made for this tool and have no published source.




References

Rossman, L. A. (2000). EPANET 2 Users Manual. EPA/600/R-00/057, National Risk Management Research Laboratory, U.S. Environmental Protection Agency, Cincinnati, OH.

Todini, E., and Pilati, S. (1987). "A Gradient Method for the Analysis of Pipe Networks." In International Conference on Computer Applications for Water Supply and Distribution, Leicester Polytechnic, Leicester.

Salgado, R., Todini, E., and O'Connell, P. E. (1988). "Extending the Gradient Method to Include Pressure Regulating Valves in Pipe Networks." In Proceedings of the International Symposium on Computer Modeling of Water Distribution Systems, University of Kentucky, Lexington, KY.

Cross, H. (1936). Analysis of Flow in Networks of Conduits or Conductors. Bulletin No. 286, Engineering Experiment Station, University of Illinois, Urbana, IL.

Colebrook, C. F. (1939). "Turbulent Flow in Pipes, with Particular Reference to the Transition Region between the Smooth and Rough Pipe Laws." Journal of the Institution of Civil Engineers, Vol. 11, No. 4, pp. 133–156.

Swamee, P. K., and Jain, A. K. (1976). "Explicit Equations for Pipe-Flow Problems." Journal of the Hydraulics Division, ASCE, Vol. 102, No. 5, pp. 657–664.

Dunlop, E. J. (1991). WADI Users Manual. Local Government Computer Services Board, Dublin.

Bhave, P. R. (1991). Analysis of Flow in Water Distribution Networks. Technomic Publishing, Lancaster, PA.

Williams, G. S., and Hazen, A. (1905). Hydraulic Tables, Showing the Loss of Head Due to the Friction of Water Flowing in Pipes, Aqueducts, Sewers, etc. and the Discharge over Weirs, 1st ed. John Wiley and Sons, New York.

Moody, L. F. (1944). "Friction Factors for Pipe Flow." Transactions of the ASME, Vol. 66, No. 8, pp. 671–684.

Worked Examples

Published examples this tool reproduces; each page lists the inputs to enter and the printed answers.

All worked examples


DISCLAIMER: The methods and calculation on aNOWysis.com are provided as means to educate the reader. There is no warranty, expessed or implied, as to the relevance or accuracy of the methods or calculations. All calculations should be checked by a qualified analyst for appropriateness and accuracy. We will not be held liable for any damages, injuries or deaths caused by using methods or calculations from this site.