---
url: /dyad/dev/stdlib/FluidComponents/components/Sources.Boundary_pT.md
description: >-
  Dyad Sources.Boundary_pT docs.  Fluid boundary with prescribed pressure,
  temperature, composition, and trace substances.
---

# `Sources.Boundary_pT` {#Sources.Boundary_pT}

Fluid boundary with prescribed pressure, temperature, composition, and trace substances.

The boundary pressure always constrains the connected network. Temperature, composition, and trace substances determine the outflow state when fluid enters the network from the boundary.

This component extends from [`FluidComponents.Sources.BaseClasses.PartialSource`](../types/PartialSource.md)

## Usage {#Usage}

`FluidComponents.Sources.Boundary_pT(p, T, X=MediaComponents.Interfaces.medium_X_default(medium_data), C=MediaComponents.Interfaces.medium_C_default(medium_data))`

## Parameters: {#Parameters:}

|          Name | Description | Units |             Default value |
| -------------:| -----------:| -----:| -------------------------:|
| `medium_data` |             |     – |                           |
|      `nPorts` |             |     – |                           |
|          `nX` |             |     – | FluidCompon...edium_data) |
|         `nXi` |             |     – | FluidCompon...edium_data) |
|          `nC` |             |     – | FluidCompon...edium_data) |
|    `use_p_in` |             |     – |                     false |
|           `p` |             |    Pa |                           |
|           `T` |             |     K |                           |
|           `X` |             | kg/kg | MediaCompon...edium_data) |
|           `C` |             |     – | MediaCompon...edium_data) |

## Connectors {#Connectors}

* `ports` - Generic fluid connector at the design outlet. ([`FluidPort_b`](@ref))

* `p_in` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Fluid boundary with prescribed pressure, temperature, composition, and trace
substances.

The boundary pressure always constrains the connected network. Temperature,
composition, and trace substances determine the outflow state when fluid
enters the network from the boundary.
"""
component Boundary_pT
  extends FluidComponents.Sources.BaseClasses.PartialSource()
  # Whether the boundary pressure is supplied through a signal input [-]
  structural parameter use_p_in::Boolean = false
  # Boundary pressure [Pa]
  parameter p::MediaComponents.Types.AbsolutePressure
  # Boundary temperature [K]
  parameter T::MediaComponents.Types.Temperature
  # Boundary mass fractions [kg/kg]
  parameter X::MediaComponents.Types.MassFraction[nX] = MediaComponents.Interfaces.medium_X_default(medium_data)
  # Boundary trace substances [-]
  parameter C::MediaComponents.Types.ExtraProperty[nC] = MediaComponents.Interfaces.medium_C_default(medium_data) if nC > 0
  "Prescribed boundary-pressure signal."
  p_in = RealInput(units = "Pa") if use_p_in {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0},
        "icon": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0}
      }
    }
  }
relations
  if use_p_in
    medium.p = p_in
  else
    medium.p = p
  end
  medium.T = T
  if nXi > 0
    for j in 1:nXi
      medium.Xi[j] = X[j]
    end
  end
  if nC > 0
    for i in 1:nPorts
      for j in 1:nC
        ports[i].C_outflow[j] = C[j]
      end
    end
  end
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
    "icons": {"default": "dyad://FluidComponents/icons/Boundary_pT.svg"}
  }
}
end
```

```dyad
"""
Fluid boundary with prescribed pressure, temperature, composition, and trace
substances.

The boundary pressure always constrains the connected network. Temperature,
composition, and trace substances determine the outflow state when fluid
enters the network from the boundary.
"""
component Boundary_pT
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Number of fluid ports [-]
  structural parameter nPorts::Integer(min = 0)
  # Number of mass fractions [-]
  final structural parameter nX::Integer = MediaComponents.Interfaces.medium_nX(medium_data)
  # Number of independent mass fractions [-]
  final structural parameter nXi::Integer = MediaComponents.Interfaces.medium_nXi(medium_data)
  # Number of extra transported properties [-]
  final structural parameter nC::Integer = MediaComponents.Interfaces.medium_nC(medium_data)
  "Thermodynamic properties inside the boundary."
  medium = MediaComponents.Interfaces.BaseProperties(medium_data = medium_data)
  "Fluid ports connected to the boundary."
  ports = [FluidComponents.Interfaces.FluidPort_b(medium_data = medium_data) for i in 1:nPorts] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 300, "x2": 1050, "y2": 700, "rot": 0},
        "icon": {"iconName": "default", "x1": 950, "y1": 300, "x2": 1050, "y2": 700, "rot": 0}
      }
    }
  }
  # Whether the boundary pressure is supplied through a signal input [-]
  structural parameter use_p_in::Boolean = false
  # Boundary pressure [Pa]
  parameter p::MediaComponents.Types.AbsolutePressure
  # Boundary temperature [K]
  parameter T::MediaComponents.Types.Temperature
  # Boundary mass fractions [kg/kg]
  parameter X::MediaComponents.Types.MassFraction[nX] = MediaComponents.Interfaces.medium_X_default(medium_data)
  # Boundary trace substances [-]
  parameter C::MediaComponents.Types.ExtraProperty[nC] = MediaComponents.Interfaces.medium_C_default(medium_data) if nC > 0
  "Prescribed boundary-pressure signal."
  p_in = RealInput(units = "Pa") if use_p_in {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0},
        "icon": {"iconName": "default", "x1": -100, "y1": 0, "x2": 100, "y2": 200, "rot": 0}
      }
    }
  }
relations
  for i in 1:nPorts
    ports[i].p = medium.p
    ports[i].h_outflow = medium.h
    if nXi > 0
      for j in 1:nXi
        ports[i].Xi_outflow[j] = medium.Xi[j]
      end
    else
      ports[i].Xi_outflow[1] = 0
    end
    if nC == 0
      ports[i].C_outflow[1] = 0
    end
  end
  if use_p_in
    medium.p = p_in
  else
    medium.p = p
  end
  medium.T = T
  if nXi > 0
    for j in 1:nXi
      medium.Xi[j] = X[j]
    end
  end
  if nC > 0
    for i in 1:nPorts
      for j in 1:nC
        ports[i].C_outflow[j] = C[j]
      end
    end
  end
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
    "icons": {"default": "dyad://FluidComponents/icons/Boundary_pT.svg"}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
