Skip to content

Commit dd8a3da

Browse files
committed
Need some more testing
1 parent 24a0409 commit dd8a3da

File tree

3 files changed

+69
-47
lines changed

3 files changed

+69
-47
lines changed

OpenHPL/Resources/Documents/Developer_docs/OpenHPL_Pipe.tex

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,13 @@ \subsection{Friction loss of variable area pipe}
260260
\[
261261
F_{f}= f \cdot \left[\frac{2 \rho \cdot L \cdot Q^{2}}{A_{1} D_{1}} \right] \int_{0}^{1} \frac{1}{\left(1+\delta\cdot x \right)^{3}} dx
262262
\]
263+
264+
\[
265+
\int_{0}^{1} \frac{1}{\left(1+\delta\cdot x \right)^{3}} dx=\left[ \frac{-1}{(2\cdot d^{3}\cdot x^{2} + 4\cdot d^{2}\cdot x + 2\cdot d)}\right]_{0}^{1}
266+
\]
263267
%
264-
In principle the friction factor $f$ is a function of the Reynolds number $Re$ and relative roughness $\epsilon/D$. Ignoring this, and setting both to the constant value based on the mean value
268+
In principle the friction factor $f$ is a function of the Reynolds number $Re$ and relative roughness $\epsilon/D$. The Reynolds number depends on the local velocity (dependent on the local area) and the local diameter. In the current model this is ignored, and the mean velocity and diameter is used in the calculation.
269+
265270

266271
%
267272
\subsection{Kladd}
@@ -285,6 +290,35 @@ \subsection{Kladd}
285290
\[
286291
F_{f}= A \cdot \rho \cdot g \cdot h_{f}= \left[\frac{2 \rho \cdot L \cdot Q^{2}}{\pi} \right] \int \frac{1}{D^{3}(x)} dx
287292
\]
293+
\[
294+
F_{f}= A \cdot \rho \cdot g \cdot h_{f}= \left[\frac{2 \rho \cdot L \cdot Q^{2}}{\pi} \right] \int \frac{1}{D^{3}(x)} dx
295+
\]
296+
297+
\[
298+
F(x)=\int_{0}^{1} f(x)=\frac{-1}{(2\cdot d)\cdot (d^{2} + 2\cdot d + 1)} + \frac{1}{(2\cdot d)}
299+
\]
300+
301+
\[
302+
F(\delta )=\int_{0}^{1} f(x) dx =\frac{(d^{2} + 2\cdot d + 1)-1}{(2\cdot d)\cdot (d^{2} + 2\cdot d + 1)}
303+
\]
304+
305+
\[
306+
F(\delta )=\int_{0}^{1} f(x) dx =\frac{(\delta^{2} + 2\cdot \delta )}{(2\cdot \delta)\cdot (\delta^{2} + 2\cdot \delta + 1)}
307+
\]
308+
%
309+
\[
310+
F(\delta )=\int_{0}^{1} f(x) dx =\frac{(2\cdot \delta)\cdot (\frac{1}{2}\delta + 1 )}{(2\cdot \delta)\cdot (\delta^{2} + 2\cdot \delta + 1)}
311+
\]
312+
%
313+
\[
314+
F(\delta )=\int_{0}^{1} f(x) dx =\frac{(\frac{1}{2}\delta + 1 )}{(\delta^{2} + 2\cdot \delta + 1)}
315+
\]
316+
317+
%
318+
319+
\[
320+
F(0)=1
321+
\]
288322
%
289323
\bibliographystyle{plain}
290324
\bibliography{ohpl}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
set grid
3+
4+
f(x)=(x**2+2*x)/((2*x)*(x**2+2*x+1))
5+
6+
set xrange [-0.5:0.5]
7+
8+
plot f(x)
9+
10+
pause -1 "Hit return to continue"

OpenHPL/Waterway/Pipe.mo

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,89 +5,67 @@ model Pipe "Model of a pipe"
55
extends OpenHPL.Interfaces.ContactPort;
66

77
// Geometrical parameters of the pipe:
8-
parameter SI.Length H = 25 "Height difference from the inlet to the outlet" annotation (
8+
parameter SI.Length H = 10 "Height difference from the inlet to the outlet" annotation (
99
Dialog(group = "Geometry"));
10-
parameter SI.Length L = 6600 "Length of the pipe" annotation (
10+
parameter SI.Length L = 1000 "Length of the pipe" annotation (
1111
Dialog(group = "Geometry"));
12-
parameter SI.Diameter D_i = 5.8 "Diameter of the inlet side" annotation (
12+
parameter SI.Diameter D_i = 1.0 "Diameter of the inlet side" annotation (
1313
Dialog(group = "Geometry"));
1414
parameter SI.Diameter D_o = D_i "Diameter of the outlet side" annotation (
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"));
18+
//parameter Real K_c = 0.1 "Loss coefficient for contraction"
19+
// annotation (Dialog(group = "Geometry"));
2020
// Steady state:
2121
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
2222
parameter SI.VolumeFlowRate Vdot_0=data.Vdot_0 "Initial flow rate of the pipe" annotation (Dialog(group="Initialization"));
2323

24-
SI.Diameter D_ = sqrt((4/C.pi)*A_) "Average diameter";
25-
SI.Mass m "Water mass";
26-
SI.Area A_i = D_i ^ 2 * C.pi / 4 "Inlet cross-sectional area";
27-
SI.Area A_o = D_o ^ 2 * C.pi / 4 "Outlet cross-sectional area";
28-
SI.Area A_ = 0.5 * (A_i + A_o) "Average cross-sectional area";
2924

30-
Real cos_theta = H / L "Slope ratio";
3125
SI.Velocity v "Average Water velocity";
3226
SI.Force F_f "Friction force";
33-
SI.Force F_taper "Tape friction force";
27+
// SI.Force F_taper "Tape friction force";
3428
SI.Momentum M "Water momentum";
3529
SI.Pressure p_i "Inlet pressure";
3630
SI.Pressure p_o "Outlet pressure";
3731
SI.Pressure dp=p_o-p_i "Pressure difference across the pipe";
3832
SI.VolumeFlowRate Vdot(start = Vdot_0) "Volume flow rate";
3933
protected
4034
SI.Velocity v_o;
35+
parameter Real delta=(D_i-D_o)/D_i "Contraction factor";
36+
// parameter Real ddd=;
37+
parameter SI.Diameter D_ = sqrt((4/C.pi)*A_) "Average diameter";
38+
parameter SI.Mass m = data.rho * A_ * L "Mass of water";
39+
parameter SI.Area A_i = D_i ^ 2 * C.pi / 4 "Inlet cross-sectional area";
40+
parameter SI.Area A_o = D_o ^ 2 * C.pi / 4 "Outlet cross-sectional area";
41+
parameter SI.Area A_ = 0.5 * (A_i + A_o) "Average cross-sectional area";
42+
43+
parameter Real cos_theta = H / L "Slope ratio";
44+
45+
4146

42-
/* TBD:
43-
// temperature variation. Not finished...
44-
parameter Boolean TempUse = data.TempUse "If checked - the water temperature is not constant" annotation (Dialog(group = "Initialization"));
45-
parameter SI.Temperature T_0 = data.T_0 "Initial water temperature in the pipe" annotation (Dialog(group = "Initialization", enable = TempUse));
46-
Real W_f, W_e;
47-
SI.Temperature T( start = T_0);
48-
*/
49-
50-
protected
51-
parameter SI.Diameter D_eff=
52-
if D_i == D_o then
53-
D_i
54-
else
55-
(D_i - D_o) / log(D_i/D_o) "Effective diameter for a linear taper";
5647

5748
initial equation
5849
if SteadyState then
5950
der(M) = 0;
6051
end if;
52+
assert((D_i-D_o)/L > 0.1, "Change in pipe diameter too large",AssertionLevel.warning);
6153
equation
6254
Vdot = mdot / data.rho "Volumetric flow rate through the pipe";
6355
v = Vdot / A_ "Average water velocity";
6456
v_o = Vdot / A_o "Outlet water velocity";
6557
M = data.rho * L * Vdot "Momentum of water";
66-
m = data.rho * A_ * L "Mass of water";
67-
F_f = Functions.DarcyFriction.Friction(v, D_eff, L, data.rho, data.mu, p_eps)
68-
"Friction force";
69-
F_taper = K_c * 0.5 * data.rho * A_o * v_o * abs(v_o)
70-
"Tapering (local contraction) loss";
58+
59+
F_f = Functions.DarcyFriction.Friction(v, D_, L, data.rho, data.mu, p_eps)*((0.5*delta+1)/(delta^2+2*delta+1)) "Friction force";
60+
7161
der(M) = data.rho * Vdot^2 * (1/A_i - 1/A_o)
7262
+ p_i * A_i - p_o * A_o
73-
- F_f - F_taper
74-
+ m * data.g * cos_theta
75-
"Momentum balance including tapering loss";
63+
- F_f
64+
+ m * data.g * cos_theta "Momentum balance including friction loss";
65+
7666
p_i = i.p "Inlet pressure";
7767
p_o = o.p "Outlet pressure";
7868

79-
/* TBD:
80-
// possible temperature variation implementation. Not finished...
81-
W_f = -F_f * v;
82-
W_e = Vdot * (p_i- p_o);
83-
if TempUse then
84-
data.c_p * m * der(T) = Vdot * data.rho * data.c_p * (p.T - T) + W_e - W_f;
85-
0 = Vdot * data.rho * data.c_p * (p.T - n.T) + W_e - W_f;
86-
else
87-
der(n.T) = 0;
88-
end if;
89-
n.T = T;
90-
*/
9169
annotation (
9270
Documentation(info="<html><p>The simple model of the pipe gives possibilities
9371
for easy modelling of different conduit: intake race, penstock, tail race, etc.</p>

0 commit comments

Comments
 (0)