From c2b6ed21f7a76ddf7948362e179b3c9a54e179b6 Mon Sep 17 00:00:00 2001 From: Rob Falck Date: Wed, 13 Nov 2024 14:03:55 -0500 Subject: [PATCH] more debugging of water rocket cases. --- .github/workflows/dymos_tests_workflow.yml | 2 +- dymos/examples/water_rocket/phases.py | 2 +- .../water_rocket/test/test_water_rocket.py | 19 +++++++------------ .../water_rocket/water_engine_comp.py | 4 +++- dymos/phase/phase.py | 1 - 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dymos_tests_workflow.yml b/.github/workflows/dymos_tests_workflow.yml index 7540efb15..d9b1817a4 100644 --- a/.github/workflows/dymos_tests_workflow.yml +++ b/.github/workflows/dymos_tests_workflow.yml @@ -445,7 +445,7 @@ jobs: if [[ "${{ matrix.NAME }}" != "latest" ]]; then testflo dymos -n 4 --pre_announce --show_skipped --durations 20 --coverage --coverpkg dymos else - testflo dymos -n 4 --pre_announce --show_skipped --durations 20 + testflo dymos -n 4 --pre_announce --show_skipped --durations 20 -s fi - name: Submit coverage if: github.event_name != 'workflow_dispatch' diff --git a/dymos/examples/water_rocket/phases.py b/dymos/examples/water_rocket/phases.py index 43cd63ef6..ffc1d4154 100644 --- a/dymos/examples/water_rocket/phases.py +++ b/dymos/examples/water_rocket/phases.py @@ -94,7 +94,7 @@ def new_descent_phase(transcription): def new_water_rocket_trajectory(objective): - tx_prop = dm.Radau(num_segments=50, order=3, compressed=True) + tx_prop = dm.Radau(num_segments=10, order=3, compressed=True) tx_bal = dm.Radau(num_segments=10, order=3, compressed=True) tx_desc = dm.Radau(num_segments=10, order=3, compressed=True) traj = dm.Trajectory() diff --git a/dymos/examples/water_rocket/test/test_water_rocket.py b/dymos/examples/water_rocket/test/test_water_rocket.py index f9abcc17c..000f6ac23 100644 --- a/dymos/examples/water_rocket/test/test_water_rocket.py +++ b/dymos/examples/water_rocket/test/test_water_rocket.py @@ -18,7 +18,7 @@ @require_pyoptsparse(optimizer='IPOPT') -@use_tempdirs +# @use_tempdirs class TestWaterRocketForDocs(unittest.TestCase): @unittest.skipIf(mpl is None, "This test requires matplotlib") @@ -30,11 +30,8 @@ def test_water_rocket_height_for_docs(self): traj = p.model.add_subsystem('traj', traj) p.driver = om.pyOptSparseDriver(optimizer='IPOPT', print_results=False) - p.driver.opt_settings['mu_init'] = 1e-3 + p.driver.opt_settings['print_level'] = 5 p.driver.opt_settings['max_iter'] = 500 - p.driver.opt_settings['print_level'] = 0 - p.driver.opt_settings['nlp_scaling_method'] = 'gradient-based' # for faster convergence - p.driver.opt_settings['alpha_for_y'] = 'safer-min-dual-infeas' p.driver.opt_settings['mu_strategy'] = 'monotone' p.driver.declare_coloring(tol=1.0E-12) @@ -44,7 +41,8 @@ def test_water_rocket_height_for_docs(self): p.setup() set_sane_initial_guesses(phases) - dm.run_problem(p, run_driver=True, simulate=True) + dm.run_problem(p, run_driver=True, simulate=True, make_plots=True) + print(p.get_outputs_dir()) summary = summarize_results(p) for key, entry in summary.items(): @@ -57,7 +55,7 @@ def test_water_rocket_height_for_docs(self): plot_trajectory(p, exp_out) plot_states(p, exp_out) - # plt.show() + plt.show() # Check results (tolerance is relative unless value is zero) assert_near_equal(summary['Launch angle'].value, 85, 0.01) @@ -73,11 +71,8 @@ def test_water_rocket_range_for_docs(self): traj = p.model.add_subsystem('traj', traj) p.driver = om.pyOptSparseDriver(optimizer='IPOPT') - p.driver.opt_settings['mu_init'] = 1e-3 - p.driver.opt_settings['max_iter'] = 500 - p.driver.opt_settings['print_level'] = 0 - p.driver.opt_settings['nlp_scaling_method'] = 'gradient-based' # for faster convergence - p.driver.opt_settings['alpha_for_y'] = 'safer-min-dual-infeas' + p.driver.opt_settings['print_level'] = 5 + p.driver.opt_settings['max_iter'] = 300 p.driver.opt_settings['mu_strategy'] = 'monotone' p.driver.declare_coloring(tol=1.0E-12) diff --git a/dymos/examples/water_rocket/water_engine_comp.py b/dymos/examples/water_rocket/water_engine_comp.py index 9eae3d5c9..5f109d71a 100644 --- a/dymos/examples/water_rocket/water_engine_comp.py +++ b/dymos/examples/water_rocket/water_engine_comp.py @@ -34,6 +34,9 @@ def setup(self): subsys=_WaterThrust(num_nodes=nn), promotes=['rho_w', 'A_out', 'F']) + self.set_input_defaults('A_out', val=np.pi*13e-3**2/4*np.ones(nn)) + self.set_input_defaults('p', val=6.5e5*np.ones(nn)) + self.connect('water_exhaust_speed.v_out', 'water_flow_rate.v_out') self.connect('water_exhaust_speed.v_out', 'water_thrust.v_out') @@ -187,5 +190,4 @@ def compute_partials(self, inputs, partials): p = om.Problem() p.model = WaterEngine(num_nodes=1) p.setup() - p.check_config(checks=['unconnected_inputs'], out_file=None) p.final_setup() diff --git a/dymos/phase/phase.py b/dymos/phase/phase.py index 47623f0d4..b83fa50ee 100644 --- a/dymos/phase/phase.py +++ b/dymos/phase/phase.py @@ -1912,7 +1912,6 @@ def set_time_val(self, initial=None, duration=None, units=None): units : str or None Units of the time. If none are specified, the default units are used. """ - print(f'Setting times {self.pathname=} {initial=} {duration=}') if units is None: units = self.time_options['units'] if initial is not None: