class PerfInjThruster: def __init__(self, name='PI Thruster', geomObj=Geometry(), ERE=0.98, oxName='N2O4', fuelName='MMH', MRcore=1.9, Pc=500, isRegenCham=0, noz_regen_eps=1.0, calc_CdThroat=True): # create a perfect injector CoreStream coreObj = CoreStream( geomObj=geomObj, effObj=Efficiencies(ERE=ERE), oxName=oxName, fuelName=fuelName, MRcore=MRcore, Pc=Pc) self.R = RocketThruster( name=name, coreObj=coreObj, injObj=None, isRegenCham=isRegenCham, noz_regen_eps=noz_regen_eps, calc_CdThroat=calc_CdThroat) def summ_print(self): self.R.summ_print() def scale_Rt_to_Thrust(self, ThrustLbf=500.0, Pamb=0.0, use_scipy=False): """ Adjust throat size in order to get total thrust at specified ambient pressure exactly :param ThrustLbf: lbf, desired thrust at specified ambient pressure (Pamb) :param Pamb: psia, ambient pressure :param use_scipy: flag to indicate the need for more sophisticated root finder :type ThrustLbf: float :type Pamb: float :type use_scipy: bool :return: None :rtype: None """ self.R.scale_Rt_to_Thrust( ThrustLbf=ThrustLbf, Pamb=Pamb, use_scipy=use_scipy ) def set_to_optimum_MR(self): """Starting with MR for ER=1 find max Isp MR""" C = self.R.coreObj # core object # get MR for equivalence ratio = 1 MRstart = C.ceaObj.getMRforER( ERr=1.0 ) MRlo = MRstart / 3.0 MRhi = MRstart * 3.0 def get_ispdel( MR ): C.reset_attr('MRcore', MR, re_evaluate=True) self.R.calc_all_eff() return C.IspDel MRopt, IspMax = search_max(get_ispdel, MRlo, MRhi, tol=0.01) print('MRopt=%g, IspMax=%g sec'%(MRopt, IspMax) ) # use MRopt to reset everything get_ispdel( MRopt ) return MRopt
from rocketisp.examples.compare_vals import compare_header, compare geomObj = Geometry(Rthrt=Rthrt, CR=(5.131/2.4724)**2, eps=eps, pcentBell=70, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=2.4842/2, LchmMin=2.0, LchamberInp=15.0) effObj = Efficiencies() effObj.set_const('ERE', 0.9892 ) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc, CdThroat=CdThroat) R = RocketThruster(name='RL10',coreObj=core, injObj=None, calc_CdThroat=False, noz_regen_eps=eps) R.scale_Rt_to_Thrust( Fvac, Pamb=0.0 , use_scipy=False ) compare_header() compare('Fvacuum',Fvac, core('FvacTotal')) compare('Isp Vacuum', Isp, core('IspDel')) compare('Cstar ODE', cstarODE, core('cstarODE')) print() compare('Fuel Flow Rate', wdotFuel, core('wdotFlCore')) compare('Ox Flow Rate', wdotOx, core('wdotOxCore')) R.summ_print() #geomObj.plot_geometry()
C = RocketThruster(name='Huzel A-2',coreObj=core, injObj=None, calc_CdThroat=False) #C.scale_Rt_to_Thrust( Fvac, Pamb=0 , use_scipy=False ) compare_header() compare('Fvacuum',Fvac, core('FvacTotal')) compare('CfVacDesign', CfVacDesign, core('CfVacDel')) print() compare('Efficiency Cstar/ERE', effCstar, effObj('ERE')) compare('Cstar ODE', cstarODE, core('cstarODE')) compare('Cstar Delivered', cstar, core('cstarERE')) effCfODE = effCfFrozen * core('IspODF') / core('IspODE') compare('Efficiency Cf/Noz', effCfODE, effObj('Noz')) print() compare('Isp Vacuum', Isp, core('IspDel')) IspFrozen = Isp / effCstar / effCfFrozen compare('IspODF', IspFrozen, core('IspODF')) compare('Throat Area', At, geomObj('At')) compare('Fuel Flow Rate', wdFuel, core('wdotFlCore')) compare('Ox Flow Rate', wdOx, core('wdotOxCore')) C.summ_print()