예제 #1
0
    def setup(self):

        thermo_spec = species_data.janaf

        self.add_subsystem(
            'fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))

        self.add_subsystem(
            'inlet',
            Inlet(design=True, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem(
            'fan',
            Compressor(thermo_data=thermo_spec, elements=AIR_MIX, design=True))
        self.add_subsystem('nozz',
                           Nozzle(thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=0))

        self.add_subsystem('shaft', IndepVarComp('Nmech', 1., units='rpm'))

        self.add_subsystem('pwr_balance',
                           BalanceComp('W',
                                       units='lbm/s',
                                       eq_units='hp',
                                       val=50.,
                                       lower=1.,
                                       upper=500.),
                           promotes_inputs=[('rhs:W', 'pwr_target')])

        # self.set_order(['pwr_balance', 'pwr_target', 'fc', 'inlet', 'shaft', 'fan', 'nozz', 'perf'])

        connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I')
        connect_flow(self, 'inlet.Fl_O', 'fan.Fl_I')
        connect_flow(self, 'fan.Fl_O', 'nozz.Fl_I')

        self.connect('shaft.Nmech', 'fan.Nmech')

        self.connect('fc.Fl_O:stat:P', 'nozz.Ps_exhaust')
        self.connect('inlet.Fl_O:tot:P', 'perf.Pt2')
        self.connect('fan.Fl_O:tot:P', 'perf.Pt3')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('nozz.Fg', 'perf.Fg_0')

        self.connect('pwr_balance.W', 'fc.W')
        self.connect('fan.power', 'pwr_balance.lhs:W')

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-12
        newton.options['rtol'] = 1e-12
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 10
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 10
        #
        newton.linesearch = BoundsEnforceLS()
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        # newton.linesearch.options['print_bound_enforce'] = True
        # newton.linesearch.options['iprint'] = -1
        #
        self.linear_solver = DirectSolver(assemble_jac=True)
    def setup(self):
        thermo_spec = species_data.janaf
        design = self.options['design']

        ##########################################
        # Elements
        ##########################################

        self.add_subsystem(
            'fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        # Inlet Components
        self.add_subsystem('mil_spec', MilSpecRecovery())
        self.add_subsystem(
            'inlet',
            Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))

        # Fan Components - Split here for CFD integration Add a CFDStart Compomponent
        self.add_subsystem('fan',
                           Compressor(map_data=AXI5,
                                      design=design,
                                      thermo_data=thermo_spec,
                                      elements=AIR_MIX,
                                      map_extrap=True),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])

        self.add_subsystem(
            'splitter',
            Splitter(design=design, thermo_data=thermo_spec, elements=AIR_MIX))

        # Bypass Stream
        ###################
        self.add_subsystem(
            'bypass_duct',
            Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))

        # Core Stream
        ##############
        self.add_subsystem(
            'ic_duct',
            Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))

        self.add_subsystem('hpc',
                           Compressor(map_data=HPCmap,
                                      design=design,
                                      thermo_data=thermo_spec,
                                      elements=AIR_MIX,
                                      bleed_names=['cool1', 'cool2'],
                                      map_extrap=True),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])

        self.add_subsystem(
            'duct_3',
            Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))

        self.add_subsystem('bleed_3',
                           BleedOut(design=design, bleed_names=['cust_bleed']))

        self.add_subsystem(
            'burner',
            Combustor(design=design,
                      thermo_data=thermo_spec,
                      inflow_elements=AIR_MIX,
                      air_fuel_elements=AIR_FUEL_MIX,
                      fuel_type='Jet-A(g)'))
        self.add_subsystem('hpt',
                           Turbine(map_data=HPTmap,
                                   design=design,
                                   thermo_data=thermo_spec,
                                   elements=AIR_FUEL_MIX,
                                   bleed_names=['chargable', 'non_chargable'],
                                   map_extrap=True),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])

        self.add_subsystem(
            'it_duct',
            Duct(design=design, thermo_data=thermo_spec,
                 elements=AIR_FUEL_MIX))

        # uncooled lpt
        self.add_subsystem('lpt',
                           Turbine(map_data=LPTmap,
                                   design=design,
                                   thermo_data=thermo_spec,
                                   elements=AIR_FUEL_MIX,
                                   map_extrap=True),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])

        if not design:
            self.add_subsystem(
                'vabi',
                ExecComp('Fl1_area = Fl1_area_des*fact',
                         Fl1_area_des={'units': 'inch**2'},
                         Fl1_area={
                             'units': 'inch**2',
                             'value': 164.
                         }))

        self.add_subsystem(
            'mixer',
            Mixer(design=design,
                  designed_stream=1,
                  Fl_I1_elements=AIR_FUEL_MIX,
                  Fl_I2_elements=AIR_MIX))

        # augmentor Components
        self.add_subsystem(
            'augmentor',
            Combustor(design=design,
                      thermo_data=thermo_spec,
                      inflow_elements=AIR_FUEL_MIX,
                      air_fuel_elements=AIR_FUEL_MIX,
                      fuel_type='Jet-A(g)'))
        # End CFD HERE
        # Nozzle
        self.add_subsystem(
            'nozzle',
            Nozzle(nozzType='CD',
                   lossCoef='Cfg',
                   thermo_data=thermo_spec,
                   elements=AIR_FUEL_MIX))

        # Mechanical components
        self.add_subsystem('lp_shaft',
                           Shaft(num_ports=2),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])
        self.add_subsystem('hp_shaft',
                           Shaft(num_ports=2),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])

        # Aggregating component
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=2))

        ##########################################
        #  Connecting the Flow Path
        ##########################################
        connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I')
        connect_flow(self, 'inlet.Fl_O', 'fan.Fl_I')
        connect_flow(self, 'fan.Fl_O', 'splitter.Fl_I')

        # Bypass Connections
        connect_flow(self, 'splitter.Fl_O2', 'bypass_duct.Fl_I')
        connect_flow(self, 'bypass_duct.Fl_O', 'mixer.Fl_I2')

        # Core connections
        connect_flow(self, 'splitter.Fl_O1', 'ic_duct.Fl_I')
        connect_flow(self, 'ic_duct.Fl_O', 'hpc.Fl_I')
        connect_flow(self, 'hpc.Fl_O', 'duct_3.Fl_I')
        connect_flow(self, 'duct_3.Fl_O', 'bleed_3.Fl_I')
        connect_flow(self, 'bleed_3.Fl_O', 'burner.Fl_I')
        connect_flow(self, 'burner.Fl_O', 'hpt.Fl_I')
        connect_flow(self, 'hpt.Fl_O', 'it_duct.Fl_I')
        connect_flow(self, 'it_duct.Fl_O', 'lpt.Fl_I')
        connect_flow(self, 'lpt.Fl_O', 'mixer.Fl_I1')

        connect_flow(self, 'mixer.Fl_O', 'augmentor.Fl_I')
        connect_flow(self, 'augmentor.Fl_O', 'nozzle.Fl_I')

        # Connect cooling flows
        connect_flow(self,
                     'hpc.cool1',
                     'hpt.non_chargable',
                     connect_stat=False)
        connect_flow(self, 'hpc.cool2', 'hpt.chargable', connect_stat=False)

        ##########################################
        #  Additional Connections
        ##########################################
        # Make additional model connections
        self.connect('fc.Fl_O:stat:MN', 'mil_spec.MN')
        self.connect('mil_spec.ram_recovery', 'inlet.ram_recovery')
        self.connect('inlet.Fl_O:tot:P', 'perf.Pt2')
        self.connect('hpc.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('augmentor.Wfuel', 'perf.Wfuel_1')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('nozzle.Fg', 'perf.Fg_0')

        self.connect('fan.trq', 'lp_shaft.trq_0')
        self.connect('lpt.trq', 'lp_shaft.trq_1')

        self.connect('hpc.trq', 'hp_shaft.trq_0')
        self.connect('hpt.trq', 'hp_shaft.trq_1')

        self.connect('fc.Fl_O:stat:P', 'nozzle.Ps_exhaust')

        if not design:
            self.connect('vabi.Fl1_area', 'mixer.Fl_I1_stat_calc.area')

        ##########################################
        #  Balances to define cycle convergence
        ##########################################
        balance = self.add_subsystem('balance', BalanceComp())
        if design:
            balance.add_balance('W',
                                lower=1e-3,
                                upper=200.,
                                units='lbm/s',
                                eq_units='lbf')
            self.connect('balance.W', 'fc.fs.W')
            self.connect('perf.Fn', 'balance.lhs:W')
            # self.add_subsystem('wDV',IndepVarComp('wDes',100,units='lbm/s'))
            # self.connect('wDV.wDes','fc.fs.W')

            balance.add_balance('BPR', eq_units=None, lower=0.25, val=5.0)
            self.connect('balance.BPR', 'splitter.BPR')
            self.connect('mixer.ER', 'balance.lhs:BPR')

            balance.add_balance('FAR_core',
                                eq_units='degR',
                                lower=1e-4,
                                val=.017)
            self.connect('balance.FAR_core', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR_core')

            balance.add_balance('FAR_ab',
                                eq_units='degR',
                                lower=1e-4,
                                val=.017)
            self.connect('balance.FAR_ab', 'augmentor.Fl_I:FAR')
            self.connect('augmentor.Fl_O:tot:T', 'balance.lhs:FAR_ab')

            balance.add_balance('lpt_PR',
                                val=1.5,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                use_mult=True,
                                mult_val=-1)
            self.connect('balance.lpt_PR', 'lpt.PR')
            self.connect('lp_shaft.pwr_in', 'balance.lhs:lpt_PR')
            self.connect('lp_shaft.pwr_out', 'balance.rhs:lpt_PR')

            balance.add_balance('hpt_PR',
                                val=1.5,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                use_mult=True,
                                mult_val=-1)
            self.connect('balance.hpt_PR', 'hpt.PR')
            self.connect('hp_shaft.pwr_in', 'balance.lhs:hpt_PR')
            self.connect('hp_shaft.pwr_out', 'balance.rhs:hpt_PR')

        else:  # off design
            balance.add_balance('W',
                                lower=1e-3,
                                upper=400.,
                                units='lbm/s',
                                eq_units='inch**2')
            self.connect('balance.W', 'fc.fs.W')
            self.connect('nozzle.Throat:stat:area', 'balance.lhs:W')

            balance.add_balance('BPR', lower=0.25, upper=3.0, eq_units='psi')
            self.connect('balance.BPR', 'splitter.BPR')
            self.connect('mixer.Fl_I1_calc:stat:P', 'balance.lhs:BPR')
            self.connect('bypass_duct.Fl_O:stat:P', 'balance.rhs:BPR')

            # balance.add_balance('FAR_core', eq_units='degR', lower=1e-4, upper=.045, val=.017)
            # self.connect('balance.FAR_core', 'burner.Fl_I:FAR')
            # self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR_core')

            balance.add_balance('FAR_ab',
                                eq_units='degR',
                                lower=1e-4,
                                upper=.045,
                                val=.017)
            self.connect('balance.FAR_ab', 'augmentor.Fl_I:FAR')
            self.connect('augmentor.Fl_O:tot:T', 'balance.lhs:FAR_ab')

            far_core_bal = ConstrainedTempBalance()
            self.add_subsystem('far_core_bal', far_core_bal)
            self.connect('far_core_bal.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'far_core_bal.T_computed')
            self.connect('fan.map.shaftNc.NcMap', 'far_core_bal.Nc_computed')

            balance.add_balance('LP_Nmech',
                                val=1.,
                                units='rpm',
                                lower=0.5,
                                upper=2.,
                                eq_units='hp',
                                use_mult=True,
                                mult_val=-1)
            self.connect('balance.LP_Nmech', 'LP_Nmech')
            self.connect('lp_shaft.pwr_in', 'balance.lhs:LP_Nmech')
            self.connect('lp_shaft.pwr_out', 'balance.rhs:LP_Nmech')

            balance.add_balance('HP_Nmech',
                                val=1.,
                                units='rpm',
                                lower=0.5,
                                upper=2.,
                                eq_units='hp',
                                use_mult=True,
                                mult_val=-1)
            self.connect('balance.HP_Nmech', 'HP_Nmech')
            self.connect('hp_shaft.pwr_in', 'balance.lhs:HP_Nmech')
            self.connect('hp_shaft.pwr_out', 'balance.rhs:HP_Nmech')

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-6
        newton.options['rtol'] = 1e-10
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 30
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 10
        newton.linesearch = BoundsEnforceLS()
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        # newton.linesearch.options['print_bound_enforce'] = True
        newton.linesearch.options['iprint'] = -1

        # newton.linesearch = ArmijoGoldsteinLS()
        # newton.linesearch.options['c'] = -.1

        self.linear_solver = DirectSolver(assemble_jac=True)

        # TODO: re-factor pycycle so this block isn't needed in default use case!!!
        if design:
            ##########################################
            #  Model Parameters
            ##########################################
            element_params = self.add_subsystem('element_params',
                                                IndepVarComp(),
                                                promotes=["*"])
            # element_params.add_output('inlet:ram_recovery', 0.9990)
            element_params.add_output('inlet:MN_out', 0.65)
            # self.connect('inlet:ram_recovery', 'inlet.ram_recovery')
            self.connect('inlet:MN_out', 'inlet.MN')

            element_params.add_output('fan:effDes', 0.8700)
            element_params.add_output('fan:MN_out', 0.4578)
            self.connect('fan:effDes', 'fan.map.effDes')
            self.connect('fan:MN_out', 'fan.MN')

            element_params.add_output('splitter:MN_out1', 0.3104)
            element_params.add_output('splitter:MN_out2', 0.4518)
            self.connect('splitter:MN_out1', 'splitter.MN1')
            self.connect('splitter:MN_out2', 'splitter.MN2')

            element_params.add_output('ic_duct:dPqP', 0.0048)
            element_params.add_output('ic_duct:MN_out', 0.3121)
            self.connect('ic_duct:dPqP', 'ic_duct.dPqP')
            self.connect('ic_duct:MN_out', 'ic_duct.MN')

            element_params.add_output('hpc:effDes', 0.8707)
            element_params.add_output('hpc:MN_out', 0.2442)
            self.connect('hpc:effDes', 'hpc.map.effDes')
            self.connect('hpc:MN_out', 'hpc.MN')

            element_params.add_output('hpc:cool1:frac_W', 0.09)
            element_params.add_output('hpc:cool1:frac_P', 1.0)
            element_params.add_output('hpc:cool1:frac_work', 1.0)
            self.connect('hpc:cool1:frac_W', 'hpc.cool1:frac_W')
            self.connect('hpc:cool1:frac_P', 'hpc.cool1:frac_P')
            self.connect('hpc:cool1:frac_work', 'hpc.cool1:frac_work')

            element_params.add_output('hpc:cool2:frac_W', 0.07)
            element_params.add_output('hpc:cool2:frac_P', 0.5)
            element_params.add_output('hpc:cool2:frac_work', 0.5)
            self.connect('hpc:cool2:frac_W', 'hpc.cool2:frac_W')
            self.connect('hpc:cool2:frac_P', 'hpc.cool2:frac_P')
            self.connect('hpc:cool2:frac_work', 'hpc.cool2:frac_work')

            element_params.add_output('duct_3:dPqP', 0.0048)
            element_params.add_output('duct_3:MN_out', 0.2)
            self.connect('duct_3:dPqP', 'duct_3.dPqP')
            self.connect('duct_3:MN_out', 'duct_3.MN')

            element_params.add_output('bleed_3:MN_out', 0.3000)
            element_params.add_output('bleed_3:cust_bleed:frac_W', 0.07)
            self.connect('bleed_3:MN_out', 'bleed_3.MN')
            self.connect('bleed_3:cust_bleed:frac_W',
                         'bleed_3.cust_bleed:frac_W')

            element_params.add_output('burner:dPqP', 0.0540)
            element_params.add_output('burner:MN_out', 0.1025)
            self.connect('burner:dPqP', 'burner.dPqP')
            self.connect('burner:MN_out', 'burner.MN')

            element_params.add_output('hpt:effDes', 0.8888)
            element_params.add_output('hpt:MN_out', 0.3650)
            element_params.add_output('hpt:chargable:frac_P', 0.0)
            element_params.add_output('hpt:non_chargable:frac_P', 1.0)
            self.connect('hpt:effDes', 'hpt.map.effDes')
            self.connect('hpt:MN_out', 'hpt.MN')
            self.connect('hpt:chargable:frac_P', 'hpt.chargable:frac_P')
            self.connect('hpt:non_chargable:frac_P',
                         'hpt.non_chargable:frac_P')

            element_params.add_output('it_duct:dPqP', 0.0051)
            element_params.add_output('it_duct:MN_out', 0.3063)
            self.connect('it_duct:dPqP', 'it_duct.dPqP')
            self.connect('it_duct:MN_out', 'it_duct.MN')

            element_params.add_output('lpt:effDes', 0.8996)
            element_params.add_output('lpt:MN_out', 0.4127)
            self.connect('lpt:effDes', 'lpt.map.effDes')
            self.connect('lpt:MN_out', 'lpt.MN')

            element_params.add_output('bypass_duct:dPqP', 0.0107)
            element_params.add_output('bypass_duct:MN_out', 0.4463)
            self.connect('bypass_duct:dPqP', 'bypass_duct.dPqP')
            self.connect('bypass_duct:MN_out', 'bypass_duct.MN')

            # No params for mixer

            element_params.add_output('augmentor:dPqP', 0.0540)
            element_params.add_output('augmentor:MN_out', 0.1025)
            self.connect('augmentor:dPqP', 'augmentor.dPqP')
            self.connect('augmentor:MN_out', 'augmentor.MN')

            element_params.add_output('nozzle:Cfg', 0.9933)
            self.connect('nozzle:Cfg', 'nozzle.Cfg')

            element_params.add_output('lp_shaft:Nmech', 1, units='rpm')
            element_params.add_output('hp_shaft:Nmech', 1, units='rpm')
            element_params.add_output('hp_shaft:HPX', 250.0, units='hp')
            self.connect('lp_shaft:Nmech', 'LP_Nmech')
            self.connect('hp_shaft:Nmech', 'HP_Nmech')
            self.connect('hp_shaft:HPX', 'hp_shaft.HPX')
예제 #3
0
파일: CFM56.py 프로젝트: friedenhe/pyCycle
    def setup(self):

        thermo_spec = species_data.janaf
        design = self.options['design']
        statics = self.options['statics']

        self.add_subsystem('fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('inlet', Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('fan', Compressor(map_data=FanMap, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                        bleed_names=[], statics=statics, map_extrap=True), promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('splitter', Splitter(design=design, thermo_data=thermo_spec, elements=AIR_MIX, statics=statics))
        self.add_subsystem('duct4', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX, statics=statics))
        self.add_subsystem('lpc', Compressor(map_data=LPCmap, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                        statics=statics, map_extrap=True),promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('duct6', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX, statics=statics))
        self.add_subsystem('hpc', Compressor(map_data=HPCmap, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                        bleed_names=['cool1','cool2','cust'], statics=statics, map_extrap=True),promotes_inputs=[('Nmech','HP_Nmech')])
        self.add_subsystem('bld3', BleedOut(design=design, statics=statics, bleed_names=['cool3','cool4']))
        self.add_subsystem('burner', Combustor(design=design,thermo_data=thermo_spec,
                                        inflow_elements=AIR_MIX,
                                        air_fuel_elements=AIR_FUEL_MIX,
                                        fuel_type='Jet-A(g)', statics=statics))
        self.add_subsystem('hpt', Turbine(map_data=HPTmap, design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX,
                                        bleed_names=['cool3','cool4'], statics=statics, map_extrap=True),promotes_inputs=[('Nmech','HP_Nmech')])
        self.add_subsystem('duct11', Duct(design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX, statics=statics))
        self.add_subsystem('lpt', Turbine(map_data=LPTmap, design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX,
                                        bleed_names=['cool1','cool2'], statics=statics, map_extrap=True),promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('duct13', Duct(design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX, statics=statics))
        self.add_subsystem('core_nozz', Nozzle(nozzType='CV', lossCoef='Cv', thermo_data=thermo_spec, elements=AIR_FUEL_MIX))

        self.add_subsystem('byp_bld', BleedOut(design=design, statics=statics, bleed_names=['bypBld']))
        self.add_subsystem('duct15', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX, statics=statics))
        self.add_subsystem('byp_nozz', Nozzle(nozzType='CV', lossCoef='Cv', thermo_data=thermo_spec, elements=AIR_MIX))

        self.add_subsystem('lp_shaft', Shaft(num_ports=3),promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('hp_shaft', Shaft(num_ports=2),promotes_inputs=[('Nmech','HP_Nmech')])
        self.add_subsystem('perf', Performance(num_nozzles=2, num_burners=1))

        self.connect('inlet.Fl_O:tot:P', 'perf.Pt2')
        self.connect('hpc.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('core_nozz.Fg', 'perf.Fg_0')
        self.connect('byp_nozz.Fg', 'perf.Fg_1')

        self.connect('fan.trq', 'lp_shaft.trq_0')
        self.connect('lpc.trq', 'lp_shaft.trq_1')
        self.connect('lpt.trq', 'lp_shaft.trq_2')
        self.connect('hpc.trq', 'hp_shaft.trq_0')
        self.connect('hpt.trq', 'hp_shaft.trq_1')
        self.connect('fc.Fl_O:stat:P', 'core_nozz.Ps_exhaust')
        self.connect('fc.Fl_O:stat:P', 'byp_nozz.Ps_exhaust')

        balance = self.add_subsystem('balance', BalanceComp())
        if design:
            balance.add_balance('W', units='lbm/s', eq_units='lbf')
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('perf.Fn', 'balance.lhs:W')

            balance.add_balance('FAR', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR')

            balance.add_balance('lpt_PR', val=1.5, lower=1.001, upper=8, 
                                eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.lpt_PR', 'lpt.PR')
            self.connect('lp_shaft.pwr_in_real', 'balance.lhs:lpt_PR')
            self.connect('lp_shaft.pwr_out_real', 'balance.rhs:lpt_PR')

            balance.add_balance('hpt_PR', val=1.5, lower=1.001, upper=8, 
                                eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.hpt_PR', 'hpt.PR')
            self.connect('hp_shaft.pwr_in_real', 'balance.lhs:hpt_PR')
            self.connect('hp_shaft.pwr_out_real', 'balance.rhs:hpt_PR')

        else:

            balance.add_balance('FAR', val=0.017, lower=1e-4, eq_units='lbf')
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('perf.Fn', 'balance.lhs:FAR')

            balance.add_balance('W', units='lbm/s', lower=10., upper=1000., eq_units='inch**2')
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('core_nozz.Throat:stat:area', 'balance.lhs:W')

            balance.add_balance('BPR', lower=2., upper=10., eq_units='inch**2')
            self.connect('balance.BPR', 'splitter.BPR')
            self.connect('byp_nozz.Throat:stat:area', 'balance.lhs:BPR')

            balance.add_balance('lp_Nmech', val=1.5, units='rpm', lower=500., eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.lp_Nmech', 'LP_Nmech')
            self.connect('lp_shaft.pwr_in_real', 'balance.lhs:lp_Nmech')
            self.connect('lp_shaft.pwr_out_real', 'balance.rhs:lp_Nmech')

            balance.add_balance('hp_Nmech', val=1.5, units='rpm', lower=500., eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.hp_Nmech', 'HP_Nmech')
            self.connect('hp_shaft.pwr_in_real', 'balance.lhs:hp_Nmech')
            self.connect('hp_shaft.pwr_out_real', 'balance.rhs:hp_Nmech')

            self.set_order(['balance', 'fc', 'inlet', 'fan', 'splitter', 'duct4', 'lpc', 'duct6', 'hpc', 'bld3', 'burner', 'hpt', 'duct11',
                            'lpt', 'duct13', 'core_nozz', 'byp_bld', 'duct15', 'byp_nozz', 'lp_shaft', 'hp_shaft', 'perf'])

        connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
        connect_flow(self, 'inlet.Fl_O', 'fan.Fl_I')
        connect_flow(self, 'fan.Fl_O', 'splitter.Fl_I')
        connect_flow(self, 'splitter.Fl_O1', 'duct4.Fl_I')
        connect_flow(self, 'duct4.Fl_O', 'lpc.Fl_I')
        connect_flow(self, 'lpc.Fl_O', 'duct6.Fl_I')
        connect_flow(self, 'duct6.Fl_O', 'hpc.Fl_I')
        connect_flow(self, 'hpc.Fl_O', 'bld3.Fl_I')
        connect_flow(self, 'bld3.Fl_O', 'burner.Fl_I')
        connect_flow(self, 'burner.Fl_O', 'hpt.Fl_I')
        connect_flow(self, 'hpt.Fl_O', 'duct11.Fl_I')
        connect_flow(self, 'duct11.Fl_O', 'lpt.Fl_I')
        connect_flow(self, 'lpt.Fl_O', 'duct13.Fl_I')
        connect_flow(self, 'duct13.Fl_O','core_nozz.Fl_I')
        connect_flow(self, 'splitter.Fl_O2', 'byp_bld.Fl_I')
        connect_flow(self, 'byp_bld.Fl_O', 'duct15.Fl_I')
        connect_flow(self, 'duct15.Fl_O', 'byp_nozz.Fl_I')
       

        connect_flow(self, 'hpc.cool1', 'lpt.cool1', connect_stat=False)
        connect_flow(self, 'hpc.cool2', 'lpt.cool2', connect_stat=False)
        connect_flow(self, 'bld3.cool3', 'hpt.cool3', connect_stat=False)
        connect_flow(self, 'bld3.cool4', 'hpt.cool4', connect_stat=False)

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-8
        newton.options['rtol'] = 1e-8
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 50
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 100

        
        # ls = newton.linesearch = BoundsEnforceLS()
        ls = newton.linesearch = ArmijoGoldsteinLS()
        ls.options['maxiter'] = 3
        ls.options['bound_enforcement'] = 'scalar'
        # ls.options['print_bound_enforce'] = True

        self.linear_solver = DirectSolver(assemble_jac=True)
예제 #4
0
    def setup(self):
        thermo_spec = species_data.janaf
        design = self.options['design']

        self.add_subsystem('fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        # Inlet Components
        self.add_subsystem('inlet', Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('inlet_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        # Fan Components - Split here for CFD integration Add a CFDStart Compomponent
        self.add_subsystem('fan', Compressor(map_data=AXI5, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                             map_extrap=True),promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('splitter', Splitter(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        # Core Stream components
        self.add_subsystem('splitter_core_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('lpc', Compressor(map_data=LPCmap, design=design, thermo_data=thermo_spec, elements=AIR_MIX,map_extrap=True),
                                             promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('lpc_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('hpc', Compressor(map_data=HPCmap, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                        bleed_names=['cool1'],map_extrap=True),promotes_inputs=[('Nmech','HP_Nmech')])
        self.add_subsystem('bld3', BleedOut(design=design, bleed_names=['cool3']))
        self.add_subsystem('burner', Combustor(design=design,thermo_data=thermo_spec,
                                                inflow_elements=AIR_MIX,
                                                air_fuel_elements=AIR_FUEL_MIX,
                                                fuel_type='Jet-A(g)'))
        self.add_subsystem('hpt', Turbine(map_data=HPTmap, design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX,
                                          bleed_names=['cool3'],map_extrap=True),promotes_inputs=[('Nmech','HP_Nmech')])
        self.add_subsystem('hpt_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX))
        self.add_subsystem('lpt', Turbine(map_data=LPTmap, design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX,
                                        bleed_names=['cool1'],map_extrap=True), promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('lpt_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX))
        # Bypass Components
        self.add_subsystem('bypass_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        # Mixer component
        self.add_subsystem('mixer', Mixer(design=design, designed_stream=1, Fl_I1_elements=AIR_FUEL_MIX, Fl_I2_elements=AIR_MIX))
        self.add_subsystem('mixer_duct', Duct(design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX))
        # Afterburner Components
        self.add_subsystem('afterburner', Combustor(design=design,thermo_data=thermo_spec,
                                                inflow_elements=AIR_FUEL_MIX,
                                                air_fuel_elements=AIR_FUEL_MIX,
                                                fuel_type='Jet-A(g)'))
        # End CFD HERE
        # Nozzle
        self.add_subsystem('mixed_nozz', Nozzle(nozzType='CD', lossCoef='Cfg', thermo_data=thermo_spec, elements=AIR_FUEL_MIX))

        # Mechanical components
        self.add_subsystem('lp_shaft', Shaft(num_ports=3),promotes_inputs=[('Nmech','LP_Nmech')])
        self.add_subsystem('hp_shaft', Shaft(num_ports=2),promotes_inputs=[('Nmech','HP_Nmech')])

        # Aggregating component
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=2))

        # Connnect flow path
        connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I')
        connect_flow(self, 'inlet.Fl_O', 'inlet_duct.Fl_I')
        connect_flow(self, 'inlet_duct.Fl_O', 'fan.Fl_I')
        connect_flow(self, 'fan.Fl_O', 'splitter.Fl_I')
        # Core connections
        connect_flow(self, 'splitter.Fl_O1', 'splitter_core_duct.Fl_I')
        connect_flow(self, 'splitter_core_duct.Fl_O', 'lpc.Fl_I')
        connect_flow(self, 'lpc.Fl_O', 'lpc_duct.Fl_I')
        connect_flow(self, 'lpc_duct.Fl_O', 'hpc.Fl_I')
        connect_flow(self, 'hpc.Fl_O', 'bld3.Fl_I')
        connect_flow(self, 'bld3.Fl_O', 'burner.Fl_I')
        connect_flow(self, 'burner.Fl_O', 'hpt.Fl_I')
        connect_flow(self, 'hpt.Fl_O', 'hpt_duct.Fl_I')
        connect_flow(self, 'hpt_duct.Fl_O', 'lpt.Fl_I')
        connect_flow(self, 'lpt.Fl_O', 'lpt_duct.Fl_I')
        connect_flow(self, 'lpt_duct.Fl_O','mixer.Fl_I1')
        # Bypass Connections
        connect_flow(self, 'splitter.Fl_O2', 'bypass_duct.Fl_I')
        connect_flow(self, 'bypass_duct.Fl_O', 'mixer.Fl_I2')

        #Mixer Connections
        connect_flow(self, 'mixer.Fl_O', 'mixer_duct.Fl_I')
        # After Burner
        connect_flow(self,'mixer_duct.Fl_O','afterburner.Fl_I')

        # Nozzle
        connect_flow(self,'afterburner.Fl_O','mixed_nozz.Fl_I')

        # Connect cooling flows
        connect_flow(self, 'hpc.cool1', 'lpt.cool1', connect_stat=False)
        connect_flow(self, 'bld3.cool3', 'hpt.cool3', connect_stat=False)

        # Make additional model connections
        self.connect('inlet.Fl_O:tot:P', 'perf.Pt2')
        self.connect('hpc.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('afterburner.Wfuel', 'perf.Wfuel_1')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('mixed_nozz.Fg', 'perf.Fg_0')

        self.connect('fan.trq', 'lp_shaft.trq_0')
        self.connect('lpc.trq', 'lp_shaft.trq_1')
        self.connect('lpt.trq', 'lp_shaft.trq_2')
        self.connect('hpc.trq', 'hp_shaft.trq_0')
        self.connect('hpt.trq', 'hp_shaft.trq_1')
        self.connect('fc.Fl_O:stat:P', 'mixed_nozz.Ps_exhaust')

        # Add balence components to close the implicit components
        balance = self.add_subsystem('balance', BalanceComp())
        if design:
            balance.add_balance('W', lower=1e-3, upper=200., units='lbm/s', eq_units='lbf')
            self.connect('balance.W', 'fc.W')
            self.connect('perf.Fn', 'balance.lhs:W')
            # self.add_subsystem('wDV',IndepVarComp('wDes',100,units='lbm/s'))
            # self.connect('wDV.wDes','fc.W')

            balance.add_balance('BPR', eq_units=None, lower=0.25, val=5.0)
            self.connect('balance.BPR', 'splitter.BPR')
            self.connect('mixer.ER', 'balance.lhs:BPR')

            balance.add_balance('FAR_core', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR_core', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR_core')

            balance.add_balance('FAR_ab', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR_ab', 'afterburner.Fl_I:FAR')
            self.connect('afterburner.Fl_O:tot:T', 'balance.lhs:FAR_ab')

            balance.add_balance('lpt_PR', val=1.5, lower=1.001, upper=8, eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.lpt_PR', 'lpt.PR')
            self.connect('lp_shaft.pwr_in', 'balance.lhs:lpt_PR')
            self.connect('lp_shaft.pwr_out', 'balance.rhs:lpt_PR')

            balance.add_balance('hpt_PR', val=1.5, lower=1.001, upper=8, eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.hpt_PR', 'hpt.PR')
            self.connect('hp_shaft.pwr_in', 'balance.lhs:hpt_PR')
            self.connect('hp_shaft.pwr_out', 'balance.rhs:hpt_PR')
        else:

            balance.add_balance('W', lower=1e-3, upper=200., units='lbm/s', eq_units='inch**2')
            self.connect('balance.W', 'fc.W')
            self.connect('mixed_nozz.Throat:stat:area', 'balance.lhs:W')

            balance.add_balance('BPR', lower=0.25, upper=5.0, eq_units='psi')
            self.connect('balance.BPR', 'splitter.BPR')
            self.connect('mixer.Fl_I1_calc:stat:P', 'balance.lhs:BPR')
            self.connect('bypass_duct.Fl_O:stat:P', 'balance.rhs:BPR')

            balance.add_balance('FAR_core', eq_units='degR', lower=1e-4, upper=.06, val=.017)
            self.connect('balance.FAR_core', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR_core')

            balance.add_balance('FAR_ab', eq_units='degR', lower=1e-4, upper=.06, val=.017)
            self.connect('balance.FAR_ab', 'afterburner.Fl_I:FAR')
            self.connect('afterburner.Fl_O:tot:T', 'balance.lhs:FAR_ab')

            balance.add_balance('LP_Nmech', val=1., units='rpm', lower=500., eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.LP_Nmech', 'LP_Nmech')
            self.connect('lp_shaft.pwr_in', 'balance.lhs:LP_Nmech')
            self.connect('lp_shaft.pwr_out', 'balance.rhs:LP_Nmech')

            balance.add_balance('HP_Nmech', val=1., units='rpm', lower=500., eq_units='hp', use_mult=True, mult_val=-1)
            self.connect('balance.HP_Nmech', 'HP_Nmech')
            self.connect('hp_shaft.pwr_in', 'balance.lhs:HP_Nmech')
            self.connect('hp_shaft.pwr_out', 'balance.rhs:HP_Nmech')

        # Off design
        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-6
        newton.options['rtol'] = 1e-10
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 10
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 100
        newton.linesearch = BoundsEnforceLS()
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        newton.linesearch.options['iprint'] = -1


        self.linear_solver = DirectSolver(assemble_jac=True)
예제 #5
0
    def setup(self):

        thermo_spec = species_data.janaf
        design = self.options['design']

        # Add engine elements
        self.add_subsystem(
            'fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem(
            'inlet',
            Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('comp',
                           Compressor(
                               map_data=AXI5,
                               design=design,
                               thermo_data=thermo_spec,
                               elements=AIR_MIX,
                           ),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem(
            'burner',
            Combustor(design=design,
                      thermo_data=thermo_spec,
                      inflow_elements=AIR_MIX,
                      air_fuel_elements=AIR_FUEL_MIX,
                      fuel_type='JP-7'))
        self.add_subsystem('turb',
                           Turbine(
                               map_data=LPT2269,
                               design=design,
                               thermo_data=thermo_spec,
                               elements=AIR_FUEL_MIX,
                           ),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem('pt',
                           Turbine(
                               map_data=LPT2269,
                               design=design,
                               thermo_data=thermo_spec,
                               elements=AIR_FUEL_MIX,
                           ),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])
        self.add_subsystem(
            'nozz',
            Nozzle(nozzType='CV',
                   lossCoef='Cv',
                   thermo_data=thermo_spec,
                   elements=AIR_FUEL_MIX))
        self.add_subsystem('HP_shaft',
                           Shaft(num_ports=2),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem('LP_shaft',
                           Shaft(num_ports=1),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=1))

        # Connect flow stations
        connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
        connect_flow(self, 'inlet.Fl_O', 'comp.Fl_I')
        connect_flow(self, 'comp.Fl_O', 'burner.Fl_I')
        connect_flow(self, 'burner.Fl_O', 'turb.Fl_I')
        connect_flow(self, 'turb.Fl_O', 'pt.Fl_I')
        connect_flow(self, 'pt.Fl_O', 'nozz.Fl_I')

        # Connect turbomachinery elements to shaft
        self.connect('comp.trq', 'HP_shaft.trq_0')
        self.connect('turb.trq', 'HP_shaft.trq_1')
        self.connect('pt.trq', 'LP_shaft.trq_0')

        # Connnect nozzle exhaust to freestream static conditions
        self.connect('fc.Fl_O:stat:P', 'nozz.Ps_exhaust')

        # Connect outputs to pefromance element
        self.connect('inlet.Fl_O:tot:P', 'perf.Pt2')
        self.connect('comp.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('nozz.Fg', 'perf.Fg_0')
        self.connect('LP_shaft.pwr_net', 'perf.power')

        # Add balances for design and off-design
        balance = self.add_subsystem('balance', BalanceComp())
        if design:

            balance.add_balance('W', val=27.0, units='lbm/s', eq_units=None)
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('nozz.PR', 'balance.lhs:W')

            balance.add_balance('FAR', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR')

            balance.add_balance('turb_PR',
                                val=3.0,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.turb_PR', 'turb.PR')
            self.connect('HP_shaft.pwr_net', 'balance.lhs:turb_PR')

            balance.add_balance('pt_PR',
                                val=3.0,
                                lower=1.001,
                                upper=8,
                                eq_units='hp')
            self.connect('balance.pt_PR', 'pt.PR')
            self.connect('LP_shaft.pwr_net', 'balance.lhs:pt_PR')

        else:

            balance.add_balance('FAR', eq_units='hp', lower=1e-4, val=.3)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('LP_shaft.pwr_net', 'balance.lhs:FAR')

            balance.add_balance('HP_Nmech',
                                val=1.5,
                                units='rpm',
                                lower=500.,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.HP_Nmech', 'HP_Nmech')
            self.connect('HP_shaft.pwr_net', 'balance.lhs:HP_Nmech')

            balance.add_balance('W',
                                val=27.0,
                                units='lbm/s',
                                eq_units='inch**2')
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('nozz.Throat:stat:area', 'balance.lhs:W')

        # Setup solver to converge engine
        self.set_order([
            'balance', 'fc', 'inlet', 'comp', 'burner', 'turb', 'pt', 'nozz',
            'HP_shaft', 'LP_shaft', 'perf'
        ])

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-6
        newton.options['rtol'] = 1e-6
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 15
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 100
        newton.linesearch = BoundsEnforceLS()
        # newton.linesearch = ArmijoGoldsteinLS()
        # newton.linesearch.options['c'] = .0001
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        newton.linesearch.options['iprint'] = -1

        self.linear_solver = DirectSolver(assemble_jac=True)
예제 #6
0
파일: J79.py 프로젝트: friedenhe/pyCycle
    def setup(self):

        thermo_spec = species_data.janaf
        design = self.options['design']
        statics = self.options['statics']

        self.add_subsystem('fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('inlet', Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem('duct1', Duct(design=design, thermo_data=thermo_spec, elements=AIR_MIX, statics=statics))
        self.add_subsystem('comp', Compressor(map_data=AXI5, design=design, thermo_data=thermo_spec, elements=AIR_MIX,
                                        bleed_names=['cool1','cool2'], statics=statics, map_extrap=True),promotes_inputs=['Nmech'])
        self.add_subsystem('burner', Combustor(design=design,thermo_data=thermo_spec,
                                        inflow_elements=AIR_MIX,
                                        air_fuel_elements=AIR_FUEL_MIX,
                                        fuel_type='JP-7', statics=statics))
        self.add_subsystem('turb', Turbine(map_data=LPT2269, design=design, thermo_data=thermo_spec, elements=AIR_FUEL_MIX,
                                        bleed_names=['cool1','cool2'], statics=statics, map_extrap=True),promotes_inputs=['Nmech'])
        self.add_subsystem('ab', Combustor(design=design,thermo_data=thermo_spec,
                                        inflow_elements=AIR_FUEL_MIX,
                                        air_fuel_elements=AIR_FUEL_MIX,
                                        fuel_type='JP-7', statics=statics))
        self.add_subsystem('nozz', Nozzle(nozzType='CD', lossCoef='Cv', thermo_data=thermo_spec, elements=AIR_FUEL_MIX, internal_solver=True))
        self.add_subsystem('shaft', Shaft(num_ports=2),promotes_inputs=['Nmech'])
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=2))

        self.connect('duct1.Fl_O:tot:P', 'perf.Pt2')
        self.connect('comp.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('ab.Wfuel', 'perf.Wfuel_1')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('nozz.Fg', 'perf.Fg_0')

        self.connect('comp.trq', 'shaft.trq_0')
        self.connect('turb.trq', 'shaft.trq_1')
        # self.connect('shaft.Nmech', 'comp.Nmech')
        # self.connect('shaft.Nmech', 'turb.Nmech')
        self.connect('fc.Fl_O:stat:P', 'nozz.Ps_exhaust')

        balance = self.add_subsystem('balance', BalanceComp())
        if design:

            balance.add_balance('W', units='lbm/s', eq_units='lbf')
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('perf.Fn', 'balance.lhs:W')

            balance.add_balance('FAR', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR')

            balance.add_balance('turb_PR', val=1.5, lower=1.001, upper=8, eq_units='hp', rhs_val=0.)
            self.connect('balance.turb_PR', 'turb.PR')
            self.connect('shaft.pwr_net', 'balance.lhs:turb_PR')

            # self.set_order(['fc', 'inlet', 'duct1', 'comp', 'burner', 'turb', 'ab', 'nozz', 'shaft', 'perf', 'thrust_balance', 'temp_balance', 'shaft_balance'])
            self.set_order(['balance', 'fc', 'inlet', 'duct1', 'comp', 'burner', 'turb', 'ab', 'nozz', 'shaft', 'perf'])

        else:

            balance.add_balance('FAR', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR')

            balance.add_balance('Nmech', val=8000., units='rpm', lower=500., eq_units='hp', rhs_val=0.)
            self.connect('balance.Nmech', 'Nmech')
            self.connect('shaft.pwr_net', 'balance.lhs:Nmech')

            balance.add_balance('W', val=100.0, units='lbm/s', eq_units=None, rhs_val=2.0)
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('comp.map.RlineMap', 'balance.lhs:W')

            self.set_order(['balance', 'fc', 'inlet', 'duct1', 'comp', 'burner', 'turb', 'ab', 'nozz', 'shaft', 'perf'])

        if statics:
            connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
            connect_flow(self, 'inlet.Fl_O', 'duct1.Fl_I')
            connect_flow(self, 'duct1.Fl_O', 'comp.Fl_I')
            connect_flow(self, 'comp.Fl_O', 'burner.Fl_I')
            connect_flow(self, 'burner.Fl_O', 'turb.Fl_I')
            connect_flow(self, 'turb.Fl_O', 'ab.Fl_I')
            connect_flow(self, 'ab.Fl_O', 'nozz.Fl_I')
        else:
            connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
            connect_flow(self, 'inlet.Fl_O', 'duct1.Fl_I', connect_stat=False)
            connect_flow(self, 'duct1.Fl_O', 'comp.Fl_I', connect_stat=False)
            connect_flow(self, 'comp.Fl_O', 'burner.Fl_I', connect_stat=False)
            connect_flow(self, 'burner.Fl_O', 'turb.Fl_I', connect_stat=False)
            connect_flow(self, 'turb.Fl_O', 'ab.Fl_I', connect_stat=False)
            connect_flow(self, 'ab.Fl_O', 'nozz.Fl_I', connect_stat=False)

        connect_flow(self, 'comp.cool1', 'turb.cool1', connect_stat=False)
        connect_flow(self, 'comp.cool2', 'turb.cool2', connect_stat=False)

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-6
        newton.options['rtol'] = 1e-6
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 15
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 100
        # newton.linesearch = BoundsEnforceLS()
        newton.linesearch = ArmijoGoldsteinLS()
        # newton.linesearch.options['c'] = .0001
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        newton.linesearch.options['iprint'] = -1

        self.linear_solver = DirectSolver(assemble_jac=True)
예제 #7
0
    def setup(self):

        thermo_spec = species_data.janaf
        design = self.options['design']
        statics = self.options['statics']

        self.add_subsystem(
            'fc', FlightConditions(thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem(
            'inlet',
            Inlet(design=design, thermo_data=thermo_spec, elements=AIR_MIX))
        self.add_subsystem(
            'duct1',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_MIX,
                 statics=statics))
        self.add_subsystem('lpc',
                           Compressor(map_data=LPCmap,
                                      design=design,
                                      thermo_data=thermo_spec,
                                      elements=AIR_MIX,
                                      statics=statics),
                           promotes_inputs=[('Nmech', 'IP_Nmech')])
        self.add_subsystem(
            'icduct',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_MIX,
                 statics=statics))
        self.add_subsystem('hpc_axi',
                           Compressor(map_data=HPCmap,
                                      design=design,
                                      thermo_data=thermo_spec,
                                      elements=AIR_MIX,
                                      statics=statics),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem(
            'bld25',
            BleedOut(design=design,
                     statics=statics,
                     bleed_names=['cool1', 'cool2']))
        self.add_subsystem('hpc_centri',
                           Compressor(map_data=HPCmap,
                                      design=design,
                                      thermo_data=thermo_spec,
                                      elements=AIR_MIX,
                                      statics=statics),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem(
            'bld3',
            BleedOut(design=design,
                     statics=statics,
                     bleed_names=['cool3', 'cool4']))
        self.add_subsystem(
            'duct6',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_MIX,
                 statics=statics))
        self.add_subsystem(
            'burner',
            Combustor(design=design,
                      thermo_data=thermo_spec,
                      inflow_elements=AIR_MIX,
                      air_fuel_elements=AIR_FUEL_MIX,
                      fuel_type='Jet-A(g)',
                      statics=statics))
        self.add_subsystem('hpt',
                           Turbine(map_data=HPTmap,
                                   design=design,
                                   thermo_data=thermo_spec,
                                   elements=AIR_FUEL_MIX,
                                   bleed_names=['cool3', 'cool4'],
                                   statics=statics),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem(
            'duct43',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_FUEL_MIX,
                 statics=statics))
        self.add_subsystem('lpt',
                           Turbine(map_data=LPTmap,
                                   design=design,
                                   thermo_data=thermo_spec,
                                   elements=AIR_FUEL_MIX,
                                   bleed_names=['cool1', 'cool2'],
                                   statics=statics),
                           promotes_inputs=[('Nmech', 'IP_Nmech')])
        self.add_subsystem(
            'itduct',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_FUEL_MIX,
                 statics=statics))
        self.add_subsystem('pt',
                           Turbine(map_data=LPTmap,
                                   design=design,
                                   thermo_data=thermo_spec,
                                   elements=AIR_FUEL_MIX,
                                   statics=statics),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])
        self.add_subsystem(
            'duct12',
            Duct(design=design,
                 thermo_data=thermo_spec,
                 elements=AIR_FUEL_MIX,
                 statics=statics))
        self.add_subsystem(
            'nozzle',
            Nozzle(nozzType='CV',
                   lossCoef='Cv',
                   thermo_data=thermo_spec,
                   elements=AIR_FUEL_MIX))

        self.add_subsystem('lp_shaft',
                           Shaft(num_ports=1),
                           promotes_inputs=[('Nmech', 'LP_Nmech')])
        self.add_subsystem('ip_shaft',
                           Shaft(num_ports=2),
                           promotes_inputs=[('Nmech', 'IP_Nmech')])
        self.add_subsystem('hp_shaft',
                           Shaft(num_ports=3),
                           promotes_inputs=[('Nmech', 'HP_Nmech')])
        self.add_subsystem('perf', Performance(num_nozzles=1, num_burners=1))

        self.connect('duct1.Fl_O:tot:P', 'perf.Pt2')
        self.connect('hpc_centri.Fl_O:tot:P', 'perf.Pt3')
        self.connect('burner.Wfuel', 'perf.Wfuel_0')
        self.connect('inlet.F_ram', 'perf.ram_drag')
        self.connect('nozzle.Fg', 'perf.Fg_0')
        self.connect('lp_shaft.pwr_in', 'perf.power')

        self.connect('pt.trq', 'lp_shaft.trq_0')
        self.connect('lpc.trq', 'ip_shaft.trq_0')
        self.connect('lpt.trq', 'ip_shaft.trq_1')
        self.connect('hpc_axi.trq', 'hp_shaft.trq_0')
        self.connect('hpc_centri.trq', 'hp_shaft.trq_1')
        self.connect('hpt.trq', 'hp_shaft.trq_2')
        self.connect('fc.Fl_O:stat:P', 'nozzle.Ps_exhaust')

        balance = self.add_subsystem('balance', BalanceComp())
        if design:

            balance.add_balance('W', units='lbm/s', eq_units=None)
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('nozzle.PR', 'balance.lhs:W')

            balance.add_balance('FAR', eq_units='degR', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('burner.Fl_O:tot:T', 'balance.lhs:FAR')

            balance.add_balance('lpt_PR',
                                val=1.5,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.lpt_PR', 'lpt.PR')
            self.connect('ip_shaft.pwr_net', 'balance.lhs:lpt_PR')

            balance.add_balance('hpt_PR',
                                val=1.5,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.hpt_PR', 'hpt.PR')
            self.connect('hp_shaft.pwr_net', 'balance.lhs:hpt_PR')

            balance.add_balance('pt_PR',
                                val=1.5,
                                lower=1.001,
                                upper=8,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.pt_PR', 'pt.PR')
            self.connect('lp_shaft.pwr_net', 'balance.lhs:pt_PR')

            # self.set_order(['fc', 'inlet', 'duct1', 'comp', 'burner', 'turb', 'ab', 'nozz', 'shaft', 'perf', 'thrust_balance', 'temp_balance', 'shaft_balance'])
            # self.set_order(['balance', 'fc', 'inlet', 'duct1', 'comp', 'burner', 'turb', 'ab', 'nozz', 'shaft', 'perf'])

        else:

            # Need to check all these balances once power turbine map is updated
            balance.add_balance('FAR', eq_units='lbf', lower=1e-4, val=.017)
            self.connect('balance.FAR', 'burner.Fl_I:FAR')
            self.connect('perf.Fn', 'balance.lhs:FAR')

            balance.add_balance('W', units='lbm/s', eq_units=None)
            self.connect('balance.W', 'inlet.Fl_I:stat:W')
            self.connect('nozzle.Throat:stat:area', 'balance.lhs:W')

            balance.add_balance('IP_Nmech',
                                val=12000.0,
                                units='rpm',
                                lower=1.001,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.IP_Nmech', 'IP_Nmech')
            self.connect('ip_shaft.pwr_net', 'balance.lhs:IP_Nmech')

            balance.add_balance('HP_Nmech',
                                val=14800.0,
                                units='rpm',
                                lower=1.001,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.HP_Nmech', 'HP_Nmech')
            self.connect('hp_shaft.pwr_net', 'balance.lhs:HP_Nmech')

            balance.add_balance('LP_Nmech',
                                val=1800.0,
                                units='rpm',
                                lower=1.001,
                                eq_units='hp',
                                rhs_val=0.)
            self.connect('balance.LP_Nmech', 'LP_Nmech')
            self.connect('lp_shaft.pwr_net', 'balance.lhs:LP_Nmech')

            # self.set_order(['balance', 'fc', 'inlet', 'fan', 'splitter', 'duct4', 'lpc', 'duct6', 'hpc', 'bld3', 'burner', 'hpt', 'duct11',
            #                 'lpt', 'duct13', 'nozzle', 'byp_bld', 'duct15', 'lp_shaft', 'ip_shaft', 'hp_shaft', 'perf'])

        if statics:
            connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
            connect_flow(self, 'inlet.Fl_O', 'duct1.Fl_I')
            connect_flow(self, 'duct1.Fl_O', 'lpc.Fl_I')
            connect_flow(self, 'lpc.Fl_O', 'icduct.Fl_I')
            connect_flow(self, 'icduct.Fl_O', 'hpc_axi.Fl_I')
            connect_flow(self, 'hpc_axi.Fl_O', 'bld25.Fl_I')
            connect_flow(self, 'bld25.Fl_O', 'hpc_centri.Fl_I')
            connect_flow(self, 'hpc_centri.Fl_O', 'bld3.Fl_I')
            connect_flow(self, 'bld3.Fl_O', 'duct6.Fl_I')
            connect_flow(self, 'duct6.Fl_O', 'burner.Fl_I')
            connect_flow(self, 'burner.Fl_O', 'hpt.Fl_I')
            connect_flow(self, 'hpt.Fl_O', 'duct43.Fl_I')
            connect_flow(self, 'duct43.Fl_O', 'lpt.Fl_I')
            connect_flow(self, 'lpt.Fl_O', 'itduct.Fl_I')
            connect_flow(self, 'itduct.Fl_O', 'pt.Fl_I')
            connect_flow(self, 'pt.Fl_O', 'duct12.Fl_I')
            connect_flow(self, 'duct12.Fl_O', 'nozzle.Fl_I')
        else:
            connect_flow(self, 'fc.Fl_O', 'inlet.Fl_I', connect_w=False)
            connect_flow(self, 'inlet.Fl_O', 'duct1.Fl_I', connect_stat=False)
            connect_flow(self, 'duct1.Fl_O', 'lpc.Fl_I', connect_stat=False)
            connect_flow(self, 'lpc.Fl_O', 'icduct.Fl_I', connect_stat=False)
            connect_flow(self,
                         'icduct.Fl_O',
                         'hpc_axi.Fl_I',
                         connect_stat=False)
            connect_flow(self,
                         'hpc_axi.Fl_O',
                         'bld25.Fl_I',
                         connect_stat=False)
            connect_flow(self,
                         'bld25.Fl_O',
                         'hpc_centri.Fl_I',
                         connect_stat=False)
            connect_flow(self,
                         'hpc_centri.Fl_O',
                         'bld3.Fl_I',
                         connect_stat=False)
            connect_flow(self, 'bld3.Fl_O', 'duct6.Fl_I', connect_stat=False)
            connect_flow(self, 'duct6.Fl_O', 'burner.Fl_I', connect_stat=False)
            connect_flow(self, 'burner.Fl_O', 'hpt.Fl_I', connect_stat=False)
            connect_flow(self, 'hpt.Fl_O', 'duct43.Fl_I', connect_stat=False)
            connect_flow(self, 'duct43.Fl_O', 'lpt.Fl_I', connect_stat=False)
            connect_flow(self, 'lpt.Fl_O', 'itduct.Fl_I', connect_stat=False)
            connect_flow(self, 'itduct.Fl_O', 'pt.Fl_I', connect_stat=False)
            connect_flow(self, 'pt.Fl_O', 'duct12.Fl_I', connect_stat=False)
            connect_flow(self,
                         'duct12.Fl_O',
                         'nozzle.Fl_I',
                         connect_stat=False)

        connect_flow(self, 'bld25.cool1', 'lpt.cool1', connect_stat=False)
        connect_flow(self, 'bld25.cool2', 'lpt.cool2', connect_stat=False)
        connect_flow(self, 'bld3.cool3', 'hpt.cool3', connect_stat=False)
        connect_flow(self, 'bld3.cool4', 'hpt.cool4', connect_stat=False)

        newton = self.nonlinear_solver = NewtonSolver()
        newton.options['atol'] = 1e-6
        newton.options['rtol'] = 1e-6
        newton.options['iprint'] = 2
        newton.options['maxiter'] = 10
        newton.options['solve_subsystems'] = True
        newton.options['max_sub_solves'] = 100
        newton.linesearch = BoundsEnforceLS()
        # newton.linesearch = ArmijoGoldsteinLS()
        # newton.linesearch.options['c'] = .0001
        newton.linesearch.options['bound_enforcement'] = 'scalar'
        newton.linesearch.options['iprint'] = -1

        self.linear_solver = DirectSolver(assemble_jac=True)