# Boundaries — Sources & Sinks / Frontières

Config types: `RefrigerantSource`, `RefrigerantSink`, `BrineSource`, `BrineSink`, `AirSource`, `AirSink`  
Sources: `refrigerant_boundary.rs`, `brine_boundary.rs`, `air_boundary.rs`

---

## EN

Boundary components fix **Dirichlet** conditions on one edge.  
**Source** = one outlet; **Sink** = one inlet. These are the natural place to **FIX** machine inputs (T, P, ṁ).

### RefrigerantSource / RefrigerantSink

```
Source: P = P_set ; h = h(P, x)           n ≈ 2
Sink:   P = P_back ; optional h if x set    n ≈ 1–2
```

| Key | Meaning | Default |
|-----|---------|---------|
| `fluid` | refrigerant | primary |
| `p_set_bar` / `p_back_bar` | pressure | ~10 bar typical |
| `quality` | vapor quality | 1.0 source |

### BrineSource / BrineSink (water / glycol)

```
Source: P, h(T), optional ṁ_set     n = 2 or 3
Sink:   P_back, optional T/h, ṁ     n = 1–3
```

| Key | Meaning | Default |
|-----|---------|---------|
| `fluid` | Water / MEG / … | Water |
| `p_set_bar` / `p_back_bar` | pressure | 2 bar |
| `t_set_c` | temperature | 12 °C (source) |
| `concentration` | glycol mass % | 0 |
| `m_flow_kg_s` | imposed loop flow (BOLT `Vd_fixed`) | optional |

**Do not** combine `m_flow_kg_s` with another flow imposition on the same branch (pump curve + fixed ṁ → over-constrained).

### AirSource / AirSink

Psychrometric state (Magnus–Tetens style humidity + moist air enthalpy):

```
h ≈ 1006·T_c + W·(2.501e6 + 1860·T_c)
Source: fix P, h(T, RH)     n = 2
```

| Key | Meaning | Default |
|-----|---------|---------|
| `t_dry_c` / `t_set_c` | dry-bulb | – |
| `rh` | relative humidity | – |
| `p_set_bar` | pressure | ~1 bar |
| `m_flow_kg_s` | optional mass flow | – |

### System wiring for HX secondary

```
BrineSource.outlet → HX.secondary_inlet
HX.secondary_outlet → BrineSink.inlet
```

Without live wiring, HX may still run in **rating** mode with scalar secondary_* on the HX itself.

### Calibration

Boundaries generally have **no Z-factors**. They are pure Fixed inputs / back-pressure.

---

## FR

### Rôle

Imposent les **conditions aux limites** (P, T, ṁ). C’est là qu’on **fixe** les entrées machine.

### Eau (Brine)

Source : P, T, ṁ optionnel. Sink : contre-pression (T sortie souvent **libre** = émergente).

### Air

État psychrométrique (T sèche, HR → h).

### Câblage HX

Source → secondary_in → secondary_out → Sink pour le mode système.

### JSON

Voir tableaux EN.
