Beispiel #1
0
    def test_aerostruct_optimization_symmetry(self):
        OAS_prob = OASProblem({'type': 'aerostruct', 'optimize': True})
        surf_dict = {
            'symmetry': True,
            'num_y': 13,
            'num_x': 2,
            'wing_type': 'CRM',
            'CL0': 0.2,
            'CD0': 0.015
        }
        OAS_prob.add_surface(surf_dict)
        OAS_prob.setup()

        OAS_prob.add_desvar('wing.twist_cp', lower=-15., upper=15.)
        OAS_prob.add_desvar('wing.thickness_cp',
                            lower=0.01,
                            upper=0.25,
                            scaler=1e2)
        OAS_prob.add_constraint('wing_perf.failure', upper=0.)
        OAS_prob.add_desvar('alpha', lower=-10., upper=10.)
        OAS_prob.add_constraint('eq_con', equals=0.)
        OAS_prob.add_objective('fuelburn', scaler=1e-4)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['fuelburn'], 80248.113842385414, places=0)
        self.assertAlmostEqual(prob['wing_perf.failure'], 1e-9)
Beispiel #2
0
    def test_aero_multiple_opt(self):
        OAS_prob = OASProblem({'type': 'aero', 'optimize': True})
        surf_dict = {
            'name': 'wing',
            'span': 5.,
            'num_y': 3,
            'span_cos_spacing': 0.
        }
        OAS_prob.add_surface(surf_dict)
        surf_dict.update({
            'name': 'tail',
            'offset': numpy.array([0., 0., 10.])
        })
        OAS_prob.add_surface(surf_dict)
        OAS_prob.setup()

        OAS_prob.add_desvar('tail.twist_cp', lower=-10., upper=15.)
        OAS_prob.add_desvar('tail.sweep', lower=10., upper=30.)
        OAS_prob.add_desvar('tail.dihedral', lower=-10., upper=20.)
        OAS_prob.add_desvar('tail.taper', lower=.5, upper=2.)
        OAS_prob.add_constraint('tail_perf.CL', equals=0.5)
        OAS_prob.add_objective('tail_perf.CD', scaler=1e4)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['wing_perf.CL'],
                               .41543435621928004,
                               places=5)
        self.assertAlmostEqual(prob['tail_perf.CL'], .5, places=5)
        self.assertAlmostEqual(prob['wing_perf.CD'],
                               .0075400306289957033,
                               places=5)
        self.assertAlmostEqual(prob['tail_perf.CD'],
                               .00791118243006308,
                               places=5)
Beispiel #3
0
    def test_struct_optimization(self):
        OAS_prob = OASProblem({'type' : 'struct',
                               'optimize' : True})
        OAS_prob.add_surface()
        OAS_prob.setup()

        OAS_prob.add_desvar('thickness_cp', lower=0.01, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('failure', upper=0.)
        OAS_prob.add_objective('weight', scaler=1e-3)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['weight'], 2010.4792274, places=2)
Beispiel #4
0
    def test_struct_optimization_symmetry(self):
        OAS_prob = OASProblem({'type' : 'struct',
                               'optimize' : True})
        surf_dict = {'symmetry' : True}
        OAS_prob.add_surface(surf_dict)
        OAS_prob.setup()

        OAS_prob.add_desvar('thickness_cp', lower=0.01, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('failure', upper=0.)
        OAS_prob.add_objective('weight', scaler=1e-3)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['weight'], 1908.6362044761127, places=2)
Beispiel #5
0
    def test_aero_optimization_flat(self):
        OAS_prob = OASProblem({'type' : 'aero',
                               'optimize' : True})
        OAS_prob.add_surface()
        OAS_prob.setup()

        OAS_prob.add_desvar('twist_cp', lower=-10., upper=15.)
        OAS_prob.add_desvar('sweep', lower=10., upper=30.)
        OAS_prob.add_desvar('dihedral', lower=-10., upper=20.)
        OAS_prob.add_desvar('taper', lower=.5, upper=2.)
        OAS_prob.add_constraint('CL', equals=0.5)
        OAS_prob.add_objective('CD', scaler=1e4)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['CD'], .004048702908627036, places=5)
Beispiel #6
0
    def test_aerostruct_optimization_symmetry_multiple(self):
        OAS_prob = OASProblem({'type' : 'aerostruct',
                               'optimize' : True})
        surf_dict = {'name' : 'wing',
                     'symmetry' : True,
                     'num_y' : 13,
                     'num_x' : 2,
                     'wing_type' : 'CRM',
                     'CL0' : 0.2,
                     'CD0' : 0.015}
        OAS_prob.add_surface(surf_dict)
        surf_dict.update({'name' : 'tail',
                          'offset':numpy.array([0., 0., 1.e7])})
        OAS_prob.add_surface(surf_dict)
        OAS_prob.setup()

        OAS_prob.add_desvar('wing_twist_cp', lower=-15., upper=15.)
        OAS_prob.add_desvar('wing_thickness_cp', lower=0.01, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('wing_failure', upper=0.)
        OAS_prob.add_desvar('tail_twist_cp', lower=-15., upper=15.)
        OAS_prob.add_desvar('tail_thickness_cp', lower=0.01, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('tail_failure', upper=0.)

        OAS_prob.add_desvar('alpha', lower=-10., upper=10.)
        OAS_prob.add_constraint('eq_con', equals=0.)
        OAS_prob.add_objective('fuelburn', scaler=1e-5)

        OAS_prob.run()
        prob = OAS_prob.prob
        self.assertAlmostEqual(prob['fuelburn'], 1708184.640125683, places=0)
        self.assertAlmostEqual(prob['wing_failure'], 1e-9)
        self.assertAlmostEqual(numpy.linalg.norm(prob['wing_twist_cp']), numpy.linalg.norm(prob['tail_twist_cp']), places=3)
Beispiel #7
0
        'name': 'wing',
        'symmetry': True,
        'num_y': 5,
        'num_x': 3
    })

    # Single lifting surface
    if not sys.argv[1].endswith('m'):

        # Setup problem and add design variables, constraint, and objective
        OAS_prob.setup()
        OAS_prob.add_desvar('wing.twist_cp', lower=-10., upper=15.)
        OAS_prob.add_desvar('wing.sweep', lower=10., upper=30.)
        OAS_prob.add_desvar('wing.dihedral', lower=-10., upper=20.)
        OAS_prob.add_desvar('wing.taper', lower=.5, upper=2.)
        OAS_prob.add_constraint('wing_perf.CL', equals=0.5)
        OAS_prob.add_objective('wing_perf.CD', scaler=1e4)

    # Multiple lifting surfaces
    else:

        # Add additional lifting surface
        OAS_prob.add_surface({
            'name': 'tail',
            'span': 3.,
            'offset': numpy.array([5., 0., 1.])
        })

        # Setup problem and add design variables, constraints, and objective
        OAS_prob.setup()
        prob_dict.update({'optimize' : False})
    else:  # perform optimization
        prob_dict.update({'optimize' : True})

    # Instantiate problem and add default surface
    OAS_prob = OASProblem(prob_dict)
    OAS_prob.add_surface({'name' : 'wing',
                          'num_y' : 5})

    # Single lifting surface
    if not sys.argv[1].endswith('m'):

        # Setup problem and add design variables, constraint, and objective
        OAS_prob.setup()
        OAS_prob.add_desvar('wing.thickness_cp', lower=0.001, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('wing.failure', upper=0.)
        OAS_prob.add_objective('wing.weight', scaler=1e-3)

    # Multiple lifting surfaces
    else:

        # Add additional lifting surface
        OAS_prob.add_surface({'name' : 'tail',
                              'span' : 3.,
                              'offset' : numpy.array([10., 0., 0.])})

        # Setup problem and add design variables, constraints, and objective
        OAS_prob.setup()

        OAS_prob.add_desvar('wing.thickness_cp', lower=0.001, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('wing.failure', upper=0.)
Beispiel #9
0
                 'num_x' : 2,
                 'wing_type' : 'CRM',
                 'CL0' : 0.2,
                 'CD0' : 0.015}

    # Add the specified wing surface to the problem
    OAS_prob.add_surface(surf_dict)

    # Single lifting surface
    if not sys.argv[1].endswith('m'):

        # Setup problem and add design variables, constraint, and objective
        OAS_prob.setup()
        OAS_prob.add_desvar('wing_twist_cp', lower=-15., upper=15.)
        OAS_prob.add_desvar('wing_thickness_cp', lower=0.01, upper=0.25, scaler=1e2)
        OAS_prob.add_constraint('wing_failure', upper=0.)

    # Multiple lifting surfaces
    else:

        # Add additional lifting surface
        surf_dict.update({'name' : 'tail',
                          'offset':numpy.array([10., 0., 10.])})
        OAS_prob.add_surface(surf_dict)

        # Setup problem and add design variables, constraints, and objective
        OAS_prob.setup()

        # Add design variables and constraints for both the wing and tail
        OAS_prob.add_desvar('wing_twist_cp', lower=-15., upper=15.)
        OAS_prob.add_desvar('wing_thickness_cp', lower=0.01, upper=0.25, scaler=1e2)