Ejemplo n.º 1
0
def NPR_shock_at_exit(AsAc):
    """Compute Nozzle Pressure Ratio to get a choked, supersonic regime but shock at exit in a nozzle with As/Ac diffuser

	Args:
		AsAc ([real]): ratio of exit over throat surfaces 
	Returns:
		[real]: Nozzle Pressure ratio (inlet total pressure over exit static pressure)
	"""
    Msup = mf.MachSup_Sigma(AsAc)
    Msh = sw.downstream_Mn(Msup)
    return Is.PtPs_Mach(Msh) / sw.Pi_ratio(Msup)
Ejemplo n.º 2
0
def test_shockwave_Mn1():
    assert sw.downstream_Mn(1.) == 1.
    assert sw.downstream_Mn(1.1) == pytest.approx(0.9117704213259055)
    assert sw.downstream_Mn(2.) == pytest.approx(0.5773502691896257)
    assert sw.downstream_Mn(1., gamma=1.3) == 1.
    assert sw.downstream_Mn(1.1, gamma=1.3) == pytest.approx(0.911201472607656)
    assert sw.downstream_Mn(2., gamma=1.3) == pytest.approx(0.5628780357842335)
Ejemplo n.º 3
0
def _NPR_Ms_list(AsAc):
    """
    	Computes all NPR limits and associated exit Mach number

		internal function
 
		:param AsAc:  ratio of section at exit over throat
		:return:      result NPR and Mach numbers
 
 		:Example:

		>>> import aerokit.aero.MassFlow as mf ; mf.Sigma_Mach(Is.Mach_PtPs(np.array(_NPR_Ms_list(2.)[:3:2])))
		array([ 2.,  2.])

		.. seealso:: NPR_choked_subsonic(), NPR_choked_supersonic(), NPR_shock_at_exit()
		.. note:: available for scalar or array (numpy) computations
    """
    Msub = mf.MachSub_Sigma(AsAc)
    NPR0 = Is.PtPs_Mach(Msub)
    Msup = mf.MachSup_Sigma(AsAc)
    Msh = sw.downstream_Mn(Msup)
    NPRsw = Is.PtPs_Mach(Msh) / sw.Pi_ratio(Msup)
    NPR1 = Is.PtPs_Mach(Msup)
    return NPR0, NPRsw, NPR1, Msub, Msh, Msup
Ejemplo n.º 4
0
FSalpha = np.log10(np.logspace(1., alphamax, npts + 1))
FSm4 = ray.SupMach_TiTicri(FSalpha / alphamax * ray.Ti_Ticri(M4max, gam), gam)
FSpi4 = ray.Pi_Picri(FSm4, gam) / ray.Pi_Picri(M3sup, gam)
FSpi3 = np.ones(npts + 1)
FSm3 = M3sup * np.ones(npts + 1)

ax[0].plot(FSalpha, FSpi3, '-', color='#ff0000')
ax[1].plot(FSalpha, FSpi4, '-', color='#ff0000')
ax[2].plot(FSalpha, FSm3, '-', color='#ff0000')

# --- (CW) conventional working state

# M8 is sonic so M4 is known
CWm4 = mf.Mach_Sigma(A3A2 / A8A2, .1, gam)  # look for subsonic value

CWm3low = sw.downstream_Mn(M3sup, gam)
alphamin = ray.Ti_Ticri(CWm4, gam) / ray.Ti_Ticri(CWm3low, gam)
CWm3high = mf.Mach_Sigma(A3A2 * mf.Sigma_Mach(sw.downstream_Mn(M2, gam), gam),
                         .1, gam)
alphamax = ray.Ti_Ticri(CWm4, gam) / ray.Ti_Ticri(CWm3high, gam)
print("           unstart of inlet throat for Ti4/Ti0 = %6.3f" % (alphamax))
print("             fully supersonic flow for Ti4/Ti0 = %6.3f" % (alphamin))

CWalpha = np.log10(np.logspace(alphamin, alphamax, npts + 1))
CWm3 = ray.SubMach_TiTicri(ray.Ti_Ticri(CWm4, gam) / CWalpha, gam)
CWpi3 = mf.Sigma_Mach(CWm3, gam) / mf.Sigma_Mach(M2, gam) / A3A2
CWpi4 = CWpi3 * ray.Pi_Picri(CWm4, gam) / ray.Pi_Picri(CWm3, gam)
CWm4 = np.ones(npts + 1) * CWm4

ax[0].plot(CWalpha, CWpi3, '-', color='#bb0000')
ax[1].plot(CWalpha, CWpi4, '-', color='#bb0000')
Ejemplo n.º 5
0
def test_shockwave_Mn1_involutive_numpy():
    m = np.linspace(1., 10., 30)
    np.testing.assert_allclose(m, sw.downstream_Mn(sw.downstream_Mn(m)))