class DuctTestCase(unittest.TestCase): def tearDown(self): comp = None def test_duct(self): # initial test case based on JT9D 34000 .8 operation self.duct = set_as_top(Duct()) self.fs = FlowStation() self.fs.W = 100. self.fs.setTotalTP( 1000, 100 ); duct = self.duct duct.Fl_I = self.fs duct.dPqP = .1 duct.run() TOL = .001 # check the flow and mechanical values assert_rel_error( self, duct.Fl_O.W, 100., TOL ) assert_rel_error( self, duct.Fl_O.Pt, 90., TOL ) assert_rel_error( self, duct.Fl_O.Tt, 1000., TOL )
def setUp(self): self.comp = set_as_top(Compressor()) self.fs = FlowStation() self.fs.W = 1.08 self.fs.setTotalTP(630.74523, 0.0271945) self.fs.Mach = .6
class InletTestCase(unittest.TestCase): def tearDown(self): comp = None def test_duct(self): # initial test case based on JT9D 34000 .8 operation self.inlet = set_as_top(Inlet()) self.fs = FlowStation() self.fs.W = 100. self.fs.setTotalTP( 1000, 100 ); inlet = self.inlet inlet.Fl_I = self.fs inlet.ram_recovery = .9 inlet.run() TOL = .001 # check the flow and mechanical values assert_rel_error( self, inlet.Fl_O.W, 100., TOL ) assert_rel_error( self, inlet.Fl_O.Pt, 90., TOL ) assert_rel_error( self, inlet.Fl_O.Tt, 1000., TOL )
def configure(self): hx = self.add('hx', HeatExchanger()) driver = self.add('driver',BroydenSolver()) driver.add_parameter('hx.T_hot_out',low=0.,high=1000.) driver.add_parameter('hx.T_cold_out',low=0.,high=1000.) driver.add_constraint('hx.residual_qmax=0') driver.add_constraint('hx.residual_e_balance=0') #hx.Wh = 0.49 #hx.Cp_hot = 1.006 #hx.T_hot_in = 791 fs = FlowStation() fs.setTotalTP(1423.8, 0.302712118187) #R, psi fs.W = .49 hx.Fl_I = fs hx.W_cold = 0.45 hx.Cp_cold = 4.186 hx.T_cold_in = 288.15 effectiveness = 0.9765 #initial guess avg = ( hx.Fl_I.Tt*.555555556 + hx.T_cold_in )/2. hx.T_cold_out = avg hx.T_hot_out = avg driver.workflow.add(['hx'])
class CompressorRlineTestCase(unittest.TestCase): def tearDown(self): comp = None def test_compressor(self): # initial test case based on JT9D 34000 .8 operation self.comp = set_as_top(CompressorRline()) self.fs = FlowStation() self.fs.W = 111.61 self.fs.setDryAir() self.fs.setTotalTP( 707.81, 22.395 ) comp = self.comp comp.PR = 5.609 comp.eff = .8651 comp.Wfrac1=.055 comp.hfrac1=1 comp.Pfrac1=1 comp.Wfrac2=.035 comp.hfrac2=1 comp.Pfrac2=1 comp.Nmech=8000 comp.Fl_I = self.fs comp.run() TOL = .001 # check the flow and mechanical values assert_rel_error( self,comp.Fl_O.W, 101.57, TOL ) assert_rel_error( self,comp.Fl_O.Pt, 125.611, TOL ) assert_rel_error( self,comp.Fl_O.Tt, 1209.83, TOL ) assert_rel_error( self,comp.Fl_bld1.W, 6.1386, TOL ) assert_rel_error( self,comp.Fl_bld1.Pt, 125.611, TOL ) assert_rel_error( self,comp.Fl_bld1.Tt, 1209.83, TOL ) assert_rel_error( self,comp.Fl_bld2.W, 3.9064, TOL ) assert_rel_error( self,comp.Fl_bld2.Pt, 125.611, TOL ) assert_rel_error( self,comp.Fl_bld2.Tt, 1209.83, TOL ) assert_rel_error( self,comp.pwr, -19639.2, TOL ) assert_rel_error( self,comp.trq, -1350.435, TOL ) assert_rel_error( self,comp.eff, .8651, TOL ) # adjust the bleed fraction to ensure the temperature is about half # way between input and output comp.hfrac1 = .5 comp.run() assert_rel_error( self,comp.Fl_bld1.Tt, 961.654, TOL )
class CompressorTestCase(unittest.TestCase): def setUp(self): self.comp = set_as_top(Compressor()) self.fs = FlowStation() self.fs.W = 1.08 self.fs.setTotalTP(630.74523, 0.0271945) self.fs.Mach = .6 def tearDown(self): comp = None def test_compressor(self): comp = self.comp comp.PR_des = 12.47 comp.MNexit_des = .4 comp.eff_des = .80 comp.Fl_I = self.fs comp.design = True comp.run() TOL = .001 assert_rel_error(self,comp.Fl_O.W, 1.08,TOL) assert_rel_error(self,comp.Fl_O.Pt, .33899, TOL) assert_rel_error(self,comp.Fl_O.Tt, 1424.01, TOL) assert_rel_error(self,comp.Fl_O.rhos, .000594, TOL) assert_rel_error(self,comp.Fl_O.Mach, .4 ,TOL) assert_rel_error(self,comp.Fl_O.area, 364.7, TOL) assert_rel_error(self,comp.pwr, 303.2, TOL) assert_rel_error(self,comp.eff_poly, .8545, TOL) #run off design comp.run() #values should remain unchanged in off-design at design condition assert_rel_error(self,comp.Fl_O.W, 1.08,TOL) assert_rel_error(self,comp.Fl_O.Pt, .33899, TOL) assert_rel_error(self,comp.Fl_O.Tt, 1424.01, TOL) assert_rel_error(self,comp.Fl_O.rhos, .000594, TOL) assert_rel_error(self,comp.Fl_O.Mach, .4 ,TOL) assert_rel_error(self,comp.Fl_O.area, 364.7, TOL) assert_rel_error(self,comp.pwr, 303.2, TOL) assert_rel_error(self,comp.eff_poly, .8545, TOL) #try changing something self.fs.W *= 1.1 comp.Fl_I = self.fs comp.run() assert_rel_error(self, comp.PR, 13.52995, TOL)
class NozzleConvergentCase(unittest.TestCase): def tearDown(self): comp = None def test_nozzleconvergent(self): # initial test case based on JT9D 34000 .8 operation # choked self.nozz = set_as_top(NozzleConvergent()) self.fs = FlowStation() self.fs.W = 562.61 self.fs.setTotalTP( 527.55, 8.978 ); nozz = self.nozz nozz.Fl_I = self.fs nozz.Cfg = .9962 nozz.PsExh = 3.626 nozz.run() TOL = .001 # check the flow and mechanical values assert_rel_error( self, nozz.Fg, 21033.3, TOL ) # initial test case based on JT9D 0. 0. operation # unchoked self.nozz = set_as_top(NozzleConvergent()) self.fs = FlowStation() self.fs.W = 1293.91 self.fs.setTotalTP( 632.71, 23.195 ); nozz = self.nozz nozz.Fl_I = self.fs nozz.Cfg = .9975 nozz.PsExh = 14.696 nozz.run() TOL = .001 # check the flow and mechanical values assert_rel_error( self, nozz.Fg, 38786, TOL )
def configure(self): #Add Compressor Cycle Components tube = self.add('tube', FlowStartStatic()) #tube.W = 1.521 tube.Ps = 0.01436 tube.Ts = 525.6 inlet = self.add('inlet', Inlet()) inlet.ram_recovery = 1.0 #inlet.MNexit_des = .6 comp1 = self.add('comp1', Compressor()) comp1.PR_des = 12.47 comp1.MNexit_des = .4 comp1.eff_des = .80 duct1 = self.add('duct1', Duct()) duct1.Q_dot = 0 # no heat exchangers duct1.dPqP = .1 #no losses split = self.add('split', SplitterW()) split.W1_des = .44 split.MNexit1_des = 1.0 split.MNexit2_des = 1.0 nozzle = self.add('nozzle', Nozzle()) nozzle.dPqP = 0 #no losses nozzle.Fl_ref = FlowStation() comp2 = self.add('comp2', Compressor()) comp2.PR_des = 5.0 comp2.MNexit_des = .4 comp2.eff_des = .80 duct2 = self.add('duct2', Duct()) #to bearings duct2.Q_dot = 0 #no heat exchangers duct2.dPqP = .1 #no losses perf = self.add('perf', Performance()) #Inter Component Connections self.connect('tube.Fl_O', 'inlet.Fl_I') self.connect('inlet.Fl_O', 'comp1.Fl_I') self.connect('comp1.Fl_O', 'duct1.Fl_I') self.connect('duct1.Fl_O', 'split.Fl_I') self.connect('split.Fl_O2', 'nozzle.Fl_I') self.connect('tube.Fl_O', 'nozzle.Fl_ref') self.connect('split.Fl_O1', 'comp2.Fl_I') self.connect('comp2.Fl_O', 'duct2.Fl_I') self.connect('comp1.pwr', 'perf.C1_pwr') self.connect('comp2.pwr', 'perf.C2_pwr') self.connect('duct2.Fl_O.Ps', 'perf.Ps_bearing') self.connect('nozzle.Fg', 'perf.Fg') self.connect('inlet.F_ram', 'perf.F_ram') #Input variable pass_throughs to the assembly boundary #Compress -> Tube self.connect('W_in', 'tube.W') self.connect('Ts_tube', 'tube.Ts') self.connect('Ps_tube', 'tube.Ps') self.connect('Mach_pod_max', 'tube.Mach') #Compress -> Inlet self.connect('Mach_c1_in', 'inlet.MNexit_des') #Compress -> C1 self.connect('c1_PR_des', 'comp1.PR_des') #Compress -> C2 self.connect('c2_PR_des', 'comp2.PR_des') #Compress -> Splitter self.connect('W_bearing_in', 'split.W1_des') #Compress -> Perf self.connect('Ps_bearing', 'perf.Ps_bearing_target') #Output variable pass_throughs to the assembly boundary self.connect('tube.Fl_O.rhot', 'rho_air') #promoted for aero calc self.connect('tube.Fl_O.area', 'area_inlet_in') self.connect('tube.Fl_O.Vflow', 'speed_max') self.connect('inlet.Fl_O.area', 'area_c1_in') self.connect('comp1.Fl_O.area', 'area_c1_out') self.connect('nozzle.Fl_O.area', 'nozzle_flow_area') self.connect('nozzle.Fl_O', 'nozzle_Fl_O') self.connect('duct2.Fl_O', 'bearing_Fl_O') self.connect('perf.F_net', 'F_net') self.connect('perf.pwr', 'pwr_req') self.connect('perf.Ps_bearing_residual', 'Ps_bearing_residual') #driver setup design = self.driver comp_list = [ 'tube', 'inlet', 'comp1', 'duct1', 'split', 'nozzle', 'comp2', 'duct2', 'perf' ] design.workflow.add(comp_list) for comp_name in comp_list: #need to put everything in design mode design.add_event('%s.design' % comp_name)