Skip to content

Conversation

@cmflannery
Copy link
Owner

@cmflannery cmflannery commented Nov 26, 2025

Summary

Complete rewrite of OpenRocketEngine with a modern, type-safe architecture. This replaces the legacy codebase with a clean, explicit API designed for liquid rocket engine preliminary design.

What's New

Core Modules

  • units.py - Custom Quantity class for type-safe physical quantities with unit conversion
  • isentropic.py - Numba-accelerated isentropic flow equations (c*, Cf, Isp, Mach relations)
  • engine.py - Immutable dataclasses (EngineInputs, EnginePerformance, EngineGeometry) with pure computation functions
  • nozzle.py - Rao bell and conical nozzle contour generation with CSV export for CAD
  • plotting.py - Publication-quality visualizations (cross-sections, altitude performance, dashboards)

Key Features

  • Type safety: beartype runtime checking prevents parameter errors
  • Units system: Custom Quantity class prevents dimensional analysis mistakes
  • Performance: Numba JIT compilation for hot paths
  • Explicit API: No magic properties - clear data flow from inputs → performance → geometry
  • Visualization: Engine cross-sections, altitude performance curves, design dashboards

Breaking Changes

  • Removed legacy Engine class from rocket.py
  • Removed interface.py CLI (replaced with examples)
  • Removed xlsxwriter dependency and Excel output
  • Removed pandas, fire dependencies
  • New API requires explicit unit-wrapped quantities

Example Usage

from openrocketengine import EngineInputs, design_engine
from openrocketengine.units import newtons, megapascals, kelvin, meters, pascals

inputs = EngineInputs(
    thrust=newtons(5000),
    chamber_pressure=megapascals(2.0),
    chamber_temp=kelvin(3200),
    exit_pressure=pascals(101325),
    molecular_weight=22.0,
    gamma=1.2,
    lstar=meters(1.0),
    mixture_ratio=2.0,
)

performance, geometry = design_engine(inputs)
print(f"Isp: {performance.isp.value:.1f} s")  # Isp: 280.3 s

Testing

  • 155 tests passing covering units, isentropic equations, engine calculations, and nozzle generation
  • Run with: uv run pytest tests/ -v

@cmflannery cmflannery changed the title Revive and upgrade this project Rewrite: Modern Python architecture with type safety, units system, and visualization (v0.2) Nov 26, 2025
@cmflannery cmflannery merged commit b290226 into master Nov 26, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants