From 4a9bb98633049cb2a0f88cfe9fe4de13deafd3dd Mon Sep 17 00:00:00 2001 From: Rob Falck Date: Tue, 17 Oct 2023 08:54:23 -0400 Subject: [PATCH] applied fixed load_case logic to deprecated load_case function for older versions of OpenMDAO. --- dymos/load_case.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dymos/load_case.py b/dymos/load_case.py index b16f5bfc8..5674b1edf 100644 --- a/dymos/load_case.py +++ b/dymos/load_case.py @@ -132,11 +132,15 @@ def load_case(problem, previous_solution, deprecation_warning=True): continue prev_time_val = prev_vars[prev_time_path]['val'] + t_initial = prev_time_val[0] + t_duration = prev_time_val[-1] - prev_time_val[0] prev_time_val, unique_idxs = np.unique(prev_time_val, return_index=True) prev_time_units = prev_vars[prev_time_path]['units'] - t_initial = prev_time_val[0] - t_duration = prev_time_val[-1] - prev_time_val[0] + if t_duration < 0: + # Unique sorts the data. In reverse-time phases, we need to undo it. + prev_time_val = np.flip(prev_time_val, axis=0) + unique_idxs = np.flip(unique_idxs, axis=0) ti_path = [s for s in phase_vars.keys() if s.endswith(f'{phase_name}.t_initial')] if ti_path: