Skip to main content

Contents

OilProps

Python 3.10+ License: MIT Pure Python Wheel

What is OilProps?

OilProps is open-source software for engineers, scientists, technicians, and anyone modeling liquid petroleum systems. It provides a unified, pure-Python library for calculating temperature- and pressure-dependent thermophysical, transport, caloric, and PVT properties of industrial fuel oils, custom petroleum blends, defined pure hydrocarbons, and petroleum distillation pseudocomponents.

OilProps covers all nine core petroleum liquid requirements across T and P:

  1. Pressure- and temperature-dependent density ($\rho(T, P)$) via ISO 91-1 / API 2540 thermal expansion and compressibility / COSTALD.
  2. Temperature-dependent atmospheric density ($\rho_0(T)$).
  3. Specific gravity & API gravity ($SG(T, P)$, $SG_{60/60}$, $^{\circ}\text{API}$).
  4. Kinematic viscosity ($\nu(T, P)$ in cSt and $\text{m}^2/\text{s}$).
  5. Viscosity–temperature charts & calibration (2-point ASTM D341 / Walther fitting, tabular chart generation, and inverse temperature solving).
  6. Dynamic viscosity ($\mu(T, P)$ in $\text{Pa}\cdot\text{s}$ and cP) with Barus / Lucas pressure corrections.
  7. Coupled pressure-dependent oil states (OilState).
  8. Vapor pressure ($P_v(T)$) via Antoine for fuel oils and thermo / Lee-Kesler $P_{sat}$ for defined hydrocarbons & pseudocomponents.
  9. Oil compressibility & acoustics (bulk modulus $K(T, P)$, isothermal compressibility $\kappa_T = 1/K$, and acoustic wave speed $c = \sqrt{K/\rho}$).

It also includes Refutas / ASTM D7152 oil blending, sensible enthalpy $\leftrightarrow$ temperature inversion, thermal conductivity & Prandtl number, and unit conversions (°C/K/°F, bar/Pa/psi, API/SG, cSt/m²/s/SUS).

OilProps runs on all operating systems supporting Python 3.10+ (Windows, Linux, macOS) as a universal pure-Python wheel (py3-none-any.whl) with zero GUI or application coupling.

Installation

Install the latest release with pip:

pip install oilprops

For local editable development including test and packaging tools:

pip install -e ".[dev]"

Dependencies:

  • Python >=3.10 (tested across Python 3.10, 3.11, 3.12, and 3.13)
  • thermo>=0.4.0
  • chemicals>=1.3.0
  • numpy>=1.23.0

Documentation

OilProps is organized into four clean, decoupled modules under oilprops:

Module Purpose
oilprops.presets OilGradeSpec, built-in presets (hfo, hfo_180, ldo, diesel, kerosene), create_custom_oil, from_api_gravity
oilprops.properties OilState, ASTM D341 fitting/charts (fit_astm_d341, generate_viscosity_temp_table, solve_temp_for_viscosity), blend_oils, scalar get_* functions, enthalpy inversion
oilprops.thermo_adapter ChEDL thermo / chemicals wrapper for pure hydrocarbons, mixtures, and Kesler-Lee pseudocomponents (evaluate_hydrocarbon, evaluate_mixture, characterize_pseudocomponent, evaluate_pseudocomponent)
oilprops.units Physical constants (ATM_BAR, WATER_REF_60F_KG_M3) and unit converters (c_to_k, bar_to_pa, api_to_sg, cst_to_sus, etc.)

All public symbols are re-exported directly from the top-level oilprops namespace.

Getting Started - Rigorous Interface

The rigorous interface exposes explicit grade specifications (OilGradeSpec), full multi-property state objects (OilState), viscosity–temperature chart tables, Refutas blending, and ChEDL equation-of-state / pseudocomponent characterization:

from oilprops import (
    characterize_pseudocomponent,
    create_custom_oil,
    evaluate_hydrocarbon,
    evaluate_mixture,
    evaluate_pseudocomponent,
    fit_astm_d341,
    generate_viscosity_temp_table,
    get_oil_properties,
    blend_oils,
    pseudocomponent_to_oil_spec,
)

# 1. Define a custom fuel oil from laboratory datasheet measurements
custom_oil = create_custom_oil(
    name="Marine Intermediate Fuel",
    rho_15_kg_m3=940.0,
    visc_t1_c=50.0,
    visc_1_cst=180.0,
    visc_t2_c=100.0,
    visc_2_cst=16.5,
)
state = get_oil_properties(custom_oil, temp_c=80.0, pressure_bar=25.0)
print(state.density_kg_m3, state.dynamic_viscosity_cp, state.bulk_modulus_bar)

# 2. Calibrate ASTM D341 and generate a viscosity-temperature chart
coeffs = fit_astm_d341(50.0, 380.0, 100.0, 25.0)
chart = generate_viscosity_temp_table("hfo", t_min_c=40.0, t_max_c=140.0, step_c=20.0)
for row in chart:
    print(f"{row.temp_c:5.1f} °C -> {row.kinematic_viscosity_cst:7.2f} cSt (Walther Y={row.walther_y:.4f})")

# 3. Blend two petroleum oils via ASTM D7152 / Refutas VBN
blended = blend_oils([("hfo", 0.70), ("diesel", 0.30)], basis="mass")
print(get_oil_properties(blended, temp_c=50.0).kinematic_viscosity_cst)

# 4. Evaluate defined hydrocarbons, mixtures, and petroleum pseudocomponents via ChEDL
dodecane = evaluate_hydrocarbon("dodecane", temp_c=60.0, pressure_bar=50.0)
hydro_mix = evaluate_mixture(["decane", "hexadecane"], [0.5, 0.5], temp_c=60.0, pressure_bar=50.0)
cut = characterize_pseudocomponent(name="Heavy Gas Oil", mw_g_mol=310.0, sg_60=0.88)
cut_state = evaluate_pseudocomponent(cut, temp_c=90.0, pressure_bar=30.0)
fast_spec = pseudocomponent_to_oil_spec(cut)

Getting Started - Simple Interface

For quick engineering lookups, one-line preset evaluations, or direct scalar calls:

from oilprops import (
    cst_to_sus,
    get_api_gravity,
    get_bulk_modulus,
    get_compressibility,
    get_density,
    get_dynamic_viscosity,
    get_enthalpy,
    get_kinematic_viscosity,
    get_oil_properties,
    get_specific_gravity,
    get_temperature_from_enthalpy,
    get_vapor_pressure,
    solve_temp_for_viscosity,
)

# Full property snapshot for HFO 380 at 80 °C, 16 bar
hfo = get_oil_properties("hfo", temp_c=80.0, pressure_bar=16.0)
print(hfo.density_kg_m3, hfo.kinematic_viscosity_cst, hfo.vapor_pressure_pa, hfo.compressibility_pa_inv)

# Direct scalar queries
rho = get_density("diesel", temp_c=40.0, pressure_bar=10.0)          # kg/m³
nu = get_kinematic_viscosity("hfo", temp_c=50.0)                     # cSt
mu = get_dynamic_viscosity("hfo", temp_c=80.0, pressure_bar=50.0)    # Pa·s
pv = get_vapor_pressure("diesel", temp_c=100.0)                      # Pa
k_mod = get_bulk_modulus("ldo", temp_c=25.0, pressure_bar=20.0)      # Pa
kappa = get_compressibility("ldo", temp_c=25.0, pressure_bar=20.0)   # Pa⁻¹
sg = get_specific_gravity("hfo", temp_c=60.0)                        # -
api = get_api_gravity("hfo")                                         # °API

# Required preheat temperature for HFO 380 to reach 15 cSt
t_heat = solve_temp_for_viscosity("hfo", target_nu_cst=15.0)

# Enthalpy <-> temperature inversion and Saybolt conversion
h_kj = get_enthalpy("hfo", temp_c=95.0)
t_c = get_temperature_from_enthalpy("hfo", h_kj)
sus = cst_to_sus(nu)

Latest source code

The latest source code can be cloned and verified locally:

git clone https://github.com/WarLord0401/oilprops.git
cd oilprops
python -m pip install -e ".[dev]"
pytest -v
python -m build

Bug reports

To report a bug, numerical discrepancy, or feature request, please open an issue at https://github.com/WarLord0401/oilprops/issues including:

  • Your Python version and OS (python --version)
  • Installed oilprops, thermo, chemicals, and numpy versions
  • A minimal reproducible snippet showing the oil specification, $(T, P)$ inputs, observed output, and expected physical value.

License information

OilProps is MIT licensed. See LICENSE for the full text.

Copyright (c) 2026 Kanishk Teotia
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software under the terms of the MIT License.

Citation

To cite OilProps in publications, technical reports, or engineering deliverables, please use (also available via CITATION.cff):

@software{oilprops,
  author = {Kanishk Teotia},
  title = {OilProps: Universal Petroleum Oil Thermophysical and PVT Property Library in Python},
  year = {2026},
  url = {https://github.com/WarLord0401/oilprops}
}

Upstream Libraries & Standards Acknowledgments

When using oilprops.thermo_adapter or publishing academic work, please also consider citing the upstream open-source libraries and correlations OilProps builds upon:

  • Thermo (ChEDL): Caleb Bell and Contributors (2016–2024). Thermo: Chemical properties component of Chemical Engineering Design Library (ChEDL). https://github.com/CalebBell/thermo
  • Chemicals (ChEDL): Caleb Bell, Yoel Rene Cortes-Pena, and Contributors (2016–2025). Chemicals: Chemical properties component of Chemical Engineering Design Library (ChEDL). https://github.com/CalebBell/chemicals
  • NumPy: Harris, C. R., et al. (2020). Array programming with NumPy. Nature, 585, 357–362.
  • Standards & Correlations: ISO 91-1 / API MPMS Ch. 11.1 (thermal expansion), ASTM D341 (Walther viscosity–temperature), ASTM D7152 (Refutas viscosity blending), Barus pressure-viscosity, Kesler–Lee (1976) petroleum characterization, and Hankinson–Thomson COSTALD (1979/1982).

Metadata

Release files for oilprops 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oilprops 0.1.0
File Size Uploaded Provenance Actions
oilprops-0.1.0.tar.gz 35.1 kB With provenance Details for oilprops-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oilprops 0.1.0
File Interpreter ABI Platform Actions
oilprops-0.1.0-py3-none-any.whl Python 3 none any Details for oilprops-0.1.0-py3-none-any.whl

Total release size: 59.1 kB

Release files / oilprops-0.1.0.tar.gz

Download URL oilprops-0.1.0.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ded309ed3ec892b5628bbd20e352cacea0a5bf34ac7ff28935bfed821ce1921
BLAKE2b-256 checksum
How to use checksums
a9e5167b9d90ab983bb8f7dd9449b8ba9ea88fbc9acbe6419165f3035c12f7db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / oilprops-0.1.0-py3-none-any.whl

Download URL oilprops-0.1.0-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11dad121f07f33bb667ae116399519e01e986849d3bf196ce86eb871cfd3c0f1
BLAKE2b-256 checksum
How to use checksums
78ff392a141502bf75c12728aca7c32af836ecc2164714a7cfc623033ae10502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for oilprops 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for oilprops-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page