A Python program for calculating the performance of rocket nozzles
Find a file
2025-06-08 21:15:23 +02:00
theory Github doesn't support line breaks in LaTeX 2025-06-08 21:15:23 +02:00
.gitignore Initial commit 2025-06-03 00:42:53 +02:00
codegen.py Improved shock solver and function cleanup 2025-06-03 14:27:49 +02:00
LICENSE Add license and planned feature 2025-06-03 00:58:43 +02:00
nozzle.py Remove unused variable 2025-06-05 01:17:15 +02:00
nozzlemate.py Humble beginnings of the theory writeup 2025-06-05 01:07:35 +02:00
README.md Fix readme 2025-06-05 01:17:55 +02:00
relations.py Improved shock solver and function cleanup 2025-06-03 14:27:49 +02:00
vis.py Improved shock solver and function cleanup 2025-06-03 14:27:49 +02:00

NozzleMate

This is NozzleMate, a little program for calculating flow in and performance of rocket nozzles (converging-diverging nozzles).

NO CLAIMS ARE MADE ABOUT THE ACCURACY OF THIS PROGRAM

Requirements

You wil need Python 3 with the numpy, scipy and matplotlib packages to run NozzleMate. Running codegen.py also requires sympy.

Using

Input your nozzle and exhaust gas parameters in the top of nozzlemate.py and execute the file with Python:

python nozzlemate.py

Interpreting results

A rocket nozzle operates in a few different regimes, here listed from high ambient pressure to low:

  • No flow - ambient pressure is equal to the chamber pressure
  • Unchoked - flow is locally subsonic throughout the nozzle, pressure is lowest at the throat and the exit pressure is equal to ambient pressure. Thrust will be very low and exhaust hot since the internal energy hasn't been converted to kinetic energy (speed).
  • Choked and overexpanded - flow is locally sonic at the throat and supersonic after. The pressure and speed continue to respectively fall and rise in the diverging section. At higher ambient pressures (back pressures) a shock wave will occur inside the expanding part of the nozzle such that the exit pressure is equal to ambient pressure. This causes exit speed to drop to subsonic and performance will be bad. If the ambient pressure is low enough, this shockwave will occur outside the nozzle and exit flow will be supersonic and lower pressure than ambient.
  • Choked and matched - flow is locally sonic at the throat and supersonic after, exit pressure is equal to ambient pressure with no shock waves in the nozzles. This is the optimal condition for the nozzle.
  • Choked and underexpanded - flow is locally sonic at the throat and supersonic after, exit pressure is higher than ambient. The exhaust plume will expand after leaving the nozzle. Performance is potentially left on the table.

NozzleMate will print to the terminal whether the flow is choked or not, and whether it is overexpanded, underexpanded or matched as well as where the shockwave ocurs in case of overexpanded flow. The thrust will also be calculated using the mass flow rate and exit speed.

The graphs show a cross-section of the nozzle (the displayed cross-section is used to generate the rest of the graphs, but only the throat and exit areas really matter) as well as how the pressure, Mach number, flow speed, temperature and density vary throughout the nozzle. The ambient pressure is marked with a horizontal dashed line.

If you want a better understanding of the theory, head over to the theory writeup (still work-in-progress).

Planned features and todo

Future planned features in no particular order

  • Load nozzle and gas parameters from files
  • Iterative solution of actual stagnation/stagnation properties
  • Calculation of nozzle geometry from defined flow conditions
  • Calculation of exhaust gas temperature and properties from reactants

Development

Certain flow-related functions are derived ahead-of-time with SymPy and used to generate Python functions. The derivation and generation happens in codegen.py and the generated functions end up in relations.py. These functions are generally wrapped in other files to provide type hinting a bit nicer interface.