---
name: ferret-physics-pneumatics
description: Use for compressed air and gas networks in Ferret: tanks, pipes, valves, regulators, compressors, air cylinders and springs, air guns, gas mixtures (Dalton) and dissolved gas (Henry), with heating on fast filling.
---

# Pneumatics

## When to use
Train air brakes, a tyre and a pump, a pneumatic door, an air gun, a diving set with a regulator, a balloon filled from tanks, a soda bottle.

## The model
Nodes are closed volumes of a gas mixture (moles per species, internal energy). Links move moles: subsonic or choked from the isentropic law (`gasMassFlow`), carrying enthalpy; walls exchange heat. Cylinders have gas chambers and a moving mass.

## Steps
1. Add the capability `pneumatics()` and a level block `physics.pneumatics` (or build a `PneumaticCircuit` directly).
2. Tanks with volume, pressure, `mix`, and a `wall` if heat should leave; `air` is the atmosphere.
3. Links: `orifice`/`link` with `cdA` (or `pipe`), `check`, `regulator`, `relief`, `compressor`; `cylinder` with `vented: true` for an air spring.
4. Drive from programs with `(gas-valve …)`, `(compressor …)`, `(regulator …)`, read with `(gas-pressure …)`.
5. For a bottle, `liquid(node, { liquidVolume, henry })` (constants in `EXAMPLE_LIQUIDS.water.henry`, or `gases: ['CO2']` for the aqueous set's table, or `vessel` to share the dissolved gas with a chemistry vessel).

## Check afterwards
A blow-down ends at the atmosphere; a regulator holds its set pressure while the supply is above it; a fast fill warms and a slow one with a wall does not; `inventory(species)` is constant.

## What usually goes wrong
- A compressor stops: the tank reached its `maxPressure`.
- A regulator never opens: its set pressure is below the downstream pressure.
- A cylinder rod side missing: use `vented: true` or give the `.rod` chamber a link.
- Gas names are case sensitive (`CO2`, `N2`); an unknown one is refused with the list.

## Files

- `reference/pneumatics.md` — physics/pneumatics.md
- `reference/liquids.md` — Tanks and pipes, lakes and rivers, splashes and pours, and the lift of wings, sails and spinning balls: four tools for liquids at four costs.
- `reference/media.md` — Drag and buoyancy in water, mud, honey, wind and air; the atmosphere by altitude; gas volumes; floating, sinking, currents, gusts and wading.
- `reference/api-physics-pneumatics.md` — every export of `@ferret/physics-pneumatics` with signature and doc comment
- `reference/api-physics-media.md` — every export of `@ferret/physics-media` with signature and doc comment
- `reference/api-physics-liquids.md` — every export of `@ferret/physics-liquids` with signature and doc comment
- `reference/commands.md` — 31 commands of these packages with their arguments
