From d203f44b430198d6718e8066c9d88268ce8ab5ef Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Mon, 23 Sep 2024 17:08:21 -0700 Subject: [PATCH 1/4] adding kinematic viscosity as a dynamic variable --- aviary/variable_info/variable_meta_data.py | 11 +++++++++++ aviary/variable_info/variables.py | 1 + 2 files changed, 12 insertions(+) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index df7ebe700..019ba467c 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -6461,6 +6461,17 @@ 'vehicle, used as an additional degree of control for hybrid engines' ) +add_meta_data( + Dynamic.Mission.KINEMATIC_VISCOSITY, + meta_data=_MetaData, + historical_name={"GASP": None, + "FLOPS": None, + "LEAPS1": None + }, + units='ft**2/s', + desc='Atmospheric kinematic viscosity at the vehicle\'s current flight condition' +) + add_meta_data( Dynamic.Mission.LIFT, meta_data=_MetaData, diff --git a/aviary/variable_info/variables.py b/aviary/variable_info/variables.py index b2c49ea6a..330fb7284 100644 --- a/aviary/variable_info/variables.py +++ b/aviary/variable_info/variables.py @@ -628,6 +628,7 @@ class Mission: FUEL_FLOW_RATE_NEGATIVE_TOTAL = 'fuel_flow_rate_negative_total' FUEL_FLOW_RATE_TOTAL = 'fuel_flow_rate_total' HYBRID_THROTTLE = 'hybrid_throttle' + KINEMATIC_VISCOSITY = 'kinematic_viscosity' LIFT = 'lift' MACH = 'mach' MACH_RATE = 'mach_rate' From 1fa8c25f95970259272ce6e58a8253b218140ecf Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Tue, 24 Sep 2024 09:22:54 -0700 Subject: [PATCH 2/4] converting kinemetic viscosity to a dynamic variable --- .../gasp_based/flaps_model/Cl_max.py | 6 +++--- .../gasp_based/flaps_model/flaps_model.py | 2 +- .../gasp_based/flaps_model/test/test_Clmax.py | 3 ++- .../flaps_model/test/test_flaps_group.py | 18 ++++++++++++------ .../aerodynamics/gasp_based/gaspaero.py | 14 +++++++++----- .../aerodynamics/gasp_based/premission_aero.py | 3 ++- .../gasp_based/test/test_gaspaero.py | 4 ++-- 7 files changed, 31 insertions(+), 19 deletions(-) diff --git a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/Cl_max.py b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/Cl_max.py index 6372a457e..50a4d47b4 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/Cl_max.py +++ b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/Cl_max.py @@ -113,7 +113,7 @@ def setup(self): self.add_input("fus_lift", val=0.05498, units='unitless', desc="DELCLF: fuselage lift increment") self.add_input( - "kinematic_viscosity", + Dynamic.Mission.KINEMATIC_VISCOSITY, val=0.15723e-03, units="ft**2/s", desc="XKV: kinematic viscosity", @@ -193,7 +193,7 @@ def setup_partials(self): self.declare_partials( "reynolds", [ - "kinematic_viscosity", + Dynamic.Mission.KINEMATIC_VISCOSITY, Dynamic.Mission.SPEED_OF_SOUND, Aircraft.Wing.AVERAGE_CHORD, Dynamic.Mission.STATIC_PRESSURE, @@ -243,7 +243,7 @@ def compute(self, inputs, outputs): wing_loading = inputs[Aircraft.Wing.LOADING] P = inputs[Dynamic.Mission.STATIC_PRESSURE] avg_chord = inputs[Aircraft.Wing.AVERAGE_CHORD] - kinematic_viscosity = inputs["kinematic_viscosity"] + kinematic_viscosity = inputs[Dynamic.Mission.KINEMATIC_VISCOSITY] max_lift_reference = inputs[Aircraft.Wing.MAX_LIFT_REF] leading_lift_increment = inputs[Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM] fus_lift = inputs["fus_lift"] diff --git a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/flaps_model.py b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/flaps_model.py index 54c842073..fa12a855a 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/flaps_model.py +++ b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/flaps_model.py @@ -56,7 +56,7 @@ def setup(self): promotes_inputs=[ Dynamic.Mission.SPEED_OF_SOUND, Dynamic.Mission.STATIC_PRESSURE, - "kinematic_viscosity", + Dynamic.Mission.KINEMATIC_VISCOSITY, "VLAM1", "VLAM2", "VLAM3", diff --git a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_Clmax.py b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_Clmax.py index cc96894ec..fbc47559b 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_Clmax.py +++ b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_Clmax.py @@ -44,7 +44,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) diff --git a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_flaps_group.py b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_flaps_group.py index 0bf9cb917..b7b78faed 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_flaps_group.py +++ b/aviary/subsystems/aerodynamics/gasp_based/flaps_model/test/test_flaps_group.py @@ -69,7 +69,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) @@ -171,7 +172,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) @@ -275,7 +277,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) @@ -377,7 +380,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) @@ -479,7 +483,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) @@ -582,7 +587,8 @@ def setUp(self): self.prob.set_val(Dynamic.Mission.STATIC_PRESSURE, (14.696 * 144), units="lbf/ft**2") self.prob.set_val(Aircraft.Wing.AVERAGE_CHORD, 12.61, units="ft") - self.prob.set_val("kinematic_viscosity", 0.15723e-3, units="ft**2/s") + self.prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, + 0.15723e-3, units="ft**2/s") self.prob.set_val(Aircraft.Wing.MAX_LIFT_REF, 1.150) self.prob.set_val(Aircraft.Wing.SLAT_LIFT_INCREMENT_OPTIMUM, 0.930) self.prob.set_val("fus_lift", 0.05498) diff --git a/aviary/subsystems/aerodynamics/gasp_based/gaspaero.py b/aviary/subsystems/aerodynamics/gasp_based/gaspaero.py index 2553c8174..656957688 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/gaspaero.py +++ b/aviary/subsystems/aerodynamics/gasp_based/gaspaero.py @@ -400,7 +400,7 @@ def setup(self): desc="Speed of sound at current altitude", ) self.add_input( - "nu", + Dynamic.Mission.KINEMATIC_VISCOSITY, val=1.0, units="ft**2/s", shape=nn, @@ -543,13 +543,16 @@ def setup_partials(self): # diag partials for SA5-SA7 self.declare_partials( - "SA5", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, "nu"], rows=ar, cols=ar, method="cs" + "SA5", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, + Dynamic.Mission.KINEMATIC_VISCOSITY], rows=ar, cols=ar, method="cs" ) self.declare_partials( - "SA6", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, "nu"], rows=ar, cols=ar, method="cs" + "SA6", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, + Dynamic.Mission.KINEMATIC_VISCOSITY], rows=ar, cols=ar, method="cs" ) self.declare_partials( - "SA7", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, "nu", "ufac"], rows=ar, cols=ar, method="cs" + "SA7", [Dynamic.Mission.MACH, Dynamic.Mission.SPEED_OF_SOUND, + Dynamic.Mission.KINEMATIC_VISCOSITY, "ufac"], rows=ar, cols=ar, method="cs" ) # dense partials for SA5-SA7 @@ -843,7 +846,8 @@ def setup(self): nu={"units": "ft**2/s", "shape": nn}, has_diag_partials=True, ), - promotes=["*", ('rho', Dynamic.Mission.DENSITY)], + promotes=["*", ('rho', Dynamic.Mission.DENSITY), + ('nu', Dynamic.Mission.KINEMATIC_VISCOSITY)], ) self.add_subsystem("geom", AeroGeom( diff --git a/aviary/subsystems/aerodynamics/gasp_based/premission_aero.py b/aviary/subsystems/aerodynamics/gasp_based/premission_aero.py index 619b5dd50..c1b32c6ec 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/premission_aero.py +++ b/aviary/subsystems/aerodynamics/gasp_based/premission_aero.py @@ -45,7 +45,8 @@ def setup(self): rho={"units": "slug/ft**3"}, kinematic_viscosity={"units": "ft**2/s"}, ), - promotes=["viscosity", "kinematic_viscosity", + promotes=["viscosity", + ("kinematic_viscosity", Dynamic.Mission.KINEMATIC_VISCOSITY), ("rho", Dynamic.Mission.DENSITY)], ) diff --git a/aviary/subsystems/aerodynamics/gasp_based/test/test_gaspaero.py b/aviary/subsystems/aerodynamics/gasp_based/test/test_gaspaero.py index 9cfb0d9a5..d2129cfd5 100644 --- a/aviary/subsystems/aerodynamics/gasp_based/test/test_gaspaero.py +++ b/aviary/subsystems/aerodynamics/gasp_based/test/test_gaspaero.py @@ -51,7 +51,7 @@ def test_cruise(self): prob.set_val(Dynamic.Mission.MACH, mach) prob.set_val("alpha", alpha) prob.set_val(Dynamic.Mission.SPEED_OF_SOUND, row["sos"]) - prob.set_val("nu", row["nu"]) + prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, row["nu"]) prob.run_model() @@ -89,7 +89,7 @@ def test_ground(self): prob.set_val(Dynamic.Mission.ALTITUDE, alt) prob.set_val("alpha", alpha) prob.set_val(Dynamic.Mission.SPEED_OF_SOUND, row["sos"]) - prob.set_val("nu", row["nu"]) + prob.set_val(Dynamic.Mission.KINEMATIC_VISCOSITY, row["nu"]) # note we're just letting the time ramps for flaps/gear default to the # takeoff config such that the default times correspond to full flap and From 407160a97e579d8598ac6f109dba9cd5dd3b880c Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Tue, 24 Sep 2024 09:31:30 -0700 Subject: [PATCH 3/4] added legacy name --- aviary/variable_info/variable_meta_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 019ba467c..9ffd83a21 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -6464,7 +6464,7 @@ add_meta_data( Dynamic.Mission.KINEMATIC_VISCOSITY, meta_data=_MetaData, - historical_name={"GASP": None, + historical_name={"GASP": 'XKV', "FLOPS": None, "LEAPS1": None }, From 2e6f8e167b4ac2059a5be8981b99b8a32c4c861e Mon Sep 17 00:00:00 2001 From: crecine <51181861+crecine@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:03:12 -0700 Subject: [PATCH 4/4] Update aviary/variable_info/variable_meta_data.py Co-authored-by: Jason Kirk <110835404+jkirk5@users.noreply.github.com> --- aviary/variable_info/variable_meta_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 9ffd83a21..f5ee5706a 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -6469,7 +6469,7 @@ "LEAPS1": None }, units='ft**2/s', - desc='Atmospheric kinematic viscosity at the vehicle\'s current flight condition' + desc="Atmospheric kinematic viscosity at the vehicle's current flight condition" ) add_meta_data(