---
url: /dyad/dev/stdlib/FluidComponents/types/Interfaces.PartialHeatTransfer.md
description: >-
  Dyad Interfaces.PartialHeatTransfer docs.  Common interface for heat transfer
  between distributed fluid segments and their thermal boundaries.
---

# `Interfaces.PartialHeatTransfer` {#Interfaces.PartialHeatTransfer}

Common interface for heat transfer between distributed fluid segments and their thermal boundaries.

Extending components define the relation between the fluid temperatures, boundary temperatures, and segment heat-flow rates.

## Usage {#Usage}

`FluidComponents.Interfaces.PartialHeatTransfer(k, T_ambient)`

## Parameters: {#Parameters:}

|          Name | Description |    Units | Default value |
| -------------:| -----------:| --------:| -------------:|
| `medium_data` |             |        – |               |
|           `n` |             |        – |               |
|       `use_k` |             |        – |         false |
|           `k` |             | W/(m2.K) |               |
|   `T_ambient` |             |        K |               |

## Connectors {#Connectors}

* `heatPorts` - This connector represents a thermal port with temperature and heat flow as the potential and flow variables, respectively. ([`HeatPort`](/stdlib/Dyad/connectors/HeatPort#HeatPort))

## Variables {#Variables}

|           Name | Description | Units |
| --------------:| -----------:| -----:|
| `surfaceAreas` |             |    m2 |
|      `Q_flows` |             |     W |
|           `Ts` |             |     K |

## Source {#Source}

```dyad
"""
Common interface for heat transfer between distributed fluid segments and
their thermal boundaries.

Extending components define the relation between the fluid temperatures,
boundary temperatures, and segment heat-flow rates.
"""
partial component PartialHeatTransfer
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Number of heat-transfer segments [-]
  structural parameter n::Integer
  "Thermodynamic states of the fluid segments."
  states = [MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data) for i in 1:n]
  # Heat-transfer area of each segment [m2]
  variable surfaceAreas::Area[n]
  # Heat-flow rate into each fluid segment [W]
  variable Q_flows::HeatFlowRate[n]
  # Whether thermal loss to ambient is included [-]
  structural parameter use_k::Boolean = false
  # Heat-transfer coefficient to ambient [W/(m2.K)]
  parameter k::CoefficientOfHeatTransfer
  # Ambient temperature [K]
  parameter T_ambient::Temperature
  "Thermal boundary of each fluid segment."
  heatPorts = [HeatPort() for i in 1:n]
  # Fluid temperature in each segment [K]
  variable Ts::Temperature[n]
relations
  for i in 1:n
    Ts[i] = MediaComponents.Interfaces.temperature_state(medium_data, states[i].p, states[i].T, states[i].d, states[i].h, states[i].X)
  end
  if use_k
    for i in 1:n
      Q_flows[i] = heatPorts[i].Q_flow + k * surfaceAreas[i] * (T_ambient - heatPorts[i].T)
    end
  else
    for i in 1:n
      Q_flows[i] = heatPorts[i].Q_flow
    end
  end
end
```

```dyad
"""
Common interface for heat transfer between distributed fluid segments and
their thermal boundaries.

Extending components define the relation between the fluid temperatures,
boundary temperatures, and segment heat-flow rates.
"""
partial component PartialHeatTransfer
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Number of heat-transfer segments [-]
  structural parameter n::Integer
  "Thermodynamic states of the fluid segments."
  states = [MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data) for i in 1:n]
  # Heat-transfer area of each segment [m2]
  variable surfaceAreas::Area[n]
  # Heat-flow rate into each fluid segment [W]
  variable Q_flows::HeatFlowRate[n]
  # Whether thermal loss to ambient is included [-]
  structural parameter use_k::Boolean = false
  # Heat-transfer coefficient to ambient [W/(m2.K)]
  parameter k::CoefficientOfHeatTransfer
  # Ambient temperature [K]
  parameter T_ambient::Temperature
  "Thermal boundary of each fluid segment."
  heatPorts = [HeatPort() for i in 1:n]
  # Fluid temperature in each segment [K]
  variable Ts::Temperature[n]
relations
  for i in 1:n
    Ts[i] = MediaComponents.Interfaces.temperature_state(medium_data, states[i].p, states[i].T, states[i].d, states[i].h, states[i].X)
  end
  if use_k
    for i in 1:n
      Q_flows[i] = heatPorts[i].Q_flow + k * surfaceAreas[i] * (T_ambient - heatPorts[i].T)
    end
  else
    for i in 1:n
      Q_flows[i] = heatPorts[i].Q_flow
    end
  end
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
