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

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

说明与用途

使用 TypeScript 的牛顿-拉夫森方法实现的纯粹求解器,在客户端以不到 0.02 毫秒的时间完成 Colebrook‑White 方程的精确求解,消除了近似误差。

问题

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.

结果

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

工作流

  • 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.

证据

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

来源

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

来源

  • 记录日期: 2026-09-07T18:52:45.511Z