def __init__(self): super(TubeTemp, self).__init__() self.add('tm', TubeWallTemp(), promotes=['radius_outer_tube']) self.add('tmp_balance', TempBalance()) self.add('nozzle_air', FlowStart(thermo_data=janaf, elements=AIR_MIX)) self.add('bearing_air', FlowStart(thermo_data=janaf, elements=AIR_MIX)) self.connect("nozzle_air.Fl_O:tot:T", "tm.nozzle_air_Tt") self.connect("nozzle_air.Fl_O:tot:Cp", "tm.nozzle_air_Cp") self.connect("nozzle_air.Fl_O:stat:W", "tm.nozzle_air_W") self.connect("bearing_air.Fl_O:tot:T", "tm.bearing_air_Tt") self.connect("bearing_air.Fl_O:tot:Cp", "tm.bearing_air_Cp") self.connect("bearing_air.Fl_O:stat:W", "tm.bearing_air_W") self.connect('tm.ss_temp_residual', 'tmp_balance.ss_temp_residual') self.connect('tmp_balance.temp_boundary', 'tm.temp_boundary') self.nl_solver = Newton() self.nl_solver.options['atol'] = 1e-5 self.nl_solver.options['iprint'] = 1 self.nl_solver.options['rtol'] = 1e-5 self.nl_solver.options['maxiter'] = 50 self.ln_solver = ScipyGMRES() self.ln_solver.options['atol'] = 1e-6 self.ln_solver.options['maxiter'] = 100 self.ln_solver.options['restart'] = 100
def __init__(self): super(SteadyStateVacuum, self).__init__() des_vars = (('ram_recovery', 0.99), ('effDes', 0.8), ('duct_MN', 0.0), ('duct_dPqP', 0.), ('nozzle_Cfg', 1.0), ('nozzle_dPqP', 0.), ('shaft_Nmech', 10000.), ('inlet_MN', 0.0), ('comp_MN', 0.5), ('vehicle_mach', 0.8), ('Pa', 101.3e3, { 'units': 'Pa' })) self.add('input_vars', IndepVarComp(des_vars)) self.add('fl_start', FlowStart(thermo_data=janaf, elements=AIR_MIX)) # internal flow self.add('comp', Compressor(thermo_data=janaf, elements=AIR_MIX)) self.add('q', ExecComp('Prc = Pa/Ps'), promotes=['Prc', 'Pa']) self.add('q1', ExecComp('m_dot = 3*(A_tube*L_pod)*(1/pod_period)'), promotes=['m_dot', 'pod_period', 'A_tube', 'L_pod']) # connect components connect_flow(self, 'fl_start.Fl_O', 'comp.Fl_I') self.connect('input_vars.effDes', 'comp.map.effDes') self.connect('input_vars.comp_MN', 'comp.MN_target') self.connect('input_vars.shaft_Nmech', 'comp.Nmech') self.connect('input_vars.vehicle_mach', 'fl_start.MN_target') self.connect('input_vars.Pa', 'Pa') self.connect('Prc', 'comp.map.PRdes') self.connect('m_dot', 'fl_start.W') self.connect('fl_start.P', 'q.Ps')
def __init__(self): super(CompressionCycle, self).__init__() # initiate components #self.add('fc', FlightConditions()) self.add('fl_start', FlowStart(thermo_data=janaf, elements=AIR_MIX)) self.add('tube', Duct(thermo_data=janaf, elements=AIR_MIX)) self.add('splitter', Splitter(thermo_data=janaf, elements=AIR_MIX)) # internal flow self.add('inlet', Inlet(thermo_data=janaf, elements=AIR_MIX)) self.add('comp', Compressor(thermo_data=janaf, elements=AIR_MIX)) self.add('duct', Duct(thermo_data=janaf, elements=AIR_MIX)) self.add('nozzle', Nozzle(thermo_data=janaf, elements=AIR_MIX)) self.add('shaft', Shaft(1)) #external flow self.add('bypass', Duct(thermo_data=janaf, elements=AIR_MIX)) self.add('bypass_exit', Duct(thermo_data=janaf, elements=AIR_MIX)) # connect components connect_flow(self, 'fl_start.Fl_O', 'tube.Fl_I') connect_flow(self, 'tube.Fl_O', 'splitter.Fl_I') connect_flow(self, 'splitter.Fl_O1', 'inlet.Fl_I') connect_flow(self, 'inlet.Fl_O', 'comp.Fl_I') connect_flow(self, 'comp.Fl_O', 'duct.Fl_I') connect_flow(self, 'duct.Fl_O', 'nozzle.Fl_I') # bypass stream connect_flow(self, 'splitter.Fl_O2', 'bypass.Fl_I') connect_flow(self, 'bypass.Fl_O', 'bypass_exit.Fl_I') self.connect('comp.trq', 'shaft.trq_0') self.connect('shaft.Nmech', 'comp.Nmech')
def __init__(self): super(FlowPath, self).__init__() des_vars = (('ram_recovery', 0.99), ('effDes', 0.9), ('duct_MN', 0.65), ('duct_dPqP', 0.), ('nozzle_Cfg', 1.0), ('nozzle_dPqP', 0.), ('shaft_Nmech', 10000.), ('inlet_MN', 0.6), ('comp_MN', 0.65)) self.add('input_vars', IndepVarComp(des_vars)) self.add('fl_start', FlowStart(thermo_data=janaf, elements=AIR_MIX)) # internal flow self.add('inlet', Inlet(thermo_data=janaf, elements=AIR_MIX)) self.add('comp', Compressor(thermo_data=janaf, elements=AIR_MIX)) self.add('duct', Duct(thermo_data=janaf, elements=AIR_MIX)) self.add('nozzle', Nozzle(thermo_data=janaf, elements=AIR_MIX)) self.add('shaft', Shaft(1)) # connect components connect_flow(self, 'fl_start.Fl_O', 'inlet.Fl_I') connect_flow(self, 'inlet.Fl_O', 'comp.Fl_I') connect_flow(self, 'comp.Fl_O', 'duct.Fl_I') connect_flow(self, 'duct.Fl_O', 'nozzle.Fl_I') self.connect('input_vars.ram_recovery', 'inlet.ram_recovery') self.connect('input_vars.effDes', 'comp.map.effDes') self.connect('input_vars.duct_MN', 'duct.MN_target') self.connect('input_vars.duct_dPqP', 'duct.dPqP') self.connect('input_vars.nozzle_Cfg', 'nozzle.Cfg') self.connect('input_vars.nozzle_dPqP', 'nozzle.dPqP') self.connect('input_vars.shaft_Nmech', 'shaft.Nmech') self.connect('input_vars.inlet_MN', 'inlet.MN_target') self.connect('input_vars.comp_MN', 'comp.MN_target') self.connect('comp.trq', 'shaft.trq_0') self.connect('shaft.Nmech', 'comp.Nmech')
from openmdao.core.problem import Problem from openmdao.core.group import Group from openmdao.core.component import Component from pycycle.components import FlowStart from pycycle import species_data from pycycle.constants import AIR_MIX from openmdao.components.indep_var_comp import IndepVarComp if __name__ == "__main__": # ------------------------- # --- Default Test Case --- # ------------------------- p1 = Problem() p1.root = Group() #p1.root.add("freestream",Freestream()) p1.root.add("fs", FlowStart()) params = ( ('P', 0.5, { "units": "psi" }), ('T', 291.0, { "units": "K" }), ('MN', 0.8), ) p1.root.add('des_vars', IndepVarComp(params)) p1.root.connect('des_vars.P', 'fs.P') #p1.root.connect('des_vars.MN', 'fs.MN') p1.root.connect('des_vars.T', 'fs.T')