DEV Community

Cover image for Water Pressure in Python: When No Pipe Is Big Enough
Evgenii Konkin
Evgenii Konkin

Posted on

Water Pressure in Python: When No Pipe Is Big Enough

A top-floor fixture is short on pressure. The first suggestion is nearly always bigger pipe. Sometimes that works, and sometimes no pipe in the catalog can help. A few lines of Python tell you which case you have before anyone picks a diameter.

Flip the usual calculation

Normally you start with the supply, subtract everything, and see what reaches the fixture. Pipe friction is one of the things you subtract, so you need a pipe size first.

Flip it. Subtract everything except friction, then subtract what the fixture needs. What remains is the friction budget:

budget = supply - height - meter - devices - required
Enter fullscreen mode Exit fullscreen mode

A positive budget means there is something for pipe sizing to work with. At zero or below, even a frictionless pipe would leave the fixture short.

The code

PSI_PER_FT = 62.4 / 144          # 0.433 psi per foot of water

REQUIRED = {                     # flow pressure at the outlet, psi (IPC Table 604.3)
    "lavatory": 8,
    "thermostatic shower": 20,
    "urinal, flush valve": 25,
    "blowout water closet": 45,
}

def friction_budget(supply, height_ft, meter, devices, required):
    """psi left for pipe and fittings. Negative: no pipe size can fix it."""
    return supply - height_ft * PSI_PER_FT - meter - devices - required

LENGTH_FT = 120                  # total equivalent length, meter to fixture

for supply in (52, 45):
    print(f"supply {supply} psi")
    for name, req in REQUIRED.items():
        b = friction_budget(supply, height_ft=28, meter=6, devices=7, required=req)
        note = f"{b / LENGTH_FT * 100:4.1f} psi/100 ft" if b > 0 else "no pipe is big enough"
        print(f"  {name:21s} {b:+6.1f} psi   {note}")
Enter fullscreen mode Exit fullscreen mode

Output:

supply 52 psi
  lavatory               +18.9 psi   15.7 psi/100 ft
  thermostatic shower     +6.9 psi    5.7 psi/100 ft
  urinal, flush valve     +1.9 psi    1.6 psi/100 ft
  blowout water closet   -18.1 psi   no pipe is big enough
supply 45 psi
  lavatory               +11.9 psi    9.9 psi/100 ft
  thermostatic shower     -0.1 psi   no pipe is big enough
  urinal, flush valve     -5.1 psi   no pipe is big enough
  blowout water closet   -25.1 psi   no pipe is big enough
Enter fullscreen mode Exit fullscreen mode

The meter and device losses (6 and 7 psi) are example values. Yours should come from manufacturer data at your design flow.

Reading the result

One supply, very different jobs. At 52 psi the lavatory has 18.9 psi to spend on pipe. The thermostatic shower on the same floor has 6.9. The flush-valve urinal has 1.9 psi, which is tight enough to drive the whole pipe size.

The blowout toilet was never going to work. It's 18.1 psi short before friction. The fix there is a booster, a different fixture or a different supply point.

Seven psi of supply decided the shower. At 45 psi the shower budget is −0.1. If 52 was a lucky spot reading and 45 is the recorded minimum, the design fails on the days that matter. Section 604.6 of the IPC says to design for the minimum pressure available where street pressure fluctuates.

Height is a fixed cost. 28 ft takes 12.1 psi. You can shorten a run or change a softener, but you can't argue with the weight of a water column.

Quick rule

Compute the friction budget for the highest, most remote fixture, at the lowest supply pressure on record. Divide it by the total equivalent length and you have the psi per 100 ft to size pipe with. If the budget is negative, stop looking at pipe tables.

One caution: the required values are flow pressures from the IPC table. Other codes use other numbers, so check which one applies to you.

Your turn: what's the oddest cause of low pressure you've tracked down? I'd like to hear the ones where the pipe turned out to be innocent.

Top comments (0)