Beispiel #1
0
    def test_derivs(self):
        surface = get_default_surfaces()[0]

        surface['n_point_masses'] = 2

        comp = ComputePointMassLoads(surface=surface)

        group = om.Group()

        indep_var_comp = om.IndepVarComp()

        ny = surface['mesh'].shape[1]

        nodesval = np.array([[0., 0., 0.], [0., 1., 0.], [0., 2., 0.],
                             [0., 3., 0.]])

        point_masses = np.array([[2., 1.]])

        point_mass_locations = np.array([[2.1, 0.1, 0.2], [3.2, 1.2, 0.3]])

        indep_var_comp.add_output('nodes', val=nodesval, units='m')
        indep_var_comp.add_output('point_masses', val=point_masses, units='kg')
        indep_var_comp.add_output('point_mass_locations',
                                  val=point_mass_locations,
                                  units='m')

        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])
        group.add_subsystem('compute_point_mass_loads', comp, promotes=['*'])

        prob = run_test(self,
                        group,
                        complex_flag=True,
                        step=1e-8,
                        atol=1e-5,
                        compact_print=True)
Beispiel #2
0
    def setup(self):
        surface = self.options['surface']

        promotes = []
        if surface['struct_weight_relief']:
            self.add_subsystem(
                'struct_weight_loads',
                StructureWeightLoads(surface=surface),
                promotes_inputs=['element_mass', 'nodes', 'load_factor'],
                promotes_outputs=['struct_weight_loads'])
            promotes.append('struct_weight_loads')

        if surface['distributed_fuel_weight']:
            self.add_subsystem('fuel_loads',
                               FuelLoads(surface=surface),
                               promotes_inputs=[
                                   'nodes', 'load_factor', 'fuel_vols',
                                   'fuel_mass'
                               ],
                               promotes_outputs=['fuel_weight_loads'])
            promotes.append('fuel_weight_loads')

        if 'n_point_masses' in surface.keys():
            self.add_subsystem('point_masses',
                               ComputePointMassLoads(surface=surface),
                               promotes_inputs=[
                                   'point_mass_locations', 'point_masses',
                                   'nodes', 'load_factor'
                               ],
                               promotes_outputs=['loads_from_point_masses'])
            promotes.append('loads_from_point_masses')

            self.add_subsystem('thrust_loads',
                               ComputeThrustLoads(surface=surface),
                               promotes_inputs=[
                                   'point_mass_locations', 'engine_thrusts',
                                   'nodes'
                               ],
                               promotes_outputs=['loads_from_thrusts'])
            promotes.append('loads_from_thrusts')

        self.add_subsystem('total_loads',
                           TotalLoads(surface=surface),
                           promotes_inputs=['loads'] + promotes,
                           promotes_outputs=['total_loads'])

        self.add_subsystem('create_rhs',
                           CreateRHS(surface=surface),
                           promotes_inputs=['total_loads'],
                           promotes_outputs=['forces'])

        self.add_subsystem('fem',
                           FEM(surface=surface),
                           promotes_inputs=['*'],
                           promotes_outputs=['*'])

        self.add_subsystem('disp',
                           Disp(surface=surface),
                           promotes_inputs=['*'],
                           promotes_outputs=['*'])
Beispiel #3
0
    def test_simple_values(self):
        surface = get_default_surfaces()[0]

        surface['n_point_masses'] = 1

        comp = ComputePointMassLoads(surface=surface)

        group = om.Group()

        indep_var_comp = om.IndepVarComp()

        ny = surface['mesh'].shape[1]

        nodesval = np.array([[0., 0., 0.], [0., 1., 0.], [0., 2., 0.],
                             [0., 3., 0.]])

        point_masses = np.array([[1 / 9.8]])

        point_mass_locations = np.array([[.55012, 0.1, 0.]])

        indep_var_comp.add_output('nodes', val=nodesval, units='m')
        indep_var_comp.add_output('point_masses', val=point_masses, units='kg')
        indep_var_comp.add_output('point_mass_locations',
                                  val=point_mass_locations,
                                  units='m')

        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])
        group.add_subsystem('compute_point_mass_loads', comp, promotes=['*'])

        prob = run_test(self,
                        group,
                        complex_flag=True,
                        step=1e-8,
                        atol=1e-5,
                        compact_print=True)

        truth_array = np.array([0, 0, -1., 0., 0.55012, 0.])

        assert_rel_error(self, prob['comp.loads_from_point_masses'][0, :],
                         truth_array, 1e-6)