def compute_from_pt_rtt_p(self, pt, rtt, p): """Init state from Ptot r.Ttot and Ps (velocity sign is arbitrary and positive) Args: pt ([float]): [description] rtt ([float]): [description] p ([float]): [description] """ M = Is.Mach_PtPs(pt / p, self._gamma) rts = rtt / Is.TtTs_Mach(M, self._gamma) self.__init__(rho=p / rts, u=M * np.sqrt(self._gamma * rts), p=p)
def update(self): gc = self.gam_cold cpc = gc*self.r_cold/(gc-1.) self.Tt0 = self.T0*Is.TtTs_Mach(self.M0, gamma=self.gam_cold) self.Pt0 = self.P0*Is.PtPs_Mach(self.M0, gamma=self.gam_cold) self.V0 = self.M0*np.sqrt(gc*self.r_cold*self.T0) self.Pt2 = self.Pt0*self.xi_inlet self.Tt2 = self.Tt0 self.Pt3 = self.Pt2*self.OPR self.Tt3 = self.Tt2*self.OPR**((gc-1.)/(gc*self.etapolCHP)) #self.Tt4 = Ti_4 self.Pt4 = self.Pt3*self.xi_cc gh = self.gam_hot cph = gh*self.r_hot/(gh-1.) self.far = (cph*self.Tt4 - cpc*self.Tt3)/(self.xi_cc*self.Pci - cph*self.Tt4) self.Tt45 = self.Tt4 - cpc*(self.Tt3-self.Tt2)/(self.eta_shaft*cph*(1.+self.far)) #print self.Tt3, self.Pt4, self.Tt45, self.Tt4, self.far self.Pt45 = self.Pt4*(self.Tt45/self.Tt4)**(gh/((gh-1.)*self.etapolTHP))
def InitialValues(self): self.Pt0 = self.P0 * Is.PtPs_Mach(Mach=self.M0, gamma=self.g.gamma) self.Tt0 = self.T0 * Is.TtTs_Mach(Mach=self.M0, gamma=self.g.gamma) self.V0 = self.M0 * np.sqrt(self.g.gamma * self.g.r * self.T0) self.current_stage_corps = 1
def compute_from_pt_rtt_M(self, pt, rtt, M): ps = pt / Is.PtPs_Mach(M, self._gamma) rts = rtt / Is.TtTs_Mach(M, self._gamma) self.__init__(rho=ps / rts, u=M * np.sqrt(self._gamma * rts), p=ps)
import numpy as np import aerokit.aero.Isentropic as Is import matplotlib.pyplot as plt import aerokit.engine.turbofan as tf #%matplotlib inline plt.rcParams['figure.figsize'] = (10, 6) M0=.5 T0=200. P0=200e2 # Ttmax = 1600. Tt0 = T0*Is.TtTs_Mach(M0) Tt3 = np.arange(1.2*Tt0, 0.5*Ttmax, 50.) Opr = (Tt3/Tt0)**3.2 Bpr = np.arange(0.2, 10., .2) AllOpr, AllBpr = np.meshgrid(Opr, Bpr) # model = tf.turbofan_adapt(AllOpr, Ttmax, AllBpr, AllBpr/(2.+AllBpr)) model.flight_conditions(T0, P0, M0) model.update() # plt_etathp = plt.contour(AllOpr, model.spec_thrust(), model.thermoprop_efficiency(), levels=np.arange(0, 1.,.05)) plt.clabel(plt_etathp, inline=True, fontsize=8) # plt_Bpr = plt.contour(AllOpr, model.spec_thrust(), AllBpr, linestyles='dashed', levels=[0., 1., 2., 4., 8., 12.]) plt.clabel(plt_Bpr, inline=True, fontsize=8) # plt.show()
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.)