コード例 #1
0
 def set_NPR(NPR):
     if NPR < NPR0:
         _Ms = Is.Mach_PiPs(NPR, gamma=self.model.gamma)
         self._M = mf.MachSub_Sigma(self.AsoAc * mf.Sigma_Mach(Ma_col) /
                                    self.AsoAc[-1],
                                    gamma=self.model.gamma)
         self._Pt = 0. * coord_x + 1.
         self._Ps = _Pt / Is.PiPs_Mach(self._M, gamma=self.model.gamma)
     elif NPR < NPRsw:
         _M = mf.Mach_Sigma(Noz_AoAc, Mach=_Minit)
         #
         # analytical solution for Ms, losses and upstream Mach number of shock wave
         Ms = nz.Ms_from_AsAc_NPR(target_AoAc, NPR)
         Ptloss = Is.PiPs_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(_M - Msh).argmin()
         _M[ish:] = mf.MachSub_Sigma(Noz_AoAc[ish:] * mf.Sigma_Mach(Ms) /
                                     target_AoAc)
         _Pt[ish:] = Ptloss
         _Ps = _Pt / Is.PiPs_Mach(_M)
コード例 #2
0
    def set_NPR(self, NPR):
        """ Define Nozzle Pressure Ratio (inlet Ptot over outlet Ps) for this case

        :param NPR: NPR value (>1)

        """
        self.NPR = NPR
        defg.set_gamma(self._gam)
        if NPR < self.NPR0:  # flow is fully subsonic
            _Ms = Is.Mach_PiPs(NPR)
            _M = mf.MachSub_Sigma(self.section * mf.Sigma_Mach(_Ms) /
                                  self.section[-1])
            _Pt = 0. * _M + NPR
            _Ps = _Pt / Is.PiPs_Mach(_M)
        else:
            # compute Mach, assumed to be subsonic before throat, supersonic after
            _Minit = 0. * self.section + .5
            _Minit[self.ithroat:] = 2.
            _M = mf.Mach_Sigma(self.section / self.section[self.ithroat],
                               Mach=_Minit)
            _Pt = NPR + 0. * _M
            # CHECK, there is a shock
            # analytical solution for Ms, losses and upstream Mach number of shock wave
            Ms = nz.Ms_from_AsAc_NPR(self.AsoAc, NPR)
            Ptloss = Is.PiPs_Mach(Ms) / NPR
            Msh = sw.Mn_Pi_ratio(Ptloss)
            #
            if NPR < self.NPRsw:  # throat is choked, there may be a shock
                # redefine curves starting from 'ish' index (closest value of Msh in supersonic flow)
                ish = np.abs(_M - Msh).argmin()
                _M[ish:] = mf.MachSub_Sigma(
                    self.section[ish:] * mf.Sigma_Mach(Ms) / self.section[-1])
                _Pt[ish:] = Ptloss * NPR
            _Ps = _Pt / Is.PiPs_Mach(_M)
        #
        self._M = _M
        self._Pt = _Pt
        self._Ps = _Ps
        return
コード例 #3
0
def test_stagnation_i2t():
    assert Is.TtTs_Mach(2.) == Is.TiTs_Mach(2.)
    assert Is.PtPs_Mach(2.) == Is.PiPs_Mach(2.)
    assert Is.Mach_PiPs(3.) == Is.Mach_PtPs(3.)
    assert Is.Mach_TiTs(3.) == Is.Mach_TtTs(3.)
    assert Is.Velocity_MachTi(.8, 300.) == Is.Velocity_MachTt(.8, 300.)