arXiv:2609.06323cs.DCSep 2026

Manuscript Offprint

arXiv:2609.06323

Water-network decisions share one hydraulic gradient, and it can now be computed exactly

Tianwei Mu, Yue Wang, Mingzhe Yuan, Wenhong Wang, Qing Luo, Min Xiao, Jun Li, Hui Yang, Manhong Huang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Tianwei Mu 1,2,3^{1,2,3}, Yue Wang 3^{3}, Mingzhe Yuan 1,4,∗^{1,4,*}, Wenhong Wang 1^{1}, Qing Luo 2^{2}, Min Xiao 2^{2}, Jun Li 3^{3}, Hui Yang 3^{3}, Manhong Huang 5^{5}

1^{1}Guangzhou Institute of Industrial Intelligence, Guangzhou 510000, China. 2^{2}Key Laboratory of Ecological Restoration of Regional Contaminated Environment, Ministry of Education, College of Environment, Shenyang University, Shenyang 110044, China. 3^{3}School of Municipal Engineering and Environment, Shenyang Jianzhu University, Shenyang 110168, China. 4^{4}Shenyang Institute of Automation, Chinese Academy of Sciences, Shenyang 110169, China. 5^{5}College of Environmental Science and Engineering, Donghua University, Shanghai 201620, China.

∗^{*}Corresponding author: mzyuan@sia.cn.

Abstract

Calibration, leak localisation and sensor placement on water distribution networks (WDNs) are decisions about continuous parameters, yet the hydraulic engine that defines the physics returns a solution and no derivatives, so practice falls back on derivative-free search or on surrogates whose error the answer inherits. We make the global gradient algorithm itself exactly differentiable: the forward pass reproduces the reference engine's discrete devices, status switching and low-flow linearisation included, and the backward pass solves the implicit adjoint by reusing the forward pass's terminal factorisation, so one extra sparse solve returns every parameter's gradient at once, batched over scenarios on one graphics processor. Across 52 public, synthetic and operational networks and 8,140 simulation frames, every network meets the acceptance criterion, the largest head deviation from EPANET 2.2 is 1.137×10−131.137 \times 10^{-13} ft and 25 agree exactly. One adjoint solve replaces the 906 simulations a finite-difference roughness Jacobian costs on the 905-pipe L-TOWN benchmark, and a leak-inversion training loop runs at 463–470 ms per optimiser step for 256 scenarios, 191 times the prior pipeline. Gradient calibration reaches its endpoint within a median 595 model calls, where the strongest of five tuned metaheuristics needs 8,060 to match it on the training loss and two never do within 20,000. On a 554-link operating network, one adjoint pass audits, pipe by pipe, which roughness parameters the installed sensors can constrain and which sensors to add, on the model the utility already operates.

Keywords: Water distribution network; Hydraulic model; Automatic differentiation; Model calibration; Leak diagnosability; Sensor placement

1 Introduction

Most quantitative work on a water distribution network (WDN) is a search over continuous parameters: which roughness values reproduce the observed heads, which junction is leaking and by how much, where the next pressure sensor should go. Each runs against the same physics, the global gradient algorithm (GGA) of Todini and Pilati (1988), Todini and Rossman (2013), whose reference implementation EPANET 2.2 (Rossman et al., 2020) the field treats as ground truth; each is gradient-shaped, yet each is solved without gradients, because the engine returns a solution and nothing else. The workaround is derivative-free search (Maier et al., 2014), whose cost grows with parameter count and, with leakage management under regulatory and economic pressure worldwide (Sousa et al., 2026), is paid again at network scale whenever the model changes.

Two lines of work point at the missing ingredient. One makes models differentiable by replacing them: learned surrogates support state estimation and calibration (Truong et al., 2024, Kerimov et al., 2023), and gradient-based control of urban drainage became tractable because a neural internal model supplied the derivatives the physics engine could not (Zhang et al., 2026). A surrogate is fast, but its gradient is the surrogate's and its approximation error enters every downstream decision unbounded. The other keeps the physics: Ulusoy et al. (2022) showed on an operational network that gradient-based optimisation outperforms evolutionary search on large continuous design-for-control problems. What that argument needs, and what no published tool supplies, is the exact gradient of the deployed hydraulic engine.

A separate acceleration literature makes the forward solve faster, by topological reduction, domain decomposition and parallel computing (Guo et al., 2024) or by replacing the linear solver. All of it optimises one network for one demand frame; this work optimises over a batch of operating conditions and requires the result to be differentiable, so the two are complementary (Section 4).

We therefore take the reference numerical scheme exactly as it ships and make it differentiable. Analytic sensitivities of the idealised steady state are classical (Piller et al., 2017) and we claim no priority over them, but a solver in production switches link status, clamps options at parse time and linearises the head-loss law below a flow threshold, and the object differentiated here includes those devices. Three contributions follow. (i) The gradient object exists and can be trusted. The backward pass is the implicit adjoint of the very iteration the utility runs, discrete devices included, not of a smoothed stand-in, and the forward pass it hangs on is verified against the reference binary across 52 networks and 8,140 frames, largest head deviation 1.137×10−131.137 \times 10^{-13} ft, none excluded (Section 3.1), so transfer to the utility's own model carries no surrogate residual. (ii) The object is affordable at decision scale. Batching the whole solver, status machine included, on one graphics processor and reusing each scenario's terminal factorisation for the adjoint brings one forward-plus-backward L-TOWN scenario from 333 ms to 1.90 ms at batch size 256; per single solve it is not a faster simulator, and Section 3.2 keeps the qualifications in view. (iii) Three decisions, one object. Calibration is least squares on the adjoint Jacobian, the success or failure of leak search is the coherence of its columns, and sensor placement is its Fisher information, so coherence can be read before a search and the Cramér–Rao lower bound (CRLB) prices the identifiability added sensors buy. The chain runs end to end on public benchmarks and on a utility's operating network, with leak candidates drawn from its own work orders; placement keeps the sensors the utility has and prescribes, in simulation, additions that restore parameter identifiability but do not recover the leaks noise defeated, while a second objective, against coherence itself, recovers one of the three as coherence predicts (Section 3.6).

References (44)