Liquid bipropellant · NASA CEA · SI-first

PROPWRAP
THERMOCHEMISTRY
WITHOUT THE UNIT MESS

A Python library over NASA CEA (via RocketCEA) for mixture performance, O/F sweeps, density impulse, and fair multi-propellant trades. Typed results. Mostly SI. Numbers you can re-run next semester.

LOX / RP-1 · CH₄ · LH₂ N₂O₄ / MMH · UDMH Shifting + Frozen ρ · Isp Trades SI · Pa · K · m/s MIT License
propwrap · session.py
$ python
# theoretical vacuum point — not flight Isp
>>> from propwrap import Mixture
>>> r = Mixture("RP-1", "LOX").evaluate(
of=2.56, pc_bar=70, eps=20)
>>> r.isp_vac_shifting, r.ve_vac_shifting, r.c_star
343.66 s   3370 m/s   1798 m/s
# Pc stored as 7e6 Pa · c* never left as ft/s
>>>
132+
pytest cases
SI
Pa · K · m/s · kg/m³
CEA
NASA kernel via RocketCEA
BIT
match on published Isp goldens
Overview

WHAT THIS ACTUALLY DOES

You name a fuel and oxidizer, set O/F, chamber pressure, and expansion ratio. propwrap runs CEA and returns Isp, c*, temperatures, γ, densities — as typed objects you can print, plot, or dump to CSV.

IN SCOPE

Propellant thermochemistry only. Ideal shifting and frozen performance. Sweeps over O/F, Pc, and ε. Density impulse. Fair multi-pair trades at each pair’s own optimum. Blends, registry, SI converters, CLI, student lab packs.

  • Vacuum / sea-level Isp (shifting + frozen)
  • ve, c*, Cf, Tc/Tt/Te, γ, Mw
  • ρ·Isp curves and rankings
  • Custom cards and multi-component wt% blends
Library · Live

OUT OF SCOPE

This is not a full engine code. No turbopumps, no cooling channels, no trajectory. Those tools can sit on top and pull γ, c*, T, and Isp from one place.

  • Flight-delivered Isp as a “truth” mode
  • Injector CFD or finite-rate kinetics
  • Cycle analysis or vehicle sizing
  • Any certification or agency endorsement
Honest default: every number is ideal 1-D CEA theory. Real engines run lower. The docs and homework output say that out loud.
Motivation

WHY BUILD THIS

CEA is fine. The mess around it is not — Rankine next to pascals, the same O/F forced onto hydrogen and kerosene, string dumps scraped into nozzles six months later.

🧱 Library, not ritual

ONE IMPORT · PINNED VERSION

Import it, pin a release, re-run the same case next semester. No more “which notebook was the good one?”

📐 Units wall

ENGLISH STOPS AT CEA

RocketCEA still speaks psia and Rankine. propwrap converts once. Outside that wall: Pa, K, m/s, kg/m³. Isp stays in seconds; ve is m/s.

⚖️ Fair trades

EACH PAIR AT ITS OWN O/F

compare_propellants optimizes mixture ratio per pair before ranking. Forcing O/F = 2.5 on LOX/LH₂ and LOX/RP-1 is wrong — and no longer the easy path.

Trust from tests

PHYSICS THAT FAILS LOUDLY

Bit-level Isp match to RocketCEA goldens. ve = Isp·g0. Cf = ve/c*. Written validation report that also lists what we refuse to claim.

Capabilities

WHAT’S IN THE REPO TODAY

Point performance, sweeps, trades, density impulse, gas state, registry, SI converters, CLI, and student homework tooling — all wired through one API.

Typical call path · evaluate → models → CEA → cache
01 🧪

Mixture

Fuel + ox name (or blend). Registry resolves aliases and densities.

02 ⚙️

Evaluate

O/F, Pc (Pa / bar / MPa), ε. Optional η knock-downs.

03 🔥

CEA backend

RocketCEA call. English units stop here. SI comes out.

04 📦

Pydantic result

Typed fields, print-friendly, CSV / markdown export.

05 💾

SQLite cache

Same case again? Hit disk under ~/.propwrap/

Point · Sweep

PERFORMANCE CORE

Vac/SL Isp, ve, c*, Cf, temperatures, γ, Mw, Pe. O/F, Pc, ε scans with optimum().

Live
Trades

DENSITY IMPULSE

Bulk liquid density vs O/F. Rank pairs by Isp and ρ·Isp — the volume-limited stage cares about both.

Live
Composition

REGISTRY + BLENDS

Aliases (RP-1→RP1), cryo defaults, typical O/F hints, multi-component wt% fuels and oxidizers.

Live
Gas state

PRODUCT PROPERTIES

Chamber / throat / exit: T, P [Pa], ρ, γ, cp, μ, k, Pr, major species.

Live
Units

SI CONVERTERS

convert(70,"bar","Pa"), Isp↔ve, density helpers. pc_bar / pc_mpa / pc inputs.

Live
Coursework

STUDENT TOOLING

homework CLI, Case presets, markdown tables, captions, cheat sheet, sample lab assignment.

Live
Physics & units

IDENTITIES WE REFUSE TO LET DRIFT

Locked in tests. Partly re-checked at evaluation time. One real bug found on the physics pass: gamma_and_temp_at_eps used to return exit T twice.

Exhaust velocity ve = Isp · g0    g0 = 9.80665 m/s²
Vacuum thrust coefficient Cf,vac = ve / c*
Pressure ratio Pc / Pe   matches CEA Pc/Pe
Chamber density check ρ ≈ P · Mw / (R T)
Temperature ordering Te < Tt < Tc

PUBLIC SI FIELDS

  • Pressure Pa · pc_pa, pe_pa · .pc_bar view
  • Temperature K · tc_kelvin …
  • Isp s · isp_vac_shifting
  • Exhaust vel. m/s · ve_vac_shifting
  • c* m/s · c_star
  • Density kg/m³ · bulk_density_kg_m3
  • ρ·Isp s·kg/m³ · density_impulse_*
Pressure trap: pc means pascals. Use pc_bar=70 for homework. Passing pc=70 looks like vacuum and the library refuses it on purpose.
γ vs cp/cv: CEA performance γ is the isentropic exponent for nozzle relations. Chamber transport cp can include dissociation. They need not match exactly — chemistry, not a unit bug.
Validation

WHERE THE NUMBERS ARE ANCHORED

Not “Isp looks about right.” Same inputs as CEA → same Isp. SI identities hold. Gaps written down, not hand-waved.

SourceWhat it secures
NASA RP-1311 — Gordon & McBride, CEA
ntrs.nasa.gov · Parts I & II
Equilibrium / frozen rocket performance methodology under RocketCEA
RocketCEA QuickStart LOX/LH₂ table
rocketcea.readthedocs.io
Published Isp; propwrap matches get_Isp at machine precision (O/F 2…8, Pc=100 psia, ε=40)
g₀ = 9.80665 m/s² · CGPM / BIPM ve and Cf definitions
1 bar = 10⁵ Pa exactly pc_bar conversion
Direct CEA_Obj checks · RP-1, CH₄, MMH propwrap path ≡ raw RocketCEA for locked cases

LOX/LH₂ GOLDENS

O/FIsp vac [s]Role
default374.30…install smoke
2424.36fuel-rich
4453.13
5453.24near peak
6448.19
8424.70ox-rich

ALSO LOCKED

Regression matrix covers LOX/RP-1, LOX/CH₄, N₂O₄/MMH, UDMH, A-50, ethanol at documented Pc/ε. Full write-up in docs/validation.md and validation_catalog.json.

Not flight data. RS-25 ~452 s vacuum is delivered engine performance. Pure CEA at similar conditions sits higher (~464 s in our RS-25-class case). Merlin-class flight Isp is well below pure kerolox theory. The catalog marks that gap.
pytest
$ pytest tests/test_physics_identities.py \
      tests/test_validation_suite.py -v
$ pytest -q
# 132+ passed on last full run
Coursework

BUILT SO A LAB CAN FINISH

Propulsion software often assumes you already know venvs and bar vs pascals. Coursework usually doesn’t. So the repo includes the boring useful layer.

📚 Docs

START HERE

🧰 Tools

HOMEWORK PACK

One command builds a report folder: summary, assumptions, CSVs, O/F and density-Isp plots, optional multi-pair trade figure.

propwrap homework kerolox --name Ada
  • Presets Case.student_lab() · booster() · upper_stage()
  • Export to_markdown() · captions · CSV
  • Guard hard error if pc=70 means bar
  • Hints list --of-hints · typical O/F bands
Usage

MINIMAL PATH

Python 3.10+ (3.11 / 3.12 fine). Windows, Linux, or macOS. Cantera and matplotlib install with the package.

install
$ python -m venv .venv
# Windows:  .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
$ pip install propwrap
$ propwrap run RP-1 LOX --of 2.56 --pc-bar 70 --eps 20
# from source: pip install -e ".[dev]"
python
from propwrap import Mixture, compare_propellants, convert

m = Mixture("RP-1", "LOX")
r = m.evaluate(of=2.56, pc_bar=70, eps=20)
print(r)

sw = m.scan_of((2.0, 3.2, 0.1), pc_bar=70, eps=20)
print(sw.optimum().of_ratio)

print(compare_propellants(
    ["RP-1/LOX", "CH4/LOX", "LH2/LOX"],
    pc_bar=70, eps=40,
))

print(convert(70, "bar", "Pa"))  # 7000000.0

Longer walkthrough: docs/how_to_use.md · API fields: docs/api_reference.md · Validation: docs/validation.md

Limits

READ BEFORE YOU CITE A NUMBER

Theory

IDEAL 1-D CEA

No kinetics, multiphase losses, or injector efficiency baked in. Shifting and frozen bracket chemistry; flight has more losses than either.

Knobs

η FACTORS ARE ROUGH

Optional efficiency multipliers are knobs, not a validated engine model. Custom propellant cards are structure-checked, not thermodynamically certified.

Legal

MIT · CHECK ROCKETCEA

This repo’s code is MIT. RocketCEA is GPL-family — check both if you ship proprietary work. Not flight-qualified software. Don’t treat it as such.

Independent open source · not affiliated with ISRO, DRDO, NAL, HAL, NASA, or any agency.