---
url: /dyad/stable/stdlib/HVACComponents/types/Components.Partial.PartialStraightPipe.md
description: >-
  Dyad Components.Partial.PartialStraightPipe docs.  Partial base class for a
  1-D staggered-grid straight-pipe refrigerant model.
---

# `Components.Partial.PartialStraightPipe` {#Components.Partial.PartialStraightPipe}

Partial base class for a 1-D staggered-grid straight-pipe refrigerant model.

Wires together the distributed-volume cells (from PartialDistributedVolume), a staggered SimpleStaggeredFlowModel for momentum, and the two FluidPorts, and provides the (p, h) ODE system in each cell. Extending components must declare model_structure (av_vb, av_b, a_vb, a_v_b — these control how port-side flow cells line up with volume cells), flow_model_mode (FromPressureDifference or FromMassFlow), and bind the geometry arrays (lengths, crossAreas, dimensions, roughnesses, dheights) plus the scalar \*\*start values via initial equations from their own scalar geometry parameters. m_flow > 0 means refrigerant enters through port_a; medium\*data must be a refrigerant medium (inherited).

This component extends from [`PartialDistributedVolume`](./PartialDistributedVolume.md)

## Usage {#Usage}

`HVACComponents.Components.Partial.PartialStraightPipe(medium_data, p_a_start, p_b_start, h_a_start, h_b_start, m_flow_start, ps_start_explicit=fill(p_a_start, N), hs_start_explicit=fill(h_a_start, N), k_init=1.6, ps_start=missing, hs_start=missing, fluidVolumes=missing, lengths=missing, crossAreas=missing, dimensions=missing, roughnesses=missing, dheights=missing, crossAreas_start=missing, dimensions_start=missing, roughnesses_start=missing, dheights_start=missing, diameters_start=missing, dp_nominal_start=missing, m_flow_nominal_start=missing, K_dp_start=missing, dp_exp_start=missing)`

## Parameters: {#Parameters:}

|                  Name |                                                                                                                 Description | Units |                                                                                                                                       Default value |
| ---------------------:| ---------------------------------------------------------------------------------------------------------------------------:| -----:| ---------------------------------------------------------------------------------------------------------------------------------------------------:|
|                   `N` |                                                                                                   Number of control volumes |     – |                                                                                                                                                     |
|            `N_Plus_1` |                                                                                              Number of cell faces (= N + 1) |     – |                                                                                                                                               N + 1 |
|           `init_mode` |            Initial-condition distribution strategy for the per-cell (p, h) states (Linear, Lumped, Explicit or Exponential) |     – |                                                                                                  HVACComponents.InitializationDistribution.Linear() |
| `initialization_mode` |                   Initialisation mode: FixedInitial_ph sets initial equations on each mediums\[i]; NoInit only seeds guesses |     – |                                                                                     HVACComponents.FiniteVolumeInitializationMode.FixedInitial_ph() |
|     `model_structure` |                                    Staggered-grid model structure controlling how flow cells line up with mass/energy cells |     – |                                                                                                                                                     |
|     `flow_model_mode` |                         Flow formulation: FromPressureDifference computes m_flows from dps_f; FromMassFlow does the reverse |     – |                                                                                                                                                     |
|                 `nFM` |                                Number of momentum cells, derived from model_structure (av_vb: N-1, a_v_b: N+1, otherwise N) |     – | ifelse(model_structure == HVACComponents.ModelStructure.av_vb(), N - 1, ifelse(model_structure == HVACComponents.ModelStructure.a_v_b(), N + 1, N)) |
|          `nFM_Plus_1` |                                                        Number of momentum cells plus one (face count for flow-model arrays) |     – |                                                                                                                                             nFM + 1 |
|         `medium_data` |                                                               Refrigerant medium properties shared by all N control volumes |     – |                                                                                                                                                     |
|           `p_a_start` |                                                                                             Initial pressure at port_a \[Pa] |    Pa |                                                                                                                                                     |
|           `p_b_start` |                                                                                             Initial pressure at port_b \[Pa] |    Pa |                                                                                                                                                     |
|           `h_a_start` |                                                                                  Initial specific enthalpy at port_a \[J/kg] |  J/kg |                                                                                                                                                     |
|           `h_b_start` |                                                                                  Initial specific enthalpy at port_b \[J/kg] |  J/kg |                                                                                                                                                     |
|        `m_flow_start` |                                                                     Initial mass flow rate \[kg/s] (solver guess on m_flows) |  kg/s |                                                                                                                                                     |
|   `ps_start_explicit` |                                     Explicit initial pressure per cell \[Pa] (length N; used only when init_mode = Explicit) |    Pa |                                                                                                                                  fill(p_a_start, N) |
|   `hs_start_explicit` |                          Explicit initial specific enthalpy per cell \[J/kg] (length N; used only when init_mode = Explicit) |  J/kg |                                                                                                                                  fill(h_a_start, N) |
|              `k_init` | Shape exponent of the Exponential enthalpy profile \[-]; larger = more front-loaded (used only when init_mode = Exponential) |     – |                                                                                                                                                 1.6 |

## Connectors {#Connectors}

* `port_a` - ([`FluidPort`](/stdlib/HVACComponents/connectors/FluidPort#FluidPort))

* `port_b` - ([`FluidPort`](/stdlib/HVACComponents/connectors/FluidPort#FluidPort))

## Variables {#Variables}

|       Name |                                                                                 Description | Units |
| ----------:| -------------------------------------------------------------------------------------------:| -----:|
|      `dms` |                                Time derivative of fluid mass in each cell \[kg/s] (length N) |     – |
|      `dUs` |                              Time derivative of internal energy in each cell \[W] (length N) |     – |
|  `m_flows` |                                        Mass flow rate at each cell face \[kg/s] (length N+1) |  kg/s |
|  `H_flows` | Enthalpy flow rate at each cell face \[W] (length N+1); upwind-discretised on internal faces |     – |
| `mb_flows` |          Net convective mass inflow per cell \[kg/s] (length N; = m_flows\[i] - m_flows\[i+1]) |  kg/s |
| `Hb_flows` |         Net convective enthalpy inflow per cell \[W] (length N; = H_flows\[i] - H_flows\[i+1]) |     – |
| `Qb_flows` |                            Source/sink heat flow per cell \[W] (length N); extender supplies |     W |
| `Wb_flows` |                     Source/sink mechanical power per cell \[W] (length N); extender supplies |     W |
|     `Mtot` |                                      Total refrigerant mass inventory across all cells \[kg] |     – |
|     `M_cv` |                                               Refrigerant mass in each cell \[kg] (length N) |     – |
|       `vs` |                                     Mean refrigerant velocity in each cell \[m/s] (length N) |     – |
|        `a` |                            Top-left entry of the (mass, energy) 2x2 system in each cell \[s] |     – |
|        `b` |                    Top-right entry of the (mass, energy) 2x2 system in each cell \[kg.m^3/J] |     – |
|        `c` |                             Bottom-left entry of the (mass, energy) 2x2 system in each cell |     – |
|        `d` |                       Bottom-right entry of the (mass, energy) 2x2 system in each cell \[kg] |     – |
|      `det` |                                   Determinant of the (mass, energy) 2x2 system in each cell |     – |
