Rigid conduit for gas flow

**Library:**Simscape / Foundation Library / Gas / Elements

The Pipe (G) block models pipe flow dynamics in a gas network. The block accounts for viscous friction losses and convective heat transfer with the pipe wall. The pipe contains a constant volume of gas. The pressure and temperature evolve based on the compressibility and thermal capacity of this gas volume. Choking occurs when the outlet reaches the sonic condition.

Gas flow through this block can choke. If a Mass Flow Rate Source (G) block or a Controlled Mass Flow Rate Source (G) block connected to the Pipe (G) block specifies a greater mass flow rate than the possible choked mass flow rate, you get a simulation error. For more information, see Choked Flow.

Mass conservation relates the mass flow rates to the dynamics of the pressure and temperature of the internal node representing the gas volume:

$$\frac{\partial M}{\partial p}\cdot \frac{d{p}_{I}}{dt}+\frac{\partial M}{\partial T}\cdot \frac{d{T}_{I}}{dt}={\dot{m}}_{A}+{\dot{m}}_{B}$$

where:

$$\frac{\partial M}{\partial p}$$ is the partial derivative of the mass of the gas volume with respect to pressure at constant temperature and volume.

$$\frac{\partial M}{\partial T}$$ is the partial derivative of the mass of the gas volume with respect to temperature at constant pressure and volume.

*p*_{I}is the pressure of the gas volume.*T*_{I}is the temperature of the gas volume.*t*is time.$$\dot{m}$$

_{A}and $$\dot{m}$$_{B}are mass flow rates at ports A and B, respectively. Flow rate associated with a port is positive when it flows into the block.

Energy conservation relates the energy and heat flow rates to the dynamics of the pressure and temperature of the internal node representing the gas volume:

$$\frac{\partial U}{\partial p}\cdot \frac{d{p}_{I}}{dt}+\frac{\partial U}{\partial T}\cdot \frac{d{T}_{I}}{dt}={\Phi}_{A}+{\Phi}_{B}+{Q}_{H}$$

where:

$$\frac{\partial U}{\partial p}$$ is the partial derivative of the internal energy of the gas volume with respect to pressure at constant temperature and volume.

$$\frac{\partial U}{\partial T}$$ is the partial derivative of the internal energy of the gas volume with respect to temperature at constant pressure and volume.

Φ

_{A}and Φ_{B}are energy flow rates at ports A and B, respectively.*Q*_{H}is heat flow rate at port H.

The partial derivatives of the mass *M* and
the internal energy *U* of the gas volume with respect
to pressure and temperature at constant volume depend on the gas property
model. For perfect and semiperfect gas models, the equations are:

$$\begin{array}{l}\frac{\partial M}{\partial p}=V\frac{{\rho}_{I}}{{p}_{I}}\\ \frac{\partial M}{\partial T}=-V\frac{{\rho}_{I}}{{T}_{I}}\\ \frac{\partial U}{\partial p}=V\left(\frac{{h}_{I}}{ZR{T}_{I}}-1\right)\\ \frac{\partial U}{\partial T}=V{\rho}_{I}\left({c}_{pI}-\frac{{h}_{I}}{{T}_{I}}\right)\end{array}$$

where:

*ρ*_{I}is the density of the gas volume.*V*is the volume of gas.*h*_{I}is the specific enthalpy of the gas volume.*Z*is the compressibility factor.*R*is the specific gas constant.*c*_{pI}is the specific heat at constant pressure of the gas volume.

For real gas model, the partial derivatives of the mass *M* and
the internal energy *U* of the gas volume with respect
to pressure and temperature at constant volume are:

$$\begin{array}{l}\frac{\partial M}{\partial p}=V\frac{{\rho}_{I}}{{\beta}_{I}}\\ \frac{\partial M}{\partial T}=-V{\rho}_{I}{\alpha}_{I}\\ \frac{\partial U}{\partial p}=V\left(\frac{{\rho}_{I}{h}_{I}}{{\beta}_{I}}-{T}_{I}{\alpha}_{I}\right)\\ \frac{\partial U}{\partial T}=V{\rho}_{I}\left({c}_{pI}-{h}_{I}{\alpha}_{I}\right)\end{array}$$

where:

*β*is the isothermal bulk modulus of the gas volume.*α*is the isobaric thermal expansion coefficient of the gas volume.

The momentum balance for each half of the pipe models the pressure drop due to momentum flux and viscous friction:

$$\begin{array}{l}{p}_{A}-{p}_{I}={\left(\frac{{\dot{m}}_{A}}{S}\right)}^{2}\cdot \left(\frac{1}{{\rho}_{I}}-\frac{1}{{\rho}_{A}}\right)+\Delta {p}_{AI}\\ {p}_{B}-{p}_{I}={\left(\frac{{\dot{m}}_{B}}{S}\right)}^{2}\cdot \left(\frac{1}{{\rho}_{I}}-\frac{1}{{\rho}_{B}}\right)+\Delta {p}_{BI}\end{array}$$

where:

*p*is the gas pressure at port A, port B, or internal node I, as indicated by the subscript.*ρ*is the density at port A, port B, or internal node I, as indicated by the subscript.*S*is the cross-sectional area of the pipe.*Δp*_{AI}and*Δp*_{BI}are pressure losses due to viscous friction.

The heat exchanged with the pipe wall through port H is added to the energy of gas volume represented by the internal node via the energy conservation equation (see Energy Balance). Therefore, the momentum balances for each half of the pipe, between port A and the internal node and between port B and the internal node, are assumed to be adiabatic processes. The adiabatic relations are:

$$\begin{array}{l}{h}_{A}+\frac{1}{2}{\left(\frac{{\dot{m}}_{A}}{{\rho}_{A}S}\right)}^{2}={h}_{I}+\frac{1}{2}{\left(\frac{{\dot{m}}_{A}}{{\rho}_{I}S}\right)}^{2}\\ {h}_{B}+\frac{1}{2}{\left(\frac{{\dot{m}}_{B}}{{\rho}_{B}S}\right)}^{2}={h}_{I}+\frac{1}{2}{\left(\frac{{\dot{m}}_{B}}{{\rho}_{I}S}\right)}^{2}\end{array}$$

where *h* is the specific enthalpy at port
A, port B, or internal node I, as indicated by the subscript.

The pressure losses due to viscous friction, *Δp*_{AI} and *Δp*_{BI},
depend on the flow regime. The Reynolds numbers for each half of the
pipe are defined as:

$$\begin{array}{l}{\mathrm{Re}}_{A}=\frac{\left|{\dot{m}}_{A}\right|\cdot {D}_{h}}{S\cdot {\mu}_{I}}\\ {\mathrm{Re}}_{B}=\frac{\left|{\dot{m}}_{B}\right|\cdot {D}_{h}}{S\cdot {\mu}_{I}}\end{array}$$

where:

*D*_{h}is the hydraulic diameter of the pipe.*μ*_{I}is the dynamic viscosity at internal node.

If the Reynolds number is less than the **Laminar flow
upper Reynolds number limit** parameter value, then the flow
is in the laminar flow regime. If the Reynolds number is greater than
the **Turbulent flow lower Reynolds number limit** parameter
value, then the flow is in the turbulent flow regime.

In the laminar flow regime, the pressure losses due to viscous friction are:

$$\begin{array}{l}\Delta {p}_{A{I}_{lam}}={f}_{shape}\frac{{\dot{m}}_{A}\cdot {\mu}_{I}}{2{\rho}_{I}\cdot {D}_{h}^{2}\cdot S}\cdot \frac{L+{L}_{eqv}}{2}\\ \Delta {p}_{B{I}_{lam}}={f}_{shape}\frac{{\dot{m}}_{B}\cdot {\mu}_{I}}{2{\rho}_{I}\cdot {D}_{h}^{2}\cdot S}\cdot \frac{L+{L}_{eqv}}{2}\end{array}$$

where:

*f*_{shape}is the**Shape factor for laminar flow viscous friction**parameter value.*L*_{eqv}is the**Aggregate equivalent length of local resistances**parameter value.

In the turbulent flow regime, the pressure losses due to viscous friction are:

$$\begin{array}{l}\Delta {p}_{A{I}_{tur}}={f}_{Darc{y}_{A}}\frac{{\dot{m}}_{A}\cdot \left|{\dot{m}}_{A}\right|}{2{\rho}_{I}\cdot {D}_{h}\cdot {S}^{2}}\cdot \frac{L+{L}_{eqv}}{2}\\ \Delta {p}_{B{I}_{tur}}={f}_{Darc{y}_{B}}\frac{{\dot{m}}_{B}\cdot \left|{\dot{m}}_{B}\right|}{2{\rho}_{I}\cdot {D}_{h}\cdot {S}^{2}}\cdot \frac{L+{L}_{eqv}}{2}\end{array}$$

where *f*_{Darcy} is the
Darcy friction factor at port A or B, as indicated by the subscript.

The Darcy friction factors are computed from the Haaland correlation:

$$\begin{array}{l}{f}_{Darc{y}_{A}}={\left[-1.8\mathrm{log}\left(\frac{6.9}{{\mathrm{Re}}_{A}}+{\left(\frac{{\epsilon}_{rough}}{3.7{D}_{h}}\right)}^{1.11}\right)\right]}^{-2}\\ {f}_{Darc{y}_{B}}={\left[-1.8\mathrm{log}\left(\frac{6.9}{{\mathrm{Re}}_{B}}+{\left(\frac{{\epsilon}_{rough}}{3.7{D}_{h}}\right)}^{1.11}\right)\right]}^{-2}\end{array}$$

where *ε*_{rough} is
the **Internal surface absolute roughness** parameter
value.

When the Reynolds number is between the **Laminar flow
upper Reynolds number limit** and the **Turbulent
flow lower Reynolds number limit** parameter values, 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 convective heat transfer equation between the pipe wall and the gas volume is:

$${Q}_{H}={h}_{coeff}\left(\frac{4SL}{{D}_{h}}\right)\left({T}_{H}-{T}_{I}\right)$$

The heat transfer coefficient, *h*_{coeff},
depends on the Nusselt number:

$${h}_{coeff}=\left(\frac{N{u}_{A}+N{u}_{B}}{2}\right)\frac{{k}_{I}}{{D}_{h}}$$

The Nusselt numbers, *Nu*_{A} and *Nu*_{B},
depend on the flow regime. The Nusselt numbers in the laminar flow
regime are constant and equal to the **Nusselt number for
laminar flow heat transfer** parameter value. The Nusselt
numbers in the turbulent flow regime are computed from the Gnielinski
correlation:

$$\begin{array}{l}N{u}_{{A}_{tur}}=\frac{\frac{{f}_{Darc{y}_{A}}}{8}\left({\mathrm{Re}}_{A}-1000\right){\mathrm{Pr}}_{I}}{1+12.7\sqrt{\frac{{f}_{Darc{y}_{A}}}{8}}\left({\mathrm{Pr}}_{I}^{2/3}-1\right)}\\ N{u}_{{B}_{tur}}=\frac{\frac{{f}_{Darc{y}_{B}}}{8}\left({\mathrm{Re}}_{B}-1000\right){\mathrm{Pr}}_{I}}{1+12.7\sqrt{\frac{{f}_{Darc{y}_{B}}}{8}}\left({\mathrm{Pr}}_{I}^{2/3}-1\right)}\end{array}$$

where *Pr* is the Prandtl number, *Pr* =* c*_{p}*μ*/*k*. *k* is
thermal conductivity.

The Nusselt numbers during the transition region follow a smooth connection between those in the laminar flow regime and those in the turbulent flow regime.

The choked mass flow rates out of the pipe at ports A and B are:

$$\begin{array}{l}{\dot{m}}_{{A}_{choked}}={\rho}_{A}\cdot {a}_{A}\cdot S\\ {\dot{m}}_{{B}_{choked}}={\rho}_{B}\cdot {a}_{B}\cdot S\end{array}$$

where *a*_{A} and *a*_{B} is
the speed of sound at ports A and B, respectively.

The unchoked pressure at port A or B is the value of the corresponding Across variable at that port:

$$\begin{array}{l}{p}_{{A}_{unchoked}}=\text{A}\text{.p}\\ {p}_{{B}_{unchoked}}=\text{B}\text{.p}\end{array}$$

The choked pressures at ports A and B are obtained by substituting the choked mass flow rates into the momentum balance equations for the pipe:

$$\begin{array}{l}{p}_{{A}_{choked}}={p}_{I}+{\left(\frac{{\dot{m}}_{{A}_{choked}}}{S}\right)}^{2}\cdot \left(\frac{1}{{\rho}_{I}}-\frac{1}{{\rho}_{A}}\right)+\Delta {p}_{A{I}_{choked}}\\ {p}_{{B}_{choked}}={p}_{I}+{\left(\frac{{\dot{m}}_{{B}_{choked}}}{S}\right)}^{2}\cdot \left(\frac{1}{{\rho}_{I}}-\frac{1}{{\rho}_{B}}\right)+\Delta {p}_{B{I}_{choked}}\end{array}$$

*Δp*_{AIchoked} and *Δp*_{BIchoked} are
the pressure losses due to viscous friction, assuming that the choking
has occurred. They are computed similar to *Δp*_{AI} and *Δp*_{BI},
with the mass flow rates at ports A and B replaced by the choked mass
flow rate values.

Depending on whether choking has occurred, the block assigns
either the choked or unchoked pressure value as the actual pressure
at the port. Choking can occur at the pipe outlet, but not at the
pipe inlet. Therefore, if *p*_{Aunchoked} ≥ *p*_{I},
then port A is an inlet and *p*_{A} = *p*_{Aunchoked}.
If *p*_{Aunchoked} < *p*_{I},
then port A is an outlet and

$${p}_{A}=\{\begin{array}{ll}{p}_{{A}_{unchoked}},\hfill & \text{if}{p}_{{A}_{unchoked}}\ge {p}_{{A}_{choked}}\hfill \\ {p}_{{A}_{choked}},\hfill & \text{if}{p}_{{A}_{unchoked}}{p}_{{A}_{choked}}\text{}\hfill \end{array}$$

Similarly, if *p*_{Bunchoked} ≥ *p*_{I},
then port B is an inlet and *p*_{B} = *p*_{Bunchoked}.
If *p*_{Bunchoked} < *p*_{I},
then port B is an outlet and

$${p}_{B}=\{\begin{array}{ll}{p}_{{B}_{unchoked}},\hfill & \text{if}{p}_{{B}_{unchoked}}\ge {p}_{{B}_{choked}}\hfill \\ {p}_{{B}_{choked}},\hfill & \text{if}{p}_{{B}_{unchoked}}{p}_{{B}_{choked}}\text{}\hfill \end{array}$$

Use the **Variables** tab in the block dialog
box (or the **Variables** section in the block Property
Inspector) to set the priority and initial target values for the block
variables prior to simulation. For more information, see Set Priority and Initial Target for Block Variables and Initial Conditions for Blocks with Finite Gas Volume.

The pipe wall is perfectly rigid.

The flow is fully developed. Friction losses and heat transfer do not include entrance effects.

The effect of gravity is negligible.

Fluid inertia is negligible.

This block does not model supersonic flow.

Heat transfer is calculated with respect to the temperature of the fluid volume in the pipe. To model temperature gradient due to heat transfer along a long pipe, connect multiple Pipe (G) blocks in series.

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

[2] Cengel, Y. A., *Heat and Mass
Transfer – A Practical Approach*. 3rd Ed, Section
8.5. McGraw-Hill, 2007.

Was this topic helpful?