$37
Fetches thermodynamic and transport properties of pure fluids from the NIST Chemistry WebBook (webbook.nist.gov) using the fluid properties CGI interface. Covers natural gas components, CO2, water/steam, and common solvents relevant to petroleum and chemical engineering.
No API key required. NIST WebBook is a free public resource.
Base URL: https://webbook.nist.gov/cgi/fluid.cgi
The NIST fluid properties interface returns tab-delimited ASCII text with a header row. All property data is in the requested unit system.
| Parameter | Description | Example Values |
|---|---|---|
Action | Request type | Load |
ID | Fluid identifier (CAS-based, e.g. C74828) | See fluid table below |
Type | Property table type | , , , , |
SatTSatPIsoThermIsoBarIsoChorDigits | Significant figures | 5 (recommended) |
THigh | Upper temperature bound | 300 |
TLow | Lower temperature bound | 100 |
TInc | Temperature increment | 10 |
PHigh | Upper pressure bound (for IsoTherm) | 10 |
PLow | Lower pressure bound | 1 |
PInc | Pressure increment | 1 |
RefState | Reference state | DEF (default), NBP, IIR, ASHRAE |
| Parameter | Options |
|---|---|
TUnit | K, C, F, R |
PUnit | MPa, bar, atm, psia, kPa |
DUnit | mol%2FL (mol/L), kg%2Fm3 (kg/m3), g%2FmL (g/mL) |
HUnit | kJ%2Fmol, kJ%2Fkg, BTU%2Flbmol |
WUnit | m%2Fs (m/s), ft%2Fs (ft/s) |
VisUnit | uPa*s (microPa-s), cP (centipoise) |
STUnit | N%2Fm (N/m), dyn%2Fcm |
| Type | Description | Required Params |
|---|---|---|
SatT | Saturation properties vs temperature | THigh, TLow, TInc |
SatP | Saturation properties vs pressure | PHigh, PLow, PInc |
IsoTherm | Isothermal P scan at fixed T | THigh=TLow=T, PHigh, PLow, PInc |
IsoBar | Isobaric T scan at fixed P | PHigh=PLow=P, THigh, TLow, TInc |
IsoChor | Isochoric (constant volume) | DHigh, DLow, DInc |
See references/api_reference.md for the complete fluid list. Key fluids
for petroleum and chemical engineering:
| Fluid | NIST ID | CAS Number | Notes |
|---|---|---|---|
| Methane | C74828 | 74-82-8 | Primary natural gas component |
| Ethane | C74840 | 74-84-0 | NGL component |
| Propane | C74986 | 74-98-6 | NGL, LPG |
| n-Butane | C106978 | 106-97-8 | NGL |
| i-Butane | C75285 | 75-28-5 | NGL |
| n-Pentane | C109660 | 109-66-0 | NGL |
| n-Hexane | C110543 | 110-54-3 | Solvent, NGL |
| n-Heptane | C142825 | 142-82-5 | Solvent |
| n-Octane | C111659 | 111-65-9 | Solvent |
| Carbon dioxide | C124389 | 124-38-9 | EOR, injection design |
| Water | C7732185 | 7732-18-5 | Steam tables, reservoir |
| Nitrogen | C7727379 | 7727-37-9 | Injection gas |
| Hydrogen sulfide | C7783064 | 7783-06-4 | Sour gas |
| Hydrogen | C1333740 | 1333-74-0 | Hydrogen applications |
| Oxygen | C7782447 | 7782-44-7 | Combustion |
| Argon | C7440371 | 7440-37-1 | Inert gas |
| Helium | C7440597 | 7440-59-7 | Tracer |
| Ammonia | C7664417 | 7664-41-7 | Refrigerant |
| R-134a (HFC) | C811972 | 811-97-2 | Refrigerant |
curl -s "https://webbook.nist.gov/cgi/fluid.cgi?Action=Load&ID=C74828&Type=SatT&Digits=5&THigh=200&TLow=100&TInc=10&RefState=DEF&TUnit=K&PUnit=MPa&DUnit=mol%2FL&HUnit=kJ%2Fmol&WUnit=m%2Fs&VisUnit=uPa*s&STUnit=N%2Fm"
curl -s "https://webbook.nist.gov/cgi/fluid.cgi?Action=Load&ID=C7732185&Type=SatT&Digits=5&THigh=374&TLow=100&TInc=10&RefState=DEF&TUnit=C&PUnit=MPa&DUnit=kg%2Fm3&HUnit=kJ%2Fkg&WUnit=m%2Fs&VisUnit=uPa*s&STUnit=N%2Fm"
curl -s "https://webbook.nist.gov/cgi/fluid.cgi?Action=Load&ID=C124389&Type=IsoTherm&Digits=5&THigh=50&TLow=50&TInc=0&PHigh=20&PLow=1&PInc=1&RefState=DEF&TUnit=C&PUnit=MPa&DUnit=kg%2Fm3&HUnit=kJ%2Fkg&WUnit=m%2Fs&VisUnit=uPa*s&STUnit=N%2Fm"
curl -s "https://webbook.nist.gov/cgi/fluid.cgi?Action=Load&ID=C74828&Type=IsoBar&Digits=5&THigh=400&TLow=200&TInc=10&PHigh=3000&PLow=3000&PInc=0&RefState=DEF&TUnit=F&PUnit=psia&DUnit=kg%2Fm3&HUnit=kJ%2Fkg&WUnit=m%2Fs&VisUnit=uPa*s&STUnit=N%2Fm"
curl -s "https://webbook.nist.gov/cgi/fluid.cgi?..." \
| awk -F'\t' 'NR==1{print; next} /^\s*$/{next} {print}' \
| column -t -s $'\t'
Map the user's fluid description to a NIST fluid ID. Use the table above or
the extended reference in references/api_reference.md. If the user specifies
a mixture (e.g., "natural gas"), note that NIST WebBook covers pure components
only — compute mixture properties by combining component data using mixing
rules, or advise using NIST REFPROP for rigorous mixture calculations.
Determine the appropriate query type:
SatT or SatPIsoThermIsoBarIsoTherm with PHigh=PLow and small pressure rangeConvert user units to NIST parameter values. Common conversions:
Construct the URL using the base URL and parameters above. Execute with curl. Check that the response starts with column headers (Temperature, Pressure, etc.) — if it starts with "Error" or "Not Found", the fluid ID or range is invalid.
The response is tab-delimited text. Key output columns:
| Column | Description | Typical Units |
|---|---|---|
| Temperature | T | K or C or F |
| Pressure | P | MPa or psia |
| Density | rho | kg/m3 |
| Volume | v | m3/kg |
| Internal Energy | U | kJ/kg |
| Enthalpy | H | kJ/kg |
| Entropy | S | kJ/(kg-K) |
| Cv | Isochoric heat capacity | kJ/(kg-K) |
| Cp | Isobaric heat capacity | kJ/(kg-K) |
| Sound Spd. | Speed of sound | m/s |
| Joule-Thomson | J-T coefficient | K/MPa |
| Viscosity | Dynamic viscosity | uPa*s |
| Therm. Cond. | Thermal conductivity | W/(m-K) |
| Phase | Phase label | liquid / vapor / supercritical |
For saturation queries, NIST returns two rows per temperature: one for the liquid phase and one for the vapor phase.
Note the phase from the Phase column. Flag if conditions are:
Include a brief note on engineering relevance (viscosity for wellbore flow, density for hydrostatic head, Cp for heat duty calculations).
Present results as a markdown table capped at ~25 rows for readability. Always state temperature, pressure, and fluid name in the table title. Then provide a narrative summary.
## Methane Properties — Isothermal at 300 K, 1-20 MPa
| P (MPa) | Density (kg/m3) | Enthalpy (kJ/kg) | Viscosity (uPa-s) | Phase |
|---------|-----------------|------------------|-------------------|-------|
| 1.0 | 6.33 | 864.2 | 11.2 | vapor |
| 5.0 | 34.0 | 836.8 | 12.4 | vapor |
| 10.0 | 76.3 | 793.1 | 14.9 | vapor |
| 15.0 | 131.2 | 737.6 | 19.1 | vapor |
| 20.0 | 194.4 | 672.3 | 25.8 | supercritical |
**Summary:** Methane at 300 K transitions from dilute gas behavior at low
pressure to a dense, increasingly liquid-like fluid above ~15 MPa.
Density increases 30x from 1 to 20 MPa. Viscosity increases only 2.3x
over the same range — important for reservoir flow models, which are
sensitive to viscosity but less so at these values (methane remains low
viscosity even at reservoir conditions). At 300 K, methane is above its
critical temperature (190.6 K) at all pressures shown — no phase change
occurs. For WVU Appalachian wells at ~2000-4000 psia (14-28 MPa) and
200-300 F (93-149 C), methane is always supercritical.
| Condition | Action |
|---|---|
| Response contains "Error" text | Invalid fluid ID or out-of-range T/P; check ID against reference table and verify T/P within fluid's valid range |
| Response is empty after header | Temperature or pressure outside the fluid's valid range; adjust bounds |
| Phase boundary crossed in IsoTherm | Two-phase region encountered; switch to SatT query for that range, then IsoTherm above and below saturation |
| Fluid ID not in table | Search NIST WebBook manually at webbook.nist.gov/cgi/cbook.cgi?Name=FLUID&Units=SI and copy the fluid ID from the "Fluid Properties" link URL |
| Mixture requested (e.g., natural gas) | NIST WebBook covers pure components only; compute mixture properties by component fraction weighting, or recommend NIST REFPROP for rigorous mixture EOS |
| Very large T/P range returns too many rows | Increase TInc or PInc to reduce row count |
bash_tool with curl to make requests; pipe through awk or python
to parse the tab-delimited outputreferences/api_reference.md for the complete fluid ID table (50+
fluids), all unit codes, and worked examples in Goreferences/api_reference.md