A library for thermodynamic and transport property calculations of gases.
Project description
GasOptics
GasOptics is a Python library designed to calculate thermodynamic and transport properties of gases. With the introduction of the GasProperties class, the library now provides a streamlined interface for handling various gas properties under different conditions, along with robust unit conversion capabilities.
What's New in Version 0.3.2
- The
GasPropertiesClass:- Unified interface for calculating gas properties.
- Dynamic updates to conditions without reinitialization.
- Support for unit conversions using
UnitConverter.
- Thermal Conductivity Calculations:
- Added support for thermal conductivity (
λ) calculations for gases and humid air.
- Added support for thermal conductivity (
- Enhanced Unit Handling:
- Seamless input and output unit conversion for temperature, pressure, enthalpy, and more.
- Refactored Codebase:
- Modularized structure for easier maintenance and extensibility.
Features
The GasProperties Class
- Dynamic Property Calculations:
- Specific Heat: ( C_p, C_v )
- Density: ( \rho )
- Dynamic Viscosity: ( \mu )
- Enthalpy: ( h )
- Entropy: ( s )
- Heat Capacity Ratio: ( \gamma )
- Thermal Conductivity: ( \lambda )
- Update Conditions Dynamically:
- Change temperature, pressure, or relative humidity without reinitialization.
- Unit Conversion:
- Flexible input and output unit handling for consistent results.
Installation
Option 1: Install from PyPI
pip install gasoptics
Option 2: Install from Source
- Clone the repository:
git clone https://github.com/karimialii/gasoptics.git
- Navigate into the project directory:
cd gasoptics
- Install the package:
pip install .
Requirements
- Python 3.x
- NumPy
Usage
Using GasProperties
The GasProperties class provides a convenient interface to calculate various thermodynamic and transport properties of gases.
Example 1: Basic Usage
from gasoptics.properties import GasProperties
# Set global units
GasProperties.set_unit(T="C", p="bar", h="kJ")
# Create a GasProperties instance
props = GasProperties(T=25, p=1, RH=0.5, T_unit="C") # 25°C, 1 bar, 50% RH
# Calculate properties
cp = props.cp()
rho = props.rho()
mu = props.mu()
print(f"Specific Heat (cp): {cp:.2f} kJ/kg·K")
print(f"Density (rho): {rho:.3f} kg/m³")
print(f"Viscosity (mu): {mu:.6f} Pa·s")
Example 2: Dynamic Updates
# Update conditions dynamically
props.update_conditions(T=30, p=1.5, RH=0.6, T_unit="C")
# Recalculate properties
cp_updated = props.cp()
rho_updated = props.rho()
print(f"Updated Specific Heat (cp): {cp_updated:.2f} kJ/kg·K")
print(f"Updated Density (rho): {rho_updated:.3f} kg/m³")
Available Methods in GasProperties
| Method | Description |
|---|---|
cp() |
Specific heat at constant pressure (( C_p )). |
cv() |
Specific heat at constant volume (( C_v )). |
rho() |
Density (( \rho )). |
h() |
Enthalpy (( h )). |
s() |
Entropy (( s )). |
gamma() |
Heat capacity ratio (( \gamma )). |
k() |
Thermal conductivity (( \lambda )). |
mu() |
Dynamic viscosity (( \mu )). |
Tests
Run the test suite to validate functionality:
pytest tests/
Contributing
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature
- Make your changes and commit:
git commit -am "Add new feature"
- Push to your branch:
git push origin feature/your-feature
- Submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 gasoptics-0.3.2.tar.gz.
File metadata
- Download URL: gasoptics-0.3.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37e762b659f16f3d16e18a2f9da6ab2b3b820df00a2576dc2efca9e8ee3c2af6
|
|
| MD5 |
fa1b71e144ab2fbc053e55ed7cf56452
|
|
| BLAKE2b-256 |
d8cb6238a6a0f365c390aa53b1afb49b16f0f52beb2d45d441fbaaffbe13b8db
|
File details
Details for the file gasoptics-0.3.2-py3-none-any.whl.
File metadata
- Download URL: gasoptics-0.3.2-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd43c5ae9655ff4bd259cba082e52fde0dfef2c42eb248418572954fa238a467
|
|
| MD5 |
2488aa07ec83c46bbb4bc10c14b359cf
|
|
| BLAKE2b-256 |
ccf3dc0aaea193491d9141a6774f0e1436400e18498db4a483cd8b474ee9e708
|