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)
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.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster C = CoreStream( geomObj=Geometry(eps=35), effObj=Efficiencies(ERE=0.99), oxName='LOX', fuelName='LH2', MRcore=6, Pc=500, Pamb=0) R = RocketThruster(name='Example 6K Thruster', coreObj=C) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) R.summ_print()
# create basic Geometry. # Use "place-holder" of 1 inch for throat radius... correct later with "scale_Rt_to_Thrust" geomObj = Geometry(Rthrt=1, CR=2.5, eps=62.5, pcentBell=72.3, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.98) # don't know injector details so set effERE=0.98 # It's an ablative chamber, so some FFC (fuel film cooling) is required... guess about 15% core = CoreStream( geomObj=geomObj, effObj=effObj, pcentFFC=15.0, oxName='N2O4', fuelName='A50', MRcore=1.6, Pc=100 ) R = RocketThruster(name='Apollo SPS',coreObj=core) # scale geometry to give 20,500 lbf of thrust for current conditions R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) # figure out best mixture ratio to run the engine. R.set_mr_to_max_ispdel() # re-scale geometry to give 20,500 lbf of thrust after MR change R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) fsave = 'Apollo_SPS.html' fOut = open(fsave , 'w') fOut.write( R.get_html_file_str() ) fOut.close()
from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies from rocketisp.examples.compare_vals import compare_header, compare geomObj = Geometry(Rthrt=3, CR=2.5, eps=55, pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.97 ) core = CoreStream( geomObj=geomObj, effObj=effObj, oxName='N2O4', fuelName='MMH', MRcore=1.65, Pc=125, pcentFFC=4.5 ) R = RocketThruster(name='Shuttle OMS',coreObj=core, injObj=None) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) R.set_MRthruster( MRthruster=1.65 ) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) compare_header() compare('Fvacuum',6000, core('FvacTotal')) compare('Isp Vacuum', 313.2, core('IspDel')) compare('Engine Length', 77, geomObj('Ltotal')) compare('Nozzle ID', 43.09, geomObj('Rexit')*2) #R.summ_print() fsave = 'shuttle_oms.html'
CR = 3.0 Lnoz = 121 # in geomObj = Geometry(Rthrt=Rthrt, CR=CR, eps=eps, pcentBell=80, LnozInp=Lnoz, RupThroat=1.0, RdwnThroat=0.392, RchmConv=1.73921, cham_conv_deg=25.42, LchmOvrDt=2.4842/2, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.99 ) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc) R = RocketThruster(name='SSME, RS-25',coreObj=core, injObj=None, pulse_sec=float('inf'), pulse_quality=0.8) 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')) core.reset_attr( 'Pamb', 14.7, re_evaluate=True) compare('Isp SeaLevel', IspSL, core('IspAmb')) compare('FseaLevel', FseaLevel, core('Fambient')) core.reset_attr( 'Pamb', 0, re_evaluate=True) #compare('Cstar ODE', cstarODE, core('cstarODE')) #print() #compare('Fuel Flow Rate', wdotFuel, core('wdotFlCore'))
from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream(geomObj=Geometry(eps=375), effObj=Efficiencies(ERE=0.99), pcentFFC=30, oxName='N2O4', fuelName='N2H4', MRcore=1.2, Pc=137, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='100 lbf Aerojet HiPAT R-4D', coreObj=C) ispodeL = [] # list of IspODE (one-dimensional equilibrium) ispodkL = [] # list of IspODK (one-dimensional kinetic) ispdelL = [] # list of IspDel (delivered Isp) mrnetL = [] # list of MRthruster (net mixture ratio of core and barrier) mrcoreL = [] # list of MRcore (core stream tube mixture ratio) for MRcore in np.linspace(0.9, 1.9, num=60): C.reset_attr('MRcore', MRcore) R.scale_Rt_to_Thrust(100, Pamb=0.0) ispodeL.append(C('IspODE')) ispodkL.append(C('IspODK')) ispdelL.append(C('IspDel')) mrnetL.append(C('MRthruster')) mrcoreL.append(C('MRcore'))
""" This example demonstrates the proper use of project: rocketisp """ from rocketisp.rocket_isp import RocketThruster R = RocketThruster() #R.scale_Rt_to_Thrust( 10000.0, Pamb=0.0, use_scipy=False ) R.summ_print()
setNelementsBy='acoustics', # can be "acoustics", "elem_density", "input" OxOrfPerEl=1.0, FuelOrfPerEl=1.0, lolFuelElem=False, setAcousticFreqBy='mode', # can be "mode" or "freq" desAcousMode='2T', desFreqInp=5000, CdOxOrf=0.75, CdFuelOrf=0.75, dropCorrOx=0.33, dropCorrFuel=0.33, DorfMin=0.008, LfanOvDorfOx=20.0, LfanOvDorfFuel=20.0) R = RocketThruster(name='Shuttle OMS', coreObj=core, injObj=I) R.scale_Rt_to_Thrust(6000, Pamb=0.0) R.set_MRthruster(MRthruster=1.65) R.scale_Rt_to_Thrust(6000, Pamb=0.0) #R.summ_print() # ======================================================== CWheel.set_wheel('tab10') title = "Hewitt Criteria\nAnchored with Strouhal Number = 0.2" F = Figure(figsize=(6, 5), dpi=300, nrows=1, ncols=1,
#desAcousMode=0.8*4.2012, desFreqInp=2000, desAcousMode='1T', OxOrfPerEl=1.0, FuelOrfPerEl=1.0, lolFuelElem=True, CdOxOrf=0.75, CdFuelOrf=0.75, dropCorrOx=1, dropCorrFuel=1, DorfMin=0.008, LfanOvDorfOx=20.0, LfanOvDorfFuel=20.0) R = RocketThruster(name='Sample Thruster', coreObj=C, injObj=I, pulse_sec=float('inf'), pulse_quality=0.8) R.set_mr_to_max_ispdel() ispodeL = [] # list of IspODE (one-dimensional equilibrium) ispodkL = [] # list of IspODK (one-dimensional kinetic) ispdelL = [] # list of Isp thruster delivered MRsave = C.MRcore for mr in mrcoreL: R.coreObj.reset_attr('MRcore', mr, re_evaluate=True) R.calc_all_eff() ispodeL.append(R.coreObj.IspODE)
RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() core = CoreStream(geomObj=geomObj, effObj=effObj, oxName='LOX', fuelName='CH4', MRcore=3.6, Pc=4786) R = RocketThruster(name='SpaceX Raptor', coreObj=core, injObj=None) R.scale_Rt_to_Thrust(500000, Pamb=0.0) compare_header() compare('Fvacuum', 500000, core('FvacTotal')) compare('Isp Vacuum', 380, core('IspDel')) core.reset_attr('Pamb', 14.7, re_evaluate=True) compare('Isp SeaLevel', 330, core('IspAmb')) core.reset_attr('Pamb', 0, re_evaluate=True) R.summ_print()
def test_overall_Isp_efficiency(self): """test overall Isp efficiency""" R = RocketThruster(name='overall_Isp_efficiency') R.set_eff_model(eff_name='Div', model_name='simple fit') R.scale_Rt_to_Thrust(ThrustLbf=400.0, Pamb=0.0, use_scipy=False) #R.summ_print() self.assertAlmostEqual(R.coreObj.effObj('Isp'), 0.96889, places=3) self.assertAlmostEqual(R.coreObj.effObj('BL'), 0.992297, places=3) self.assertAlmostEqual(R('pulse_quality'), 0.8, places=3) R.scale_Rt_to_Thrust(ThrustLbf=500.0, Pamb=0.0, use_scipy=False) self.assertAlmostEqual(R.coreObj.Fambient, 500, places=3) R.scale_Rt_to_Thrust(ThrustLbf=500.0, Pamb=0.0, use_scipy=True) self.assertAlmostEqual(R.coreObj.Fambient, 500, places=3) R.set_eff_model(eff_name='BL', model_name='NASA-SP8120') R.noz_regen_eps = 6 R.scale_Rt_to_Thrust(ThrustLbf=400.0, Pamb=0.0, use_scipy=False) #R.summ_print() self.assertAlmostEqual(R.coreObj.effObj('Isp'), 0.969825, places=3) self.assertAlmostEqual(R.coreObj.effObj('BL'), 0.993258, places=3)
LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.99) core = CoreStream(geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc) R = RocketThruster(name='J-2', coreObj=core, injObj=None, pulse_sec=float('inf'), pulse_quality=0.8) #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')) core.reset_attr('Pamb', 14.7, re_evaluate=True) compare('Isp SeaLevel', IspSL, core('IspAmb')) compare('FseaLevel', FseaLevel, core('Fambient')) core.reset_attr('Pamb', 0, re_evaluate=True) compare('Cstar ODE', cstarODE, core('cstarODE'))
from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream( geomObj=Geometry(eps=375), effObj=Efficiencies(ERE=0.99), pcentFFC=30, oxName='N2O4', fuelName='N2H4', MRcore=1.26 , Pc=137, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='100 lbf Aerojet HiPAT R-4D', coreObj=C) R.scale_Rt_to_Thrust( 100 , Pamb=0.0 ) MRcore_opt = R.set_mr_to_max_ispdel() print('MRcore_opt = %g'%MRcore_opt) R.summ_print()
import os from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.injector import Injector from rocketisp.rocket_isp import RocketThruster C = CoreStream(geomObj=Geometry(eps=75), effObj=Efficiencies(), pcentFFC=15, oxName='N2O4', fuelName='N2H4', MRcore=1.26, Pc=137, Pamb=0) I = Injector(C) # instantiate RocketThruster R = RocketThruster(name='100 lbf Engine', coreObj=C, injObj=I) R.scale_Rt_to_Thrust(100, Pamb=0.0) here = os.path.split(os.path.abspath(__file__))[0] fOut = open(os.path.join(here, 'chk_html_save.html'), 'w') fOut.write(R.get_html_file_str()) print(os.path.abspath(fOut.name)) fOut.close() print('SAVED: chk_html_save.html to:', os.path.abspath(fOut.name))
dpOxInp=160 dpFuelInp=100 geomObj = Geometry(Rthrt=Rt, CR=CR, eps=eps, pcentBell=pcentBell, RupThroat=0.5, RdwnThroat=1.0, RchmConv=0.5, cham_conv_deg=30, LchmOvrDt=3, LchmMin=2.0, LchamberInp=Lcham) effObj = Efficiencies() effObj.set_const('ERE', 0.975 ) core = CoreStream( geomObj, effObj, oxName=oxName, fuelName=fuelName, MRcore=MR, Pc=Pc, Pamb=14.7, CdThroat=1.0, adjCstarODE=0.992801, adjIspIdeal=1.01876) 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')
Tfuel=None, elemEm=0.8, fdPinjOx=0.25, fdPinjFuel=0.25, elemDensInp=None, NelementsInp=None, setNelementsBy='acoustics', # can be "acoustics", "density", "input" setAcousticFreqBy='mode', # can be "mode" or "freq" #desAcousMode=0.8*4.2012, desFreqInp=2000, desAcousMode='1T', OxOrfPerEl=1.0, FuelOrfPerEl=1.0, lolFuelElem=True, CdOxOrf=0.75, CdFuelOrf=0.75, dropCorrOx=1, dropCorrFuel=1, DorfMin=0.008, LfanOvDorfOx=20.0, LfanOvDorfFuel=20.0) R = RocketThruster(name='Sample Thruster', coreObj=C, injObj=I, pulse_sec=float('inf'), pulse_quality=0.8) R.set_mr_to_max_ispdel() R.scale_Rt_to_Thrust(6000, Pamb=0.0) R.coreObj.effObj.summ_print()
from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies from rocketisp.examples.compare_vals import compare_header, compare geomObj = Geometry(Rthrt=Rthrt, CR=CR, 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=Lcham) effObj = Efficiencies() effObj.set_const('ERE', cstarEff ) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc) R = RocketThruster(name='RLIOA-3-3',coreObj=core, injObj=None, 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')) compare('Efficiency Cf/Noz', effCfODE, effObj('Noz')) print() compare('Fuel Flow Rate', wdotFuel, core('wdotFlCore')) compare('Ox Flow Rate', wdotOx, core('wdotOxCore'))
eps=55, pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.97) core = CoreStream(geomObj=geomObj, effObj=effObj, oxName='N2O4', fuelName='MMH', MRcore=1.65, Pc=125) R = RocketThruster(name='Shuttle OMS', coreObj=core, injObj=None) R.scale_Rt_to_Thrust(6000, Pamb=0.0) compare_header() compare('Fvacuum', 6000, core('FvacTotal')) compare('Isp Vacuum', 313.2, core('IspDel')) compare('Engine Length', 77, geomObj('Ltotal')) compare('Nozzle ID', 43.09, geomObj('Rexit') * 2) R.summ_print()
print('mr_lo =', mr_lo) print('mr_hi =', mr_hi) # =========== create RocketIsp structures # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream(geomObj=Geometry(eps=eps), effObj=Efficiencies(ERE=1.0, Div=1.0, BL=1.0, TP=1.0), pcentFFC=0, oxName=oxName, fuelName=fuelName, MRcore=mr_lo, Pc=Pc, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='Sample Thruster', coreObj=C) R.scale_Rt_to_Thrust(ThrustLbf=Fvac, Pamb=0.0) #R.summ_print() # ========================================================= # generate data ispodeL = [] # list of IspODE (one-dimensional equilibrium) ispodkL = [] # list of IspODK (one-dimensional kinetic) ispodfL = [] # list of IspODF (frozen) mrcoreL = [] # list of MRcore (core stream tube mixture ratio) for MRcore in np.linspace(mr_lo, mr_hi, num=60): C.reset_attr('MRcore', MRcore) R.scale_Rt_to_Thrust(Fvac, Pamb=0.0) ispodeL.append(C('IspODE')) ispodkL.append(C('IspODK')) ispodfL.append(C('IspODF'))
from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies # create basic Geometry. # Use "place-holder" of 1 inch for throat radius... correct later with "scale_Rt_to_Thrust" geomObj = Geometry(Rthrt=1, CR=2.5, eps=62.5, pcentBell=72.3, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.98) # don't know injector details so set effERE=0.98 # It's an ablative chamber, so some FFC (fuel film cooling) is required... guess about 15% core = CoreStream( geomObj=geomObj, effObj=effObj, pcentFFC=15.0, oxName='N2O4', fuelName='A50', MRcore=1.6, Pc=100 ) R = RocketThruster(name='Apollo SPS',coreObj=core) # scale geometry to give 20,500 lbf of thrust for current conditions R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) # figure out best mixture ratio to run the engine. R.set_mr_to_max_ispdel() # re-scale geometry to give 20,500 lbf of thrust after MR change R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) R.summ_print()
from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies 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()
def setUp(self): unittest.TestCase.setUp(self) self.myclass = RocketThruster()
def calc_ODE_ODK_FROZ_isp(oxName='N2O4', fuelName='MMH', Pc=1000.0, eps=10.0, pcentBell=80.0, Fvac=1000.0, NumRuns=20, do_show=True): # ============ use RocketCEA to find MR range =================== mc = MR_Temperature_Limits(oxName=oxName, fuelName=fuelName, PcNominal=Pc, epsNominal=eps) mr_peak = MR_Peak_At_EpsPc( mc, pc=Pc, eps=eps, ispType='CEAODE', # ispType can be CEAODE, CEAFROZEN NterpSize=100) print('Peak IspODE=%g sec at MR =' % mr_peak.ispPeak, mr_peak.mrPeak) print() print('MR at 97% Isp (on low side) =', mr_peak.calc_mrLow_minus_NPcentIsp()) print('MR at 97% Isp (on high side) =', mr_peak.calc_mrHigh_minus_NPcentIsp()) mr_lo = round( mr_peak.mrLeftOfPeak - (mr_peak.mrRightOfPeak - mr_peak.mrLeftOfPeak) / 10.0, 2) mr_hi = round(mr_peak.mrRightOfPeak, 2) delMR = (mr_hi - mr_lo) / (NumRuns - 1) # =============================== geomObj = Geometry(Rthrt=5.868 / 2, CR=2.5, eps=eps, pcentBell=pcentBell, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=16) core = CoreStream(geomObj, oxName=oxName, fuelName=fuelName, MRcore=1.6, Pc=Pc) R = RocketThruster(name='sample', coreObj=core, injObj=None) ispodeL = [] ispodkL = [] ispodfL = [] mrL = [] MR = mr_lo for _ in range(NumRuns): mrL.append(MR) core.reset_attr('MRcore', MR, re_evaluate=True) R.scale_Rt_to_Thrust(Fvac, Pamb=0.0, use_scipy=False) ispodeL.append(R.coreObj.IspODE) ispodkL.append(R.coreObj.IspODK) ispodfL.append(R.coreObj.IspODF) MR += delMR # ======= find peaks ====== mr_ode_terp = InterpProp(mrL, ispodeL) mr_ode_Peak, isp_ode_peak = gold_search_max(mr_ode_terp, mrL[0], mrL[-1], tol=1.0e-5) mr_odk_terp = InterpProp(mrL, ispodkL) mr_odk_Peak, isp_odk_peak = gold_search_max(mr_odk_terp, mrL[0], mrL[-1], tol=1.0e-5) mr_odf_terp = InterpProp(mrL, ispodfL) mr_odf_Peak, isp_odf_peak = gold_search_max(mr_odf_terp, mrL[0], mrL[-1], tol=1.0e-5) fig, ax = plt.subplots(figsize=(8, 6)) plt.plot(mrL, ispodeL, label='IspODE', color=COLORL[0]) plt.plot(mrL, ispodkL, label='IspODK', color=COLORL[1]) plt.plot(mrL, ispodfL, label='IspODF', color=COLORL[2]) # show ========= optimum MR difference ======== def span_mrpeak(isL): minpt = min(isL) maxpt = max(isL) span = maxpt - minpt return [maxpt - 0.8 * span, maxpt] plt.plot([mr_ode_Peak, mr_ode_Peak], span_mrpeak(ispodeL), '--', label='MRode=%.2f' % mr_ode_Peak, linewidth=2, color=COLORL[0]) plt.plot([mr_odk_Peak, mr_odk_Peak], span_mrpeak(ispodkL), '--', label='MRodk=%.2f' % mr_odk_Peak, linewidth=2, color=COLORL[1]) plt.plot([mr_odf_Peak, mr_odf_Peak], span_mrpeak(ispodfL), '--', label='MRodf=%.2f' % mr_odf_Peak, linewidth=2, color=COLORL[2]) isp_odk_peak = abs(isp_odk_peak) plt.text(mr_odk_Peak, isp_odk_peak, '%i' % int(isp_odk_peak), ha='left', va='bottom', transform=ax.transData, color=COLORL[1]) plt.legend() plt.ylabel('Isp (sec)') plt.xlabel('Mixture Ratio') plt.title( "%s/%s RocketIsp ODE ODK ODF\nFvac=%.0f lbf, Pc=%.0f psia, AR=%.0f:1, %%Bell=%.0f%%"%\ (oxName, fuelName, Fvac, Pc, eps, pcentBell)) png_name = 'odekf_%s_%s_Fvac%g_Pc%g_eps%g.png' % (oxName, fuelName, Fvac, Pc, eps) plt.savefig(png_name, dpi=120) if do_show: plt.show()
""" model the XLR-134 """ from rocketisp.rocket_isp import RocketThruster from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies geomObj = Geometry(Rthrt=1, CR=3.0, eps=767.9, pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', (490.45-8.6)/490.45) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=6.0, Pc=510 ) R = RocketThruster(name='xlr134',coreObj=core, injObj=None) R.scale_Rt_to_Thrust( 500 , Pamb=0.0 , use_scipy=False ) R.summ_print()
import webbrowser import os from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream(geomObj=Geometry(eps=375), effObj=Efficiencies(ERE=0.99), pcentFFC=30, oxName='N2O4', fuelName='N2H4', MRcore=1.26, Pc=137, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='100 lbf Aerojet HiPAT R-4D', coreObj=C) R.scale_Rt_to_Thrust(100, Pamb=0.0) #R.summ_print() fsave = 'hipat_at_opt_mr.html' fOut = open(fsave, 'w') fOut.write(R.get_html_file_str()) fOut.close() webbrowser.open(os.path.abspath(fsave))
from rocketisp.rocket_isp import RocketThruster RocketThruster().summ_print()