def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.dis1.x1 = 1.0 prob.dis2.y1 = 3.16 prob.dis1.y2 = 0.0 prob.run() # In the top workflow, the subdrivers should each become a PA. PA1 = prob.driver.workflow._derivative_graph.node['~localopt1'][ 'pa_object'] self.assertEqual(PA1.itercomps, ['localopt1']) PA2 = prob.driver.workflow._derivative_graph.node['~localopt2'][ 'pa_object'] self.assertEqual(PA2.itercomps, ['localopt2']) assert_rel_error(self, prob.global_des_var_targets[0], 2.0, 0.1) assert_rel_error(self, 1.0 - prob.global_des_var_targets[1], 1.0, 0.01) assert_rel_error(self, 1.0 - prob.local_des_var_targets[0], 1.0, 0.1)
def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.dis1.x1 = 1.0 prob.dis2.y1 = 3.16 prob.dis1.y2 = 0.0 prob.run() # In the top workflow, the subdrivers should each become a PA. self.assertTrue(len(prob.driver.workflow._system.subsystems()) == 10) comp_list = prob.driver.workflow._system.subsystems()[5]._nodes self.assertTrue(len(comp_list) == 1) self.assertTrue(('localopt2',) in comp_list) comp_list = prob.driver.workflow._system.subsystems()[6]._nodes self.assertTrue(len(comp_list) == 1) self.assertTrue(('localopt1',) in comp_list) assert_rel_error(self, prob.global_des_var_targets[0], 2.0, 0.1) assert_rel_error(self, 1.0-prob.global_des_var_targets[1], 1.0, 0.01) assert_rel_error(self, 1.0-prob.local_des_var_targets[0], 1.0, 0.1)
def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.dis1.x1 = 1.0 prob.dis2.y1 = 3.16 prob.dis1.y2 = 0.0 prob.run() # In the top workflow, the subdrivers should each become a PA. PA1 = prob.driver.workflow._derivative_graph.node['~localopt1']['pa_object'] self.assertEqual( PA1.itercomps, ['localopt1']) PA2 = prob.driver.workflow._derivative_graph.node['~localopt2']['pa_object'] self.assertEqual( PA2.itercomps, ['localopt2']) assert_rel_error(self, prob.global_des_var_targets[0], 2.0, 0.1) assert_rel_error(self, 1.0-prob.global_des_var_targets[1], 1.0, 0.01) assert_rel_error(self, 1.0-prob.local_des_var_targets[0], 1.0, 0.1)
def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.z1_t = 5.0 prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.z2_t = 2.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.x1_t = 1.0 prob.dis1.x1 = 1.0 prob.y1_t = 3.16 prob.dis2.y1 = 3.16 prob.y2_t = 0.0 prob.dis1.y2 = 0.0 prob.run() assert_rel_error(self, prob.z1_t, 2.0, 0.1) assert_rel_error(self, 1.0-prob.z2_t, 1.0, 0.01) assert_rel_error(self, 1.0-prob.x1_t, 1.0, 0.1)
def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.dis1.x1 = 1.0 prob.dis2.y1 = 3.16 prob.dis1.y2 = 0.0 prob.run() assert_rel_error(self, prob.global_des_var_targets[0], 2.0, 0.1) assert_rel_error(self, 1.0 - prob.global_des_var_targets[1], 1.0, 0.01) assert_rel_error(self, 1.0 - prob.local_des_var_targets[0], 1.0, 0.1)
def test_CO(self): prob = SellarCO() set_as_top(prob) # Set up initial conditions prob.dis1.z1 = 5.0 prob.dis2.z1 = 5.0 prob.dis1.z2 = 2.0 prob.dis2.z2 = 2.0 prob.dis1.x1 = 1.0 prob.dis2.y1 = 3.16 prob.dis1.y2 = 0.0 prob.run() assert_rel_error(self, prob.global_des_var_targets[0], 2.0, 0.1) assert_rel_error(self, 1.0-prob.global_des_var_targets[1], 1.0, 0.01) assert_rel_error(self, 1.0-prob.local_des_var_targets[0], 1.0, 0.1)