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

Error when running grid refinement with solve_segments='forward' #803

Open
1 of 4 tasks
kaushikponnapalli opened this issue Aug 11, 2022 · 0 comments
Open
1 of 4 tasks

Comments

@kaushikponnapalli
Copy link
Contributor

kaushikponnapalli commented Aug 11, 2022

Issue Type

  • Bug
  • Enhancement
  • Docs
  • Miscellaneous

Description

Using grid refinement on a problem with run_driver=True and solve_segments='forward' causes an array size mismatch error

Example

In test_aircraft_steady_flight.py changing line 105 to dm.run_problem(p, refine_iteration_limit=1) causes the test case test_ex_aircraft_steady_flight_solve to fail. The error is

File "/Users/kponnapa/codes/dymos/dymos/examples/aircraft_steady_flight/test/test_ex_aircraft_steady_flight.py", line 119, in test_ex_aircraft_steady_flight_solve p = ex_aircraft_steady_flight(optimizer='SLSQP', solve_segments='forward',

File "/Users/kponnapa/codes/dymos/dymos/examples/aircraft_steady_flight/test/test_ex_aircraft_steady_flight.py", line 105, in ex_aircraft_steady_flight dm.run_problem(p, refine_iteration_limit=1)

File "/Users/kponnapa/codes/dymos/dymos/run_problem.py", line 85, in run_problem failed = _refine_iter(problem, refine_iteration_limit, refine_method, case_prefix=case_prefix,

File "/Users/kponnapa/codes/dymos/dymos/grid_refinement/refinement.py", line 70, in _refine_iter failed = problem.run_driver(case_prefix=f'{_case_prefix}{refine_method}_{i}_')

File "/Users/kponnapa/codes/openmdao/openmdao/utils/hooks.py", line 130, in execute_hooks ret = f(*args, **kwargs)

File "/Users/kponnapa/codes/openmdao/openmdao/core/problem.py", line 856, in run_driver return self.driver.run()

File "/Users/kponnapa/codes/openmdao/openmdao/drivers/pyoptsparse_driver.py", line 321, in run coloring = self._get_coloring(run_model=not model_ran)

File "/Users/kponnapa/codes/openmdao/openmdao/utils/hooks.py", line 130, in execute_hooks ret = f(*args, **kwargs)

File "/Users/kponnapa/codes/openmdao/openmdao/core/driver.py", line 1290, in _get_coloring coloring = c_mod.dynamic_total_coloring(self, run_model=run_model,

File "/Users/kponnapa/codes/openmdao/openmdao/utils/coloring.py", line 1977, in dynamic_total_coloring coloring = compute_total_coloring(problem, num_full_jacs=num_full_jacs, tol=tol, orders=orders,

File "/Users/kponnapa/codes/openmdao/openmdao/utils/coloring.py", line 1911, in compute_total_coloring J, sparsity_info = _get_bool_total_jac(problem, num_full_jacs=num_full_jacs, tol=tol,

File "/Users/kponnapa/codes/openmdao/openmdao/utils/coloring.py", line 1649, in _get_bool_total_jac prob.run_model(reset_iter_counts=False)

File "/Users/kponnapa/codes/openmdao/openmdao/core/problem.py", line 810, in run_model self.model.run_solve_nonlinear()

File "/Users/kponnapa/codes/openmdao/openmdao/core/system.py", line 3992, in run_solve_nonlinear self._solve_nonlinear()

File "/Users/kponnapa/codes/openmdao/openmdao/core/group.py", line 2595, in _solve_nonlinear self._nonlinear_solver._solve_with_cache_check()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/nonlinear/nonlinear_runonce.py", line 26, in _solve_with_cache_check self.solve() # don't use caching

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/nonlinear/nonlinear_runonce.py", line 45, in solve self._gs_iter()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 787, in _gs_iter subsys._solve_nonlinear()

File "/Users/kponnapa/codes/openmdao/openmdao/core/group.py", line 2595, in _solve_nonlinear self._nonlinear_solver._solve_with_cache_check()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 825, in _solve_with_cache_check self.solve()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 583, in solve raise err

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 579, in solve self._solve()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 656, in _solve self._single_iteration()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/nonlinear/newton.py", line 241, in _single_iteration self.linesearch.solve()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 583, in solve raise err

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/solver.py", line 579, in solve self._solve()

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/linesearch/backtracking.py", line 233, in _solve self._enforce_bounds(step=du, alpha=1.0)

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/linesearch/backtracking.py", line 176, in _enforce_bounds _enforce_bounds_scalar(system._outputs, step, alpha, lower, upper)

File "/Users/kponnapa/codes/openmdao/openmdao/solvers/linesearch/backtracking.py", line 568, in _enforce_bounds_scalar change_lower = 0. if lower_bounds is None else np.maximum(u_data, lower_bounds) - u_data
ValueError: operands could not be broadcast together with shapes (4319,) (3752,)

Environment

Operating System: OS X 12.4
Python environment: Anaconda Python 3.9
Packages: Dymos v1.5.1dev0, OpenMDAO v3.19.1.dev0, pyoptsparse v2.8.3

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

No branches or pull requests

1 participant