Skip to content

Commit 20cca58

Browse files
dietmarw-sedietmarwboerrebj
authored
Feat: Adds pipe friction method selection (#75)
* Adds pipe friction method selection Adds functionality to specify pipe friction using different methods: pipe roughness, Moody friction factor, or Manning coefficient. This enhancement simplifies friction specification and offers flexibility for various application scenarios. * Fix HTML tags * Modfied relation between epsilon and Manning number * Cosmetic improvements * BOM fix --------- Co-authored-by: Dietmar Winkler <dietmar.winkler@dwe.no> Co-authored-by: Bjarne Børresen <bjarne.boerresen@gmail.com>
1 parent 2d455fd commit 20cca58

3 files changed

Lines changed: 48 additions & 5 deletions

File tree

OpenHPL/Types/FrictionMethod.mo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
within OpenHPL.Types;
2+
type FrictionMethod = enumeration(
3+
PipeRoughness "Direct pipe roughness height (p_eps)",
4+
MoodyFriction "Moody friction factor (f)",
5+
ManningFriction "Manning roughness coefficient (M or n)") "Enumeration defining method for specifying pipe friction";

OpenHPL/Types/package.order

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
DraftTube
22
Fitting
3+
FrictionMethod
34
Lambda
45
SurgeTank

OpenHPL/Waterway/Pipe.mo

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ model Pipe "Model of a pipe"
1313
Dialog(group = "Geometry"));
1414
parameter SI.Diameter D_o = D_i "Diameter of the outlet side" annotation (
1515
Dialog(group = "Geometry"));
16-
parameter SI.Height p_eps = data.p_eps "Pipe roughness height" annotation (
17-
Dialog(group = "Geometry"));
16+
17+
// Friction specification:
18+
parameter Types.FrictionMethod friction_method = Types.FrictionMethod.PipeRoughness "Method for specifying pipe friction" annotation (
19+
Dialog(group = "Friction"));
20+
parameter SI.Height p_eps_input = data.p_eps "Pipe roughness height (absolute)" annotation (
21+
Dialog(group = "Friction", enable = friction_method == Types.FrictionMethod.PipeRoughness));
22+
parameter Real f_moody(min=0) = 0.02 "Moody friction factor (dimensionless, typically 0.01-0.05)" annotation (
23+
Dialog(group = "Friction", enable = friction_method == Types.FrictionMethod.MoodyFriction));
24+
parameter Real m_manning(unit="m(1/3)/s", min=0) = 40 "Manning M (Strickler) coefficient M=1/n (typically 60-110 for steel, 30-60 for rock tunnels)" annotation (
25+
Dialog(group = "Friction", enable = friction_method == Types.FrictionMethod.ManningFriction and not use_n));
26+
parameter Boolean use_n = false "If true, use Mannings coefficient n (=1/M) instead of Manning's M (Strickler)" annotation (
27+
Dialog(group = "Friction", enable = friction_method == Types.FrictionMethod.ManningFriction), choices(checkBox=true));
28+
parameter Real n_manning(unit="s/m(1/3)", min=0) = 0.025 "Manning's n coefficient (typically 0.009-0.017 for steel/concrete, 0.017-0.030 for rock tunnels)" annotation (
29+
Dialog(group = "Friction", enable = friction_method == Types.FrictionMethod.ManningFriction and use_n));
30+
1831

1932
// Steady state:
2033
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
@@ -29,6 +42,10 @@ model Pipe "Model of a pipe"
2942
SI.VolumeFlowRate Vdot "Volume flow rate";
3043

3144
protected
45+
parameter Real n_eff = if use_n then n_manning else 1/m_manning "Effective Manning's n coefficient";
46+
parameter SI.Height p_eps = if friction_method == Types.FrictionMethod.PipeRoughness then p_eps_input
47+
elseif friction_method == Types.FrictionMethod.MoodyFriction then 3.7 * D_ * 10^(-1/(2*sqrt(f_moody)))
48+
else D_*3.0971 *exp(-0.118/n_eff) "Equivalent pipe roughness height";
3249
parameter SI.Diameter D_ = ( D_i + D_o) / 2 "Average diameter";
3350
parameter SI.Area A_i = D_i ^ 2 * C.pi / 4 "Inlet cross-sectional area";
3451
parameter SI.Area A_o = D_o ^ 2 * C.pi / 4 "Outlet cross-sectional area";
@@ -56,8 +73,7 @@ equation
5673
mdot = i.mdot "Inlet direction for mdot";
5774

5875
annotation (
59-
Documentation(info= "<html>
60-
<p>The simple model of the pipe gives possibilities
76+
Documentation(info="<html><p>The simple model of the pipe gives possibilities
6177
for easy modelling of different conduit: intake race, penstock, tail race, etc.</p>
6278
<p>This model is described by the momentum differential equation, which depends
6379
on pressure drop through the pipe together with friction and gravity forces.
@@ -72,8 +88,29 @@ equation
7288
<p>If the pipe is slightly tapered then this can be taken into account by adjusting
7389
<code>K_c</code> based on your taper geometry: 0.05–0.15 for gentle cones,
7490
up to 0.6 for sharp contractions.</p>
91+
<h5>Friction Specification</h5>
92+
<p>The pipe friction can be specified using one of three methods via the <code>friction_method</code> parameter:</p>
93+
<ul>
94+
<li><strong>Pipe Roughness (p_eps)</strong>: Direct specification of absolute pipe roughness height (m).
95+
Typical values: 0.0001-0.001 m for steel pipes, 0.001-0.003 m for concrete.</li>
96+
<li><strong>Moody Friction Factor (f)</strong>: Dimensionless friction factor from Moody diagram.
97+
Typical values: 0.01-0.05. Converted to equivalent roughness using fully turbulent flow approximation:
98+
p_eps = 3.7·D·10<sup>-1/(2√f)</sup></li>
99+
<li><strong>Manning Coefficient</strong>: Two notations are supported:
100+
<ul>
101+
<li><strong>Manning's M coefficient (Strickler)</strong> [m<sup>1/3</sup>/s]: M = 1/n, typical values 60-110 for steel,
102+
30-60 for rock tunnels.</li>
103+
<li><strong>Manning's n coefficient</strong> [s/m<sup>1/3</sup>]: Typical values 0.009-0.013 for smooth steel,
104+
0.012-0.017 for concrete, 0.017-0.030 for rock tunnels. Use checkbox <code>use_n</code> to enable this notation.</li>
105+
</ul>
106+
These are then converted using: p_eps = D_h·3.097·e<sup>(-0.118/n)</sup> empirically derived from the&nbsp;Karman-Prandtl equation.</li>
107+
</ul>
108+
<p>The conversions are simplified for hydropower applications assuming fully turbulent flow,
109+
so they depend only on fixed pipe dimensions and the chosen friction coefficient.</p>
110+
111+
<h5>More info</h5>
75112
<p>More info about the pipe model can be found in
76113
<a href=\"modelica://OpenHPL.UsersGuide.References\">[Vytvytskyi2017]</a>
77-
and <a href=\"modelica://OpenHPL.UsersGuide.References\">[Splavska2017a]</a>.</p><p>Updated formulation for non-equal inlet- and outlet diameter.</p><p><br></p><p><br></p>
114+
and <a href=\"modelica://OpenHPL.UsersGuide.References\">[Splavska2017a]</a>.</p>
78115
</html>"));
79116
end Pipe;

0 commit comments

Comments
 (0)