From 7b8a681f9a8932518e99f4fb97f028d8920e3c26 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Wed, 2 Oct 2024 14:28:30 -0700 Subject: [PATCH] fixing values that changed when drag model changed --- aviary/interface/methods_for_level2.py | 1 + .../gasp_based/ode/test/test_ascent_ode.py | 2 +- .../ode/test/test_breguet_cruise_ode.py | 8 ++--- .../gasp_based/ode/test/test_climb_ode.py | 30 +++++++++---------- .../gasp_based/ode/test/test_descent_ode.py | 27 ++++++++--------- .../ode/test/test_flight_path_ode.py | 8 ++--- .../ode/test/test_groundroll_ode.py | 4 +-- .../gasp_based/ode/test/test_rotation_ode.py | 2 +- .../ode/time_integration_base_classes.py | 4 +++ 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/aviary/interface/methods_for_level2.py b/aviary/interface/methods_for_level2.py index 5c0936c85..98cd19190 100644 --- a/aviary/interface/methods_for_level2.py +++ b/aviary/interface/methods_for_level2.py @@ -1071,6 +1071,7 @@ def add_phases(self, phase_info_parameterization=None): src_indices=[-1], flat_src_indices=True, ) + self.traj = traj return traj def add_subsystem_timeseries_outputs(phase, phase_name): diff --git a/aviary/mission/gasp_based/ode/test/test_ascent_ode.py b/aviary/mission/gasp_based/ode/test/test_ascent_ode.py index 153f190cf..79484cc2c 100644 --- a/aviary/mission/gasp_based/ode/test/test_ascent_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_ascent_ode.py @@ -38,7 +38,7 @@ def test_ascent_partials(self): tol = tol = 1e-6 assert_near_equal( self.prob[Dynamic.Mission.VELOCITY_RATE], np.array( - [641174.75, 641174.75]), tol) + [641262, 641262]), tol) assert_near_equal( self.prob[Dynamic.Mission.FLIGHT_PATH_ANGLE_RATE], np.array( [2260.644, 2260.644]), tol) diff --git a/aviary/mission/gasp_based/ode/test/test_breguet_cruise_ode.py b/aviary/mission/gasp_based/ode/test/test_breguet_cruise_ode.py index 0539e8e93..dadf64f3c 100644 --- a/aviary/mission/gasp_based/ode/test/test_breguet_cruise_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_breguet_cruise_ode.py @@ -45,16 +45,16 @@ def test_cruise(self): [1.0, 1.0]), tol) assert_near_equal( self.prob[Dynamic.Mission.DISTANCE], np.array( - [0.0, 881.8116]), tol) + [0.0, 885.4400]), tol) assert_near_equal( self.prob["time"], np.array( - [0, 7906.83]), tol) + [0, 7939.36]), tol) assert_near_equal( self.prob[Dynamic.Mission.SPECIFIC_ENERGY_RATE_EXCESS], np.array( - [3.429719, 4.433518]), tol) + [3.46954168, 4.47480548]), tol) assert_near_equal( self.prob[Dynamic.Mission.ALTITUDE_RATE_MAX], np.array( - [-17.63194, -16.62814]), tol) + [-17.59211761, -16.58685381]), tol) partial_data = self.prob.check_partials( out_stream=None, method="cs", excludes=["*USatm*", "*params*", "*aero*"] diff --git a/aviary/mission/gasp_based/ode/test/test_climb_ode.py b/aviary/mission/gasp_based/ode/test/test_climb_ode.py index 9d8d5ebe9..9a8595247 100644 --- a/aviary/mission/gasp_based/ode/test/test_climb_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_climb_ode.py @@ -49,15 +49,14 @@ def test_start_of_climb(self): self.prob.run_model() testvals = { - "alpha": 5.16398, - "CL": 0.59766664, - "CD": 0.03070836, - Dynamic.Mission.ALTITUDE_RATE: 3414.63 / 60, # ft/s - # TAS (kts -> ft/s) * cos(gamma), 253.6827 * 1.68781 * cos(0.13331060446181708) - Dynamic.Mission.DISTANCE_RATE: 424.36918705874785, # ft/s + "alpha": 5.16376881, + "CL": 0.59764714, + "CD": 0.03056306, + Dynamic.Mission.ALTITUDE_RATE: 57.01361283, # ft/s + Dynamic.Mission.DISTANCE_RATE: 424.35532272, # ft/s Dynamic.Mission.FUEL_FLOW_RATE_NEGATIVE_TOTAL: -13448.29, # lbm/h - "theta": 0.22343879616956605, # rad (12.8021 deg) - Dynamic.Mission.FLIGHT_PATH_ANGLE: 0.13331060446181708, # rad (7.638135 deg) + "theta": 0.22367849, # rad + Dynamic.Mission.FLIGHT_PATH_ANGLE: 0.13355372, # rad } check_prob_outputs(self.prob, testvals, rtol=1e-6) @@ -87,15 +86,14 @@ def test_end_of_climb(self): self.prob.run_model() testvals = { - "alpha": [4.05559, 4.08245], - "CL": [0.512629, 0.617725], - "CD": [0.02692764, 0.03311237], - Dynamic.Mission.ALTITUDE_RATE: [3053.754 / 60, 429.665 / 60], # ft/s - # TAS (kts -> ft/s) * cos(gamma), [319, 459] kts - Dynamic.Mission.DISTANCE_RATE: [536.2835, 774.4118], # ft/s + "alpha": [4.05545557, 4.08244122], + "CL": [0.51261517, 0.61772367], + "CD": [0.02678719, 0.03296697], + Dynamic.Mission.ALTITUDE_RATE: [51.04282581, 7.34336078], # ft/s + Dynamic.Mission.DISTANCE_RATE: [536.26997036, 774.40958246], # ft/s Dynamic.Mission.FUEL_FLOW_RATE_NEGATIVE_TOTAL: [-11420.05, -6050.26], - "theta": [0.16540479, 0.08049912], # rad ([9.47699, 4.61226] deg), - Dynamic.Mission.FLIGHT_PATH_ANGLE: [0.09462135, 0.00924686], # rad, gamma + "theta": [0.16567639, 0.08073428], # rad + Dynamic.Mission.FLIGHT_PATH_ANGLE: [0.09489533, 0.00948224], # rad, gamma Dynamic.Mission.THRUST_TOTAL: [25560.51, 10784.25], } check_prob_outputs(self.prob, testvals, 1e-6) diff --git a/aviary/mission/gasp_based/ode/test/test_descent_ode.py b/aviary/mission/gasp_based/ode/test/test_descent_ode.py index 1c0fd0a1c..3c8f96276 100644 --- a/aviary/mission/gasp_based/ode/test/test_descent_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_descent_ode.py @@ -49,19 +49,17 @@ def test_high_alt(self): self.prob.run_model() testvals = { - "alpha": np.array([3.23388, 1.203234]), - "CL": np.array([0.51849367, 0.25908653]), - "CD": np.array([0.02794324, 0.01862946]), + "alpha": np.array([3.23393993, 1.20331298]), + "CL": np.array([0.51850073, 0.25909499]), + "CD": np.array([0.02780363, 0.01849853]), # ft/s - Dynamic.Mission.ALTITUDE_RATE: np.array([-2356.7705, -2877.9606]) / 60, - # TAS (ft/s) * cos(gamma), [458.67774, 437.62297] kts - Dynamic.Mission.DISTANCE_RATE: [773.1637, 737.0653], # ft/s + Dynamic.Mission.ALTITUDE_RATE: np.array([-39.07162618, -47.59435367]), + Dynamic.Mission.DISTANCE_RATE: [773.1742866, 737.08941812], # ft/s # lbm/h Dynamic.Mission.FUEL_FLOW_RATE_NEGATIVE_TOTAL: np.array([-451.0239, -997.1514]), "EAS": [417.87419406, 590.73344937], # ft/s ([247.58367, 349.99997] kts) Dynamic.Mission.MACH: [0.8, 0.697266], - # gamma, rad ([-2.908332, -3.723388] deg) - Dynamic.Mission.FLIGHT_PATH_ANGLE: [-0.05075997, -0.06498538], + Dynamic.Mission.FLIGHT_PATH_ANGLE: [-0.0504911, -0.06448115], } check_prob_outputs(self.prob, testvals, rtol=1e-6) @@ -87,14 +85,13 @@ def test_low_alt(self): self.prob.run_model() testvals = { - "alpha": 4.19956, - "CL": 0.507578, - "CD": 0.0268404, - Dynamic.Mission.ALTITUDE_RATE: -1138.583 / 60, - # TAS (ft/s) * cos(gamma) = 255.5613 * 1.68781 * cos(-0.0440083) - Dynamic.Mission.DISTANCE_RATE: 430.9213, + "alpha": 4.19962426, + "CL": 0.50758417, + "CD": 0.02670105, + Dynamic.Mission.ALTITUDE_RATE: -18.85828188, + Dynamic.Mission.DISTANCE_RATE: 430.92650383, Dynamic.Mission.FUEL_FLOW_RATE_NEGATIVE_TOTAL: -1295.11, - Dynamic.Mission.FLIGHT_PATH_ANGLE: -0.0440083, # rad (-2.52149 deg) + Dynamic.Mission.FLIGHT_PATH_ANGLE: -0.04373427, # rad (-2.52149 deg) } check_prob_outputs(self.prob, testvals, rtol=1e-6) diff --git a/aviary/mission/gasp_based/ode/test/test_flight_path_ode.py b/aviary/mission/gasp_based/ode/test/test_flight_path_ode.py index a1c188f73..43433c60e 100644 --- a/aviary/mission/gasp_based/ode/test/test_flight_path_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_flight_path_ode.py @@ -39,7 +39,7 @@ def test_case1(self): self.prob.run_model() testvals = { - Dynamic.Mission.VELOCITY_RATE: [14.0673, 14.0673], + Dynamic.Mission.VELOCITY_RATE: [14.06928293, 14.06928293], Dynamic.Mission.FLIGHT_PATH_ANGLE_RATE: [-0.1429133, -0.1429133], Dynamic.Mission.ALTITUDE_RATE: [0.0, 0.0], Dynamic.Mission.DISTANCE_RATE: [168.781, 168.781], @@ -47,7 +47,7 @@ def test_case1(self): "fuselage_pitch": [0.0, 0.0], "load_factor": [0.2508988, 0.2508988], Dynamic.Mission.ALTITUDE_RATE: [0.0, 0.0], - Dynamic.Mission.ALTITUDE_RATE_MAX: [-0.01812796, -0.01812796], + Dynamic.Mission.ALTITUDE_RATE_MAX: [-0.0181305, -0.0181305], } check_prob_outputs(self.prob, testvals, rtol=1e-6) @@ -77,12 +77,12 @@ def test_case2(self): self.prob.run_model() testvals = { - Dynamic.Mission.VELOCITY_RATE: [13.58489, 13.58489], + Dynamic.Mission.VELOCITY_RATE: [13.58686175, 13.58686175], Dynamic.Mission.DISTANCE_RATE: [168.781, 168.781], "normal_force": [74910.12, 74910.12], "fuselage_pitch": [0.0, 0.0], "load_factor": [0.2508988, 0.2508988], - Dynamic.Mission.ALTITUDE_RATE_MAX: [0.7532356, 0.7532356], + Dynamic.Mission.ALTITUDE_RATE_MAX: [0.75323307, 0.75323307], } check_prob_outputs(self.prob, testvals, rtol=1e-6) diff --git a/aviary/mission/gasp_based/ode/test/test_groundroll_ode.py b/aviary/mission/gasp_based/ode/test/test_groundroll_ode.py index d204fc4c6..36b88a834 100644 --- a/aviary/mission/gasp_based/ode/test/test_groundroll_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_groundroll_ode.py @@ -38,13 +38,13 @@ def test_groundroll_partials(self): self.prob.run_model() testvals = { - Dynamic.Mission.VELOCITY_RATE: [1413548.36, 1413548.36], + Dynamic.Mission.VELOCITY_RATE: [1413741.12, 1413741.12], Dynamic.Mission.FLIGHT_PATH_ANGLE_RATE: [0.0, 0.0], Dynamic.Mission.ALTITUDE_RATE: [0.0, 0.0], Dynamic.Mission.DISTANCE_RATE: [168.781, 168.781], "normal_force": [0.0, 0.0], "fuselage_pitch": [0.0, 0.0], - "dmass_dv": [-5.03252493e-06, -5.03252493e-06], + "dmass_dv": [-5.03183878e-06, -5.03183878e-06], } check_prob_outputs(self.prob, testvals, rtol=1e-6) diff --git a/aviary/mission/gasp_based/ode/test/test_rotation_ode.py b/aviary/mission/gasp_based/ode/test/test_rotation_ode.py index b2f71860d..64324834b 100644 --- a/aviary/mission/gasp_based/ode/test/test_rotation_ode.py +++ b/aviary/mission/gasp_based/ode/test/test_rotation_ode.py @@ -41,7 +41,7 @@ def test_rotation_partials(self): tol = 1e-6 assert_near_equal( self.prob[Dynamic.Mission.VELOCITY_RATE], np.array( - [13.66655, 13.66655]), tol) + [13.66852121, 13.66852121]), tol) assert_near_equal( self.prob[Dynamic.Mission.FLIGHT_PATH_ANGLE_RATE], np.array( [0.0, 0.0]), tol) diff --git a/aviary/mission/gasp_based/ode/time_integration_base_classes.py b/aviary/mission/gasp_based/ode/time_integration_base_classes.py index 85ab1e42b..6d7b85001 100644 --- a/aviary/mission/gasp_based/ode/time_integration_base_classes.py +++ b/aviary/mission/gasp_based/ode/time_integration_base_classes.py @@ -448,6 +448,10 @@ def initialize(self, verbosity=Verbosity.QUIET): self.adjoint_int_opts['nsteps'] = 5000 self.adjoint_int_opts['name'] = "dop853" + def add_parameter(self, name, units=None, **kwargs): + self.add_input('parameters:'+name, units=units) + self.options["param_dict"].get(name, {}).update({'units': units}) + def setup_params( self, ODEs,