Skip to main content

A Python thermodynamic property wrapper for fluids and mixtures.

Project description

ThermoProp

PyPI version Python License

ThermoProp is a Python thermodynamic property wrapper for fluids, mixtures, and ideal gases.

It provides a clean interface around:

  • CoolProp
  • PYroMat
  • NumPy
  • SciPy

Why ThermoProp?

ThermoProp provides a unified API around CoolProp and PYroMat.

Instead of remembering backend-specific syntax such as:

CP.PropsSI(...)
pm.get(...)

users can write:

from thermoprop import Fluid

water = Fluid(
    "water",
    pressure=101325,
    temperature=300,
)

print(water.density)
print(water.enthalpy)

with a consistent interface for pure fluids, mixtures, and ideal gases.

Installation

pip install thermoprop

Features

Fluid

Fluid is a CoolProp-based real-fluid wrapper.

It supports:

  • Pure fluids
  • Fluid mixtures
  • Pressure-temperature states
  • Pressure-enthalpy states
  • Pressure-quality states
  • Temperature-quality states
  • Density-based states
  • Mass-fraction and mole-fraction mixtures

IdealGas

IdealGas is a PYroMat-based ideal-gas wrapper.

It supports:

  • Pure ideal gases
  • Ideal-gas mixtures
  • Temperature states
  • Enthalpy states
  • Internal-energy states
  • Pressure-density closure
  • Cp, Cv, gamma, entropy, Gibbs energy, and speed of sound

Thermodynamic Reference States

ThermoProp provides a unified interface to multiple thermodynamic backends.

Different property libraries may use different reference states for properties such as:

  • Enthalpy
  • Internal energy
  • Entropy

As a result, absolute values of these properties may differ between ThermoProp classes even when pressure, temperature, and composition are identical.

For example, two wrappers representing the same physical state may report different absolute enthalpy values if their underlying thermodynamic libraries use different energy reference conventions.

This behavior is expected and does not indicate an error.

Most engineering calculations depend on property differences rather than absolute values. Properties such as:

  • Temperature
  • Pressure
  • Density
  • Specific heats
  • Speed of sound
  • Enthalpy differences (Δh)
  • Internal-energy differences (Δu)

remain physically meaningful within each backend.

Users combining results from multiple ThermoProp wrappers should establish a consistent thermodynamic reference basis if absolute values of enthalpy, internal energy, or entropy are required.

Pure Fluid Example

from thermoprop import Fluid

water = Fluid(
    "water",
    pressure=101325,
    temperature=300,
)

print(water.density)
print(water.enthalpy)
print(water.phase)

Pressure-Enthalpy Example

from thermoprop import Fluid

water = Fluid(
    "water",
    pressure=101325,
    enthalpy=2.7e6,
)

print(water.temperature)
print(water.quality)
print(water.phase)

Mixture Example

from thermoprop import Fluid

air_like = Fluid(
    {"nitrogen": 0.79, "oxygen": 0.21},
    basis="mole",
    pressure=101325,
    temperature=300,
)

print(air_like.density)
print(air_like.specific_heat_cp)

Ideal Gas Example

from thermoprop import IdealGas

nitrogen = IdealGas(
    "gn2",
    pressure=101325,
    temperature=300,
)

print(nitrogen.density)
print(nitrogen.specific_heat_ratio)
print(nitrogen.speed_of_sound)

Common Properties

from thermoprop import Fluid

fluid = Fluid(
    "water",
    pressure=101325,
    temperature=300,
)

print(fluid.pressure)
print(fluid.temperature)
print(fluid.density)
print(fluid.enthalpy)
print(fluid.entropy)
print(fluid.specific_heat_cp)
print(fluid.specific_heat_cv)
print(fluid.specific_heat_ratio)
print(fluid.speed_of_sound)
print(fluid.dynamic_viscosity)
print(fluid.conductivity)

Updating State Properties

ThermoProp states can be updated after creation.

Real Fluid

from thermoprop import Fluid

water = Fluid(
    "water",
    pressure=101325,
    temperature=300,
)

water.pressure = 2e5
water.temperature = 350

print(water.density)
print(water.enthalpy)

You can also update state pairs directly:

water.pressure_temperature = (2e5, 350)
water.pressure_enthalpy = (2e5, 1.5e6)
water.pressure_quality = (101325, 0.5)
water.temperature_quality = (373.15, 1.0)

Ideal Gas

Ideal gases only require a thermal state such as temperature, enthalpy, or internal energy.

from thermoprop import IdealGas

nitrogen = IdealGas(
    "gn2",
    temperature=300,
)

print(nitrogen.enthalpy)
print(nitrogen.internal_energy)
print(nitrogen.specific_heat_cp)

Pressure is optional, but it is required for pressure-dependent properties such as density and entropy:

nitrogen.pressure = 101325

print(nitrogen.density)
print(nitrogen.entropy)

You can also update ideal-gas states:

nitrogen.temperature = 500
nitrogen.pressure_temperature = (101325, 300)
nitrogen.pressure_enthalpy = (101325, nitrogen.enthalpy)

Ideal-Gas Viscosity Limitation

IdealGas.dynamic_viscosity uses Sutherland's law.

Currently, viscosity is only supported for selected pure gases, including:

  • Air
  • Argon
  • Carbon dioxide
  • Carbon monoxide
  • Nitrogen
  • Oxygen
  • Hydrogen
  • Water vapor

Mixture viscosity is not currently supported.

from thermoprop import IdealGas

air = IdealGas(
    "air",
    pressure=101325,
    temperature=300,
)

print(air.dynamic_viscosity)

If viscosity data is unavailable for a gas, ThermoProp raises NotImplementedError.

Source Code

GitHub:

https://github.com/saakethramoju/ThermoProp

License

ThermoProp is released under the GNU General Public License v3.0.

See LICENSE and THIRD_PARTY_LICENSES.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thermoprop-0.1.6.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thermoprop-0.1.6-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file thermoprop-0.1.6.tar.gz.

File metadata

  • Download URL: thermoprop-0.1.6.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for thermoprop-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7afb572250db659e971d1b3acfe5df38cea6202336b6380d5d23ea8be3cc9026
MD5 0dac9d5cde9bfbf1f026cc1e47b13c0e
BLAKE2b-256 7abcaf07ad6e8c3d88aa900ae74e59d4169cd84e7295c5d3c3544133ca5d521f

See more details on using hashes here.

File details

Details for the file thermoprop-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: thermoprop-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for thermoprop-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7d28c8f4480683a1435b4edcf51df2ef5f265b15c772364cbf5753a7df622f42
MD5 02ec7afeea7f5711a770a34667931932
BLAKE2b-256 c9cc0f95856e6682185e8b97b969cd33a48ded588f7163d71e746ee8673a52ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page