rockmoc is a Python library I built to design rocket nozzles the way textbooks and NASA reports describe them — using the method of characteristics. You pick a gas, a throat size, and a target Mach number; it hands back a wall contour, performance numbers, dark figures, and a paper trail against real literature.
Most student “nozzle codes” stop at a cone or a single MLN sketch. rockmoc is the toolkit I wished I had: several real contour families, honest performance estimates, plots you can drop into a report, and checks against NASA/NACA/textbook numbers so you know the code is not inventing physics.
You describe the gas (γ and R, or a teaching preset like LOX/RP-1), the throat radius, and exactly one expansion target — exit Mach, area ratio, or pe/pc. A designer function marches the method of characteristics and returns a wall polyline plus metrics.
From there you can export CSV for CAD, plot a dark dashboard, compare families side by side, or run the production pipeline (finer mesh, optional multi-γ, boundary-layer growth, field CF, altitude sweep).
rockmoc design …)Everything is aimed at the same loop: design → inspect → export → defend the numbers.
Planar NASA MLN, axisymmetric MLN, ideal, TIC, Rao TOP/TOC, a 15° cone baseline, and Lee/Vernacchia aerospikes (full, truncated, with cowl).
One call chains fine MOC, expansion tables, Sauer-style throat start, BL δ*, exit-plane CF, altitude sweep, and optional mesh certificates.
Vacuum and ambient CF / Isp, divergence efficiency, O/F–γ–ε sweeps, and fair comparisons you can paste as Markdown or LaTeX tables.
Constant-γ perfect gas, multi-γ tables along Mach, teaching presets, and optional RocketCEA frozen chemistry for more realistic γ and R.
Post-solve dashboards: wall, MOC field with C+/C−, profiles, edge M and p/pc, altitude, BL, aerospike — dark theme, optional PNG save.
Errors that say how to fix them, unit-aware reports, lab-report generator, glossary, worked problems, and four Jupyter tutorials.
Same Me, γ, and throat — different designers. A typical length story is MLN shorter than Rao TOP (~80% of a 15° cone), TIC somewhere in the middle of ideal, and a plain cone as the honest baseline every textbook still uses.
Sharp throat corner, expansion fan, canceling wall that tries to leave the exit nearly axial. Shortest contoured option when mass and length hurt. design_mln
Circular-arc throat then a longer canceling region. TIC simply cuts that length (say 80%) when you cannot afford the full ideal bell. design_ideal · design_tic
Thrust-oriented contours used in industry practice; length is a fraction of the equivalent 15° cone. Attachment angle sits above exit angle by design. design_rao
Straight wall at a fixed half-angle (default 15°). Dead simple, easy to grade, and the right thing to beat before you claim “MOC is better.” design_conical
Two-dimensional paper-faithful path: θ_max = νe/2 and exit height = A/A*. Great for labs that follow the NASA sample case. design_planar_mln_nasa
Lee/Vernacchia plug geometry with truncation, base pressure, and optional primary cowl — for altitude-compensation stories instead of closed bells. design_spike
The solver marches along Mach waves the way Zucrow & Hoffman and NASA TM-X-1502 describe. You can inspect the net, not just the final polyline.
Interior points solve C− ∩ C+. The axis forces θ = 0. The canceling wall follows the classic MLN angle schedule and is scaled isotropically so geometric ε matches one-dimensional A/A*(Me) without warping wall slopes.
Multi-γ tables let γ change with Mach for production runs. Chemistry backends only set better chamber γ, R, and Tc — they do not turn rockmoc into a reacting CFD code, and the docs say so out loud.
design_production() is the “I need to hand this to CAD and still sleep” path.
Vacuum CF starts from classic isentropic formulas. Divergence losses use the exit angle, not a vague “wall looked curved so subtract 2%.” Field integration does the exit-plane momentum/pressure sum when you ask for it.
Click any image to zoom. These are the same dark plots the library writes to disk.














Chart.js plots built from Anderson/NACA gold digits and the deep validation snapshot.
Reference table digits vs rockmoc — errors sit well under a hundredth of a percent.
The same relation that sizes ε and planar exit height.
43 cases · 170 metrics · 12 sources · zero failures on the deep campaign.
Illustrative L/Rt from a fair compare_nozzle_designs run (mesh changes absolute length a bit).
Every deep-campaign metric stores reference, solver value, and error percent.
Re-run anytime with py -3.12 tests/run_deep_validation.py.
| M | ν ref° | ν solver | err % | A/A* ref | A/A* solver | err % | |
|---|---|---|---|---|---|---|---|
| 1.5 | 11.905 | 11.90521 | 0.0018 | 1.1762 | 1.17617 | 0.0028 | PASS |
| 2.0 | 26.380 | 26.37976 | 0.0009 | 1.6875 | 1.68750 | ~0 | PASS |
| 3.0 | 49.757 | 49.75735 | 0.0007 | 4.2346 | 4.23457 | 0.0008 | PASS |
| 4.0 | 65.785 | 65.78482 | 0.0003 | 10.7188 | 10.71875 | 0.0005 | PASS |
| 5.0 | 76.920 | 76.92022 | 0.0003 | 25.000 | 25.00000 | ~0 | PASS |
Homework should not fight the API. Defaults, reports, and docs are written for people learning propulsion.
result.report(length_unit="mm") talks in mm and degrees. lab_report("lab.md") drops a checklist-ready Markdown skeleton.
example_gas("lox_rp1"), air, LOX/LH2, methalox — frozen estimates with a clear “not flight thermo” disclaimer.
Forgot that only one of Me / ε / pe/pc is allowed? The error tells you what to change and shows a working line.
Symbol sheet, mini-explainers per nozzle type, eight worked problems with solution sketches.
First MLN, family compare, altitude performance, NASA planar sample — open and run.
Throat in millimeters, n = 40, optional gas name. Fast enough for office hours.
from rockmoc import DesignSpec, design_mln, compare_nozzle_designs
spec = DesignSpec.student(Me=3.0, gas_name="lox_rp1", Rt_mm=50)
mln = design_mln(spec)
print(mln.report())
mln.lab_report("my_lab.md", student_name="Alex", course="AE-4XX")
print(compare_nozzle_designs(spec).to_markdown())
Small, focused packages under src/rockmoc/ — easy to open one file and understand one idea.
Perfect gas, multi-γ tables, optional chemistry backends.
Unit processes, planar NASA, axisym HF, wall builders.
MLN, ideal, TIC, Rao, conical, production wrapper.
Lee spike, truncation, base pressure, cowl.
1-D CF, field integrals, altitude sweeps.
Dark figures, reports, literature campaign.
From a clone of the repo, editable install keeps you one edit away from experiments.
pip install -e ".[plot,cli,dev]"
# optional chemistry stacks
pip install -e ".[cea]"
pip install -e ".[all]"
rockmoc design --type mln --Me 3.0 \
--gamma 1.25 --Rt 0.05 -o wall.csv
rockmoc design --type tic --Me 4.0 \
--truncate 0.8 -o tic.csv
from rockmoc import PerfectGas, DesignSpec, design_mln
gas = PerfectGas(gamma=1.25, R=350.0)
spec = DesignSpec(
gas=gas,
throat_radius=0.05,
exit_mach=3.0, # or area_ratio / pressure_ratio
n_characteristics=80,
)
result = design_mln(spec, store_net=True)
print(result.summary())
result.export_csv("nozzle.csv")
result.plot() # needs rockmoc[plot]
| Call | What you get |
|---|---|
design_mln / ideal / tic / rao / conical | Axisymmetric wall + metrics |
design_planar_mln_nasa | NASA-style planar MLN |
design_spike* | Aerospike family |
design_production | Full accuracy package |
compare_nozzle_designs | Family table (+ cone) |
run_deep_validation | 12-source campaign → JSON/CSV/MD |
Every report prints known limits so the tool is hard to misuse in a capstone.