Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added linear solver for cases where states solved via optimizer have input_initial=True #991

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -224,6 +224,7 @@ def two_burn_orbit_raise_problem(transcription='gauss-lobatto', optimizer='SLSQP
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.opt_settings['derivative_test'] = 'first-order'
if show_output:
p.driver.opt_settings['print_level'] = 5

Original file line number Diff line number Diff line change
@@ -39,8 +39,6 @@ def test_ex_two_burn_orbit_raise_connected(self):
compressed=False, optimizer=optimizer,
show_output=False, connected=True, run_driver=True)

p.check_totals(compact_print=True)

if p.model.traj.phases.burn2 in p.model.traj.phases._subsystems_myproc:
assert_near_equal(p.get_val('traj.burn2.states:deltav')[0], 0.3995,
tolerance=4.0E-3)
3 changes: 1 addition & 2 deletions dymos/transcriptions/pseudospectral/pseudospectral_base.py
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ def setup_states(self, phase):
if self.any_solved_segs or self.any_connected_opt_segs:
indep = StateIndependentsComp(grid_data=grid_data,
state_options=phase.state_options)
indep.linear_solver = om.DirectSolver()
else:
indep = om.IndepVarComp()

@@ -513,8 +514,6 @@ def configure_solvers(self, phase):
newton.options['stall_limit'] = 3
newton.linesearch = om.BoundsEnforceLS()

# even though you don't need a nl_solver for connections, you still ln_solver since its implicit
if self.any_solved_segs or self._implicit_duration:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the next 2 lines be de-dented?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, didn't notice the line cut. This is fine.

if isinstance(phase.linear_solver, om.LinearRunOnce):
phase.linear_solver = om.DirectSolver()