From a2072a0ef42484e3a19f59f78dc74bd1a82984e8 Mon Sep 17 00:00:00 2001 From: David Gilman Date: Wed, 11 Nov 2026 09:39:54 -0500 Subject: [PATCH 1/2] Fix Colebrook term in transitional friction factor The Dunlop cubic interpolation used epsilon / 3.7 * D, which multiplies by D. The relative roughness term is epsilon / (3.7 * D), as in the Swamee-Jain branch above. Co-Authored-By: Claude Opus 5.5 --- HydroGenerate/hydraulic_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HydroGenerate/hydraulic_processing.py b/HydroGenerate/hydraulic_processing.py index 8102e53..7589214 100755 --- a/HydroGenerate/hydraulic_processing.py +++ b/HydroGenerate/hydraulic_processing.py @@ -329,7 +329,7 @@ def frictionfactor_calculator(self, hydraulic_parameters): elif Re > 2000: # Cubic interpolation formula derived from the Moody Diagram (Dunlop, 1991) AA= -1.5634601348517065795 AB= 0.00328895476345399058690 - Y2 = (epsilon / 3.7 * D) + AB + Y2 = (epsilon / (3.7 * D)) + AB Y3 = -2 * np.log10(Y2) FA = Y3**-2 FB = FA * (2 - (AA * AB / (Y2 * Y3))) From d0cad3396ca604417fee36f01202fb62df72748e Mon Sep 17 00:00:00 2001 From: David Gilman Date: Wed, 11 Nov 2026 09:39:54 -0500 Subject: [PATCH 2/2] Do not convert max_headloss_allowed to feet max_headloss_allowed is a percent of the head, not a length. us_to_si_conversion does not convert it, but si_to_us_conversion divided it by ft_to_m, so the value reported with US units was 3.28 times too large. Co-Authored-By: Claude Opus 5.5 --- HydroGenerate/hydropower_potential.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/HydroGenerate/hydropower_potential.py b/HydroGenerate/hydropower_potential.py index e572b13..869cd4b 100755 --- a/HydroGenerate/hydropower_potential.py +++ b/HydroGenerate/hydropower_potential.py @@ -271,9 +271,6 @@ def si_to_us_conversion(self): if self.net_head is not None: self.net_head = self.net_head / ft_to_m # m to ft - if self.max_headloss_allowed is not None: - self.max_headloss_allowed = self.max_headloss_allowed / ft_to_m # m to ft - if self.penstock_length is not None: self.penstock_length = self.penstock_length / ft_to_m # m to ft