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 default_nonlinear_solver and default_linear_solver options to Trajectory. #1016

Merged
merged 13 commits into from
Nov 15, 2023

Conversation

robfalck
Copy link
Contributor

@robfalck robfalck commented Nov 3, 2023

Summary

Trajectories require some form of nonlinear solver and linear solver when running connected phases in parallel (under MPI).
Trajectory will now automatically assign NonlinearBlocJac and PETScKrylov if the default "run once" solvers are in place.

Option record_inputs is now set to the default False value for the dymos solution and simulation recorders.

Related Issues

Backwards incompatibilities

Inputs will no longer be recorded by default. This can be changed by setting problem.recording_options['record_inputs'] = True.

New Dependencies

None

@coveralls
Copy link

coveralls commented Nov 6, 2023

Coverage Status

coverage: 91.776% (-0.7%) from 92.459%
when pulling a53266a on robfalck:i1014
into 8bfc904 on OpenMDAO:master.

# Verify that the second case has the same inputs and outputs
assert_cases_equal(case1, p, tol=1.0E-9, require_same_vars=False)
assert_cases_equal(sim_case1, sim_case2, tol=1.0E-8)
if MPI:
Copy link
Contributor

Choose a reason for hiding this comment

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

this conditional appears to be redundant with the test decorator...

@@ -75,8 +75,7 @@ def run_problem(problem, refine_method='hp', refine_iteration_limit=0, run_drive
if solution_record_file not in [rec._filepath for rec in iter(problem._rec_mgr)]:
recorder = om.SqliteRecorder(solution_record_file)
problem.add_recorder(recorder)
# record_inputs is needed to capture potential input parameters that aren't connected
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove the inputs from the case recorder?

I mostly ask this because today, I read in a case db from an Aviary run and did a list_inputs on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be unnecessary now since everything is ultimately an output. This was also a fast way around an openmdao bug in set val when it attempts to set a remote input. There is an issue up for that, but I thought it made sense to stop recording redundant data

@@ -831,12 +831,6 @@ def test_simulate_array_param(self):

assert_near_equal(sol - sim, np.zeros_like(sol))

# Test that the parameter is available in the solution and simulation files
Copy link
Member

Choose a reason for hiding this comment

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

This was removed because we don't record inputs anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

These solvers can be changed through the
'default_nonlinear_solver' and 'default_linear_solver' options.
"""
if self._has_connected_phases and MPI and self.comm.size > 1:
Copy link
Member

Choose a reason for hiding this comment

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

Just for clarification, why are the solvers only needed under MPI for the connected phases?

Copy link
Contributor Author

@robfalck robfalck Nov 13, 2023

Choose a reason for hiding this comment

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

Phases are run simultaneously under MPI. If one is directly connected to another, then NLBlockJac is necessary to make sure the inputs and outputs are all in agreement

Copy link
Member

Choose a reason for hiding this comment

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

Wait, there is an actual data connection between subsystems in a parallel group? I guess I would have to think about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a less used capability to link phases by connection instead of constraint. If you do that under MPI then a solver is necessary

@robfalck robfalck merged commit 37bb5dd into OpenMDAO:master Nov 15, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dymos should no longer record inputs by default. Allow Trajectory to automatically assign solvers to phases
5 participants