npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

iapws-if97

v2.8.0

Published

TypeScript implementation of IAPWS-IF97 for water and steam properties, including forward/backward solvers, saturation states, and transport properties.

Readme

iapws-if97

Industrial water and steam properties for Node.js and TypeScript.

Turn two known properties into a water or steam state using IAPWS-IF97. For steam tables, thermal-cycle calculations, and engineering tools.

CI npm version

API reference · References · Changelog

IAPWS-IF97 pressure–temperature map showing Regions 1–5, the saturation curve, and the 100 MPa and 50 MPa pressure limits.

  • Forward, backward, and saturation solvers for eight input pairs across IF97 Regions 1–5.
  • Saturation results include liquid and vapor endpoints.
  • Viscosity, thermal conductivity, surface tension, dielectric constant, and ionization constant where applicable.
  • ESM with TypeScript declarations and no runtime dependencies.

Start calculating

Requires Node.js ≥20.19.0. Use ESM imports.

npm install iapws-if97

Save as example.mjs and run node example.mjs:

import { solvePT } from 'iapws-if97';

const steam = solvePT(3, 573.15); // 3 MPa, 300 °C

console.log(steam.enthalpy.toFixed(2)); // 2994.35 kJ/kg
console.log(steam.density.toFixed(3));  // 12.319 kg/m³

The result includes pressure, temperature, enthalpy, entropy, density, heat capacities, speed of sound, and applicable transport properties. All fields and units →

Use the properties you have

| Known properties | Solver | | --- | --- | | Pressure + temperature | solvePT(p, T) | | Pressure + enthalpy | solvePH(p, h) | | Pressure + entropy | solvePS(p, s) | | Enthalpy + entropy | solveHS(h, s) | | Temperature + enthalpy | solveTH(T, h) | | Temperature + entropy | solveTS(T, s) | | Pressure + vapor quality | solvePx(p, x) | | Temperature + vapor quality | solveTx(T, x) |

Use MPa, K, kJ/kg, and kJ/(kg·K) for pressure, temperature, enthalpy, and entropy. Vapor quality x is the vapor mass fraction, from 0 (saturated liquid) to 1 (saturated vapor).

Use solve() when the input pair is chosen at runtime:

import { solve } from 'iapws-if97';

const state = solve({ mode: 'PH', p: 3, h: 3000 });

Long field names such as pressure and enthalpy are also accepted. Use solveBasic() when you only need thermodynamics; it skips transport calculations and omits density.

Work with saturation

Specify quality to calculate saturated liquid, saturated vapor, or wet steam:

import { solvePx } from 'iapws-if97';

const wet = solvePx(1, 0.9); // 1 MPa, 90% vapor by mass

console.log(wet.temperature.toFixed(2)); // 453.04 K

if (wet.saturation) {
  const { liquid, vapor } = wet.saturation;
  const latentHeat = vapor.enthalpy - liquid.enthalpy;
  console.log(latentHeat.toFixed(2)); // 2014.44 kJ/kg
}

Every saturation result includes saturation.liquid and saturation.vapor for phase properties and latent-heat calculations. Use solveTx(T, x) when temperature is known instead of pressure.

Before integrating

  • PT selects a single phase. Pressure and temperature alone do not determine wet-steam quality; use Px or Tx for a mixture.
  • Single-phase quality is null. Mixtures return null for heat capacities, speed of sound, and most transport properties. Return-value details →
  • TH and TS throw AmbiguousStateError with candidate states when multiple solutions exist. Use pressure or quality to resolve the state. Errors →
  • The exact critical point is unsupported, and near-critical solves can fail. Transport correlations have separate validity ranges. Numerical limits → · Transport limits →

| Thermodynamic temperature range | Maximum pressure | | --- | --- | | 273.15–1073.15 K | 100 MPa | | Above 1073.15 K, up to 2273.15 K | 50 MPa |

Saturation solvers accept 273.16 ≤ T < 647.096 K or 0.000611657 ≤ p < 22.064 MPa. All numeric inputs must be finite; invalid or unresolved states throw typed errors.

Verification and development

Tests cover official IAPWS verification values, backward-solver round trips, region boundaries, and published ASME and GB/T steam tables. CI also checks TypeScript types, package exports, and coverage thresholds. Verification details and references →

npm ci
npm run typecheck
npm test
npm run test:package

For low-level region equations, saturation curves, transport correlations, or region detection, see advanced imports.

References

See the full reference list for release details.

Project origin

iapws-if97 began as the calculation engine behind the WeChat Mini Program "汽水计算器" (wxid: wx7201fd1713b524e5). Since its 2019 launch, it has served more than 20,000 users. AI-assisted review helped bring this open-source edition up to date with IAPWS R11-24 (2024). I am sharing the engine so it can reach engineers far beyond the original program.

License

MIT