Skip to content

Commit 75c65f7

Browse files
committed
Added documentation of branch development
1 parent ac0f435 commit 75c65f7

File tree

3 files changed

+284
-0
lines changed

3 files changed

+284
-0
lines changed
48.7 KB
Loading
Lines changed: 41 additions & 0 deletions
Loading
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
\documentclass[a4paper,11pt]{article}
2+
%
3+
\usepackage[UKenglish]{babel}
4+
\usepackage{graphicx}
5+
\usepackage{amsmath}
6+
\usepackage{float}
7+
\usepackage{listings}
8+
\usepackage{dtsyntax}
9+
\usepackage{svg}
10+
\usepackage{verbatim}
11+
%
12+
\restylefloat{figure}
13+
\DeclareGraphicsExtensions{.png,.jpg}
14+
%
15+
%
16+
%opening
17+
\title{OpenHPL - Correction of pipe model}
18+
\author{BB}
19+
%
20+
\begin{document}
21+
\lstset{language=modelica}
22+
23+
\maketitle
24+
25+
26+
27+
\begin{abstract}
28+
The OpenHPL class \texttt{Pipe} implements a rigid water pipe model. The current implementation have certain issues. In the following note a revision is proposed.
29+
This includes a class of test cases.
30+
\end{abstract}
31+
%
32+
\tableofcontents
33+
%
34+
\section{Introduction}
35+
% https://docs.bentley.com/LiveContent/web/Bentley%20HAMMER%20SS6-v1/en/GUID-F87F1515-85CE-4FF3-9C5F-3AD5E427F125.html
36+
% https://ocw.snu.ac.kr/sites/default/files/NOTE/HD%20Ch6-LC9.pdf
37+
%
38+
In the following transient change of pressure in a pipe is discussed. When the change is slow compared to the speed of sound, the elastic pressures waves in the medium can be ignored. This approach is often denoted rigid water column and implies that the instantaneous flow rate is constant in all cross sections in the pipe
39+
\footnote{Since the compressibility of the medium is assumed to be constant, the density and hence the mass flow is also constant in all cross sections.}.
40+
The rigid water column momentum equation can be derived from Newtons first law:
41+
\[
42+
F=m\cdot a
43+
\]
44+
Writing out this relation for the pipe in figure \ref{fig:pipe} yields
45+
\[
46+
\left(p_{1}+\rho \cdot g \cdot H \right)\cdot A_{1} - p_{2}\cdot A_{2} -F_{f} = \left(\rho\cdot \overline{A} \cdot L \right) \frac{dv}{dt}
47+
\]
48+
where $F_{f}$ is the total friction force along the pipe and $\overline{A} $ is the average area such that the total mass of water $M$ is $M=\overline{A} \cdot L$ (see also \ref{sec:d_and_a})).
49+
% loss for a straight pipe with reference diameter $\tilde{D}$ and $F_{c}$ is the additional friction force due to the change in diameter.
50+
Since OpenHPL is formulated with the mass flow $m=\rho \cdot q =\rho \cdot A \cdot v$ the above can be rewritten as
51+
\[
52+
\left(p_{1}+\rho \cdot g \cdot H \right)\cdot A_{1} - p_{2}\cdot A_{2} - F_{f}= L \cdot \frac{dm}{dt}
53+
\]
54+
\subsection{Friction force}
55+
%
56+
In principle the friction force is found by integrating the wall shear force $\tau_{w}$ along the all surfaces. For constant diameter pipe the traditional approach is to express this friction loss through the semi-empirical head loss formula
57+
\[
58+
F_{f}= A \cdot \rho \cdot g \cdot h_{f}= A \cdot \rho \cdot g \left[ f \cdot \left(\frac{L}{D}\right) \frac{v^{2}}{2g} \right]
59+
\]
60+
where $f$ is the friction factor, commonly taken from the Moody diagram or various approximations to the Moody diagram
61+
%
62+
\begin{figure}[H] % The figure environment allows for captioning and floating
63+
\centering % Centers the image within the figure environment
64+
\includegraphics[width=0.9\textwidth]{01_pipe.png}
65+
\caption{Consider a pipe with inlet diameter $D_1$ and outlet diameter $D_2$ and length $L$.} % Caption for the image
66+
\label{fig:pipe} % Label for cross-referencing
67+
\end{figure}
68+
%
69+
\subsection{Area change/conical pipe}
70+
%
71+
If the pipe is strongly conical (either diverging or converging) special loss models must be used as the
72+
73+
\section{Today's implementation}
74+
\begin{comment}
75+
\begin{lstlisting}
76+
within OpenHPL.Waterway;
77+
model Pipe "Model of a pipe"
78+
outer Data data "Using standard data set";
79+
extends OpenHPL.Icons.Pipe;
80+
extends OpenHPL.Interfaces.ContactPort;
81+
82+
// Geometrical parameters of the pipe:
83+
parameter SI.Length H = 25 "Height difference from the inlet to the outlet" annotation (
84+
Dialog(group = "Geometry"));
85+
parameter SI.Length L = 6600 "Length of the pipe" annotation (
86+
Dialog(group = "Geometry"));
87+
parameter SI.Diameter D_i = 5.8 "Diameter of the inlet side" annotation (
88+
Dialog(group = "Geometry"));
89+
parameter SI.Diameter D_o = D_i "Diameter of the outlet side" annotation (
90+
Dialog(group = "Geometry"));
91+
parameter SI.Height p_eps (displayUnit = "mm") = 1e-5 "Pipe roughness height" annotation (
92+
Dialog(group = "Geometry"));
93+
parameter Real K_c = 0.1 "Loss coefficient for contraction"
94+
annotation (Dialog(group = "Geometry"));
95+
// Steady state:
96+
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
97+
parameter SI.VolumeFlowRate Vdot_0=data.Vdot_0 "Initial flow rate of the pipe" annotation (Dialog(group="Initialization"));
98+
99+
SI.Diameter D_ = 0.5 * (D_i + D_o) "Average diameter";
100+
SI.Mass m "Water mass";
101+
SI.Area A_i = D_i ^ 2 * C.pi / 4 "Inlet cross-sectional area";
102+
SI.Area A_o = D_o ^ 2 * C.pi / 4 "Outlet cross-sectional area";
103+
SI.Area A_ = D_ ^ 2 * C.pi / 4 "Average cross-sectional area";
104+
Real cos_theta = H / L "Slope ratio";
105+
SI.Velocity v "Water velocity";
106+
SI.Velocity v_o "Outlet water velocity";
107+
SI.Force F_f "Friction force";
108+
SI.Force F_taper "Taper friction force";
109+
SI.Momentum M "Water momentum";
110+
SI.Pressure p_i "Inlet pressure";
111+
SI.Pressure p_o "Outlet pressure";
112+
SI.Pressure dp=p_o-p_i "Pressure difference across the pipe";
113+
SI.VolumeFlowRate Vdot(start = Vdot_0) "Volume flow rate";
114+
115+
116+
117+
protected
118+
parameter SI.Diameter D_eff=
119+
if D_i == D_o then
120+
D_i
121+
else
122+
(D_i - D_o) / log(D_i/D_o) "Effective diameter for a linear taper";
123+
124+
initial equation
125+
if SteadyState then
126+
der(M) = 0;
127+
end if;
128+
equation
129+
Vdot = mdot / data.rho "Volumetric flow rate through the pipe";
130+
v = Vdot / A_ "Average water velocity";
131+
v_o = Vdot / A_o "Outlet water velocity";
132+
M = data.rho * L * Vdot "Momentum of water";
133+
m = data.rho * A_ * L "Mass of water";
134+
F_f = Functions.DarcyFriction.Friction(v, D_eff, L, data.rho, data.mu, p_eps)
135+
"Friction force";
136+
F_taper = K_c * 0.5 * data.rho * A_o * v_o * abs(v_o)
137+
"Tapering (local contraction) loss";
138+
der(M) = data.rho * Vdot^2 * (1/A_i - 1/A_o)
139+
+ p_i * A_i - p_o * A_o
140+
- F_f - F_taper
141+
+ m * data.g * cos_theta
142+
"Momentum balance including tapering loss";
143+
p_i = i.p "Inlet pressure";
144+
p_o = o.p "Outlet pressure";
145+
146+
147+
end Pipe;
148+
149+
150+
\end{lstlisting}
151+
\end{comment}
152+
153+
%
154+
155+
\section{New implementation}
156+
157+
Overall goal and checks:
158+
\begin{enumerate}
159+
\item When inlet and outlet diameter is the same, should be identical to "simple pipe"
160+
\item
161+
\end{enumerate}
162+
%
163+
\section{Future development}
164+
%
165+
\bibliographystyle{plain}
166+
\bibliography{ohpl}
167+
%
168+
\appendix
169+
%
170+
\section{On diameter and area}
171+
\label{sec:d_and_a}
172+
%
173+
Consider the pipe in figure \ref{fig:pipe_apendix} with inlet and outlet diameter $D_1$ and $D_2$. The corresponding areas are $A_1$ and $A_2$.
174+
The average diameter $\overline{D}$ is
175+
\[
176+
\overline{D}=\frac{1}{2}\left(D_1 + D_2\right)
177+
\]
178+
The average area $\overline{A}$ is
179+
\[
180+
\overline{A}=\frac{1}{2}\left(A_1 + A_2\right)
181+
\]
182+
Since the area is a quadratic function of diameter, the mean area $\overline{A}$ is different than the area of the mean diameter. In the model
183+
\[
184+
\tilde{D}=\sqrt{\frac{4}{\pi}\overline{A}}
185+
\]
186+
%
187+
\subsection{Further details}
188+
%
189+
%
190+
Introducing $D_1=D$ and $D_2=\delta \cdot D$, the average diameter can be written as
191+
%
192+
\[
193+
\overline{D}=\frac{\left(1+\delta\right)}{2}\cdot D
194+
\]
195+
%
196+
The average area can be written as
197+
%
198+
\[
199+
\overline{A}=\frac{\pi}{4}\cdot D^{2} \cdot \frac{\left(1 +\delta^{2}\right)}{2}
200+
\]
201+
%
202+
The area, based on the average diameter can be written as
203+
\[
204+
A\left(\overline{D}\right)=\frac{\pi}{4}\cdot D^{2}\cdot \frac{\left(1+2\delta+\delta^2\right)}{4}
205+
\]
206+
\[
207+
A\left(\overline{D}\right)=\frac{\pi}{4}\left(\frac{1}{2}\left(D_1 + D_2\right)\right)^{2}=\frac{\pi}{4}\cdot\frac{1}{4}\left(D_{1}^{2} + 2 D_{1} D_{2} + D_{2}^{2}\right)=
208+
\]
209+
210+
211+
212+
213+
%
214+
\begin{figure}[H] % The figure environment allows for captioning and floating
215+
\centering % Centers the image within the figure environment
216+
\includegraphics[width=0.9\textwidth]{01_pipe.png}
217+
\caption{Consider a pipe with inlet diameter $D_1$ and outlet diameter $D_2$ and length $L$.} % Caption for the image
218+
\label{fig:pipe_apendix} % Label for cross-referencing
219+
\end{figure}
220+
%
221+
\subsection{Friction loss of variable area pipe}
222+
%
223+
In general it is difficult to find a closed form equation for the friction force for a pipe with varying area that is completely universal.
224+
%
225+
\[
226+
F_{f}= A \cdot \rho \cdot g \cdot h_{f}= A \cdot \rho \cdot g \left[ f \cdot \left(\frac{L}{D}\right) \frac{v^{2}}{2g} \right] =\frac{1}{A} \cdot \rho \cdot g \left[ f \left(\frac{L}{D}\right) \frac{Q^{2}}{2g} \right]
227+
\]
228+
Assuming a linear diameter distribution from the inlet to the outlet
229+
\[
230+
D\left(x\right)=D_{1}+\frac{\left(D_{2}-D_{1} \right)}{L}\cdot x
231+
\]
232+
or
233+
\[
234+
D\left(x\right)=D_{1}+\frac{\left(D_{2}-D_{1} \right)}{L}\cdot x
235+
\]
236+
%
237+
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
238+
239+
%
240+
%
241+
\bibliographystyle{plain}
242+
\bibliography{ohpl}
243+
\end{document}

0 commit comments

Comments
 (0)