def test_case1_vs_inductrack(self):

        CycleGroup = cycle_group.Cycle()

        prob = create_problem(CycleGroup)

        params = (('vehicleMach', 0.8),
                  ('inlet_MN', 0.65),
                  ('P', 0.1885057735, {'units': 'psi'}),
                  ('T', 591.0961831, {'units': 'degR'}),
                  ('W', 4.53592, {'units': 'kg/s'}),
                  ('PsE', 0.59344451, {'units': 'psi'}),
                  ('cmpMach', 0.65), )

        prob.root.add('des_vars', IndepVarComp(params))
        prob.root.connect('des_vars.PsE', 'Cycle.FlowPath.nozzle.Ps_exhaust')
        prob.root.connect('des_vars.P', 'Cycle.FlowPath.fl_start.P')
        prob.root.connect('des_vars.T', 'Cycle.FlowPath.fl_start.T')
        prob.root.connect('des_vars.W', 'Cycle.FlowPath.fl_start.W')

        prob.root.connect('des_vars.vehicleMach', 'Cycle.FlowPath.fl_start.MN_target')
        prob.root.connect('des_vars.inlet_MN', 'Cycle.FlowPath.inlet.MN_target')

        prob.setup()
        prob.root.list_connections()

        # Inlet Conditions

        prob['Cycle.FlowPath.inlet.ram_recovery'] = 0.99
        if prob['des_vars.inlet_MN'] > prob['des_vars.vehicleMach']:
            prob['des_vars.inlet_MN'] = prob['des_vars.vehicleMach']

        # Compressor Conditions
        prob['Cycle.FlowPath.comp.map.PRdes'] = 6.0
        prob['Cycle.FlowPath.comp.map.effDes'] = 0.9
        prob['Cycle.FlowPath.comp.MN_target'] = 0.65

        # Duct
        prob['Cycle.FlowPath.duct.MN_target'] = 0.65
        prob['Cycle.FlowPath.duct.dPqP'] = 0.

        # Nozzle Conditions
        prob['Cycle.FlowPath.nozzle.Cfg'] = 1.0
        prob['Cycle.FlowPath.nozzle.dPqP'] = 0.

        # Shaft
        prob['Cycle.FlowPath.shaft.Nmech'] = 10000.

        prob.run()

        # Test Values
        assert np.isclose(prob['Cycle.comp_mass'], 583.259285, rtol=.01)
        assert np.isclose(prob['Cycle.comp_len'], 0.609973, rtol=.01)
        assert np.isclose(prob['Cycle.FlowPath.inlet.Fl_O:tot:h'], 11.208383, rtol=.01)
        assert np.isclose(prob['Cycle.FlowPath.comp.Fl_O:tot:h'], 116.307430, rtol=.01)
        assert np.isclose((cu(prob['Cycle.FlowPath.inlet.Fl_O:stat:area'], 'inch**2', 'm**2')), 1.794921, rtol=.01)
        assert np.isclose(prob['Cycle.FlowPath.inlet.Fl_O:tot:T'], 591.096183, rtol=.01)
示例#2
0
 def solve_nonlinear(self, params, unknowns, resids):
     self._clear_unknowns('flow_nozzle', unknowns)
     self._clear_unknowns('flow_bearings', unknowns)
     self._solve_flow_vars('flow_nozzle', params, unknowns)
     self._solve_flow_vars('flow_bearings', params, unknowns)
     # Q = mdot * cp * deltaT
     Qbearing = cu(unknowns['flow_bearings:out:W'],'lbm/s', 'kg/s') * cu(unknowns['flow_bearings:out:Cp'], 'Btu/lbm/degR', 'J/kg/K') * (cu(unknowns['flow_bearings:out:Tt'], 'degR', 'degK') - params['temp_boundary'])
     Qnozzle = cu(unknowns['flow_nozzle:out:W'], 'lbm/s', 'kg/s') * cu(unknowns['flow_nozzle:out:Cp'], 'Btu/lbm/degR', 'J/kg/K') * (cu(unknowns['flow_nozzle:out:Tt'], 'degR', 'degK') - params['temp_boundary'])
     unknowns['heat_rate_per_pod'] = Qnozzle + Qbearing
     unknowns['heat_rate_tot'] = unknowns['heat_rate_per_pod'] * params['n_pods']
     # Determine thermal resistance of outside via natural or forced convection
     # Prandtl # (Pr) = viscous diffusion rate / thermal diffusion rate = Cp * dyanamic viscosity / thermal conductivity
     # Pr << 1: thermal diffusivity dominates; Pr >> 1: momentum diffusivity dominates
     # SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
     if params['temp_ambient'] < 400.0:
         unknowns['GrDelTL3'] = 4.178e19 * params['temp_ambient'] ** -4.639
         unknowns['Pr'] = 1.23 * params['temp_ambient'] ** -0.09685
         unknowns['k'] = 0.0001423 * params['temp_ambient'] ** 0.9138
     else:
         unknowns['GrDelTL3'] = 4.985e18 * params['temp_ambient'] ** -4.284
         unknowns['Pr'] = 0.59 * params['temp_ambient'] ** 0.0239
         unknowns['k'] = 0.0002494 * params['temp_ambient'] ** 0.8152
     # Grashof # (Gr) < 10^8: laminar; Gr > 10^9: turbulent
     unknowns['Gr'] = unknowns['GrDelTL3'] * (params['temp_boundary'] - params['temp_ambient']) * (2.0 * params['r_tube_outer']) ** 3
     # Rayleigh #: buoyancy driven flow (natural convection)
     unknowns['Ra'] = unknowns['Pr'] * unknowns['Gr']
     if unknowns['Ra'] <= 1e12: # valid in specific flow regime
         # Nusselt # (Nu) = convective heat transfer / conductive heat transfer
         unknowns['Nu'] = (0.6 + 0.387 * unknowns['Ra'] ** (1.0 / 6.0) / (1.0 + (0.559 / unknowns['Pr']) ** (9.0 / 16.0)) ** (8.0 / 27.0)) ** 2 # 3rd Ed. of Introduction to Heat Transfer by Incropera and DeWitt, equations (9.33) and (9.34) on page 465
     else:
         raise Exception('Rayleigh number outside of acceptable range.')
     unknowns['h'] = unknowns['k'] * unknowns['Nu'] / (2.0 * params['r_tube_outer']) # h = k * Nu / characteristic length
     unknowns['convection_area'] = pi * params['tube_len'] * 2.0 * params['r_tube_outer']
     unknowns['Qradiated_nat_convection_per_area'] = unknowns['h'] * (params['temp_boundary'] - params['temp_ambient'])
     unknowns['Qradiated_nat_convection_tot'] = unknowns['Qradiated_nat_convection_per_area'] * unknowns['convection_area']
     unknowns['area_viewing'] = params['tube_len'] * 2.0 * params['r_tube_outer'] # sun hits an effective rectangular cross section
     unknowns['Qsolar_per_area'] = (1.0 - params['reflectance']) * params['nn_incidence_factor'] * params['insolation']
     unknowns['Qsolar_tot'] = unknowns['Qsolar_per_area'] * unknowns['area_viewing']
     unknowns['radiating_area'] = unknowns['convection_area']
     unknowns['Qradiated_per_area'] = params['sb_const'] * params['emissivity'] * (params['temp_boundary'] ** 4 - params['temp_ambient'] ** 4) # P / A = SB * emmisitivity * (T ** 4 - To ** 4)
     unknowns['Qradiated_tot'] = unknowns['radiating_area'] * unknowns['Qradiated_per_area']
     unknowns['Qout_tot'] = unknowns['Qradiated_tot'] + unknowns['Qradiated_nat_convection_per_area']
     unknowns['Qin_tot'] = unknowns['Qsolar_tot'] + unknowns['heat_rate_tot']
     unknowns['Q_resid'] = abs(unknowns['Qout_tot'] - unknowns['Qin_tot'])
示例#3
0
    def solve_nonlinear(self, p, u, r):
        R_gas_const = 286 # m**2/s**2/K
        gamma = 1.4 # air

        # http://www.engineeringtoolbox.com/dry-air-properties-d_973.html
        tb_t  = 175. ,200. , 225., 250., 275., 300., 325., 350., 375., 400., 450., 500., 550., 600., 650., 700. # temp breakpoints (K)
        tb_tc = 1.593,1.809,2.020,2.227,2.428,2.624,2.816,4.004,3.186,3.365,3.710,4.041,4.357,4.466,4.954,5.236 # Thermal Conductivity (10e-2 W/m/K)
        tb_pr = 0.744,0.736,0.728,0.720,0.713,0.707,0.701,0.697,0.692,0.688,0.684,0.680,0.680,0.680,0.682,0.684 # Prandtl Number

        u['Vsonic'] = self.a = (gamma*R_gas_const*cu(p['SLTemp'],'degF','degK'))**0.5
        u['MN'] = cu(p['Speed'],'kn','m/s')/u['Vsonic']
        t = u['FLTemp'] = p['SLTemp']-3.6*(p['alt']/1000.) # degF
        t2 = cu(t,'degF','degK')                           # degK
        #print(t,t2)

        u['AirCond'] = interp(cu(t,'degF','degK'),tb_t,tb_tc)/100.
        u['Pr'] = interp(cu(t,'degF','degK'),tb_t,tb_pr)

        u['MotHeat'] = p['MotPwr']*(1.-p['MotEff'])
示例#4
0
    def solve_nonlinear(self, p, u, r):
        R_gas_const = 286  # m**2/s**2/K
        gamma = 1.4  # air

        # http://www.engineeringtoolbox.com/dry-air-properties-d_973.html
        tb_t = 175., 200., 225., 250., 275., 300., 325., 350., 375., 400., 450., 500., 550., 600., 650., 700.  # temp breakpoints (K)
        tb_tc = 1.593, 1.809, 2.020, 2.227, 2.428, 2.624, 2.816, 4.004, 3.186, 3.365, 3.710, 4.041, 4.357, 4.466, 4.954, 5.236  # Thermal Conductivity (10e-2 W/m/K)
        tb_pr = 0.744, 0.736, 0.728, 0.720, 0.713, 0.707, 0.701, 0.697, 0.692, 0.688, 0.684, 0.680, 0.680, 0.680, 0.682, 0.684  # Prandtl Number

        u['Vsonic'] = self.a = (gamma * R_gas_const *
                                cu(p['SLTemp'], 'degF', 'degK'))**0.5
        u['MN'] = cu(p['Speed'], 'kn', 'm/s') / u['Vsonic']
        t = u['FLTemp'] = p['SLTemp'] - 3.6 * (p['alt'] / 1000.)  # degF
        t2 = cu(t, 'degF', 'degK')  # degK
        #print(t,t2)

        u['AirCond'] = interp(cu(t, 'degF', 'degK'), tb_t, tb_tc) / 100.
        u['Pr'] = interp(cu(t, 'degF', 'degK'), tb_t, tb_pr)

        u['MotHeat'] = p['MotPwr'] * (1. - p['MotEff'])
    def test_case1_vs_inductrack(self):

        CycleGroup = cycle_group.Cycle()

        prob = create_problem(CycleGroup)

        params = (('comp_PR', 12.6, {'units': 'unitless'}),
              ('PsE', 0.05588, {'units': 'psi'}),
              ('pod_mach_number', .8, {'units': 'unitless'}),
              ('tube_pressure', 850., {'units': 'Pa'}),
              ('tube_temp', 320., {'units': 'K'}),
              ('comp_inlet_area', 2.3884, {'units': 'm**2'}))

        prob.root.add('des_vars', IndepVarComp(params))

        prob.root.connect('des_vars.comp_PR', 'Cycle.comp.map.PRdes')
        prob.root.connect('des_vars.PsE', 'Cycle.nozzle.Ps_exhaust')
        prob.root.connect('des_vars.pod_mach_number', 'Cycle.pod_mach')
        prob.root.connect('des_vars.tube_pressure', 'Cycle.tube_pressure')
        prob.root.connect('des_vars.tube_temp', 'Cycle.tube_temp')
        prob.root.connect('des_vars.comp_inlet_area', 'Cycle.comp_inlet_area')

        prob.setup()
        #prob.root.list_connections()

        prob['Cycle.CompressorMass.comp_eff'] = 91.0

        prob['Cycle.CompressorLen.h_stage'] = 58.2

        prob['Cycle.FlowPathInputs.gamma'] = 1.4
        prob['Cycle.FlowPathInputs.R'] = 287.
        prob['Cycle.FlowPathInputs.eta'] = 0.99
        prob['Cycle.FlowPathInputs.comp_mach'] = 0.6

        prob.run()

        # Test Values
        assert np.isclose(prob['Cycle.comp_len'], 3.579, rtol=.01)
        assert np.isclose(prob['Cycle.comp_mass'], 774.18, rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.trq'], 'ft*lbf', 'N*m'), -2622.13, rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.power'], 'hp', 'W'), -2745896.44, rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.Fl_O:stat:area'], 'inch**2', 'm**2'), 0.314, rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fg'], 'lbf', 'N'), 6562.36, rtol=.01)
        assert np.isclose(cu(prob['Cycle.inlet.F_ram'], 'lbf', 'N'), 1855.47, rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fl_O:tot:T'], 'degR', 'K'), 767.132, rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fl_O:stat:W'], 'lbm/s', 'kg/s'), 6.467, rtol=.01)
示例#6
0
    #Define Parameters
    params = (('alt', 2300.0, {
        'units': 'ft'
    }), ('Speed', 105., {
        'units': 'kn'
    }))

    p.root.add('des_vars', IndepVarComp(params))
    p.root.connect('des_vars.alt', 'fc.calcs.alt')

    p.setup()

    p.run()

    #print following properties
    print('Pt : %f Pa' % cu(p['fc.amb.Fl_O:tot:P'], 'psi', 'Pa'))
    print('rho : %f kg/m**3' %
          cu(p['fc.amb.Fl_O:tot:rho'], 'lbm/ft**3', 'kg/m**3'))
    # --- Sutherlands Law ---
    mustar = 0.00001716 * (cu(p['fc.amb.Fl_O:stat:T'], 'degR', 'degK') /
                           273.15)**1.5 * (273.15 + 110.4) / (
                               cu(p['fc.amb.Fl_O:stat:T'], 'degR', 'degK') +
                               110.4)
    print('Air Visc : %f Pa*s' % cu(mustar, 'kg/m/s', 'Pa*s'))
    print('Air Cond : %f' % p['fc.calcs.AirCond'])
    print('Pr : %f' % p['fc.calcs.Pr'])
    print('Cp : %f' %
          cu(p['fc.amb.Fl_O:stat:Cp'], 'Btu/(lbm*degR)', 'J/(kg*K)'))

    p['des_vars.alt'] = 0
    p['des_vars.Speed'] = 0
示例#7
0
    def solve_nonlinear(self, p, u, r):
        """Calculate Various Paramters"""

        u['diameter_outer_tube'] = 2*sqrt(p['tube_area']/pi) + p['tube_thickness']

        # u['bearing_q'] = cu(p['bearing_air_W'], 'lbm/s', 'kg/s') * cu(
        #     p['bearing_air_Cp'], 'Btu/(lbm*degR)', 'J/(kg*K)') * (
        #         cu(p['bearing_air_Tt'], 'degR', 'degK') - p['temp_boundary'])
        u['nozzle_q'] = cu(p['nozzle_air_W'], 'lbm/s', 'kg/s') * cu(
            p['nozzle_air_Cp'], 'Btu/(lbm*degR)', 'J/(kg*K)') * (
                cu(p['nozzle_air_Tt'], 'degR', 'degK') - p['temp_boundary'])
        #Q = mdot * cp * deltaT
        u['heat_rate_pod'] = u['nozzle_q'] #+ u['bearing_q']
        #Total Q = Q * (number of pods)
        u['total_heat_rate_pods'] = u['heat_rate_pod'] * p['num_pods']

        #Determine thermal resistance of outside via Natural Convection or forced convection
        if (p['temp_outside_ambient'] < 400):
            u['GrDelTL3'] = 41780000000000000000 * (
                (p['temp_outside_ambient'])**(-4.639)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['GrDelTL3'] = 4985000000000000000 * (
                (p['temp_outside_ambient'])**(-4.284)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)

        #Prandtl Number
        #Pr = viscous diffusion rate/ thermal diffusion rate = Cp * dyanamic viscosity / thermal conductivity
        #Pr << 1 means thermal diffusivity dominates
        #Pr >> 1 means momentum diffusivity dominates
        if (p['temp_outside_ambient'] < 400):
            u['Pr'] = 1.23 * (
                p['temp_outside_ambient']**(-0.09685)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['Pr'] = 0.59 * (p['temp_outside_ambient']**(0.0239))
        #Grashof Number
        #Relationship between buoyancy and viscosity
        #Laminar = Gr < 10^8
        #Turbulent = Gr > 10^9
        u['Gr'] = u['GrDelTL3'] * abs(p['temp_boundary'] - p[
            'temp_outside_ambient']) * (
                u['diameter_outer_tube']**3
            )  #JSG: Added abs incase subtraction goes negative
        #Rayleigh Number
        #Buoyancy driven flow (natural convection)
        u['Ra'] = u['Pr'] * u['Gr']
        #Nusselt Number
        #Nu = convecive heat transfer / conductive heat transfer
        if (u['Ra'] <= 10**12):  #valid in specific flow regime
            u['Nu'] = p['Nu_multiplier'] * (
                (0.6 + 0.387 * u['Ra']**(1. / 6.) /
                 (1 + (0.559 / u['Pr'])**(9. / 16.))**(8. / 27.))**2
            )  #3rd Ed. of Introduction to Heat Transfer by Incropera and DeWitt, equations (9.33) and (9.34) on page 465
        if (p['temp_outside_ambient'] < 400):
            u['k'] = 0.0001423 * (
                p['temp_outside_ambient']**(0.9138)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['k'] = 0.0002494 * (p['temp_outside_ambient']**(0.8152))
        #h = k*Nu/Characteristic Length
        u['h'] = (u['k'] * u['Nu']) / u['diameter_outer_tube']
        #Convection Area = Surface Area
        u['area_convection'] = pi * p['length_tube'] * u['diameter_outer_tube']
        #Determine heat radiated per square meter (Q)
        u['q_per_area_nat_conv'] = u['h'] * (
            p['temp_boundary'] - p['temp_outside_ambient'])
        #Determine total heat radiated over entire tube (Qtotal)
        u['total_q_nat_conv'] = u['q_per_area_nat_conv'] * u['area_convection']
        #Determine heat incoming via Sun radiation (Incidence Flux)
        #Sun hits an effective rectangular cross section
        u['area_viewing'] = p['length_tube'] * u['diameter_outer_tube']
        u['q_per_area_solar'] = (
            1 - p['surface_reflectance']
        ) * p['nn_incidence_factor'] * p['solar_insolation']
        u['q_total_solar'] = u['q_per_area_solar'] * u['area_viewing']
        #Determine heat released via radiation
        #Radiative area = surface area
        u['area_rad'] = u['area_convection']
        #P/A = SB*emmisitivity*(T^4 - To^4)
        u['q_rad_per_area'] = p['sb_constant'] * p['emissivity_tube'] * (
            (p['temp_boundary']**4) - (p['temp_outside_ambient']**4))
        #P = A * (P/A)
        u['q_rad_tot'] = u['area_rad'] * u['q_rad_per_area']
        #------------
        #Sum Up
        u['q_total_out'] = u['q_rad_tot'] + u['total_q_nat_conv']
        u['q_total_in'] = u['q_total_solar'] + u['total_heat_rate_pods']

        u['ss_temp_residual'] = (u['q_total_out'] - u['q_total_in']) / 1e6
示例#8
0
    root.ln_solver = ScipyGMRES()
    root.nl_solver = Newton()
    #p.root.set_order(['bal', 'comp'])
    p.root.nl_solver.options['iprint'] = 1
    p.root.nl_solver.options['maxiter'] = 10
    p.setup()
    #p.root.list_connections()

    # average effective blackbody temperature of the sky,
    # use between -34C to 10C (Section 4.5.2)
    p['comp.skyTemp'] = 273 - 34

    p.run()
    print('Results:  Sky Temp |    Plate Temp  ')
    print('            -34C   |  %3.1f degC  %3.1f degF ' %
          (cu(p['comp.plateTemp'], 'degK',
              'degC'), cu(p['comp.plateTemp'], 'degK', 'degF')))

    p['comp.skyTemp'] = 273 + 10
    p.run()
    print('             10C   |  %3.1f degC  %3.1f degF ' %
          (cu(p['comp.plateTemp'], 'degK',
              'degC'), cu(p['comp.plateTemp'], 'degK', 'degF')))

    p['comp.skyTemp'] = 273 + 10
    p['comp.absorb'] = 0.2
    p.run()
    print('')
    print('absorb=0.2,  10C   |  %3.1f degC  %3.1f degF ' %
          (cu(p['comp.plateTemp'], 'degK',
              'degC'), cu(p['comp.plateTemp'], 'degK', 'degF')))
示例#9
0
    p.driver.options['optimizer'] = 'COBYLA'

    g.add('temp_boundary', ParamComp('T', 340.0))
    g.add('tube_wall', TubeWallTemp())
    g.connect('temp_boundary.T', 'tube_wall.temp_boundary')
    g.add('con', ConstraintComp('temp_boundary > 305.7', out='out'))
    g.connect('temp_boundary.T', 'con.temp_boundary')
    
    p.driver.add_param('temp_boundary.T', low=0.0, high=10000.0)
    p.driver.add_objective('tube_wall.Q_resid')
    p.driver.add_constraint('con.out')

    p.setup()

    g.tube_wall.params['flow_nozzle:in:Tt'] = 1710.0
    g.tube_wall.params['flow_nozzle:in:Pt'] = 0.304434211
    g.tube_wall.params['flow_nozzle:in:W'] = 1.08
    g.tube_wall.params['flow_bearings:in:W'] = 0.0
    g.tube_wall.params['r_tube_outer'] = 2.22504 / 2.0
    g.tube_wall.params['tube_len'] = 482803.0
    g.tube_wall.params['n_pods'] = 34
    g.tube_wall.params['temp_ambient'] = 305.6

    p.run()

    print '\nCompleted tube heat flux model calculations...\n'
    print 'Compress Q:             %g\nSolar Q:                %g\nRadiation Q:            %g\nConvection Q:           %g' % (g.tube_wall.unknowns['heat_rate_tot'], g.tube_wall.unknowns['Qsolar_tot'], g.tube_wall.unknowns['Qradiated_tot'], g.tube_wall.unknowns['Qradiated_nat_convection_tot'])
    print 'Equilibrium wall temp.: %g K or %g F' % (g.unknowns['temp_boundary.T'], cu(g.unknowns['temp_boundary.T'], 'degK', 'degF'))
    print 'Ambient temp.:          %g K or %g F' % (g.tube_wall.params['temp_ambient'], cu(g.tube_wall.params['temp_ambient'], 'degK', 'degF'))
    print 'Q out:                  %g W\nQ in:                   %g W\nError:                  %3.9f%%\n' % (g.tube_wall.unknowns['Qout_tot'], g.tube_wall.unknowns['Qin_tot'], (g.tube_wall.unknowns['Qout_tot'] - g.tube_wall.unknowns['Qin_tot']) / g.tube_wall.unknowns['Qout_tot'] * 100.0)
示例#10
0
        self.add_output('pod_V', 0.0, desc='final velocity after acceleration', units='m/s')

    def solve_nonlinear(self, params, unknowns, resids):
        unknowns['pod_a'] = params['A'] * math.log(params['pod_mass']) + params['B']
        unknowns['t'] = math.sqrt(2 * params['displacement'] / unknowns['pod_a'])
        unknowns['pod_V'] = unknowns['pod_a'] * unknowns['t']


if __name__ == "__main__":
    from openmdao.core.problem import Problem
    from openmdao.core.group import Group
    from openmdao.units.units import convert_units as cu

    p = Problem(root=Group())
    p.root.add('pusher', Pusher())

    p.setup(check=False)

    print ''
    p['pusher.pod_mass'] = float(raw_input('Pod mass with payload (kg): '))

    p.run()

    print ''
    print 'Acceleration:', p['pusher.pod_a'], 'm/s**2'
    print 'Time:', p['pusher.t'], 's'
    print 'Final velocity:', p['pusher.pod_V'], 'm/s'
    print '               ', cu(p['pusher.pod_V'], 'm/s', 'ft/s'), 'ft/s'
    print '               ', cu(p['pusher.pod_V'], 'm/s', 'mi/h'), 'mi/h'
    print '           Mach', p['pusher.pod_V'] / 343.3 # assumes 343.3 to be speed of sound in tube env
示例#11
0
    # Compressor Conditions
    prob['Cycle.FlowPath.comp.map.PRdes'] = 6.0
    prob['Cycle.FlowPath.comp.map.effDes'] = 0.9
    prob['Cycle.FlowPath.comp.MN_target'] = 0.65

    # Duct
    prob['Cycle.FlowPath.duct.MN_target'] = 0.65
    prob['Cycle.FlowPath.duct.dPqP'] = 0.

    # Nozzle Conditions
    prob['Cycle.FlowPath.nozzle.Cfg'] = 1.0
    prob['Cycle.FlowPath.nozzle.dPqP'] = 0.

    # Shaft
    prob['Cycle.FlowPath.shaft.Nmech'] = 10000.

    #prob.print_all_convergence()
    import time
    t = time.time()

    prob.run()

    print('Comp_Mass %f' % prob['Cycle.comp_mass'])
    print('Comp_len %f' % prob['Cycle.comp_len'])
    print('H_int %f' % prob['Cycle.FlowPath.inlet.Fl_O:tot:h'])
    print('H_out %f' % prob['Cycle.FlowPath.comp.Fl_O:tot:h'])
    print("Compressor Area:       %.6f m^2" %
          (cu(prob['Cycle.inlet.Fl_O:stat:area'], 'inch**2', 'm**2')))
    print("Compressor Tt:         %.6f degR" %
          (prob['Cycle.inlet.Fl_O:tot:T']))
示例#12
0
    def solve_nonlinear(self, p, u, r):
        """Calculate Various Paramters"""

        u['diameter_outer_tube'] = 2*sqrt(p['tube_area']/pi) + p['tube_thickness']

        # u['bearing_q'] = cu(p['bearing_air_W'], 'lbm/s', 'kg/s') * cu(
        #     p['bearing_air_Cp'], 'Btu/(lbm*degR)', 'J/(kg*K)') * (
        #         cu(p['bearing_air_Tt'], 'degR', 'degK') - p['temp_boundary'])
        u['nozzle_q'] = cu(p['nozzle_air_W'], 'lbm/s', 'kg/s') * cu(
            p['nozzle_air_Cp'], 'Btu/(lbm*degR)', 'J/(kg*K)') * (
                cu(p['nozzle_air_Tt'], 'degR', 'degK') - p['temp_boundary'])
        #Q = mdot * cp * deltaT
        u['heat_rate_pod'] = u['nozzle_q'] #+ u['bearing_q']
        #Total Q = Q * (number of pods)
        u['total_heat_rate_pods'] = u['heat_rate_pod'] * p['num_pods']

        #Determine thermal resistance of outside via Natural Convection or forced convection
        if (p['temp_outside_ambient'] < 400):
            u['GrDelTL3'] = 41780000000000000000 * (
                (p['temp_outside_ambient'])**(-4.639)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['GrDelTL3'] = 4985000000000000000 * (
                (p['temp_outside_ambient'])**(-4.284)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)

        #Prandtl Number
        #Pr = viscous diffusion rate/ thermal diffusion rate = Cp * dyanamic viscosity / thermal conductivity
        #Pr << 1 means thermal diffusivity dominates
        #Pr >> 1 means momentum diffusivity dominates
        if (p['temp_outside_ambient'] < 400):
            u['Pr'] = 1.23 * (
                p['temp_outside_ambient']**(-0.09685)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['Pr'] = 0.59 * (p['temp_outside_ambient']**(0.0239))
        #Grashof Number
        #Relationship between buoyancy and viscosity
        #Laminar = Gr < 10^8
        #Turbulent = Gr > 10^9
        u['Gr'] = u['GrDelTL3'] * abs(p['temp_boundary'] - p[
            'temp_outside_ambient']) * (
                u['diameter_outer_tube']**3
            )  #JSG: Added abs incase subtraction goes negative
        #Rayleigh Number
        #Buoyancy driven flow (natural convection)
        u['Ra'] = u['Pr'] * u['Gr']
        #Nusselt Number
        #Nu = convecive heat transfer / conductive heat transfer
        if (u['Ra'] <= 10**12):  #valid in specific flow regime
            u['Nu'] = p['Nu_multiplier'] * (
                (0.6 + 0.387 * u['Ra']**(1. / 6.) /
                 (1 + (0.559 / u['Pr'])**(9. / 16.))**(8. / 27.))**2
            )  #3rd Ed. of Introduction to Heat Transfer by Incropera and DeWitt, equations (9.33) and (9.34) on page 465
        if (p['temp_outside_ambient'] < 400):
            u['k'] = 0.0001423 * (
                p['temp_outside_ambient']**(0.9138)
            )  #SI units (https://mdao.grc.nasa.gov/publications/Berton-Thesis.pdf pg51)
        else:
            u['k'] = 0.0002494 * (p['temp_outside_ambient']**(0.8152))
        #h = k*Nu/Characteristic Length
        u['h'] = (u['k'] * u['Nu']) / u['diameter_outer_tube']
        #Convection Area = Surface Area
        u['area_convection'] = pi * p['length_tube'] * u['diameter_outer_tube']
        #Determine heat radiated per square meter (Q)
        u['q_per_area_nat_conv'] = u['h'] * (
            p['temp_boundary'] - p['temp_outside_ambient'])
        #Determine total heat radiated over entire tube (Qtotal)
        u['total_q_nat_conv'] = u['q_per_area_nat_conv'] * u['area_convection']
        #Determine heat incoming via Sun radiation (Incidence Flux)
        #Sun hits an effective rectangular cross section
        u['area_viewing'] = p['length_tube'] * u['diameter_outer_tube']
        u['q_per_area_solar'] = (
            1 - p['surface_reflectance']
        ) * p['nn_incidence_factor'] * p['solar_insolation']
        u['q_total_solar'] = u['q_per_area_solar'] * u['area_viewing']
        #Determine heat released via radiation
        #Radiative area = surface area
        u['area_rad'] = u['area_convection']
        #P/A = SB*emmisitivity*(T^4 - To^4)
        u['q_rad_per_area'] = p['sb_constant'] * p['emissivity_tube'] * (
            (p['temp_boundary']**4) - (p['temp_outside_ambient']**4))
        #P = A * (P/A)
        u['q_rad_tot'] = u['area_rad'] * u['q_rad_per_area']
        #------------
        #Sum Up
        u['q_total_out'] = u['q_rad_tot'] + u['total_q_nat_conv']
        u['q_total_in'] = u['q_total_solar'] + u['total_heat_rate_pods']

        u['ss_temp_residual'] = (u['q_total_out'] - u['q_total_in']) / 1e6
示例#13
0
if __name__ == "__main__":
    print 'Setting up...'

    # Set up OpenMDAO problem `p` with pod traveling at Mach 0.2
    p = HyperloopSim.p_factory(pod_MN=0.35,
                               inlet_area=0.4735,
                               cross_section=0.8538)
    # Change some problem parameters

    p['percent_into_bypass'] = 1.0 - p['inlet_area'] / p['tube_area']

    print 'Setup complete.'
    print ''
    print 'Ambient tube pressure:', ' ' * 17, p['tube_P'], 'Pa'
    print 'Ambient tube temperature:', ' ' * 14, cu(p['tube_T'], 'degK',
                                                    'degC'), 'degC'
    print 'Maximum pod cross-section:', ' ' * 13, p['cross_section'], 'm**2'
    print 'Inlet area:', ' ' * 28, p['inlet_area'], 'm**2'
    print 'Comp 1 PR:', ' ' * 29, p['compression_system.comp1.PR_design']
    print 'Comp 2 PR:', ' ' * 29, p['compression_system.comp2.PR_design']
    print ''
    print 'WARNING: Temp values for compressors are wrong. With temp, proceed with caution.'
    print 'Optimizing...'

    # Run problem
    p.run()

    # Display some results
    print ''
    print 'Velocity:', cu(p['start.Fl_O:stat:V'], 'ft/s', 'm/s'), 'm/s'
    print 'Tube area:', ' ' * 29, p['tube_area'], 'm**2'
示例#14
0
    prob.root.connect('des_vars.comp_inlet_area', 'Cycle.comp_inlet_area')

    prob.setup()
    # prob.root.list_connections()
    #print(prob.root.Cycle.list_order())
    #from openmdao.api import view_tree
    #view_tree(prob)
    #exit()

    prob.run()

    print('Pt               %f' % prob['Cycle.FlowPathInputs.Pt'])
    print('Tt               %f' % prob['Cycle.FlowPathInputs.Tt'])
    print('m_dot            %f' % prob['Cycle.FlowPathInputs.m_dot'])

    print('H in             %f' % prob['Cycle.FlowPath.inlet.Fl_O:tot:h'])
    print('H out            %f' % prob['Cycle.FlowPath.comp.Fl_O:tot:h'])

    print('Comp_len         %f m' % prob['Cycle.comp_len'])
    print('Comp_Mass        %f kg' % prob['Cycle.comp_mass'])

    print('Torque           %f N*m' % (cu(prob['Cycle.comp.trq'], 'ft*lbf', 'N*m')))
    print('Power            %f W' % (cu(prob['Cycle.comp.power'], 'hp', 'W')))

    print('A_duct           %f m**2' % (cu(prob['Cycle.comp.Fl_O:stat:area'], 'inch**2', 'm**2')))
    print('nozzle.Fg        %f N' % (cu(prob['Cycle.nozzle.Fg'], 'lbf', 'N')))
    print('inlet.F_ram      %f N' % (cu(prob['Cycle.inlet.F_ram'], 'lbf', 'N')))

    print('Nozzle exit temp %f K' % (cu(prob['Cycle.nozzle.Fl_O:tot:T'], 'degR', 'K')))
    print('Nozzle exit MFR  %f kg/s' % (cu(prob['Cycle.nozzle.Fl_O:stat:W'], 'lbm/s', 'kg/s')))
示例#15
0
        unknowns['pod_a'] = params['A'] * math.log(
            params['pod_mass']) + params['B']
        unknowns['t'] = math.sqrt(2 * params['displacement'] /
                                  unknowns['pod_a'])
        unknowns['pod_V'] = unknowns['pod_a'] * unknowns['t']


if __name__ == "__main__":
    from openmdao.core.problem import Problem
    from openmdao.core.group import Group
    from openmdao.units.units import convert_units as cu

    p = Problem(root=Group())
    p.root.add('pusher', Pusher())

    p.setup(check=False)

    print ''
    p['pusher.pod_mass'] = float(raw_input('Pod mass with payload (kg): '))

    p.run()

    print ''
    print 'Acceleration:', p['pusher.pod_a'], 'm/s**2'
    print 'Time:', p['pusher.t'], 's'
    print 'Final velocity:', p['pusher.pod_V'], 'm/s'
    print '               ', cu(p['pusher.pod_V'], 'm/s', 'ft/s'), 'ft/s'
    print '               ', cu(p['pusher.pod_V'], 'm/s', 'mi/h'), 'mi/h'
    print '           Mach', p[
        'pusher.pod_V'] / 343.3  # assumes 343.3 to be speed of sound in tube env
示例#16
0
    #root.connect('bal.plateTemp','comp.plateTemp')
    root.ln_solver = ScipyGMRES()
    root.nl_solver = Newton()
    #p.root.set_order(['bal', 'comp'])
    p.root.nl_solver.options['iprint'] = 1
    p.root.nl_solver.options['maxiter'] = 10
    p.setup()
    #p.root.list_connections()

    # average effective blackbody temperature of the sky,
    # use between -34C to 10C (Section 4.5.2)
    p['comp.skyTemp'] = 273-34

    p.run()
    print('Results:  Sky Temp |    Plate Temp  ')
    print('            -34C   |  %3.1f degC  %3.1f degF ' % (cu(p['comp.plateTemp'],'degK','degC'), cu(p['comp.plateTemp'],'degK','degF')))

    p['comp.skyTemp'] = 273+10
    p.run()
    print('             10C   |  %3.1f degC  %3.1f degF ' % (cu(p['comp.plateTemp'],'degK','degC'), cu(p['comp.plateTemp'],'degK','degF')))

# NASA TM 2008 215633 Table 4-8
#              |  Design High Solar Radiation |
#   Time of Day|   BTU/ft^2/hr  |    W/m^2    |
#         0500 |             0  |           0 |
#         1100 |           363  |        1145 |
#         1400 |           363  |        1145 |
#         2000 |             0  |           0 |

#              |  Design Low Solar Radiation |
#   Time of Day|   BTU/ft^2/hr  |    W/m^2    |
示例#17
0
文件: heatSink2.py 项目: jcchin/cept
    def solve_nonlinear(self, p, u, r):

        flag = p['flag']
        pwr = p['InvPwr']*(1.-p['Inv_eff'])
        Abase = p['sink_w']*p['sink_l']
        gam_e = p['gamm_eff']
        u['R_max'] = (p['T_max'] - p['T_air'])/ pwr
        #u['min_area'] = pwr/(p['h_0']*(p['T_max']-p['T_air']))

        #choose fin height Arthur Method:
        H = u['fin_h'] = 0.5*u['min_area']/(u['n_fins']*p['sink_l'])
        if flag ==1: # force to test case fin height value
            H = 0.0141
        if flag ==2: # let user specify fin height
            H = p['fin_h2']

        Pr = u['Pr'] = (p['mu']*p['Cp'])/p['k_air']
        if flag:
            Pr = u['Pr'] = 0.708 #force to test case value

        u['Nu'] = 2.656*gam_e*Pr**(1./3.) #non-ducted
        ducted = True
        if ducted:
            u['Nu'] = 8.235 # http://www.dtic.mil/dtic/tr/fulltext/u2/a344846.pdf
        u['alpha'] = sqrt(p['k_fin']/(p['k_air']*u['Nu']))

        V = u['V_in']  = cu(p['cfm']/cu((p['sink_w']*H-(H*u['n_fins']*u['fin_w'])),'m**2','ft**2'),'ft/min','m/s')
        print('V',V)

        b = u['fin_gap'] = 2.*gam_e*sqrt((p['nu']*p['sink_l'])/V)
        lam = u['lambda'] = H/(u['fin_gap']*u['alpha'])
        u['omega'] = H / (p['k_fin'] * Abase)


        Dh = u['Dh'] = 2.*b
        mu = p['mu']
        l = p['sink_l']
        Re = u['Re'] = (p['rho']*V*b*b)/(mu*l)
        u['Lstar'] = l/(Dh*Re*Pr)

        u['R_lossless'] = u['omega']*lam**-2.
        u['zeta_global'] = 2.*lam + 1.
        u['R_global'] = u['zeta_global'] * u['R_lossless']

        u['zeta_thin'] = sqrt(lam)*(lam+1.)/tanh(sqrt(lam))
        u['R_thin'] = u['zeta_thin'] * u['R_lossless']

        u['fin_w'] = H/u['alpha'] # actual ideal will be a bit smaller, accurate with small lambda
        u['n_fins'] = p['sink_w']/(u['fin_w']+u['fin_gap'])

        u['R_case'] = p['case_thickness']/(p['k_case']*Abase)

        u['R_grease'] = p['grease_thickness']/(p['k_grease']*Abase)

        if lam >=1:
            u['R_tot'] = u['R_case'] + u['R_grease'] + u['R_global']
        else:
            u['R_tot'] = u['R_case'] + u['R_grease'] + u['R_thin']

        #pressure drop calcs
        s = u['sigma'] = 1.- (u['n_fins']*u['fin_w'])/p['sink_w']
        u['Ke'] = (1.-s**2.)**2.
        u['Kc'] = 0.42 * (1-s**2)
        Lstar2 = (l/Dh)/Re
        lamb = u['lambda'] = b/H
        u['f'] = (24.-32.527*lamb + 46.721*lamb**2. - 40.829*lamb**3. + 22.954*lamb**4 - 6.089*lamb**5 ) / Re
        u['f_app'] = sqrt(((3.44/sqrt(Lstar2))**2. + (u['f']*Re)**2.))/Re
        rho = p['rho']
        u['dP'] = ((u['Kc']+4.*u['f_app']*(l/Dh)+u['Ke'])*rho*(V**2.)/2.)

        u['h'] = u['Nu']*p['k_air']/Dh
示例#18
0
    t = time.time()
    prob.run()
    print time.time() - t
    #inputs = ['balance.Pt', 'balance.Tt', 'balance.W', 'balance.BPR']
    #prob.check_total_derivatives()

    #Atube = prob['inlet.Fl_O:stat:area']/(3.28084**2.)/(144.)
    #AtubeC = prob['splitter.Fl_O1:stat:area']/(3.28084**2.)/(144.)
    #AtubeB = prob['splitter.Fl_O2:stat:area']/(3.28084**2.)/(144.)
    batteries = (
        -prob['cycle.comp.power'] * HPtoKW *
        (tubeLen /
         (prob['cycle.fl_start.Fl_O:stat:V'] * 0.3048) / 3600.0)) / teslaPack

    astar = np.sqrt(prob['cycle.fl_start.Fl_O:stat:gamma'] * R_UNIVERSAL_SI *
                    (cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK')))
    ustar = astar * prob['cycle.fl_start.Fl_O:stat:MN']
    dstar = prob['cycle.fl_start.Fl_O:stat:gamma'] * cu(
        prob['cycle.fl_start.Fl_O:stat:P'], 'psi', 'Pa') / astar**2
    mustar = 0.00001716 * (
        cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK') /
        273.15)**1.5 * (273.15 + 110.4) / (
            cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK') + 110.4
        )  # --- Sutherlands Law
    #Re = dstar*ustar/mustar*Lstar_Lref
    print mustar

    print ""
    print "--- Output ----------------------"

    print "--- Freestream Static Conditions ---"
示例#19
0
    # Shaft
    prob['cycle.shaft.Nmech'] = 10000.

    #prob.print_all_convergence()
if __name__ == "__main__":
    import time
    t = time.time()
    prob.run()
    #print (time.time() - t)
    #inputs = ['balance.Pt', 'balance.Tt', 'balance.W', 'balance.BPR']
    #prob.check_total_derivatives()

    batteries = (-prob['cycle.comp.power']*HPtoKW*(tubeLen/(prob['cycle.fl_start.Fl_O:stat:V']*0.3048)/3600.0))/teslaPack;

    astar = np.sqrt(prob['cycle.fl_start.Fl_O:stat:gamma']*R_UNIVERSAL_SI*(cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK')))
    ustar = astar*prob['cycle.fl_start.Fl_O:stat:MN']
    dstar = prob['cycle.fl_start.Fl_O:stat:gamma']*cu(prob['cycle.fl_start.Fl_O:stat:P'],'psi','Pa')/astar**2
    mustar = 0.00001716*(cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK')/273.15)**1.5*(273.15+110.4)/(cu(prob['cycle.fl_start.Fl_O:stat:T'], 'degR', 'degK')+110.4) # --- Sutherlands Law
    #Re = dstar*ustar/mustar*Lstar_Lref
    #print (mustar)

    print ("")
    print ("--- Output ----------------------")

    print ("--- Freestream Static Conditions ---")
    print ("Pod Mach No.:  %.6f " % (prob['cycle.fl_start.Fl_O:stat:MN']))
    print ("Ambient Ps:    %.6f psi" % (prob['cycle.fl_start.Fl_O:stat:P']))
    print ("Ambient Ts:    %.6f R" % (prob['cycle.fl_start.Fl_O:stat:T']))
    print ("Ambient Pt:    %.6f psi" % (prob['cycle.fl_start.Fl_O:tot:P']))
    print ("Ambient Tt:    %.6f R" % (prob['cycle.fl_start.Fl_O:tot:T']))
示例#20
0
    def solve_nonlinear(self, p, u, r):

        flag = p['flag']
        pwr = p['InvPwr'] * (1. - p['Inv_eff'])
        Abase = p['sink_w'] * p['sink_l']
        gam_e = p['gamm_eff']
        u['R_max'] = (p['T_max'] - p['T_air']) / pwr
        #u['min_area'] = pwr/(p['h_0']*(p['T_max']-p['T_air']))

        #choose fin height Arthur Method:
        H = u['fin_h'] = 0.5 * u['min_area'] / (u['n_fins'] * p['sink_l'])
        if flag == 1:  # force to test case fin height value
            H = 0.0141
        if flag == 2:  # let user specify fin height
            H = p['fin_h2']

        Pr = u['Pr'] = (p['mu'] * p['Cp']) / p['k_air']
        if flag:
            Pr = u['Pr'] = 0.708  #force to test case value

        u['Nu'] = 2.656 * gam_e * Pr**(1. / 3.)  #non-ducted
        ducted = True
        if ducted:
            u['Nu'] = 8.235  # http://www.dtic.mil/dtic/tr/fulltext/u2/a344846.pdf
        u['alpha'] = sqrt(p['k_fin'] / (p['k_air'] * u['Nu']))

        V = u['V_in'] = cu(
            p['cfm'] / cu((p['sink_w'] * H -
                           (H * u['n_fins'] * u['fin_w'])), 'm**2', 'ft**2'),
            'ft/min', 'm/s')
        print('V', V)

        b = u['fin_gap'] = 2. * gam_e * sqrt((p['nu'] * p['sink_l']) / V)
        lam = u['lambda'] = H / (u['fin_gap'] * u['alpha'])
        u['omega'] = H / (p['k_fin'] * Abase)

        Dh = u['Dh'] = 2. * b
        mu = p['mu']
        l = p['sink_l']
        Re = u['Re'] = (p['rho'] * V * b * b) / (mu * l)
        u['Lstar'] = l / (Dh * Re * Pr)

        u['R_lossless'] = u['omega'] * lam**-2.
        u['zeta_global'] = 2. * lam + 1.
        u['R_global'] = u['zeta_global'] * u['R_lossless']

        u['zeta_thin'] = sqrt(lam) * (lam + 1.) / tanh(sqrt(lam))
        u['R_thin'] = u['zeta_thin'] * u['R_lossless']

        u['fin_w'] = H / u[
            'alpha']  # actual ideal will be a bit smaller, accurate with small lambda
        u['n_fins'] = p['sink_w'] / (u['fin_w'] + u['fin_gap'])

        u['R_case'] = p['case_thickness'] / (p['k_case'] * Abase)

        u['R_grease'] = p['grease_thickness'] / (p['k_grease'] * Abase)

        if lam >= 1:
            u['R_tot'] = u['R_case'] + u['R_grease'] + u['R_global']
        else:
            u['R_tot'] = u['R_case'] + u['R_grease'] + u['R_thin']

        #pressure drop calcs
        s = u['sigma'] = 1. - (u['n_fins'] * u['fin_w']) / p['sink_w']
        u['Ke'] = (1. - s**2.)**2.
        u['Kc'] = 0.42 * (1 - s**2)
        Lstar2 = (l / Dh) / Re
        lamb = u['lambda'] = b / H
        u['f'] = (24. - 32.527 * lamb + 46.721 * lamb**2. - 40.829 * lamb**3. +
                  22.954 * lamb**4 - 6.089 * lamb**5) / Re
        u['f_app'] = sqrt(((3.44 / sqrt(Lstar2))**2. + (u['f'] * Re)**2.)) / Re
        rho = p['rho']
        u['dP'] = ((u['Kc'] + 4. * u['f_app'] * (l / Dh) + u['Ke']) * rho *
                   (V**2.) / 2.)

        u['h'] = u['Nu'] * p['k_air'] / Dh
示例#21
0
    p.root.add('fc', FC_Group())

    #Define Parameters
    params = (
        ('alt', 2300.0, {'units' : 'ft'}),
        ('Speed', 105., {'units' : 'kn'})
    )

    p.root.add('des_vars', IndepVarComp(params))
    p.root.connect('des_vars.alt','fc.calcs.alt')

    p.setup()

    p.run()

    #print following properties
    print ('Pt : %f Pa' % cu(p['fc.amb.Fl_O:tot:P'],'psi','Pa'))
    print ('rho : %f kg/m**3' % cu(p['fc.amb.Fl_O:tot:rho'],'lbm/ft**3','kg/m**3'))
     # --- Sutherlands Law ---
    mustar = 0.00001716*(cu(p['fc.amb.Fl_O:stat:T'], 'degR', 'degK')/273.15)**1.5*(273.15+110.4)/(cu(p['fc.amb.Fl_O:stat:T'], 'degR', 'degK')+110.4)
    print ('Air Visc : %f Pa*s' % cu(mustar,'kg/m/s','Pa*s'))
    print ('Air Cond : %f' % p['fc.calcs.AirCond'])
    print ('Pr : %f' % p['fc.calcs.Pr'])
    print ('Cp : %f' % cu(p['fc.amb.Fl_O:stat:Cp'],'Btu/(lbm*degR)','J/(kg*K)'))

    p['des_vars.alt'] = 0
    p['des_vars.Speed'] = 0

    p.run()
    print ('Ps : %f Pa SLS' % cu(p['fc.amb.Fl_O:stat:P'],'psi','Pa'))
示例#22
0
 def convert(val):
     return cu(val, unit1, unit2)
示例#23
0
    # Shaft
    prob['FlowPath.shaft.Nmech'] = 10000.

    #prob.print_all_convergence()
    import time
    t = time.time()
    prob.run()
    #print (time.time() - t)
    #inputs = ['balance.Pt', 'balance.Tt', 'balance.W', 'balance.BPR']
    #prob.check_total_derivatives()

    batteries = (-prob['FlowPath.comp.power'] * HPtoKW * (tubeLen / (
        prob['FlowPath.fl_start.Fl_O:stat:V'] * 0.3048) / 3600.0)) / teslaPack

    astar = np.sqrt(prob['FlowPath.fl_start.Fl_O:stat:gamma'] * R_UNIVERSAL_SI *
                    (cu(prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR', 'degK')))
    ustar = astar * prob['FlowPath.fl_start.Fl_O:stat:MN']
    dstar = prob['FlowPath.fl_start.Fl_O:stat:gamma'] * cu(
        prob['FlowPath.fl_start.Fl_O:stat:P'], 'psi', 'Pa') / astar**2
    mustar = 0.00001716 * (cu(
        prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR', 'degK') / 273.15)**1.5 * (
            273.15 + 110.4) / (cu(prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR',
                                  'degK') + 110.4)  # --- Sutherlands Law
    #Re = dstar*ustar/mustar*Lstar_Lref
    #print (mustar)

    print("")
    print("--- Output ----------------------")

    print("--- Freestream Static Conditions ---")
    print("Pod Mach No.:  %.6f " % (prob['FlowPath.fl_start.Fl_O:stat:MN']))
示例#24
0
    def test_case1_vs_inductrack(self):

        CycleGroup = cycle_group.Cycle()

        prob = create_problem(CycleGroup)

        params = (('comp_PR', 12.6, {
            'units': 'unitless'
        }), ('PsE', 0.05588, {
            'units': 'psi'
        }), ('pod_mach_number', .8, {
            'units': 'unitless'
        }), ('tube_pressure', 850., {
            'units': 'Pa'
        }), ('tube_temp', 320., {
            'units': 'K'
        }), ('comp_inlet_area', 2.3884, {
            'units': 'm**2'
        }))

        prob.root.add('des_vars', IndepVarComp(params))

        prob.root.connect('des_vars.comp_PR', 'Cycle.comp.map.PRdes')
        prob.root.connect('des_vars.PsE', 'Cycle.nozzle.Ps_exhaust')
        prob.root.connect('des_vars.pod_mach_number', 'Cycle.pod_mach')
        prob.root.connect('des_vars.tube_pressure', 'Cycle.tube_pressure')
        prob.root.connect('des_vars.tube_temp', 'Cycle.tube_temp')
        prob.root.connect('des_vars.comp_inlet_area', 'Cycle.comp_inlet_area')

        prob.setup()
        #prob.root.list_connections()

        prob['Cycle.CompressorMass.comp_eff'] = 91.0

        prob['Cycle.CompressorLen.h_stage'] = 58.2

        prob['Cycle.FlowPathInputs.gamma'] = 1.4
        prob['Cycle.FlowPathInputs.R'] = 287.
        prob['Cycle.FlowPathInputs.eta'] = 0.99
        prob['Cycle.FlowPathInputs.comp_mach'] = 0.6

        prob.run()

        # Test Values
        assert np.isclose(prob['Cycle.comp_len'], 3.579, rtol=.01)
        assert np.isclose(prob['Cycle.comp_mass'], 774.18, rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.trq'], 'ft*lbf', 'N*m'),
                          -2622.13,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.power'], 'hp', 'W'),
                          -2745896.44,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.comp.Fl_O:stat:area'], 'inch**2',
                             'm**2'),
                          0.314,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fg'], 'lbf', 'N'),
                          6562.36,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.inlet.F_ram'], 'lbf', 'N'),
                          1855.47,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fl_O:tot:T'], 'degR', 'K'),
                          767.132,
                          rtol=.01)
        assert np.isclose(cu(prob['Cycle.nozzle.Fl_O:stat:W'], 'lbm/s',
                             'kg/s'),
                          6.467,
                          rtol=.01)
示例#25
0
    #from openmdao.api import view_tree
    #view_tree(prob)
    #exit()

    prob.run()

    print('Pt               %f' % prob['Cycle.FlowPathInputs.Pt'])
    print('Tt               %f' % prob['Cycle.FlowPathInputs.Tt'])
    print('m_dot            %f' % prob['Cycle.FlowPathInputs.m_dot'])

    print('H in             %f' % prob['Cycle.FlowPath.inlet.Fl_O:tot:h'])
    print('H out            %f' % prob['Cycle.FlowPath.comp.Fl_O:tot:h'])

    print('Comp_len         %f m' % prob['Cycle.comp_len'])
    print('Comp_Mass        %f kg' % prob['Cycle.comp_mass'])

    print('Torque           %f N*m' %
          (cu(prob['Cycle.comp.trq'], 'ft*lbf', 'N*m')))
    print('Power            %f W' % (cu(prob['Cycle.comp.power'], 'hp', 'W')))

    print('A_duct           %f m**2' %
          (cu(prob['Cycle.comp.Fl_O:stat:area'], 'inch**2', 'm**2')))
    print('nozzle.Fg        %f N' % (cu(prob['Cycle.nozzle.Fg'], 'lbf', 'N')))
    print('inlet.F_ram      %f N' %
          (cu(prob['Cycle.inlet.F_ram'], 'lbf', 'N')))

    print('Nozzle exit temp %f K' %
          (cu(prob['Cycle.nozzle.Fl_O:tot:T'], 'degR', 'K')))
    print('Nozzle exit MFR  %f kg/s' %
          (cu(prob['Cycle.nozzle.Fl_O:stat:W'], 'lbm/s', 'kg/s')))
示例#26
0
    #prob.root.set_order(['des_vars', 'balance', 'FlowPath'])
    prob.setup(check=True)
    prob.root.list_connections()

    #prob.print_all_convergence()
    import time
    t = time.time()
    prob.run()

    batteries = (-prob['FlowPath.comp.power'] * HPtoKW *
                 (tubeLen / (prob['FlowPath.fl_start.Fl_O:stat:V'] * 0.3048) /
                  3600.0)) / teslaPack

    astar = np.sqrt(
        prob['FlowPath.fl_start.Fl_O:stat:gamma'] * R_UNIVERSAL_SI *
        (cu(prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR', 'degK')))
    ustar = astar * prob['FlowPath.fl_start.Fl_O:stat:MN']
    dstar = prob['FlowPath.fl_start.Fl_O:stat:gamma'] * cu(
        prob['FlowPath.fl_start.Fl_O:stat:P'], 'psi', 'Pa') / astar**2
    mustar = 0.00001716 * (
        cu(prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR', 'degK') /
        273.15)**1.5 * (273.15 + 110.4) / (
            cu(prob['FlowPath.fl_start.Fl_O:stat:T'], 'degR', 'degK') + 110.4
        )  # --- Sutherlands Law
    #Re = dstar*ustar/mustar*Lstar_Lref
    #print (mustar)

    print("")
    print("--- Output ----------------------")

    print("--- Freestream Static Conditions ---")
示例#27
0
        return p


if __name__ == "__main__":
    print 'Setting up...'

    # Set up OpenMDAO problem `p` with pod traveling at Mach 0.2
    p = HyperloopSim.p_factory(pod_MN=0.35, inlet_area=0.4735, cross_section=0.8538)
    # Change some problem parameters

    p['percent_into_bypass'] = 1.0 - p['inlet_area'] / p['tube_area']

    print 'Setup complete.'
    print ''
    print 'Ambient tube pressure:', ' ' * 17, p['tube_P'], 'Pa'
    print 'Ambient tube temperature:', ' ' * 14, cu(p['tube_T'], 'degK', 'degC'), 'degC'
    print 'Maximum pod cross-section:', ' ' * 13, p['cross_section'], 'm**2'
    print 'Inlet area:', ' ' * 28, p['inlet_area'], 'm**2'
    print 'Comp 1 PR:', ' ' * 29, p['compression_system.comp1.PR_design']
    print 'Comp 2 PR:', ' ' * 29, p['compression_system.comp2.PR_design']
    print ''
    print 'WARNING: Temp values for compressors are wrong. With temp, proceed with caution.'
    print 'Optimizing...'

    # Run problem
    p.run()

    # Display some results
    print ''
    print 'Velocity:', cu(p['start.Fl_O:stat:V'], 'ft/s', 'm/s'), 'm/s'
    print 'Tube area:', ' ' * 29, p['tube_area'], 'm**2'
示例#28
0
 def convert(val):
     return cu(val, unit1, unit2)