Chemistry · function

phaseChange

A phase change, as the reaction it actually is.

Explained in Chemistry.

function phaseChange(id: string, from: string, to: string, temperature: number, width?: number, rate?: number): Reaction
import { phaseChange } from '@driftengine/chemistry';

Parameters

ParameterTypeDescription
idstring
fromstring
tostring
temperaturenumber
width?number
rate?number

In depth

Its enthalpy is not given here and must not be: Hess's law over CH-0's formation enthalpies gives 333,611 J/kg for ice melting against a literature 333,550, and — the part that settles the design — 2,442,631 J/kg for water boiling, which is the value at 298.15 K rather than the 2,256,400 quoted at the boiling point. That is right, and it means the latent heat at any temperature stops being stored and becomes a consequence of the heat capacities either side, varying the way the real one does.

A fast finite rate rather than Instant, and the difference is the whole plateau. Instant kinetics would let the clamp convert every gram of water it could reach in a single sub-step — two and a half megajoules absorbed at once, and a temperature that falls hundreds of kelvin below the boiling point rather than sitting on it. A finite rate through an opening gate is a proportional controller instead: the further above the transition the temperature strays, the more converts, the more heat is absorbed, and it settles just above with an overshoot proportional to the flux arriving. That settling is the plateau, and it comes out of the substep-and-clamp solver rather than out of a table.

activationEnergy: 0 makes the Arrhenius form a constant, so no second kinetics kind was needed.