Poi = 1.e5
At = 0.2
Ae = 0.6
AR = Ae / At
Me_sub = cflow.nozzle.find_Mach_from_area_ratio(AR, mode='subsonic')
Pe_sub = cflow.stagnation.get_static_pressure(Po=Poi, M=Me_sub)
Me_sup = cflow.nozzle.find_Mach_from_area_ratio(AR, mode='supersonic')
Pe_sup = cflow.stagnation.get_static_pressure(Po=Poi, M=Me_sup)
Pe_shock_at_exit = cflow.normal_shock.get_downstream_pressure(M1=Me_sup, P1=Pe_sup)
print('1. choked flow: NPR >= %f' % (Poi / Pe_sub))
print('2. internal shock: %f < NPR < %f' % (Poi / Pe_sub, Poi / Pe_shock_at_exit))
print('3. normal shock at exit: NPR = %f' % (Poi / Pe_shock_at_exit))
print('4. overexpanded flow: %f < NPR < %f' % (Poi / Pe_shock_at_exit, Poi / Pe_sup))
print('5. supercritical flow: NPR = %f' % (Poi / Pe_sup))
print('6. underexpanded flow: %f < NPR' % (Poi / Pe_sup))