Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Solving the Implicit Colebrook‑White Equation in TypeScript via Newton‑Raphson Iterations

Description and use

A pure TypeScript Newton‑Raphson solver delivers exact Colebrook‑White friction‑factor calculations client‑side in under 0.02 ms, eliminating approximation errors.

Problem

Explicit friction‑factor approximations introduce systematic errors up to 3.5 % in turbulent pipe flow calculations, while the exact Colebrook‑White equation is implicit and non‑linear.

Outcome

The implementation achieves deterministic, sub‑millisecond performance, eliminating approximation errors and enabling accurate client‑side friction‑loss calculations.

Workflow

  • Define FluidFlowParams (Re, roughness, diameter, optional maxIterations, tolerance).
  • If Re ≤ 2000, return Hagen‑Poiseuille laminar solution.
  • Compute relative roughness and initial estimate using Haaland explicit formula.
  • Iteratively apply Newton‑Raphson: compute F(x) and its derivative, update x, check convergence or safeguard against non‑positive log arguments.
  • After convergence, recover f = 1/x² and clamp to physical bounds.
  • Return f.

Evidence

The Newton‑Raphson iterative update step is: x(n+1) = x(n) – (F(x(n))/F'(x(n)))

Source

The solver executes in under 0.02 ms in modern browser engines.

Source

  • Record date: 2026-09-07T18:52:45.511Z