A Pythonic object-oriented wrapper for CoolProp with property validation, state management, and all thermodynamic properties settable
Project description
CoolProp-OOP
An object-oriented wrapper for CoolProp thermodynamic properties. This library provides an intuitive, Pythonic interface to CoolProp's functionality for both humid air and pure fluid property calculations.
Features
- Object-oriented interface to CoolProp's functionality
- Property validation to prevent physically impossible states
- All thermodynamic properties are directly settable - enthalpy, entropy, and any other property can be used as a constraint
- Automatic caching of calculated properties for better performance
- Support for both Humid Air (
StateHA) and Pure Fluids (StateProps) - Comprehensive state validation with helpful error messages
- Fully Pythonic API with property-based getters and setters
CoolProp-OOP provides an intuitive, object-oriented interface to CoolProp's thermodynamic property calculations for both humid air and pure fluids. It simplifies property access and calculations through two main classes: StateHA for humid air properties and StateProps for pure fluid properties.
Installation
pip install coolprop-oop
Features
- Easy-to-use object-oriented interface
- Simple property constraint management
- Support for both humid air and pure fluid calculations
- Consistent SI unit system
- Compatible with CoolProp 6.7.0
Usage
Humid Air Properties
from coolprop_oop import StateHA
# Create a state for humid air at 25°C, 1 atm, 60% RH
state = StateHA('T', 298.15, 'P', 101325, 'R', 0.6)
# Access properties using property codes
humidity_ratio = state.get('W')
wet_bulb = state.get('B') - 273.15 # Convert to Celsius
enthalpy = state.get('H')
# Get multiple properties in one call
temp, pressure, rel_humidity = state.get('T', 'P', 'R')
# View current constraint values
constraints = state.constraints()
print(constraints) # {'T': 298.15, 'P': 101325, 'R': 0.6}
# Update a constraint
state.reset('T', 303.15) # Change temperature to 30°C
# Replace a constraint with a different property
state.replace('R', 'W', 0.015) # Replace RH with humidity ratio
Pure Fluid Properties
from coolprop_oop import StateProps
# Create a state for water at 100°C, 1 atm
water = StateProps('T', 373.15, 'P', 101325, 'water')
# Access properties using property codes
density = water.get('D')
enthalpy = water.get('H')
entropy = water.get('S')
# Get multiple properties in one call
temp, pressure = water.get('T', 'P')
# View current constraint values
constraints = water.constraints()
print(constraints) # {'T': 373.15, 'P': 101325, 'fluid': 'water'}
# Update a constraint
water.reset('T', 393.15) # Change temperature to 120°C
# Replace a constraint with a different property
water.replace('P', 'D', 900.0) # Replace pressure with density
Property Codes (CoolProp 6.7.0)
Humid Air Properties (StateHA)
'T': Temperature [K]'P': Pressure [Pa]'W': Humidity ratio [kg/kg dry air]'R': Relative humidity [0-1]'D': Dew point temperature [K]'B': Wet bulb temperature [K]'V': Specific volume [m³/kg dry air]'H': Specific enthalpy [J/kg dry air]'S': Specific entropy [J/kg dry air/K]'C': Specific heat capacity [J/kg dry air/K]
Pure Fluid Properties (StateProps)
'T': Temperature [K]'P': Pressure [Pa]'D': Density [kg/m³]'H': Specific enthalpy [J/kg]'S': Specific entropy [J/kg-K]'Q': Vapor quality [-]'C': Specific heat capacity at constant pressure [J/kg-K]'O': Specific heat capacity at constant volume [J/kg-K]'U': Specific internal energy [J/kg]
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coolprop_oop-2.0.0.tar.gz.
File metadata
- Download URL: coolprop_oop-2.0.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d9cd8915f9470cd68cd98d386b996db230124ca60c2298792af766ccfb12cb
|
|
| MD5 |
534a2eaae8d0397959039a161764547f
|
|
| BLAKE2b-256 |
b71014d822aad27f8d9ab9fd5509b2ffe5a4f8f4362e6d29d361c82351c1064a
|
File details
Details for the file coolprop_oop-2.0.0-py3-none-any.whl.
File metadata
- Download URL: coolprop_oop-2.0.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6106f7700dbe85b1361c68405e4bd76b8f1ffa5f3efb33cb2ab75af4425acba3
|
|
| MD5 |
4556236d67d14ac71b0ecca53a454e42
|
|
| BLAKE2b-256 |
93553ac46c3fd61c70677350addb8c7d5ad03b4dada20dd9c07dad46067d29a7
|