---
url: /dyad/dev/stdlib/FluidComponents/types/Sources.BaseClasses.PartialFlowSource.md
description: >-
  Dyad Sources.BaseClasses.PartialFlowSource docs.  Base class for prescribed
  fluid-flow sources with one or more fluid ports.
---

# `Sources.BaseClasses.PartialFlowSource` {#Sources.BaseClasses.PartialFlowSource}

Base class for prescribed fluid-flow sources with one or more fluid ports.

All ports share the pressure, outflow enthalpy, and outflow composition of the source medium. Extending components prescribe the total mass flow and the source state.

## Usage {#Usage}

`FluidComponents.Sources.BaseClasses.PartialFlowSource()`

## Parameters: {#Parameters:}

|          Name | Description | Units |             Default value |
| -------------:| -----------:| -----:| -------------------------:|
| `medium_data` |             |     – |                           |
|      `nPorts` |             |     – |                           |
|          `nX` |             |     – | MediaCompon...edium_data) |
|         `nXi` |             |     – | MediaCompon...edium_data) |
|          `nC` |             |     – | MediaCompon...edium_data) |

## Connectors {#Connectors}

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

## Source {#Source}

```dyad
"""
Base class for prescribed fluid-flow sources with one or more fluid ports.

All ports share the pressure, outflow enthalpy, and outflow composition of the
source medium. Extending components prescribe the total mass flow and the
source state.
"""
partial component PartialFlowSource
  # 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 source."
  medium = MediaComponents.Interfaces.BaseProperties(medium_data = medium_data)
  "Fluid ports connected to the source."
  ports = [FluidComponents.Interfaces.FluidPort_b(medium_data = medium_data) for i in 1:nPorts] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0},
        "icon": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "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
end
```

```dyad
"""
Base class for prescribed fluid-flow sources with one or more fluid ports.

All ports share the pressure, outflow enthalpy, and outflow composition of the
source medium. Extending components prescribe the total mass flow and the
source state.
"""
partial component PartialFlowSource
  # 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 source."
  medium = MediaComponents.Interfaces.BaseProperties(medium_data = medium_data)
  "Fluid ports connected to the source."
  ports = [FluidComponents.Interfaces.FluidPort_b(medium_data = medium_data) for i in 1:nPorts] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0},
        "icon": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "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
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
