Browser-native PVT for oil & gas fluids — cubic-equation-of-state phase behaviour, two-phase flash, and the full standard lab-experiment suite, running entirely in your browser.
PVT Lab is a from-scratch TypeScript rebuild of the cubic-EOS core of Equinor's NeqSim, validated against it to machine precision. Everything runs client-side — your fluid composition never leaves your browser.
🔗 Live demo: https://pvt-demo.nrgnr.app
Technical demo, not engineering advice.
- Equations of state — Soave-Redlich-Kwong (SRK) and Peng-Robinson (PR), with NeqSim's exact constants, fitted binary interaction parameters (kᵢⱼ), and Peneloux volume translation.
- Two-phase PT flash — Michelsen tangent-plane stability → Rachford-Rice → successive substitution. Per-phase Z, density, viscosity, molecular weight, gas gravity.
- Phase envelope (P–T) — bubble & dew loci, the two-phase region, and the critical point, traced live with a draggable operating point.
- Standard PVT experiments, each matched to NeqSim:
- CCE — constant composition expansion (relative volume, liquid dropout).
- Differential liberation — Bo, Rs, Bg referred to residual oil.
- Constant volume depletion — retrograde liquid dropout, gas Z, cumulative depletion.
- Separator test — an editable multi-stage surface train → Bo, total GOR, stock-tank °API.
- Fluid properties — viscosity by Lohrenz-Bray-Clark, Bo/Bg/Rs, °API, gas gravity.
- SI ⇄ field units (°C/bar/kg·m⁻³ ⇄ °F/psia/lb·ft⁻³ …) and replay animations on every experiment.
The engine reproduces NeqSim across 80 parity tests:
| Quantity | Agreement |
|---|---|
| Two-phase flash (Z, β, compositions) | ~1×10⁻⁷ |
| LBC viscosity | ~1×10⁻⁵ % |
| Black-oil Bo / Rs / Bg | < 1×10⁻⁴ |
| Differential liberation, separator test | < 1×10⁻⁴ |
| CVD (dew point, gas Z, liquid dropout) | digit-exact Z; ~1–2 % dropout |
NeqSim itself is used only as a local reference oracle during development — it is not bundled,
imported, or shipped (see NOTICE).
| Package | What |
|---|---|
engine/ |
@workollab/pvt-engine — the PVT engine. Zero runtime dependencies, pure TypeScript. |
app/ |
The demo (Vite + React + Tailwind). Hand-rolled SVG charts — no charting library. |
docs/ |
MATH_SPEC.md — the EOS / flash / experiment math. |
reference/ |
Curated component data + NeqSim parity goldens, and the Python validation oracle. |
The component database, kᵢⱼ, and volume-shift constants are baked into the bundle as literals — no data is fetched at runtime. There are no network calls anywhere in the app or engine.
npm install
npm run dev # http://localhost:5173 — the demo
npm run test:engine # run the parity test suite
npm run build # build engine + static demo into app/distThe built demo is a static index.html + one JS + one CSS bundle (~60 KB gzip) — host it anywhere.
import { flash, phaseEnvelope, cce, differentialLiberation, separatorTest } from '@workollab/pvt-engine';
// flash a composition at T [K], P [Pa]
const r = flash('pr', { methane: 0.7, 'n-pentane': 0.3 }, 300, 60e5);
console.log(r.nPhases, r.phases.map((p) => ({ kind: p.kind, beta: p.beta, Z: p.Z })));The parity goldens in reference/curated/ were generated from NeqSim (Java) via Python
(neqsim + jpype1 + jdk4py, with the JDK provided in-venv — no system Java required). The
generator scripts live in reference/oracle/. The tests run against the committed goldens, so you
do not need NeqSim to build or test PVT Lab.
MIT © Workollab. Rebuilt from scratch from, and validated against, Equinor's NeqSim
(Apache-2.0); component data is a curated subset of NeqSim's open database. See NOTICE.
Built by Workollab. Part of a series rebuilding the open-source subsurface stack in the browser — see also Auto DCA.