Class NetworkValidationBenchmarks
Provides analytically solvable or published benchmark cases for verifying the Hardy Cross and Newton-Raphson solvers against known solutions. Each benchmark returns a result object with computed values, expected values, and pass/fail status.
Benchmark Cases
- Single Pipe (Darcy-Weisbach): Analytical ΔP from Swamee-Jain / Darcy-Weisbach equation
- Two Parallel Pipes: Known flow split from equal/unequal diameter pipes
- Triangle Loop: Classic 3-pipe loop with Hardy Cross analytical solution
- Two-Loop Network: Cross (1936) textbook example with 5 pipes and 2 loops
- Mass Balance: Verifies conservation of mass at all junction nodes
- Pressure Monotonicity: Verifies pressure drops along flow direction
Reference: Cross, H. (1936). "Analysis of Flow in Networks of Conduits or Conductors". Bulletin 286, University of Illinois Engineering Experiment Station.
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBenchmark result container.static classSingle metric result within a benchmark. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static LoopedPipeNetworkbuildTwoLoopNetwork(SystemInterface gas, String prefix) Build a standard two-loop network for benchmarking.private static SystemInterfaceDefault gas for benchmarks: methane-dominated natural gas at 50 bar, 25 C.Run all benchmarks and return aggregate results.Benchmark 2: Two parallel pipes with known flow split.Benchmark 5: Pressure monotonicity along flow direction.Benchmark 1: Single pipe Darcy-Weisbach pressure drop.Benchmark 4: Hardy Cross vs Newton-Raphson agreement.Benchmark 6: Sparse vs Dense solver agreement for large networks.Benchmark 3: Triangle loop mass balance.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
NetworkValidationBenchmarks
public NetworkValidationBenchmarks()
-
-
Method Details
-
createBenchmarkGas
Default gas for benchmarks: methane-dominated natural gas at 50 bar, 25 C.- Returns:
- configured gas system
-
runSinglePipeBenchmark
Benchmark 1: Single pipe Darcy-Weisbach pressure drop.Verifies: For a single straight pipe of known L, D, roughness, with a given mass flow, the network solver produces the same pressure drop as the Darcy-Weisbach equation with the Swamee-Jain friction factor.
Analytical solution:
f = 0.25 / [log10(e/(3.7D) + 5.74/Re^0.9)]^2 (Swamee-Jain) dP = f * (L/D) * (rho * v^2 / 2)
- Returns:
- benchmark result
-
runParallelPipeBenchmark
Benchmark 2: Two parallel pipes with known flow split.For two parallel pipes with the same L and roughness but different diameters D1 and D2, the flow split at steady state satisfies equal pressure drop across both paths:
dP1(Q1) = dP2(Q2) and Q1 + Q2 = Q_total
For turbulent Darcy-Weisbach: Q1/Q2 ≈ (D1/D2)^(5/2) (approximate for equal friction factors).
- Returns:
- benchmark result
-
runTriangleMassBalance
Benchmark 3: Triangle loop mass balance.A triangle network (A-B-C-A) with one source at A and two sinks at B and C. Verifies that mass is conserved at all junction nodes and that the Hardy Cross solver correctly distributes flow.
- Returns:
- benchmark result
-
runSolverCrossVerification
Benchmark 4: Hardy Cross vs Newton-Raphson agreement.Solves the same two-loop network with both methods and verifies that results agree within tolerance. This is a cross-verification benchmark — both solvers should converge to the same physical solution.
- Returns:
- benchmark result
-
runPressureMonotonicity
Benchmark 5: Pressure monotonicity along flow direction.In a purely pipe-based network with no compressors, pressure must decrease along the flow direction. This benchmark verifies that the solver produces physically consistent pressure profiles.
- Returns:
- benchmark result
-
runSparseVsDenseBenchmark
Benchmark 6: Sparse vs Dense solver agreement for large networks.Constructs a 10x10 grid network (100 nodes, ~200 pipes) and verifies that the sparse CSC solver and dense Gaussian elimination produce identical results. Reports timing for both.
- Returns:
- benchmark result
-
runAllBenchmarks
Run all benchmarks and return aggregate results.- Returns:
- list of all benchmark results
-
buildTwoLoopNetwork
Build a standard two-loop network for benchmarking.- Parameters:
gas- fluid templateprefix- name prefix- Returns:
- configured network
-