Pipe

Create Function

For creating a single pipe:

If using a standard type:

For creating multiple pipes at once:

If using a standard type:

Component Table Data

net.pipe

Parameter

Datatype

Value Range

Explanation

name

string

Name of the pipe

from_junction

integer

\(>\) 0

Index of junction at which the pipe starts

to_junction

integer

\(>\) 0

Index of junction at which the pipe ends

std_type

string

A selected std type for the pipe

length_km

float

\(>\) 0

Length of the pipe [km]

diameter_m

float

\(\gt\) 0

Inner diameter of the pipe [m]

k_mm

float

\(\gt\) 0

Pipe roughness [mm]

loss_coefficient

float

\(\geq\) 0

An additional loss coefficient which might account for e.g. bends

alpha_w_per_m2k

float

\(\geq\) 0

Heat transfer coefficient [W/(m^2K)]

qext_w

float

\(>\) 0

An additional heat flow entering or leaving the pipe [W]

text_k

float

\(>\) 0

The ambient temperature used for calculating heat losses [K]

sections

integer

\(\geq\) 1

The number of internal pipe sections

in_service

boolean

True / False

Specifies if the line is in service.

type

string

Type variable to classify junctions

net.pipe_geodata

Parameter

Datatype

Explanation

coords

list

List of (x,y) tuples that mark the inflexion points of the pipe

Physical Model

For both the hydraulic and temperature calculation mode, the main function of the pipe element is to calculate pressure and heat losses, respectively.

Hydraulic mode

The following image shows the implemented pipe model with relevant quantities of the hydraulic calculations:

alternate Text

Losses are calculated in different ways for incompressible and compressible media. Please also note that for an incompressible fluid, the velocity along the pipe is constant. This is not the case for compressible fluids.

Incompressible media

The pressure loss for incompressible media is calculated according to the following formula:

\begin{align*} p_\text{loss} &= \rho \cdot g \cdot \Delta h - \frac{\rho \cdot \lambda(v) \cdot l \cdot v^2}{ 2 \cdot d} - \zeta \cdot \frac{\rho \cdot v^2}{2} \\ \end{align*}

Compressible media

For compressible media, the density is expressed with respect to a reference state using the law of ideal gases:

\begin{align*} \rho &= \frac{\rho_N \cdot p \cdot T_N}{T \cdot p_N} \\ \end{align*}

As reference state variables, the normal temperature and pressure are used by pandapipes. With this relation, also the pipe velocity can be expressed using reference values:

\begin{align*} v &= \frac{T \cdot p_N}{p \cdot T_N} \cdot v_N \\ \end{align*}

Inserting the equations from above in the differential equation for describing the pressure drop along a pipe results in the following formula, which is used by pandapipes to calculate the pressure drop for compressible media:

\begin{align*} \text{d}p_\text{loss} &= -\lambda(v) \cdot \frac{\rho_N \cdot v_N^2}{2 \cdot d}\cdot \frac{p_N}{p} \cdot \frac{T}{T_N} \cdot K \cdot \text{d}l \\ \end{align*}

The equation for pressure drop also introduces a variable K. This is the compressibility factor, which is used to account for real gas behaviour.

After calculating the gas network, the pressure losses and velocities for the reference state are known. During post processing, the reference velocities are recalculated according to

\begin{align*} v &= \frac{T \cdot p_N}{p \cdot T_N} \cdot v_N \\ \end{align*}

The equations from above were implemented following [EH90].

Because the velocity of a compressible fluid changes along the pipe axis, it is possible to split a pipe into several sections, increasing the internal resolution. The parameter sections is used to increase the amount of internal pipe sections.

Friction models

Three friction models are used to calculate the velocity dependent friction factor:

  • Nikuradse

  • Prandtl-Colebrook

  • Swamee-Jain

Nikuradse is chosen by default. In this case, the friction factor is calculated by:

\begin{align*} \lambda &= \frac{64}{Re} + \frac{1}{(-2 \cdot \log (\frac{k}{3.71 \cdot d}))^2}\\ \end{align*}

Note that in literature, Nikuradse is known as a model for turbulent flows. In pandapipes, the formula for the Nikuradse model is also applied for laminar flow.

If Prandtl-Colebrook is selected, the friction factor is calculated iteratively according to

\begin{align*} \frac{1}{\sqrt{\lambda}} &= -2 \cdot \log (\frac{2.51}{Re \cdot \sqrt{\lambda}} + \frac{k}{3.71 \cdot d})\\ \end{align*}

Equations for pressure losses due to friction were taken from [EH90] and [Cer08].

The equation according to Swamee-Jain [SJ76] is an approximation of the calculation method according to Prandtl-Colebrook. It is an explicit formula for the friction factor of the transition zone of turbulent flows in pipes and is defined as follows:

\begin{align*} \lambda &= \frac{0.25}{(\log(\frac{k}{3.7 \cdot d} + \frac{5.74}{Re^{0.9}}))^2}\\ \end{align*}

Heat transfer mode

The following image shows the implemented pipe model with relevant quantities of the heat transfer calculations:

alternate Text

For heat transfer, two effects are considered by the pipe element:

  • The heat loss due to a temperature difference between the pipe medium and the surrounding temperature is calculated

  • An additional heat in- or outflow can be specified by the user

The heat losses are described by

\begin{align*} Q_\text{loss} &= \alpha \cdot l \cdot \Pi \cdot d \cdot (T - T_\text{ext})\\ \end{align*}

according to [BS10]. If the default value of the sections parameter is changed, the resolution of temperature values can be increased.

Result Table Data

For incompressible media:

net.res_pipe

Parameter

Datatype

Explanation

v_mean_m_per_s

float

The mean pipe velocity [m/s]

p_from_bar

float

Pressure at “from”-junction [bar]

p_to_bar

float

Pressure at “to”-junction [bar]

t_from_k

float

Temperature at “from”-junction [K]

t_to_k

float

Temperature at “to”-junction [K]

mdot_from_kg_per_s

float

Mass flow into pipe [kg/s]

mdot_to_kg_per_s

float

Mass flow out of pipe [kg/s]

vdot_norm_m3_per_s

float

Norm volume flow [m^3/s]

reynolds

float

Average Reynolds number

lambda

float

Average pipe friction factor

For compressible media:

net.res_pipe

Parameter

Datatype

Explanation

v_from_m_per_s

float

The velocity at the pipe entry [m/s]

v_to_m_per_s

float

The velocity at the pipe exit [m/s]

v_mean_m_per_s

float

The mean pipe velocity [m/s]

p_from_bar

float

Pressure at “from”-junction [bar]

p_to_bar

float

Pressure at “to”-junction [bar]

t_from_k

float

Temperature at “from”-junction [K]

t_to_k

float

Temperature at “to”-junction [K]

mdot_from_kg_per_s

float

Mass flow into pipe [kg/s]

mdot_to_kg_per_s

float

Mass flow out of pipe [kg/s]

vdot_norm_m3_per_s

float

Norm volume flow [m^3/s]

reynolds

float

Average Reynolds number

lambda

float

Average pipe friction factor

normfactor_from

float

Normfactor to calculate real gas velocity at “from”-junction (only for gas flows)

normfactor_to

float

Normfactor to calculate real gas velocity at “to”-junction (only for gas flows)