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)
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
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)