Skip to main content

A library for thermodynamic and transport property calculations of gases.

Project description

Gasoptics

Gasoptics is a Python library for calculating thermodynamic and transport properties of gases, now updated to include enhanced functionality for real gas behavior, humid air modeling, and more robust computational methods.

What's New in Version 0.3.0

  • Thermal Conductivity: Added support for calculating thermal conductivity (λ) for gases and humid air.
  • Unit Conversion: Introduced the UnitConverter class for standardized input and output unit handling.
  • Improved Imports: Simplified imports with enhanced modular design.
  • Code Refinements: Refactored the codebase for better maintainability and extensibility.
  • Humid Air Modeling: Added functions to calculate thermodynamic properties (e.g., ( C_p ), ( C_v ), and density) for humid air, including relative humidity considerations.
  • Enhanced Dynamic Viscosity: Improved viscosity calculations using Sutherland’s law and empirical pressure corrections for high-pressure conditions.
  • Real Gas Handling: Extended support for real gas properties using Redlich-Kwong and Peng-Robinson equations of state.
  • Improved Testing: Expanded test coverage and added comparison with reference datasets.
  • Refactored Codebase: Organized functions into specific modules for easier maintenance and scalability.
  • New Property Calculations:
    • Specific Heat (( C_p ), ( C_v ))
    • Ratio of Specific Heats (( \gamma ))
    • Density
    • Dynamic Viscosity
    • Entropy and Enthalpy for real and ideal gases

Features

  • Thermodynamic Properties:
    • Specific heat (( C_p, C_v )), enthalpy, entropy, and (\gamma) for real and humid air.
  • Transport Properties:
    • Viscosity and thermal conductivity calculations using empirical and theoretical models.
  • Equations of State:
    • Support for Redlich-Kwong and Peng-Robinson EOS.
  • Modular Design:
    • Organized codebase with dedicated modules for each property.
  • Utility Functions:
    • Helper functions for handling gas constants and property lookups.

Installation

Option 1: Install from PyPI

pip install gasoptics

Option 2: Install from Source

  1. Clone the repository:
    git clone https://github.com/karimialii/gasoptics.git
    
  2. Navigate into the project directory:
    cd gasoptics
    
  3. Install the package:
    pip install .
    

Requirements

  • Python 3.x
  • NumPy
  • Matplotlib

Usage

Example: Calculating Thermodynamic Properties

from gasoptics.thermodynamics import calculate_cp, calculate_cv, calculate_gamma
from gasoptics.transport import calculate_dynamic_viscosity

# Define conditions
T = 300  # Temperature in Kelvin
P = 101325  # Pressure in Pascals
RH = 0.5  # Relative Humidity (50%)

# Calculate specific heat at constant pressure
cp = calculate_cp(T, P, RH=RH)
print(f"Specific Heat (Cp): {cp} J/kg·K")

# Calculate specific heat at constant volume
cv = calculate_cv(T, P, RH=RH)
print(f"Specific Heat (Cv): {cv} J/kg·K")

# Calculate ratio of specific heats (gamma)
gamma = calculate_gamma(T, P, RH=RH)
print(f"Gamma (Cp/Cv): {gamma}")

# Calculate dynamic viscosity
mu = calculate_dynamic_viscosity(T, P)
print(f"Dynamic Viscosity: {mu} Pa·s")

Example: Calculating Density

from gasoptics.thermodynamics import calculate_density

# Conditions
T = 300  # Kelvin
P = 101325  # Pascals
RH = 0.8  # Relative Humidity (80%)

# Calculate density for humid air
rho = calculate_density(T, P, RH=RH)
print(f"Density of Humid Air: {rho:.3f} kg/m³")

Tests

Run the test suite to validate functionality:

pytest tests/

Contributing

Contributions are welcome! Follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature
    
  3. Make your changes and commit:
    git commit -am "Add new feature"
    
  4. Push to your branch:
    git push origin feature/your-feature
    
  5. 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

gasoptics-0.3.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

gasoptics-0.3.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file gasoptics-0.3.0.tar.gz.

File metadata

  • Download URL: gasoptics-0.3.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for gasoptics-0.3.0.tar.gz
Algorithm Hash digest
SHA256 131bf5731b2f944ccfd9df241a4ae510b34cc5eed893924004657b1c5a5e6982
MD5 c2ad81693efa25ec585a7d1b8dd0ac1d
BLAKE2b-256 f3c4a6175ea82de55e4c8aa11b8f2b1bfb5756f3d07fc77a6807e05301ef93f9

See more details on using hashes here.

File details

Details for the file gasoptics-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gasoptics-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for gasoptics-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5f465673161884c81647c2c051c8c7e24d4a2508bdca1e57fb183c1151f2f53
MD5 95f8941fb09d28b7abb06275936f3993
BLAKE2b-256 f5e3534b1e6e1b91b3b5e4d406e0d0c3e1e850929dcf025e749671c122d39af6

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