Quasi-1D isentropic expansion in nozzles
Sint-Genesius-Rode, Mar 2018.


This page is in the "junk" directory! Make sure you check some better material as well, on the main page :-)

In this page you can find a couple of Octave/MATLAB scripts computing the quasi-1D isentropic expansion of a perfect gas into a nozzle. Here are the governing equations (See for example Ascher H. Shapiro, The dynamics and thermodynamics of compressible fluid flows, vol. 1 - Part II.):
isentropic_nozzle_equations

Analytic results script

Obtaining an analytic solution for the above equations is a matter of a few passages, that you can find on many textbooks. Hoping I didn't introduce mistakes, here are the results:
integrals

And here is an Octave script computing them: Octave script for analytic nozzle

The script reads an input file with the nozzle geometry organized in two columns: the first one is the axial coordinate (x) and the second one the radius (y). The code assumes the nozzle is axisimmetric: for 2D nozzles you only have to modify the area computation in the script.
The throat conditions are set inside the script, and you'll have to choose the value for the specific heat ratio (gamma), which is 5/3 for monatomic gases and 7/5 for diatomic ones.

-Small technical note-
The correct procedure for obtaining the Mach number and the other flow quantities (velocity, density, pressure) along the nozzle should be:
  1. Import the geometry (x,y coordinates) and compute the nozzle area vs x;
  2. Invert the area-Mach number relation given above to get the Mach number at each section (a nonlinear equation appears);
  3. Compute the velocity, pressure and density using the Mach number just obtained.
In order to avoid inverting the area-Mach number relation, the script assumes that the Mach number of interest is in the range of M = 0 to M = 200, then creates a fictitious vector of areas which correspond to that Mach number and then interpolates back the real areas vector to obtain the real Mach number.

ODE integration script

In case you don't want to use the analytic results and you wish to solve the nozzle flow governing equations numerically, here's a simple script. The script integrates the equations (see below) with a simple 1st order upwinded method, starting from the throat: Octave script for ODE integration
Again, you need to have a nozzle geometry (see above) and to set in the script the flow conditions in the throat. Here are the solved equations, which can be easily obtained from the mass, momentum and energy conservation equations, together with the perfect gas law.
Here are the equations, obtained by manipulating a bit the main equations on the top:
integrals

Cheers!
-Stefano