# Pipe (IL)

**Libraries:**

Simscape /
Foundation Library /
Isothermal Liquid /
Elements

## Description

The Pipe (IL) block models pipe flow dynamics in an isothermal liquid network. The block accounts for viscous friction losses, and can also account for dynamic compressibility and fluid inertia.

The pipe contains a constant volume of liquid. The liquid experiences pressure losses due to viscous friction, following the Darcy-Weisbach equation.

### Pipe Effects

The block lets you include dynamic compressibility and fluid inertia effects. Turning on each of these effects can improve model fidelity at the cost of increased equation complexity and potentially increased simulation cost:

When dynamic compressibility is off, the liquid is assumed to spend negligible time in the pipe volume. Therefore, there is no accumulation of mass in the pipe, and mass inflow equals mass outflow. This is the simplest option. It is appropriate when the liquid mass in the pipe is a negligible fraction of the total liquid mass in the system.

When dynamic compressibility is on, an imbalance of mass inflow and mass outflow can cause liquid to accumulate or diminish in the pipe. As a result, pressure in the pipe volume can rise and fall dynamically, which provides some compliance to the system and modulates rapid pressure changes. This is the default option.

If dynamic compressibility is on, you can also turn on fluid inertia. This effect results in additional flow resistance, besides the resistance due to friction. This additional resistance is proportional to the rate of change of mass flow rate. Accounting for fluid inertia slows down rapid changes in flow rate but can also cause the flow rate to overshoot and oscillate. This option is appropriate in a very long pipe. Turn on fluid inertia and connect multiple pipe segments in series to model the propagation of pressure waves along the pipe, such as in the water hammer phenomenon.

### Mass Balance

The mass conservation equation for the pipe is

$${\dot{m}}_{\text{A}}+{\dot{m}}_{\text{B}}=\{\begin{array}{cc}0,& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{dynamic}\text{\hspace{0.17em}}\text{compressibility}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{off}\\ \frac{{\dot{p}}_{I}}{{\beta}_{I}}{\rho}_{I}V,& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{dynamic}\text{\hspace{0.17em}}\text{compressibility}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{on}\end{array}$$

where:

$${\dot{m}}_{\text{A}}$$ and $${\dot{m}}_{\text{B}}$$ are the mass flow rates through ports

**A**and**B**.*V*is the pipe fluid volume.*p*_{I}is the pressure inside the pipe.*ρ*_{I}is the fluid density inside the pipe.*β*_{I}is the fluid bulk modulus inside the pipe.

The fluid can be a mixture of pure liquid and a small amount of entrained air, as
specified by the Isothermal Liquid Properties (IL) block
connected to the circuit. Equations used to compute
*ρ*_{I} and
*β*_{I}, as well as port densities
*ρ*_{A} and
*ρ*_{B} in the viscous friction pressure loss
equations for each half pipe, depend on the selected isothermal liquid model. For detailed
information, see Isothermal Liquid Modeling Options.

### Momentum Balance

The table shows the momentum conservation equations for each half pipe.

For half pipe adjacent to port A |
$${p}_{A}-{p}_{I}=\{\begin{array}{cc}\Delta {p}_{\text{v,A}},& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{inertia}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{off}\\ \Delta {p}_{\text{v,A}}+\frac{L}{2S}{\ddot{m}}_{\text{A}},& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{inertia}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{on}\end{array}$$ |

For half pipe adjacent to port B |
$${p}_{B}-{p}_{I}=\{\begin{array}{cc}\Delta {p}_{\text{v,B}},& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{inertia}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{off}\\ \Delta {p}_{\text{v,B}}+\frac{L}{2S}{\ddot{m}}_{\text{B}},& \text{if}\text{\hspace{0.17em}}\text{fluid}\text{\hspace{0.17em}}\text{inertia}\text{\hspace{0.17em}}\text{is}\text{\hspace{0.17em}}\text{on}\end{array}$$ |

In the equations:

*p*,*p*_{A}, and*p*_{B}are the liquid pressures at port**A**and port**B**, respectively.*Δp*_{v,A}and*Δp*_{v,B}are the viscous friction pressure losses between the pipe volume center and ports**A**and**B**.*L*is the pipe length.*S*is the pipe cross-sectional area.

### Viscous Friction Pressure Losses

The table shows the viscous friction pressure loss equations for each half pipe.

For half pipe adjacent to port A |
$$\Delta {p}_{\text{v,A}}=\{\begin{array}{cc}\lambda \mu \left(\frac{L+{L}_{\text{eq}}}{\text{2}}\right)\frac{{\dot{m}}_{\text{A}}}{2{\rho}_{I}{D}_{h}{}^{2}S},& \text{if}\text{\hspace{0.17em}}{\text{Re}}_{\text{A}}<{\text{Re}}_{\text{lam}}\\ {f}_{\text{A}}\left(\frac{L+{L}_{\text{eq}}}{2}\right)\frac{{\dot{m}}_{\text{A}}\left|{\dot{m}}_{\text{A}}\right|}{2{\rho}_{I}{D}_{h}{S}^{2}},& {\text{ifRe}}_{\text{A}}{\text{Re}}_{\text{tur}}\end{array}$$ |

For half pipe adjacent to port B |
$$\Delta {p}_{\text{v,B}}=\{\begin{array}{cc}\lambda \mu \left(\frac{L+{L}_{\text{eq}}}{\text{2}}\right)\frac{{\dot{m}}_{\text{B}}}{2{\rho}_{I}{D}_{h}{}^{2}S},& \text{if}\text{\hspace{0.17em}}{\text{Re}}_{\text{B}}<{\text{Re}}_{\text{lam}}\\ {f}_{\text{B}}\left(\frac{L+{L}_{\text{eq}}}{2}\right)\frac{{\dot{m}}_{\text{B}}\left|{\dot{m}}_{\text{B}}\right|}{2{\rho}_{I}{D}_{h}{S}^{2}},& {\text{ifRe}}_{\text{B}}\ge {\text{Re}}_{\text{tur}}\end{array}$$ |

In the equations:

*λ*is the pipe shape factor, used to calculate the Darcy friction factor in the laminar regime.*μ*is the dynamic viscosity of the liquid in the pipe.*L*_{eq}is the aggregate equivalent length of the local pipe resistances.*D*_{h}is the hydraulic diameter of the pipe.*f*_{A}and*f*_{B}are the Darcy friction factors in the pipe halves adjacent to ports**A**and**B**.*Re*_{A}and*Re*_{B}are the Reynolds numbers at ports**A**and**B**.*Re*_{lam}is the Reynolds number above which the flow transitions to turbulent.*Re*_{tur}is the Reynolds number below which the flow transitions to laminar.

When the Reynolds number is between *Re*_{lam} and
*Re*_{tur}, the flow is in transition between laminar
flow and turbulent flow. The pressure losses due to viscous friction during the transition
region follow a smooth connection between those in the laminar flow regime and those in the
turbulent flow regime.

The block computes the Reynolds numbers at ports **A** and
**B** based on the mass flow rate through the appropriate port:

$$\mathrm{Re}=\frac{\left|\dot{m}\right|{D}_{h}}{\mu S}.$$

The Darcy friction factors follow from the Haaland approximation for the turbulent regime:

$$f=\frac{1}{{\left(-1.8{\mathrm{log}}_{10}\left(\frac{6.9}{\mathrm{Re}}+{\left(\frac{1}{3.7}\frac{r}{{D}_{h}}\right)}^{1.11}\right)\right)}^{2}},$$

where:

*f*is the Darcy friction factor.*r*is the pipe surface roughness.

### Assumptions and Limitations

The pipe wall is rigid.

The flow is fully developed.

The effect of gravity is negligible.

## Ports

### Conserving

## Parameters

## References

[1] White, F. M., *Fluid
Mechanics*. 7th Ed, Section 6.8. McGraw-Hill, 2011.

## Extended Capabilities

## Version History

**Introduced in R2020a**