Chemical Equilibrium Calculator - Professional thermodynamic analysis software with NASA CEA2 integration

Chemical Equilibrium Calculator

Professional Thermodynamic Analysis Software with NASA CEA2 Integration

GPL v3 Python 3.11+ PySide6 129 Oxidizers 397 Fuels NASA CEA2 Ready

📌 What is Chemical Equilibrium Calculator?

Chemical Equilibrium Calculator is a professional-grade desktop application for thermodynamic equilibrium calculations in chemical systems. Built with a modular MVC architecture, it provides precise equilibrium composition analysis, thermodynamic property calculations, and comprehensive performance evaluation.

The software integrates with NASA's CEA2 (Chemical Equilibrium with Applications) for high-precision calculations while maintaining a robust fallback ideal gas calculator when CEA2 is unavailable.

Target Users

  • Chemists studying chemical equilibrium
  • Chemical Engineers designing reactors
  • Aerospace Engineers analyzing propulsion
  • Researchers publishing thermodynamic data
  • Python Developers building scientific apps

Key Metrics

  • 129 Oxidizers + 397 Fuels database
  • Real-time calculation in <1 second
  • 25+ analysis tools included
  • Export to CSV/Excel formats
  • English & French interfaces

Architecture

Modular MVC architecture with separation of concerns:

Chemical-Equilibrium-Calculator/
├── main.py                 # Entry point
├── requirements.txt        # Dependencies
├── config/                 # Configuration files
├── database/               # Species database (129 oxidizers + 397 fuels)
├── engine/                 # Calculation logic (CEA2 + fallback)
├── models/                 # Data layer
└── ui/                     # User interface
    ├── main_window.py      # Main window controller
    ├── styles.py           # QSS styling
    ├── widgets/            # UI components
    │   ├── input_panel.py  # Formulation input
    │   ├── results_tabs.py # Results display
    │   └── toast.py        # Notifications
    └── dialogs/            # Popup dialogs
        ├── user_defined_reactant_dialog.py
        ├── nozzle_dialog.py
        └── batch_sweep_dialog.py

Equilibrium Calculations

Complex multi-species chemical equilibrium analysis using free-energy minimization. Supports both equilibrium and frozen chemistry modes.

Thermodynamic Properties

Calculate temperature, pressure, enthalpy, entropy, specific heat, molecular weight, and transport properties.

Nozzle Designer

Isentropic flow analysis, throat/exit diameter calculation, Mach number distribution, and nozzle contour generation.

Batch Sweep

Parametric studies across O/F ratios, chamber pressures, and area ratios. Identify optimal performance points.

Advanced Visualization

Interactive bar charts, radar plots, pie charts, and Isp vs O/F ratio graphs with Matplotlib.

User-Defined Reactants

Create custom chemical species with atomic composition, saved to database for reuse across sessions.

Export Capabilities

Export results to CSV and Excel formats with formatted tables and multi-sheet workbooks.

Multi-Language

English and French interfaces with real-time switching without application restart.

Analysis Tools (25+)

🚀 Nozzle & Geometry

  • Nozzle Designer
  • Chamber Sizer
  • Contraction Ratio

🔥 Thermal & Cooling

  • Heat Transfer (Bartz)
  • Regenerative Cooling
  • Instability Predictor

🌍 Mission & Performance

  • Delta-V Calculator
  • Orbit Insertion ΔV
  • Staging Optimiser

📊 Advanced Analysis

  • Sensitivity Analysis
  • Design of Experiments
  • Composition vs T

⚡ Chemical Equilibrium Fundamentals

Chemical equilibrium occurs when the forward and reverse reaction rates are equal, resulting in no net change in species concentrations.

Gibbs Free Energy Minimization:
ΔG° = -RT ln K

Equilibrium Constant:
K = exp(-ΔG°/RT)

Van't Hoff Equation:
d(ln K)/dT = ΔH°/(RT²)

📐 Rocket Performance Parameters

Specific Impulse: Isp = F/ṁ = (C* × Cf) / g₀
Characteristic Velocity: C* = Pc × At / ṁ
Thrust Coefficient: Cf = F / (Pc × At)
Isp = Specific Impulse (s) C* = Characteristic Velocity (m/s) Cf = Thrust Coefficient Pc = Chamber Pressure (bar) At = Throat Area (m²) ṁ = Mass Flow Rate (kg/s)

📊 Isentropic Flow Relations

Area-Mach Relation:
A/A* = (1/M) × [(2/(γ+1)) × (1 + (γ-1)M²/2)]^((γ+1)/(2(γ-1)))

Temperature Ratio: T/T₀ = 1 / (1 + (γ-1)M²/2)
Pressure Ratio: P/P₀ = (T/T₀)^{γ/(γ-1)}

📋 System Requirements

RequirementMinimumRecommended
Python3.113.13
RAM2 GB4 GB
Disk200 MB500 MB
Display1280×7201920×1080

🐍 Dependencies

PySide6>=6.6.0 matplotlib>=3.7.0 numpy>=1.24.0 pandas>=2.0.0 qtawesome>=1.3.0

🚀 Installation Commands

# Clone repository
git clone https://github.com/khadev/Chemical-Equilibrium-Calculator.git
cd Chemical-Equilibrium-Calculator

# Create virtual environment (optional)
python -m venv venv
# Windows: venv\Scripts\activate
# Linux/Mac: source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run application
python main.py

# Optional: Install NASA CEA2 for high-precision calculations
pip install cea

📦 Standalone Executable (PyInstaller)

pip install pyinstaller
pyinstaller --windowed --onefile --name ChemicalEquilibrium main.py
# Output: dist/ChemicalEquilibrium.exe

🔧 CEAResult Class

class CEAResult:
    # Performance
    isp_vac: float      # Vacuum specific impulse (s)
    isp_ms: float       # Specific impulse (m/s)
    cstar: float        # Characteristic velocity (m/s)
    cf: float           # Thrust coefficient
    cf_vac: float       # Vacuum thrust coefficient
    ae_at: float        # Area ratio Ae/At
    
    # Thermodynamic
    t_chamber: float    # Chamber temperature (K)
    t_throat: float     # Throat temperature (K)
    t_exit: float       # Exit temperature (K)
    p_chamber: float    # Chamber pressure (bar)
    p_exit: float       # Exit pressure (bar)
    gamma: float        # Specific heat ratio
    mw: float           # Molecular weight (g/mol)
    mach_exit: float    # Exit Mach number
    
    # Species
    mass_fractions: Dict[str, float]

⚡ CEAWorker Thread

class CEAWorker(QThread):
    result_ready = Signal(object)   # CEAResult
    data_parsed = Signal(object)    # For plots
    engine_error = Signal(str)
    log_message = Signal(str)

    def __init__(self, formulation: Formulation):
        # Runs CEA or fallback in background thread

🗄️ Species Database

CategoryCount
Oxidizers129 species
Fuels397 species
Named Fuels10 presets (HTPB, MCCN, etc.)
Elements70+ elements

📁 Database Files

database/
├── databasecea.txt     # NASA CEA species database (immutable)
├── user_custom.json    # User-defined custom species
└── saved_udrs.json     # Saved user-defined reactants

config/
├── config.json         # User settings (paths, units, language)
└── translations.json   # English/French translations

🤝 Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 Code Style

  • Follow PEP 8 with 120 character line length
  • Use type hints for all function signatures
  • Add docstrings to all public methods (Google style)
  • Maintain test coverage > 80%

📧 Commit Message Format

type(scope): subject

Types: feat, fix, docs, style, refactor, test, chore

Example:
feat(tafel): add automatic outlier detection
Khaled
Khaled ABOUT THE AUTHOR :
My name is Khaled and I studied chemistry at the University of science in Oran-Algeria I have got a master's degree in Biomolecule engineering. I believe in the philosophy of progression over perfection and that fitness is a lifelong journey with new milestones and achievements along the way. After cultivating a healthier lifestyle and developing a commitment to improving through my own fitness journey i discovered my desire to help others with what method works best for me and gave me the best results. That’s why I made this blog. So if you want to take your workouts and your passion to the next level, you’re in the right place.
When I'm not busy with sports, I fill my downtime spending time coding and building blocks of a website (design front-end developer), hanging with family & friends, spearfishing and cooking healthy food.
Progressive Fitness is a compilation of my workouts and nutrition advice, packaged just for you!

Post a Comment