def test_combined(self):

        c = {'root':
                {'class': 'Group',
                 'components':
                    [
                    {'name': 'x_c',
                    'class': 'IndepVarComp',
                    'parameter': ['p0', 6.],
                    'promotes': ['*']},
                    {'name': 'x_div',
                    'class': 'ExecComp',
                    'expr': ['x = p0 / 2.'],
                    'parameters': {'p0': 25.},
                    'promotes': ['*']},
                    {'name': 'simple',
                     'class': 'fusedwind.core.test.simple_comps.SimpleComp',
                     'parameters':
                            {'multiplier': 4.},
                      'promotes': ['*']}]}}

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['x'], 3.)
        self.assertEqual(p['y'], 12.)
    def test_listindeps(self):

        c = {'root':
                {'class': 'Group',
                 'components':
                    [
                    {'name': 'x_c',
                    'class': 'IndepVarComp',
                    'parameter': ['p0', 6.],
                    'promotes': ['*']}]}}
        yaml.dump(c, open('simple.yml', 'w'))
        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        self.assertEqual(p.list_indepvars(), ['p0'])
    def test_exec(self):
        c = {'root':
                {'class': 'Group',
                 'components':
                    [
                    {'name': 'x_div',
                    'class': 'ExecComp',
                    'expr': ['p1 = p0 * 4', 'x = p1 / 2.'],
                    'parameters': {'p0': 25.},
                    'promotes': ['*']}]}}

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['p0'], 25.)
        self.assertEqual(p['x'], 50.)
Esempio n. 4
0
    def test_listindeps(self):

        c = {
            'root': {
                'class':
                'Group',
                'components': [{
                    'name': 'x_c',
                    'class': 'IndepVarComp',
                    'parameter': ['p0', 6.],
                    'promotes': ['*']
                }]
            }
        }
        yaml.dump(c, open('simple.yml', 'w'))
        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        self.assertEqual(p.list_indepvars(), ['p0'])
    def test_simple(self):

        c = {'root':
                {'class': 'Group',
                 'components':
                    [
                    {'name': 'simple',
                     'class': 'fusedwind.core.test.simple_comps.SimpleComp',
                     'parameters':
                            {'multiplier': 4.},
                      'promotes': ['*']}]}}

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['x'], 3.)
        self.assertEqual(p['y'], 12.)
Esempio n. 6
0
def configure():
    """
    configures a test problem with an IndepVarComp,
    ExecComp, and a simple multiplier comp
    """

    c = {
        'root': {
            'class':
            'Group',
            'components': [{
                'name': 'x_c',
                'class': 'IndepVarComp',
                'parameter': ['p0', 6.],
                'promotes': ['*']
            }, {
                'name': 'x_div',
                'class': 'ExecComp',
                'expr': ['x = p0 / 2.'],
                'parameters': {
                    'p0': 25.
                },
                'promotes': ['*']
            }, {
                'name': 'simple',
                'class': 'fusedwind.core.test.simple_comps.SimpleComp',
                'parameters': {
                    'multiplier': 4.
                },
                'promotes': ['*']
            }]
        }
    }

    yaml.dump(c, open('simple.yml', 'w'))

    p = FUSEDProblem(filename='simple.yml')

    return p
Esempio n. 7
0
    def test_combined(self):

        c = {
            'root': {
                'class':
                'Group',
                'components': [{
                    'name': 'x_c',
                    'class': 'IndepVarComp',
                    'parameter': ['p0', 6.],
                    'promotes': ['*']
                }, {
                    'name': 'x_div',
                    'class': 'ExecComp',
                    'expr': ['x = p0 / 2.'],
                    'parameters': {
                        'p0': 25.
                    },
                    'promotes': ['*']
                }, {
                    'name': 'simple',
                    'class': 'fusedwind.core.test.simple_comps.SimpleComp',
                    'parameters': {
                        'multiplier': 4.
                    },
                    'promotes': ['*']
                }]
            }
        }

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['x'], 3.)
        self.assertEqual(p['y'], 12.)
Esempio n. 8
0
    def test_simple(self):

        c = {
            'root': {
                'class':
                'Group',
                'components': [{
                    'name': 'simple',
                    'class': 'fusedwind.core.test.simple_comps.SimpleComp',
                    'parameters': {
                        'multiplier': 4.
                    },
                    'promotes': ['*']
                }]
            }
        }

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['x'], 3.)
        self.assertEqual(p['y'], 12.)
Esempio n. 9
0
    def test_exec(self):
        c = {
            'root': {
                'class':
                'Group',
                'components': [{
                    'name': 'x_div',
                    'class': 'ExecComp',
                    'expr': ['p1 = p0 * 4', 'x = p1 / 2.'],
                    'parameters': {
                        'p0': 25.
                    },
                    'promotes': ['*']
                }]
            }
        }

        yaml.dump(c, open('simple.yml', 'w'))

        p = FUSEDProblem(filename='simple.yml')
        p.setup()
        p.run()
        self.assertEqual(p['p0'], 25.)
        self.assertEqual(p['x'], 50.)