Error estimation for grid refinement fails if rate_source is not an ODE output.
Issue Type
[x] Bug
[ ] Enhancement
Description
eval_ode_on_grid needs to account for situations where the rate source is another state, a control, control rate, time, or parameter.
Example
Running test_ex_aircraft_steady_flight with grid refinement enabled results in the following exception:
File "/home/travis/build/OpenMDAO/dymos/dymos/examples/aircraft_steady_flight/test/test_ex_aircraft_steady_flight.py", line 106, in ex_aircraft_steady_flight
dm.run_problem(p)
File "/home/travis/build/OpenMDAO/dymos/dymos/run_problem.py", line 115, in run_problem
_refine_iter(problem, refine_iteration_limit, refine_method, recorder_file)
File "/home/travis/build/OpenMDAO/dymos/dymos/grid_refinement/refinement.py", line 41, in _refine_iter
refine_results = check_error(phases)
File "/home/travis/build/OpenMDAO/dymos/dymos/grid_refinement/error_estimation.py", line 318, in check_error
x, _, _, f = eval_ode_on_grid(phase=phase, transcription=new_tx)
File "/home/travis/build/OpenMDAO/dymos/dymos/grid_refinement/error_estimation.py", line 211, in eval_ode_on_grid
f[name] = np.atleast_2d(p_refine.get_val(f'ode.{rate_source}', units=rate_units))
File "/home/travis/build/OpenMDAO/dymos/OpenMDAO/openmdao/core/problem.py", line 386, in get_val
from_src=True)
File "/home/travis/build/OpenMDAO/dymos/OpenMDAO/openmdao/core/system.py", line 4281, in get_val
raise KeyError('{}: Variable "{}" not found.'.format(self.msginfo, name))
KeyError: 'Group (<model>): Variable "ode.climb_rate" not found.'
Summary of Issue
Error estimation for grid refinement fails if rate_source is not an ODE output.
Issue Type
Description
eval_ode_on_grid
needs to account for situations where the rate source is another state, a control, control rate, time, or parameter.Example
Running test_ex_aircraft_steady_flight with grid refinement enabled results in the following exception:
Environment
N/A