Skip to content

Commit ef0b3ac

Browse files
committed
Pipe: Implement a improved handling of tapering.
ref: #63 This extends the simple pipe momentum equation to include a local loss term F_taper = K_c · (ρ·v_o^2/2)·A_o for the diameter contraction. Adjust K_c based on your taper geometry: 0.05–0.15 for gentle cones, up to 0.6 for sharp contractions.
1 parent 34b81e4 commit ef0b3ac

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

OpenHPL/Waterway/Pipe.mo

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ model Pipe "Model of a pipe"
1515
Dialog(group = "Geometry"));
1616
parameter SI.Height p_eps = data.p_eps "Pipe roughness height" annotation (
1717
Dialog(group = "Geometry"));
18+
parameter Real K_c = 0.1 "Loss coefficient for contraction"
19+
annotation (Dialog(group = "Geometry"));
1820
// Steady state:
1921
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
2022
parameter SI.VolumeFlowRate Vdot_0=data.Vdot_0 "Initial flow rate of the pipe" annotation (Dialog(group="Initialization"));
@@ -26,7 +28,9 @@ model Pipe "Model of a pipe"
2628
SI.Area A_ = D_ ^ 2 * C.pi / 4 "Average cross-sectional area";
2729
Real cos_theta = H / L "Slope ratio";
2830
SI.Velocity v "Water velocity";
31+
SI.Velocity v_o "Outlet water velocity";
2932
SI.Force F_f "Friction force";
33+
SI.Force F_taper "Tapering (local contraction) loss";
3034
SI.Momentum M "Water momentum";
3135
SI.Pressure p_i "Inlet pressure";
3236
SI.Pressure p_o "Outlet pressure";
@@ -41,18 +45,32 @@ model Pipe "Model of a pipe"
4145
SI.Temperature T( start = T_0);
4246
*/
4347

48+
protected
49+
parameter SI.Diameter D_eff=
50+
if abs(D_i - D_o)< C.eps then
51+
D_i
52+
else
53+
(D_i - D_o) / log(D_i/D_o) "Effective diameter for a linear taper";
54+
4455
initial equation
4556
if SteadyState then
4657
der(M) = 0;
4758
end if;
4859
equation
4960
Vdot = mdot / data.rho "Volumetric flow rate through the pipe";
50-
v = Vdot / A_ "Water velocity";
61+
v = Vdot / A_ "Average water velocity";
62+
v_o = Vdot / A_o "Outlet water velocity";
5163
M = data.rho * L * Vdot "Momentum of water";
5264
m = data.rho * A_ * L "Mass of water";
53-
F_f = Functions.DarcyFriction.Friction(v, D_, L, data.rho, data.mu, p_eps) "Friction force";
54-
der(M) = data.rho * Vdot ^ 2 * (1 / A_i - 1 / A_o) + p_i * A_i - p_o * A_o - F_f + m * data.g * cos_theta
55-
"momentum balance";
65+
F_f = Functions.DarcyFriction.Friction(v, D_eff, L, data.rho, data.mu, p_eps)
66+
"Friction force";
67+
F_taper = K_c * 0.5 * data.rho * A_o * v_o * abs(v_o)
68+
"Tapering (local contraction) loss";
69+
der(M) = data.rho * Vdot^2 * (1/A_i - 1/A_o)
70+
+ p_i * A_i - p_o * A_o
71+
- F_f - F_taper
72+
+ m * data.g * cos_theta
73+
"Momentum balance including tapering loss";
5674
p_i = i.p "Inlet pressure";
5775
p_o = o.p "Outlet pressure";
5876

@@ -81,6 +99,9 @@ equation
8199
(inlet and outlet pressure from connectors).</p>
82100
<p>It should be noted that this pipe model provides possibilities for modelling
83101
of pipes with both a positive and a negative slopes (positive or negative height difference).</p>
102+
<p>If the pipe is slightly tapered then this can be taken into account by adjusting
103+
<code>K_c</code> based on your taper geometry: 0.05–0.15 for gentle cones,
104+
up to 0.6 for sharp contractions.</p>
84105
<p>More info about the pipe model can be found in
85106
<a href=\"modelica://OpenHPL.UsersGuide.References\">[Vytvytskyi2017]</a>
86107
and <a href=\"modelica://OpenHPL.UsersGuide.References\">[Splavska2017a]</a>.</p>

0 commit comments

Comments
 (0)