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 2.0

  • 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.2.0.tar.gz (10.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.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gasoptics-0.2.0.tar.gz
  • Upload date:
  • Size: 10.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.2.0.tar.gz
Algorithm Hash digest
SHA256 c640c553de351712b16f0828169d94018bfe8bea45d0d35856b4a723f1c4bde8
MD5 3adbcb211e71c18c767e48ab8e180a10
BLAKE2b-256 e0c9fc7b30b504accf3a7b62a4b52a49ff3d1f5b987b5828a6468bb68f7b0d5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gasoptics-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8678e6c2e836e33d58b99bfe62a7fd984401bfaac3d3dd2d42f76b94e840f89a
MD5 317c49d5e643f314c8599939ac579952
BLAKE2b-256 a1922cce86ae03679e2cdb1d51bd44dc9acdccb031888eff952c15490a521697

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