Ejemplo n.º 1
0
    def test(self):
        surface = {}
        surface['symmetry'] = False
        surface['type'] = 'aero'
        span = 1
        ny = 5
        mesh = np.zeros((2, ny, 3))
        mesh[0, :, 0] = -1.
        mesh[:, :, 1] = np.linspace(0, span, ny)
        surface['mesh'] = mesh
        surface['name'] = 'wing'

        # The way this is currently set up, we don't actually use the values here
        surface['twist_cp'] = np.zeros((5))
        surface['chord_cp'] = np.zeros((5))
        surface['xshear_cp'] = np.zeros((5))
        surface['yshear_cp'] = np.zeros((5))
        surface['zshear_cp'] = np.zeros((5))

        surface['span'] = span
        surface['t_over_c_cp'] = np.array([.12])

        comp = GeometryMesh(surface=surface)

        run_test(self, comp, complex_flag=True, method='cs')
    def test_2(self):
        surface = get_default_surfaces()[0]
        surface['distributed_fuel_weight'] = True

        comp = TotalLoads(surface=surface)

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 3
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = Forces(surfaces=surfaces)

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('wing_widths',
                                  val=np.ones((surfaces[0]['num_y'] - 1)),
                                  units='m')
        indep_var_comp.add_output('tail_widths',
                                  val=np.ones((surfaces[1]['num_y'] - 1)),
                                  units='m')
        indep_var_comp.add_output('M', val=.3)

        group.add_subsystem('indep_var_comp', indep_var_comp)
        group.add_subsystem('forces', comp)

        group.connect('indep_var_comp.wing_widths', 'forces.wing_widths')
        group.connect('indep_var_comp.tail_widths', 'forces.tail_widths')
        group.connect('indep_var_comp.M', 'forces.M')

        run_test(self, group)
Ejemplo n.º 4
0
    def test_2(self):
        surface = get_default_surfaces()[0]
        surface['distributed_fuel_weight'] = True

        comp = TotalLoads(surface=surface)

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 5
0
    def test(self):
        surface = get_default_surfaces()[0]

        ny = surface['mesh'].shape[1]
        comp = FEM(surface=surface)

        run_test(self, comp)
Ejemplo n.º 6
0
    def test_1(self):
        surface = get_default_surfaces()[0]
        surface['struct_weight_relief'] = True

        comp = TotalLoads(surface=surface)

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 7
0
    def test(self):
        surface = get_default_surfaces()[0]

        group = Group()

        comp = VonMisesTube(surface=surface)

        indep_var_comp = IndepVarComp()

        ny = surface['num_y']

        #  define the spar with y out the wing
        nodes = np.zeros((ny, 3))
        nodes[:,1] = np.linspace(0,1,ny)

        radius = 0.01*np.ones((ny - 1))

        disp = np.zeros((ny, 6))
        for i in range(6):
            disp[:,i] = np.linspace(0,0.001,ny)

        indep_var_comp.add_output('nodes', val=nodes, units='m')
        indep_var_comp.add_output('radius', val=radius, units='m')
        indep_var_comp.add_output('disp', val=disp, units='m')

        group.add_subsystem('vm_comp', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.nodes', 'vm_comp.nodes')
        group.connect('indep_var_comp.radius', 'vm_comp.radius')
        group.connect('indep_var_comp.disp', 'vm_comp.disp')

        run_test(self, group)
Ejemplo n.º 8
0
    def test_quick(self):
        """ Short pre-setup test to compare component derivs. """
        surfaces = get_default_surfaces()

        comp = SectionPropertiesTube(surface=surfaces[0])

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 9
0
    def test(self):
        surface = get_default_surfaces()[0]

        ny = surface['mesh'].shape[1]
        comp = FEM(surface=surface)

        run_test(self, comp)
    def test_quick(self):
        """ Short pre-setup test to compare component derivs. """
        surfaces = get_default_surfaces()

        comp = SectionPropertiesTube(surface=surfaces[0])

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 11
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = Forces(surfaces=surfaces)

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('wing_widths',
                                  val=np.ones((surfaces[0]['num_y'] - 1)),
                                  units='m')
        indep_var_comp.add_output('tail_widths',
                                  val=np.ones((surfaces[1]['num_y'] - 1)),
                                  units='m')
        indep_var_comp.add_output('wing_def_mesh',
                                  val=surfaces[0]['mesh'],
                                  units='m')
        indep_var_comp.add_output('tail_def_mesh',
                                  val=surfaces[1]['mesh'],
                                  units='m')
        indep_var_comp.add_output('M', val=.3)

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

        run_test(self, group)
    def test_1(self):
        surface = get_default_surfaces()[0]
        surface['struct_weight_relief'] = True

        comp = TotalLoads(surface=surface)

        run_test(self, comp, complex_flag=True)
Ejemplo n.º 13
0
    def test(self):
        surface = get_default_surfaces()[0]
        surface['with_wave'] = True
        surface['t_over_c_cp'] = np.array([0.15, 0.21, 0.03, 0.05])

        nx = surface['mesh'].shape[0]
        ny = surface['mesh'].shape[1]
        n_cp = len(surface['t_over_c_cp'])

        group = om.Group()

        indep_var_comp = om.IndepVarComp()
        indep_var_comp.add_output('t_over_c_cp', val=surface['t_over_c_cp'])
        indep_var_comp.add_output('Mach_number', val=.95)
        indep_var_comp.add_output('CL', val=0.7)
        indep_var_comp.add_output('widths', val = np.array([12.14757848, 11.91832712, 11.43730892]),units='m')
        indep_var_comp.add_output('cos_sweep', val = np.array([10.01555924,  9.80832351,  9.79003729]),units='m')
        indep_var_comp.add_output('chords', val = np.array([ 2.72835132,  5.12528179,  7.88916016, 13.6189974]),units='m')
        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])
        
        x_interp = np.linspace(0., 1., int(ny-1))
        comp = group.add_subsystem('t_over_c_bsp', om.SplineComp(
            method='bsplines', x_interp_val=x_interp,
            num_cp=n_cp,
            interp_options={'order' : min(n_cp, 4)}),
            promotes_inputs=['t_over_c_cp'], promotes_outputs=['t_over_c'])
        comp.add_spline(y_cp_name='t_over_c_cp', y_interp_name='t_over_c')

        comp = WaveDrag(surface=surface)
        group.add_subsystem('wavedrag', comp, promotes=['*'])

        run_test(self, group, complex_flag=True)
    def test(self):
        surface = get_default_surfaces()[0]

        group = Group()

        comp = VonMisesTube(surface=surface)

        indep_var_comp = IndepVarComp()

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

        #  define the spar with y out the wing
        nodes = np.zeros((ny, 3))
        nodes[:,0] = np.linspace(0,0.01,ny)
        nodes[:,1] = np.linspace(0,1,ny)

        radius = 0.01*np.ones((ny - 1))

        disp = np.zeros((ny, 6))
        for i in range(6):
            disp[:,i] = np.linspace(0,0.001,ny)

        indep_var_comp.add_output('nodes', val=nodes, units='m')
        indep_var_comp.add_output('radius', val=radius, units='m')
        indep_var_comp.add_output('disp', val=disp, units='m')

        group.add_subsystem('vm_comp', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.nodes', 'vm_comp.nodes')
        group.connect('indep_var_comp.radius', 'vm_comp.radius')
        group.connect('indep_var_comp.disp', 'vm_comp.disp')

        run_test(self, group, complex_flag=True, compact_print=True, method='cs', step=1e-40, atol=2e-4, rtol=1e-8)
Ejemplo n.º 15
0
    def test(self):
        surface = get_default_surfaces()[0]
        surface['t_over_c_cp'] = np.array([0.1, 0.15, 0.2])

        nx = surface['mesh'].shape[0]
        ny = surface['mesh'].shape[1]
        n_cp = len(surface['t_over_c_cp'])

        group = om.Group()

        indep_var_comp = om.IndepVarComp()
        indep_var_comp.add_output('t_over_c_cp', val=surface['t_over_c_cp'])
        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])

        x_interp = np.linspace(0., 1., int(ny - 1))
        comp = group.add_subsystem('t_over_c_bsp',
                                   om.SplineComp(
                                       method='bsplines',
                                       x_interp_val=x_interp,
                                       num_cp=n_cp,
                                       interp_options={'order': min(n_cp, 4)}),
                                   promotes_inputs=['t_over_c_cp'],
                                   promotes_outputs=['t_over_c'])
        comp.add_spline(y_cp_name='t_over_c_cp',
                        y_interp_name='t_over_c',
                        y_cp_val=np.zeros(n_cp))

        comp = ViscousDrag(surface=surface, with_viscous=True)
        group.add_subsystem('viscousdrag', comp, promotes=['*'])

        run_test(self, group, complex_flag=True)
Ejemplo n.º 16
0
    def test(self):
        surfaces = get_default_surfaces()

        group = om.Group()
        comp = SolveMatrix(surfaces=surfaces)

        indep_var_comp = om.IndepVarComp()

        system_size = 0
        for surface in surfaces:
            nx = surface['mesh'].shape[0]
            ny = surface['mesh'].shape[1]
            system_size += (nx - 1) * (ny - 1)

        indep_var_comp.add_output('rhs',
                                  val=np.ones((system_size)),
                                  units='m/s')
        indep_var_comp.add_output('mtx',
                                  val=np.identity((system_size)),
                                  units='1/m')

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

        run_test(self, group)
    def test(self):
        surface = get_default_surfaces()[0]
        surface['with_wave'] = True
        surface['t_over_c_cp'] = np.array([0.15, 0.21, 0.03, 0.05])

        nx = surface['mesh'].shape[0]
        ny = surface['mesh'].shape[1]
        n_cp = len(surface['t_over_c_cp'])

        group = Group()

        indep_var_comp = IndepVarComp()
        indep_var_comp.add_output('t_over_c_cp', val=surface['t_over_c_cp'])
        indep_var_comp.add_output('Mach_number', val=.95)
        indep_var_comp.add_output('CL', val=0.7)
        indep_var_comp.add_output('widths', val = np.array([12.14757848, 11.91832712, 11.43730892]),units='m')
        indep_var_comp.add_output('cos_sweep', val = np.array([10.01555924,  9.80832351,  9.79003729]),units='m')
        indep_var_comp.add_output('chords', val = np.array([ 2.72835132,  5.12528179,  7.88916016, 13.6189974]),units='m')
        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])

        group.add_subsystem('t_over_c_bsp', BsplinesComp(
            in_name='t_over_c_cp', out_name='t_over_c',
            num_control_points=n_cp, num_points=int(ny-1),
            bspline_order=min(n_cp, 4), distribution='uniform'),
            promotes_inputs=['t_over_c_cp'], promotes_outputs=['t_over_c'])

        comp = WaveDrag(surface=surface)
        group.add_subsystem('wavedrag', comp, promotes=['*'])

        run_test(self, group, complex_flag=True)
Ejemplo n.º 18
0
    def test(self):
        surface = get_default_surfaces()[0]
        surface['t_over_c_cp'] = np.array([0.1, 0.15, 0.2])

        ny = surface['num_y']
        nx = surface['num_x']
        n_cp = len(surface['t_over_c_cp'])

        group = Group()

        indep_var_comp = IndepVarComp()
        indep_var_comp.add_output('t_over_c_cp', val=surface['t_over_c_cp'])
        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])

        group.add_subsystem('t_over_c_bsp',
                            BsplinesComp(in_name='t_over_c_cp',
                                         out_name='t_over_c',
                                         num_control_points=n_cp,
                                         num_points=int(ny - 1),
                                         bspline_order=min(n_cp, 4),
                                         distribution='uniform'),
                            promotes_inputs=['t_over_c_cp'],
                            promotes_outputs=['t_over_c'])

        comp = ViscousDrag(surface=surface, with_viscous=True)
        group.add_subsystem('viscousdrag', comp, promotes=['*'])

        run_test(self, group, complex_flag=True)
Ejemplo n.º 19
0
    def test(self):
        surfaces = get_default_surfaces()

        comp = EvalVelocities(surfaces=surfaces,
                              eval_name='TestEval',
                              num_eval_points=11)

        run_test(self, comp)
Ejemplo n.º 20
0
    def test(self):
        surfaces = get_default_surfaces()

        comp = EvalVelMtx(surfaces=surfaces,
                          num_eval_points=2,
                          eval_name='test_name')

        run_test(self, comp)
Ejemplo n.º 21
0
    def test_groundplane(self):
        surfaces = get_ground_effect_surfaces()

        comp = GetVectors(surfaces=surfaces,
                          num_eval_points=10,
                          eval_name='test_name')

        run_test(self, comp)
Ejemplo n.º 22
0
    def test(self):
        surfaces = get_default_surfaces()

        comp = GetVectors(surfaces=surfaces,
                          num_eval_points=10,
                          eval_name='test_name')

        run_test(self, comp)
Ejemplo n.º 23
0
    def test(self):
        wing_dict = {'name': 'wing', 'num_y': 7, 'num_x': 2, 'symmetry': True}
        tail_dict = {'name': 'tail', 'num_y': 5, 'num_x': 3, 'symmetry': False}

        surfaces = [wing_dict, tail_dict]

        comp = TotalLiftDrag(surfaces=surfaces)

        run_test(self, comp, tol=1e-5)
Ejemplo n.º 24
0
    def test(self):
        wing_dict = {'name': 'wing', 'num_y': 7, 'num_x': 2, 'symmetry': True}
        tail_dict = {'name': 'tail', 'num_y': 5, 'num_x': 3, 'symmetry': False}

        surfaces = [wing_dict, tail_dict]

        comp = MomentCoefficient(surfaces=surfaces)

        run_test(self, comp)
    def test(self):
        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        comp = FailureExact(surface=surface)

        run_test(self, comp)
Ejemplo n.º 26
0
    def test(self):
        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        comp = FailureKS(surface=surface)

        run_test(self, comp, complex_flag=True, step=1e-40, method='cs', compact_print=False)
    def test(self):
        """
        This is for checking the partials.
        """

        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        surface['data_x_upper'] = np.array([
            0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2,
            0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31,
            0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42,
            0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53,
            0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6
        ],
                                           dtype='complex128')

        surface['data_x_lower'] = np.array([
            0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2,
            0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31,
            0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42,
            0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53,
            0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6
        ],
                                           dtype='complex128')
        surface['data_y_upper'] = np.array([
            0.0447, 0.046, 0.0472, 0.0484, 0.0495, 0.0505, 0.0514, 0.0523,
            0.0531, 0.0538, 0.0545, 0.0551, 0.0557, 0.0563, 0.0568, 0.0573,
            0.0577, 0.0581, 0.0585, 0.0588, 0.0591, 0.0593, 0.0595, 0.0597,
            0.0599, 0.06, 0.0601, 0.0602, 0.0602, 0.0602, 0.0602, 0.0602,
            0.0601, 0.06, 0.0599, 0.0598, 0.0596, 0.0594, 0.0592, 0.0589,
            0.0586, 0.0583, 0.058, 0.0576, 0.0572, 0.0568, 0.0563, 0.0558,
            0.0553, 0.0547, 0.0541
        ],
                                           dtype='complex128')
        surface['data_y_lower'] = np.array([
            -0.0447, -0.046, -0.0473, -0.0485, -0.0496, -0.0506, -0.0515,
            -0.0524, -0.0532, -0.054, -0.0547, -0.0554, -0.056, -0.0565,
            -0.057, -0.0575, -0.0579, -0.0583, -0.0586, -0.0589, -0.0592,
            -0.0594, -0.0595, -0.0596, -0.0597, -0.0598, -0.0598, -0.0598,
            -0.0598, -0.0597, -0.0596, -0.0594, -0.0592, -0.0589, -0.0586,
            -0.0582, -0.0578, -0.0573, -0.0567, -0.0561, -0.0554, -0.0546,
            -0.0538, -0.0529, -0.0519, -0.0509, -0.0497, -0.0485, -0.0472,
            -0.0458, -0.0444
        ],
                                           dtype='complex128')
        surface['original_wingbox_airfoil_t_over_c'] = 0.1
        comp = SectionPropertiesWingbox(surface=surface)

        run_test(self, comp, complex_flag=True, method='cs', step=1e-40)
    def test(self):
        surface = get_default_surfaces()[0]
        surface['data_x_upper'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')

        surface['data_x_lower'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')
        surface['data_y_upper'] = np.array([ 0.0447,  0.046,  0.0472,  0.0484,  0.0495,  0.0505,  0.0514,  0.0523,  0.0531,  0.0538, 0.0545,  0.0551,  0.0557, 0.0563,  0.0568, 0.0573,  0.0577,  0.0581,  0.0585,  0.0588,  0.0591,  0.0593,  0.0595,  0.0597,  0.0599,  0.06,    0.0601,  0.0602,  0.0602,  0.0602,  0.0602,  0.0602,  0.0601,  0.06,    0.0599,  0.0598,  0.0596,  0.0594,  0.0592,  0.0589,  0.0586,  0.0583,  0.058,   0.0576,  0.0572,  0.0568,  0.0563,  0.0558,  0.0553,  0.0547,  0.0541], dtype = 'complex128')
        surface['data_y_lower'] = np.array([-0.0447, -0.046, -0.0473, -0.0485, -0.0496, -0.0506, -0.0515, -0.0524, -0.0532, -0.054, -0.0547, -0.0554, -0.056, -0.0565, -0.057, -0.0575, -0.0579, -0.0583, -0.0586, -0.0589, -0.0592, -0.0594, -0.0595, -0.0596, -0.0597, -0.0598, -0.0598, -0.0598, -0.0598, -0.0597, -0.0596, -0.0594, -0.0592, -0.0589, -0.0586, -0.0582, -0.0578, -0.0573, -0.0567, -0.0561, -0.0554, -0.0546, -0.0538, -0.0529, -0.0519, -0.0509, -0.0497, -0.0485, -0.0472, -0.0458, -0.0444], dtype = 'complex128')
        surface['original_wingbox_airfoil_t_over_c'] = 0.1
        comp = SectionPropertiesWingbox(surface=surface)

        run_test(self, comp, complex_flag=True)
    def test(self):

        wing_dict = {'name' : 'wing',
                     'mesh': np.zeros((2,7)),
                     'symmetry' : True}
        tail_dict = {'name' : 'tail',
                     'mesh': np.zeros((3,5)),
                     'symmetry' : False}

        surfaces = [wing_dict, tail_dict]

        comp = MomentCoefficient(surfaces=surfaces)

        run_test(self, comp)
Ejemplo n.º 30
0
    def test(self):
        surface = get_default_surfaces()[0]
        ny = surface['mesh'].shape[1]

        group = Group()

        ivc = IndepVarComp()
        ivc.add_output('nodes', val=np.random.random_sample((ny, 3)))

        comp = Weight(surface=surface)

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

        run_test(self, group, compact_print=False, complex_flag=True)
Ejemplo n.º 31
0
    def test(self):
        surface = get_default_surfaces()[0]
        ny = surface['mesh'].shape[1]

        group = om.Group()

        ivc = om.IndepVarComp()
        ivc.add_output('nodes', val=np.random.random_sample((ny, 3)))

        comp = Weight(surface=surface)

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

        run_test(self, group, compact_print=False, complex_flag=True)
Ejemplo n.º 32
0
    def test(self):
        surface = get_default_surfaces()[0]
        ny = surface['num_y']

        group = Group()

        ivc = IndepVarComp()
        ivc.add_output('nodes', val=np.random.random_sample((ny, 3)))

        comp = Weight(surface=surface)

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

        run_test(self, group)
    def test(self):
        wing_dict = {'name' : 'wing',
                     'num_y' : 7,
                     'num_x' : 2,
                     'symmetry' : True}
        tail_dict = {'name' : 'tail',
                     'num_y' : 5,
                     'num_x' : 3,
                     'symmetry' : False}

        surfaces = [wing_dict, tail_dict]

        comp = TotalLiftDrag(surfaces=surfaces)

        run_test(self, comp)
Ejemplo n.º 34
0
    def test_structural_weight_loads(self):
        surface = get_default_surfaces()[0]

        comp = StructureWeightLoads(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

        #carefully chosen "random" values that give non-uniform derivatives outputs that are good for testing
        nodesval = np.array(
            [[1., 2., 4.], [20., 22., 7.], [8., 17., 14.], [13., 14., 16.]],
            dtype=complex)
        element_weights_val = np.arange(ny - 1) + 1

        indep_var_comp.add_output('nodes', val=nodesval, units='m')
        indep_var_comp.add_output('element_weights',
                                  val=element_weights_val,
                                  units='N')

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

        p = run_test(self, group, complex_flag=True, compact_print=True)
    def test_derivs(self):
        surface = get_default_surfaces()[0]

        surface['n_point_masses'] = 2

        comp = ComputePointMassLoads(surface=surface)

        group = Group()

        indep_var_comp = 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)
    def test_simple_values(self):
        surface = get_default_surfaces()[0]

        surface['n_point_masses'] = 1

        comp = ComputePointMassLoads(surface=surface)

        group = Group()

        indep_var_comp = 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)
Ejemplo n.º 37
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)
    def test(self):
        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        comp = FailureKS(surface=surface)

        run_test(self,
                 comp,
                 complex_flag=True,
                 step=1e-40,
                 method='cs',
                 compact_print=False)
    def test_structural_weight_loads(self):
        surface = get_default_surfaces()[0]

        comp = StructureWeightLoads(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

        #carefully chosen "random" values that give non-uniform derivatives outputs that are good for testing
        nodesval = np.array([[1., 2., 4.],
                            [20., 22., 7.],
                            [8., 17., 14.],
                            [13., 14., 16.]],dtype=complex)
        element_weights_val = np.arange(ny-1)+1

        indep_var_comp.add_output('nodes', val=nodesval,units='m')
        indep_var_comp.add_output('element_weights', val=element_weights_val,units='N')

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

        p = run_test(self, group, complex_flag=True, compact_print=True)
Ejemplo n.º 40
0
    def test_simple_values(self):
        surface = get_default_surfaces()[0]

        surface['n_point_masses'] = 1

        comp = ComputeThrustLoads(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

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

        engine_thrusts = 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('engine_thrusts', val=engine_thrusts, units='N')
        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_thrusts'][0, :], truth_array, 1e-6)
Ejemplo n.º 41
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = RadiusComp(surface=surfaces[0])

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('mesh', val=surfaces[0]['mesh'], units='m')

        group.add_subsystem('radius', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.mesh', 'radius.mesh')

        run_test(self, group)
Ejemplo n.º 42
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = VLMGeometry(surface=surfaces[0])

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('def_mesh', val=surfaces[0]['mesh'], units='m')

        group.add_subsystem('geom', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.def_mesh', 'geom.def_mesh')

        run_test(self, group)
    def test2(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = MomentCoefficient(surfaces=surfaces)

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('S_ref_total', val=1e4, units='m**2')

        group.add_subsystem('moment_calc', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.S_ref_total', 'moment_calc.S_ref_total')

        run_test(self, group)
Ejemplo n.º 44
0
    def test(self):
        surfaces = get_default_surfaces()

        group = om.Group()

        comp = VLMGeometry(surface=surfaces[0])

        indep_var_comp = om.IndepVarComp()

        indep_var_comp.add_output('def_mesh', val=surfaces[0]['mesh'], units='m')

        group.add_subsystem('geom', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.def_mesh', 'geom.def_mesh')

        run_test(self, group)
    def test(self):
        surface = get_default_surfaces()[0]
        group = Group()

        comp = LoadTransfer(surface=surface)

        indep_var_comp = IndepVarComp()

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

        indep_var_comp.add_output('def_mesh', val=np.random.random((nx, ny, 3)), units='m')
        indep_var_comp.add_output('sec_forces', val=np.random.random((nx-1, ny-1, 3)), units='N')

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

        run_test(self, group, complex_flag=True, compact_print=False)
    def test(self):
        surface = get_default_surfaces()[0]

        comp = ComputeTransformationMatrix(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

        ny = surface['mesh'].shape[1]
        disp = np.random.random_sample((ny, 6)) * 100.

        indep_var_comp.add_output('disp', val=disp, units='m')

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

        run_test(self, group, complex_flag=True, method='cs')
Ejemplo n.º 47
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()

        comp = RadiusComp(surface=surfaces[0])
        ny = surfaces[0]['mesh'].shape[1]

        indep_var_comp = IndepVarComp()
        indep_var_comp.add_output('mesh', val=surfaces[0]['mesh'], units='m')
        indep_var_comp.add_output('t_over_c', val=np.linspace(0.1,0.5,num=ny-1))

        group.add_subsystem('radius', comp)
        group.add_subsystem('indep_var_comp', indep_var_comp)

        group.connect('indep_var_comp.mesh', 'radius.mesh')
        group.connect('indep_var_comp.t_over_c', 'radius.t_over_c')

        run_test(self, group)
    def test(self):
        surface = get_default_surfaces()[0]

        group = Group()

        comp = StructuralCG(surface=surface)

        indep_var_comp = IndepVarComp()

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

        indep_var_comp.add_output('nodes', val=np.random.random((ny, 3)), units='m')
        indep_var_comp.add_output('structural_weight', val=1., units='N')
        indep_var_comp.add_output('element_weights', val=np.ones((ny-1)), units='N')

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

        run_test(self, group, complex_flag=True, compact_print=False)
    def test(self):
        surface = get_default_surfaces()[0]

        comp = DisplacementTransfer(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

        mesh = surface['mesh']

        indep_var_comp.add_output('mesh', val=mesh, units='m')

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

        run_test(self, group, complex_flag=True)
    def test(self):
        """
        This is for checking the partials.
        """

        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        surface['data_x_upper'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')

        surface['data_x_lower'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')
        surface['data_y_upper'] = np.array([ 0.0447,  0.046,  0.0472,  0.0484,  0.0495,  0.0505,  0.0514,  0.0523,  0.0531,  0.0538, 0.0545,  0.0551,  0.0557, 0.0563,  0.0568, 0.0573,  0.0577,  0.0581,  0.0585,  0.0588,  0.0591,  0.0593,  0.0595,  0.0597,  0.0599,  0.06,    0.0601,  0.0602,  0.0602,  0.0602,  0.0602,  0.0602,  0.0601,  0.06,    0.0599,  0.0598,  0.0596,  0.0594,  0.0592,  0.0589,  0.0586,  0.0583,  0.058,   0.0576,  0.0572,  0.0568,  0.0563,  0.0558,  0.0553,  0.0547,  0.0541], dtype = 'complex128')
        surface['data_y_lower'] = np.array([-0.0447, -0.046, -0.0473, -0.0485, -0.0496, -0.0506, -0.0515, -0.0524, -0.0532, -0.054, -0.0547, -0.0554, -0.056, -0.0565, -0.057, -0.0575, -0.0579, -0.0583, -0.0586, -0.0589, -0.0592, -0.0594, -0.0595, -0.0596, -0.0597, -0.0598, -0.0598, -0.0598, -0.0598, -0.0597, -0.0596, -0.0594, -0.0592, -0.0589, -0.0586, -0.0582, -0.0578, -0.0573, -0.0567, -0.0561, -0.0554, -0.0546, -0.0538, -0.0529, -0.0519, -0.0509, -0.0497, -0.0485, -0.0472, -0.0458, -0.0444], dtype = 'complex128')
        surface['original_wingbox_airfoil_t_over_c'] = 0.1
        comp = SectionPropertiesWingbox(surface=surface)

        run_test(self, comp, complex_flag=True, method='cs', step=1e-40)
    def test(self):
        surface = get_default_surfaces()[0]

        # turn down some of these properties, so the absolute deriv error isn't magnified
        surface['E'] = 7
        surface['G'] = 3
        surface['yield'] = .02

        surface['strength_factor_for_upper_skin'] = 1.0

        comp = VonMisesWingbox(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

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

        indep_var_comp.add_output('nodes', val=nodesval)
        indep_var_comp.add_output('disp', val=np.ones((ny, 6)))
        indep_var_comp.add_output('Qz', val=np.ones((ny - 1)))
        indep_var_comp.add_output('Iz', val=np.ones((ny - 1)))
        indep_var_comp.add_output('J', val=np.ones((ny - 1)))
        indep_var_comp.add_output('A_enc', val=np.ones((ny - 1)))
        indep_var_comp.add_output('spar_thickness', val=np.ones((ny - 1)))
        indep_var_comp.add_output('skin_thickness', val=np.ones((ny - 1)))
        indep_var_comp.add_output('htop', val=np.ones((ny - 1)))
        indep_var_comp.add_output('hbottom', val=np.ones((ny - 1)))
        indep_var_comp.add_output('hfront', val=np.ones((ny - 1)))
        indep_var_comp.add_output('hrear', val=np.ones((ny - 1)))

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

        run_test(self, group,  complex_flag=True, step=1e-8, atol=2e-5, compact_print=True)
    def test(self):
        surface = get_default_surfaces()[0]


        surface['data_x_upper'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')

        surface['data_x_lower'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6], dtype = 'complex128')
        surface['data_y_upper'] = np.array([ 0.0447,  0.046,  0.0472,  0.0484,  0.0495,  0.0505,  0.0514,  0.0523,  0.0531,  0.0538, 0.0545,  0.0551,  0.0557, 0.0563,  0.0568, 0.0573,  0.0577,  0.0581,  0.0585,  0.0588,  0.0591,  0.0593,  0.0595,  0.0597,  0.0599,  0.06,    0.0601,  0.0602,  0.0602,  0.0602,  0.0602,  0.0602,  0.0601,  0.06,    0.0599,  0.0598,  0.0596,  0.0594,  0.0592,  0.0589,  0.0586,  0.0583,  0.058,   0.0576,  0.0572,  0.0568,  0.0563,  0.0558,  0.0553,  0.0547,  0.0541], dtype = 'complex128')
        surface['data_y_lower'] = np.array([-0.0447, -0.046, -0.0473, -0.0485, -0.0496, -0.0506, -0.0515, -0.0524, -0.0532, -0.054, -0.0547, -0.0554, -0.056, -0.0565, -0.057, -0.0575, -0.0579, -0.0583, -0.0586, -0.0589, -0.0592, -0.0594, -0.0595, -0.0596, -0.0597, -0.0598, -0.0598, -0.0598, -0.0598, -0.0597, -0.0596, -0.0594, -0.0592, -0.0589, -0.0586, -0.0582, -0.0578, -0.0573, -0.0567, -0.0561, -0.0554, -0.0546, -0.0538, -0.0529, -0.0519, -0.0509, -0.0497, -0.0485, -0.0472, -0.0458, -0.0444], dtype = 'complex128')

        comp = WingboxGeometry(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

        indep_var_comp.add_output('mesh', val=surface['mesh'])

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

        run_test(self, group,  complex_flag=True)
Ejemplo n.º 53
0
    def test_0(self):
        surface = get_default_surfaces()[0]

        comp = FuelLoads(surface=surface)

        group = Group()

        indep_var_comp = IndepVarComp()

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

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

        indep_var_comp.add_output('nodes', val=nodesval)

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

        run_test(self, group, complex_flag=True, atol=1e-2, rtol=1e-6)
Ejemplo n.º 54
0
    def test(self):
        surfaces = get_default_surfaces()

        group = Group()
        comp = SolveMatrix(surfaces=surfaces)

        indep_var_comp = IndepVarComp()

        system_size = 0
        for surface in surfaces:
            nx = surface['mesh'].shape[0]
            ny = surface['mesh'].shape[1]
            system_size += (nx - 1) * (ny - 1)


        indep_var_comp.add_output('rhs', val=np.ones((system_size)), units='m/s')
        indep_var_comp.add_output('mtx', val=np.identity((system_size)), units='1/m')

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


        run_test(self, group)
Ejemplo n.º 55
0
    def test(self):
        surface = get_default_surfaces()[0]
        surface['t_over_c_cp'] = np.array([0.1, 0.15, 0.2])

        nx = surface['mesh'].shape[0]
        ny = surface['mesh'].shape[1]
        n_cp = len(surface['t_over_c_cp'])

        group = Group()

        indep_var_comp = IndepVarComp()
        indep_var_comp.add_output('t_over_c_cp', val=surface['t_over_c_cp'])
        group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])

        group.add_subsystem('t_over_c_bsp', BsplinesComp(
            in_name='t_over_c_cp', out_name='t_over_c',
            num_control_points=n_cp, num_points=int(ny-1),
            bspline_order=min(n_cp, 4), distribution='uniform'),
            promotes_inputs=['t_over_c_cp'], promotes_outputs=['t_over_c'])

        comp = ViscousDrag(surface=surface, with_viscous=True)
        group.add_subsystem('viscousdrag', comp, promotes=['*'])

        run_test(self, group, complex_flag=True)
Ejemplo n.º 56
0
    def test(self):
        surface = get_default_surfaces()[0]

        comp = CreateRHS(surface=surface)

        run_test(self, comp)
Ejemplo n.º 57
0
    def test(self):
        surfaces = get_default_surfaces()

        comp = VLMMtxRHSComp(surfaces=surfaces)

        run_test(self, comp)
    def test(self):
        surfaces = get_default_surfaces()

        comp = CollocationPoints(surfaces=surfaces)

        run_test(self, comp)
Ejemplo n.º 59
0
    def test(self):
        surfaces = get_default_surfaces()

        comp = SumAreas(surfaces=surfaces)

        run_test(self, comp)