Exemple #1
0
    def test_copy_flow(self):
        a = set_as_top(Assembly())
        a.add('comp1', DummyComp())
        a.add('comp2', DummyComp())

        a.connect('comp1.Fl_O', 'comp2.Fl_I')
        a.driver.workflow.add(['comp1', 'comp2'])

        fs = FlowStation()
        fs.W = 100
        fs.setDryAir()
        fs.setTotalTP(518, 15)
        a.comp1.Fl_I = fs

        a.run()
Exemple #2
0
        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 = 1.0
            hx.Fl_I = fs
            hx.W_cold = .45
            hx.T_hot_out = hx.Fl_I.Tt
            hx.T_cold_out = hx.T_cold_in

            driver.workflow.add(['hx'])
Exemple #3
0
    def execute(self): 

        Fl_I = self.Fl_I
        Fl_O = self.Fl_O
        Fl_ref = self.Fl_ref

        fs_throat = FlowStation()
        fs_exitIdeal = FlowStation()

        fs_throat.W = Fl_I.W
        Pt_out = (1-self.dPqP)*Fl_I.Pt
        fs_throat.setTotalTP( Fl_I.Tt, Pt_out )
        fs_throat.Mach = 1.0
        self.Athroat_dmd = fs_throat.area

        fs_exitIdeal.W = Fl_I.W
        fs_exitIdeal.setTotalTP( Fl_I.Tt, Pt_out )
        fs_exitIdeal.Ps = Fl_ref.Ps

        Fl_O.W = Fl_I.W
        Fl_O.setTotalTP( Fl_I.Tt, Pt_out )
        Fl_O.Mach = fs_exitIdeal.Mach

        if self.run_design: 
            # Design Calculations at throat
            self.Athroat_des = fs_throat.area

            # Design calculations at exit
            self.Aexit_des = fs_exitIdeal.area
            self.switchRegime = "PERFECTLY_EXPANDED"
        else:
            # Find subsonic solution, curve 4
            Fl_O.sub_or_super = "sub"
            Fl_O.area = self.Aexit_des

            MachSubsonic = Fl_O.Mach

            if MachSubsonic > 1:
                print "invalid nozzle subsonic solution"
            PsSubsonic = Fl_O.Ps

            # Find supersonic solution, curve 5
            Fl_O.sub_or_super = "super"
            Fl_O.area = self.Aexit_des
            MachSupersonic = Fl_O.Mach
            PsSupersonic = Fl_O.Ps

            # normal shock at nozzle exit, curve c
            Fl_O.sub_or_super = "sub"
            Msuper = MachSupersonic
            PtExit = self.shockPR( Msuper, fs_throat.gams ) * fs_throat.Pt
            Fl_O.setTotalTP( fs_throat.Tt, PtExit )
            Fl_O.area = self.Aexit_des      
            PsShock = Fl_O.Ps

            # find correct operating regime
            # curves 1 to 4
            if Fl_ref.Ps >= PsSubsonic:
                self.switchRegime = "UNCHOKED"
                
                fs_throat.sub_or_super = "sub"
                Fl_O.sub_or_super = "sub"
                fs_throat.area = self.Athroat_des
                Fl_O.setTotalTP( fs_throat.Tt, fs_throat.Pt )
                Fl_O.area = self.Aexit_des

            # between curves 4 and c
            elif Fl_ref.Ps < PsSubsonic and Fl_ref.Ps >= PsShock:
                self.switchRegime = "NORMAL_SHOCK"
                Fl_O.sub_or_super = "sub"
                Fl_O.Ps = Fl_ref.Ps


            # between curves c and 5
            elif Fl_ref.Ps < PsShock and Fl_ref.Ps > PsSupersonic:
                self.switchRegime = "OVEREXPANDED"
                Fl_O.sub_or_super = "super"
                Fl_O.setTotalTP( fs_throat.Tt, fs_throat.Pt )
                Fl_O.area = self.Aexit_des

            # between curves 5 and e
            elif Fl_ref.Ps <= PsSupersonic:
                self.switchRegime = "UNDEREXPANDED"
                Fl_O.sub_or_super = "super"
                Fl_O.setTotalTP( fs_throat.Tt, fs_throat.Pt )
                Fl_O.area = self.Aexit_des
            if abs(Fl_ref.Ps - PsSupersonic)/Fl_ref.Ps < .001: 
                self.switchRegime = "PERFECTLY_EXPANDED"

        self.Fg = Fl_O.W*Fl_O.Vflow/32.174 + Fl_O.area*(Fl_O.Ps-Fl_ref.Ps)
        self.PR = fs_throat.Pt/Fl_O.Ps
        self.AR = Fl_O.area/fs_throat.area
        
        self.WqAexit = Fl_I.W/self.Athroat_des
        self.WqAexit_dmd = Fl_I.W/self.Athroat_dmd

        if self.switchRegime == "UNCHOKED": 
            self.WqAexit = Fl_I.W/Fl_ref.Ps
            self.WqAexit_dmd = Fl_I.W/Fl_O.Ps
Exemple #4
0
    def execute(self):

        Fl_I = self.Fl_I
        Fl_O = self.Fl_O
        Fl_ref = self.Fl_ref

        fs_throat = FlowStation()
        fs_exitIdeal = FlowStation()

        fs_throat.W = Fl_I.W
        Pt_out = (1 - self.dPqP) * Fl_I.Pt
        fs_throat.setTotalTP(Fl_I.Tt, Pt_out)
        fs_throat.Mach = 1.0
        self.Athroat_dmd = fs_throat.area

        fs_exitIdeal.W = Fl_I.W
        fs_exitIdeal.setTotalTP(Fl_I.Tt, Pt_out)
        fs_exitIdeal.Ps = Fl_ref.Ps

        Fl_O.W = Fl_I.W
        Fl_O.setTotalTP(Fl_I.Tt, Pt_out)
        Fl_O.Mach = fs_exitIdeal.Mach

        if self.run_design:
            # Design Calculations at throat
            self.Athroat_des = fs_throat.area

            # Design calculations at exit
            self.Aexit_des = fs_exitIdeal.area
            self.switchRegime = "PERFECTLY_EXPANDED"
        else:
            # Find subsonic solution, curve 4
            Fl_O.sub_or_super = "sub"
            Fl_O.area = self.Aexit_des

            MachSubsonic = Fl_O.Mach

            if MachSubsonic > 1:
                print "invalid nozzle subsonic solution"
            PsSubsonic = Fl_O.Ps

            # Find supersonic solution, curve 5
            Fl_O.sub_or_super = "super"
            Fl_O.area = self.Aexit_des
            MachSupersonic = Fl_O.Mach
            PsSupersonic = Fl_O.Ps

            # normal shock at nozzle exit, curve c
            Fl_O.sub_or_super = "sub"
            Msuper = MachSupersonic
            PtExit = self.shockPR(Msuper, fs_throat.gams) * fs_throat.Pt
            Fl_O.setTotalTP(fs_throat.Tt, PtExit)
            Fl_O.area = self.Aexit_des
            PsShock = Fl_O.Ps

            # find correct operating regime
            # curves 1 to 4
            if Fl_ref.Ps >= PsSubsonic:
                self.switchRegime = "UNCHOKED"

                fs_throat.sub_or_super = "sub"
                Fl_O.sub_or_super = "sub"
                fs_throat.area = self.Athroat_des
                Fl_O.setTotalTP(fs_throat.Tt, fs_throat.Pt)
                Fl_O.area = self.Aexit_des

            # between curves 4 and c
            elif Fl_ref.Ps < PsSubsonic and Fl_ref.Ps >= PsShock:
                self.switchRegime = "NORMAL_SHOCK"
                Fl_O.sub_or_super = "sub"
                Fl_O.Ps = Fl_ref.Ps

            # between curves c and 5
            elif Fl_ref.Ps < PsShock and Fl_ref.Ps > PsSupersonic:
                self.switchRegime = "OVEREXPANDED"
                Fl_O.sub_or_super = "super"
                Fl_O.setTotalTP(fs_throat.Tt, fs_throat.Pt)
                Fl_O.area = self.Aexit_des

            # between curves 5 and e
            elif Fl_ref.Ps <= PsSupersonic:
                self.switchRegime = "UNDEREXPANDED"
                Fl_O.sub_or_super = "super"
                Fl_O.setTotalTP(fs_throat.Tt, fs_throat.Pt)
                Fl_O.area = self.Aexit_des
            if abs(Fl_ref.Ps - PsSupersonic) / Fl_ref.Ps < .001:
                self.switchRegime = "PERFECTLY_EXPANDED"

        self.Fg = Fl_O.W * Fl_O.Vflow / 32.174 + Fl_O.area * (Fl_O.Ps -
                                                              Fl_ref.Ps)
        self.PR = fs_throat.Pt / Fl_O.Ps
        self.AR = Fl_O.area / fs_throat.area

        self.WqAexit = Fl_I.W / self.Athroat_des
        self.WqAexit_dmd = Fl_I.W / self.Athroat_dmd

        if self.switchRegime == "UNCHOKED":
            self.WqAexit = Fl_I.W / Fl_ref.Ps
            self.WqAexit_dmd = Fl_I.W / Fl_O.Ps