Example #1
0
    def set_NPR(self, NPR):
        """ Define Nozzle Pressure Ratio (inlet Ptot over outlet Ps) for this case
		Define Nozzle pressure ratio and compute Mach number, Ptot and Ps according to nozzle regime
        :param NPR: NPR value (>1)

		"""
        self._Pt = np.ones_like(self.AxoAc)
        if NPR < self.NPR0:
            _Ms = Is.Mach_PtPs(NPR, gamma=self.gamma)
            self._M = mf.MachSub_Sigma(self.AxoAc / self.AsoAc *
                                       mf.Sigma_Mach(_Ms),
                                       gamma=self.gamma)
            self._Ps = self._Pt / Is.PtPs_Mach(self._M, gamma=self.gamma)
        else:
            self._M = np.ones_like(self.AxoAc)
            self._M[:self.ithroat + 1] = mf.MachSub_Sigma(
                self.AxoAc[:self.ithroat + 1], gamma=self.gamma)
            self._M[self.ithroat + 1:] = mf.MachSup_Sigma(
                self.AxoAc[self.ithroat + 1:], gamma=self.gamma)
            if NPR < self.NPRsw:
                # analytical solution for Ms, losses and upstream Mach number of shock wave
                Ms = Ms_from_AsAc_NPR(self.AsoAc, NPR)
                Ptloss = Is.PtPs_Mach(Ms) / NPR
                Msh = sw.Mn_Pi_ratio(Ptloss)
                # redefine curves starting from 'ish' index (closest value of Msh in supersonic flow)
                ish = np.abs(self._M - Msh).argmin()
                self._M[ish:] = mf.MachSub_Sigma(
                    self.AxoAc[ish:] * mf.Sigma_Mach(Ms) / self.AsoAc)
                self._Pt[ish:] = Ptloss
            self._Ps = self._Pt / Is.PtPs_Mach(self._M)
Example #2
0
def NPR_choked_supersonic(AsAc):
    """Compute Nozzle Pressure Ratio to get a choked supersonic regime 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)
	"""
    return Is.PtPs_Mach(mf.MachSup_Sigma(AsAc))
Example #3
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)
Example #4
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
Example #5
0
def test_MachSup_Sigma(AsAc):
    mach = mf.MachSup_Sigma(AsAc)
    assert (mach > 1)
    assert mf.Sigma_Mach(mach) == pytest.approx(AsAc, rel=1.e-6)