Skip to content

Commit

Permalink
more debugging of water rocket cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
robfalck committed Nov 13, 2024
1 parent cfea6eb commit c2b6ed2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dymos_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion dymos/examples/water_rocket/phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 7 additions & 12 deletions dymos/examples/water_rocket/test/test_water_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand All @@ -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():
Expand All @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion dymos/examples/water_rocket/water_engine_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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()
1 change: 0 additions & 1 deletion dymos/phase/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c2b6ed2

Please sign in to comment.