Skip to content

Commit

Permalink
Merge pull request OpenMDAO#542 from crecine/viscosity
Browse files Browse the repository at this point in the history
adding kinematic viscosity as a dynamic variable
  • Loading branch information
jkirk5 authored Sep 25, 2024
2 parents 35efb86 + dcc4b78 commit e7bacd9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 9 additions & 5 deletions aviary/subsystems/aerodynamics/gasp_based/gaspaero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion aviary/subsystems/aerodynamics/gasp_based/premission_aero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions aviary/variable_info/variable_meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": 'XKV',
"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,
Expand Down
1 change: 1 addition & 0 deletions aviary/variable_info/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e7bacd9

Please sign in to comment.