From 980048ad003ccadde589d9b98b67c5e68156179b Mon Sep 17 00:00:00 2001 From: Manning Date: Tue, 25 Jun 2024 11:31:33 -0400 Subject: [PATCH 01/17] A cleaner solution that targets errors surrounding modeling aircraft with only fuselage engines --- .../mass/flops_based/landing_gear.py | 10 ++++--- .../mass/flops_based/wing_detailed.py | 27 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index 56c9e4879..a465bbe82 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -285,8 +285,14 @@ def setup(self): add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, val=np.zeros(count)) - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + + if num_wing_engines > 0: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros((count, int(num_wing_engines[0]/2)))) + else: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=[[0]]) + add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) @@ -300,7 +306,6 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): # TODO temp using first engine, multi-engine not supported num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] - y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] # TODO: high engine-count configuation. @@ -340,7 +345,6 @@ def compute_partials(self, inputs, partials, discrete_inputs=None): # TODO temp using first engine, multi-engine not supported num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] - y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] y_eng_aft = 0 diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 1bd420c56..4349ee08e 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -49,8 +49,12 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + if total_num_wing_engines > 0: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros(int(total_num_wing_engines/2))) + else: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) @@ -196,13 +200,24 @@ def compute(self, inputs, outputs): eel = np.zeros(len(dy) + 1, dtype=chord.dtype) # BUG this is broken for wing engine locations of zero or above last integration station point (around 0.9-0.95) - loc = np.where(integration_stations < engine_locations[idx:idx2][0])[0] - eel[loc] = 1.0 + + if num_wing_engines > 0: + loc = np.where(integration_stations < engine_locations[idx:idx2][0])[0] + eel[loc] = 1.0 + + delme = dy * eel[1:] + + delme[loc[-1]] = engine_locations[idx:idx2][0] - \ + integration_stations[loc[-1]] + else: + loc = np.where(integration_stations < engine_locations[idx:idx2])[0] + eel[loc] = 1.0 + + delme = dy * eel[1:] - delme = dy * eel[1:] + delme[loc] = engine_locations[idx:idx2] - \ + integration_stations[loc] - delme[loc[-1]] = engine_locations[idx:idx2][0] - \ - integration_stations[loc[-1]] eem = delme * csw eem = np.cumsum(eem[::-1])[::-1] From ea59afe35d5bebac7196b2377f6ec1f596e063db Mon Sep 17 00:00:00 2001 From: Dawson M <165822740+Dawson-Manning@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:01:45 -0400 Subject: [PATCH 02/17] landing_gear.py --- aviary/subsystems/mass/flops_based/landing_gear.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index 6395c1c3b..e3cc4424a 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -287,8 +287,12 @@ def setup(self): add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, val=np.zeros(num_engine_type)) - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) + if num_wing_engines > 0: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=np.zeros((int(num_wing_engines[0]/2)))) + else: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=[[0]]) add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) From fe47b13e2c863e57558bb38eeffefb0bb3019c2f Mon Sep 17 00:00:00 2001 From: Dawson M <165822740+Dawson-Manning@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:03:31 -0400 Subject: [PATCH 03/17] wing_detailed.py --- .../mass/flops_based/wing_detailed.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 81ddc32fd..59ca2f004 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -50,8 +50,12 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + if total_num_wing_engines > 0: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros(int(total_num_wing_engines/2))) + else: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) @@ -196,8 +200,10 @@ def compute(self, inputs, outputs): for i in range(num_engine_type): # idx2 is the last index for the range of engines of this type idx2 = idx + int(num_wing_engines[i]/2) - - eng_loc = engine_locations[idx:idx2][0] + if num_wing_engines>0: + eng_loc = engine_locations[idx:idx2][0] + else: + eng_loc = engine_locations[idx:idx2] if eng_loc <= integration_stations[0]: inertia_factor[i] = 1.0 @@ -212,8 +218,12 @@ def compute(self, inputs, outputs): delme = dy * eel[1:] - delme[loc[-1]] = engine_locations[idx:idx2][0] - \ - integration_stations[loc[-1]] + if num_wing_engines>0: + delme[loc[-1]] = engine_locations[idx:idx2][0] - \ + integration_stations[loc[-1]] + else: + delme[loc] = engine_locations[idx:idx2] - \ + integration_stations[loc] eem = delme * csw eem = np.cumsum(eem[::-1])[::-1] From 91d07961bfe9f1cd11eea634f4f73397625e01ad Mon Sep 17 00:00:00 2001 From: Manning Date: Fri, 26 Jul 2024 14:13:49 -0400 Subject: [PATCH 04/17] 'update' --- .../mass/flops_based/landing_gear.py | 441 +++++++++++++++++- .../mass/flops_based/wing_detailed.py | 4 +- 2 files changed, 441 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index 254a71a1a..cdd85e865 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -289,8 +289,445 @@ def setup(self): val=np.zeros(num_engine_type)) if num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros((int(num_wing_engines[0]/2)))) + val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) + else:import numpy as np +import openmdao.api as om + +from aviary.constants import GRAV_ENGLISH_LBM +from aviary.subsystems.mass.flops_based.distributed_prop import ( + distributed_nacelle_diam_factor, distributed_nacelle_diam_factor_deriv) +from aviary.utils.aviary_values import AviaryValues +from aviary.variable_info.functions import add_aviary_input, add_aviary_output +from aviary.variable_info.variables import Aircraft, Mission + +DEG2RAD = np.pi / 180.0 + + +class LandingGearMass(om.ExplicitComponent): + ''' + Calculate the mass of the landing gear. The methodology is based on the + FLOPS weight equations, modified to output mass instead of weight. + ''' + # TODO: add in aircraft type and carrier factors as options and modify + # equations + + def initialize(self): + self.options.declare( + 'aviary_options', types=AviaryValues, + desc='collection of Aircraft/Mission specific options') + + def setup(self): + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) + + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) + + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) + + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) + + add_aviary_input(self, Aircraft.Design.TOUCHDOWN_MASS, val=0.0) + + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) + + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) + + # TODO landing weight is not a landing_gear component level variable + # self.add_input('aircraft:landing_gear:weights:landing_weight', val=0.0, desc='design landing weight', units='lbf') + # self.add_input('aircraft:landing_gear:dimensions:extend_main_gear_oleo_len', val=0.0, desc='length of extended \ + # main landing gear oleo', units='inch') + # self.add_input('aircraft:landing_gear:dimensions:extend_nose_gear_oleo_len', val=0.0, desc='length of extended \ + # nose landing gear oleo', units='inch') + # self.add_input('TBD:aircraft:landing_gear:main_landing_gear_weight_multipler', val=1.0, desc='weight multiplier for \ + # main landing gear weight', units='unitless') + # self.add_input('TBD:aircraft:landing_gear:nose_landing_gear_weight_multipler', val=1.0, desc='weight multiplier for \ + # nose landing gear weight', units='unitless') + + # self.add_output('TBD:landing_gear:weights:main_landing_gear_weight', val=0.0, desc='main landing gear weight', units='lbf') + # self.add_output('TBD:landing_gear:weights:nose_landing_gear_weight', val=0.0, desc='nose landing gear weight', units='lbf') + + def setup_partials(self): + self.declare_partials( + Aircraft.LandingGear.MAIN_GEAR_MASS, + [ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, + Aircraft.Design.TOUCHDOWN_MASS]) + self.declare_partials( + Aircraft.LandingGear.NOSE_GEAR_MASS, + [ + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, + Aircraft.Design.TOUCHDOWN_MASS]) + + def compute(self, inputs, outputs): + + main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] + main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] + nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] + nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] + landing_weight = inputs[Aircraft.Design.TOUCHDOWN_MASS] * \ + GRAV_ENGLISH_LBM + + outputs[Aircraft.LandingGear.MAIN_GEAR_MASS] = 0.0117 * \ + landing_weight**0.95 * main_gear_length**0.43 * \ + main_gear_scaler / GRAV_ENGLISH_LBM + outputs[Aircraft.LandingGear.NOSE_GEAR_MASS] = 0.048 * \ + landing_weight**0.67 * nose_gear_length**0.43 * \ + nose_gear_scaler / GRAV_ENGLISH_LBM + + # main_gear_weight = (0.0117 - 0.0012 * type_factor) * landing_weight**0.95 * main_gear_length**0.43 + # outputs['TBD:landing_gear:weights:main_landing_gear_weight'] = main_gear_weight * inputs['TBD:aircraft:landing_gear:main_landing_gear_weight_multipler'] + # nose_gear_weight = (0.048 - 0.008 * type_factor) * landing_weight**0.67 * nose_gear_length**0.43 * (1 + 0.8*carrier_factor) + # outputs['TBD:landing_gear:weights:nose_landing_gear_weight'] = nose_gear_weight * inputs['TBD:aircraft:landing_gear:nose_landing_gear_weight_multipler'] + + def compute_partials(self, inputs, J): + main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] + main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] + nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] + nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] + landing_weight = \ + inputs[Aircraft.Design.TOUCHDOWN_MASS] * GRAV_ENGLISH_LBM + + landing_weight_exp1 = landing_weight**0.95 + landing_weight_exp2 = landing_weight**0.67 + main_gear_length_exp = main_gear_length**0.43 + nose_gear_length_exp = nose_gear_length**0.43 + + J[ + Aircraft.LandingGear.MAIN_GEAR_MASS, + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = 0.005031 * \ + landing_weight_exp1 * main_gear_length**-0.57 * \ + main_gear_scaler / GRAV_ENGLISH_LBM + J[ + Aircraft.LandingGear.MAIN_GEAR_MASS, + Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] = 0.0117 * \ + landing_weight_exp1 * main_gear_length_exp / GRAV_ENGLISH_LBM + J[Aircraft.LandingGear.MAIN_GEAR_MASS, Aircraft.Design.TOUCHDOWN_MASS] = \ + 0.011115 * \ + landing_weight**-0.05 * main_gear_length_exp * main_gear_scaler + + J[ + Aircraft.LandingGear.NOSE_GEAR_MASS, + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = 0.02064 * \ + landing_weight_exp2 * nose_gear_length**-0.57 * \ + nose_gear_scaler / GRAV_ENGLISH_LBM + J[ + Aircraft.LandingGear.NOSE_GEAR_MASS, + Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] = 0.048 * \ + landing_weight_exp2 * nose_gear_length_exp / GRAV_ENGLISH_LBM + J[Aircraft.LandingGear.NOSE_GEAR_MASS, Aircraft.Design.TOUCHDOWN_MASS] = \ + 0.03216 * \ + landing_weight**-0.33 * nose_gear_length_exp * \ + nose_gear_scaler + + +class AltLandingGearMass(om.ExplicitComponent): + ''' + Calculate the mass of the landing gear using the alternate method. + The methodology is based on the FLOPS weight equations, modified + to output mass instead of weight. + ''' + + def initialize(self): + self.options.declare( + 'aviary_options', types=AviaryValues, + desc='collection of Aircraft/Mission specific options') + + def setup(self): + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) + + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) + + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) + + add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) + + add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) + + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) + + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) + + def setup_partials(self): + self.declare_partials(Aircraft.LandingGear.MAIN_GEAR_MASS, [ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, + Mission.Design.GROSS_MASS] + ) + self.declare_partials(Aircraft.LandingGear.NOSE_GEAR_MASS, [ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, + Mission.Design.GROSS_MASS] + ) + + def compute(self, inputs, outputs): + main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] + main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] + nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] + nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] + gross_weight = inputs[Mission.Design.GROSS_MASS] * GRAV_ENGLISH_LBM + + total_gear_weight = gross_weight * ( + (30100.0 + + 0.3876 * main_gear_length * main_gear_length + + 0.09579 * nose_gear_length * nose_gear_length + ) / 1.0e6 + ) + + outputs[Aircraft.LandingGear.MAIN_GEAR_MASS] = 0.85 * \ + total_gear_weight * main_gear_scaler / GRAV_ENGLISH_LBM + outputs[Aircraft.LandingGear.NOSE_GEAR_MASS] = 0.15 * \ + total_gear_weight * nose_gear_scaler / GRAV_ENGLISH_LBM + + def compute_partials(self, inputs, J): + main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] + main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] + nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] + nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] + gross_weight = inputs[Mission.Design.GROSS_MASS] * GRAV_ENGLISH_LBM + + total_gear_fact = (30100.0 + + 0.3876 * main_gear_length * main_gear_length + + 0.09579 * nose_gear_length * nose_gear_length + ) / 1.0e6 + total_gear_weight = gross_weight * total_gear_fact + total_gear_weight_dmain = gross_weight * 7.752e-7 * main_gear_length + total_gear_weight_dnose = gross_weight * 1.9158e-7 * nose_gear_length + + J[ + Aircraft.LandingGear.MAIN_GEAR_MASS, + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = ( + 0.85 * total_gear_weight_dmain * main_gear_scaler / GRAV_ENGLISH_LBM + ) + + J[ + Aircraft.LandingGear.MAIN_GEAR_MASS, + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = ( + 0.85 * total_gear_weight_dnose * main_gear_scaler / GRAV_ENGLISH_LBM + ) + + J[ + Aircraft.LandingGear.MAIN_GEAR_MASS, + Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] = ( + 0.85 * total_gear_weight / GRAV_ENGLISH_LBM + ) + + J[Aircraft.LandingGear.MAIN_GEAR_MASS, Mission.Design.GROSS_MASS] = ( + 0.85 * total_gear_fact * main_gear_scaler + ) + + J[ + Aircraft.LandingGear.NOSE_GEAR_MASS, + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = ( + 0.15 * total_gear_weight_dmain * nose_gear_scaler / GRAV_ENGLISH_LBM + ) + + J[ + Aircraft.LandingGear.NOSE_GEAR_MASS, + Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = ( + 0.15 * total_gear_weight_dnose * nose_gear_scaler / GRAV_ENGLISH_LBM + ) + + J[ + Aircraft.LandingGear.NOSE_GEAR_MASS, + Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] = ( + 0.15 * total_gear_weight / GRAV_ENGLISH_LBM + ) + + J[Aircraft.LandingGear.NOSE_GEAR_MASS, Mission.Design.GROSS_MASS] = ( + 0.15 * total_gear_fact * nose_gear_scaler + ) + + +class NoseGearLength(om.ExplicitComponent): + + def initialize(self): + self.options.declare( + 'aviary_options', types=AviaryValues, + desc='collection of Aircraft/Mission specific options') + + def setup(self): + add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) + add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) + + def setup_partials(self): + self.declare_partials(Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + val=0.7) + + def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): + outputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = 0.7 * \ + inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] + + +class MainGearLength(om.ExplicitComponent): + + def initialize(self): + self.options.declare( + 'aviary_options', types=AviaryValues, + desc='collection of Aircraft/Mission specific options') + + def setup(self): + num_engine_type = len(self.options['aviary_options'].get_val( + Aircraft.Engine.NUM_ENGINES)) + num_wing_engines = self.options['aviary_options'].get_val( + Aircraft.Engine.NUM_WING_ENGINES) + + add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) + add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) + add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, + val=np.zeros(num_engine_type)) + if num_wing_engines > 0: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) else: + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, + val=[[0.0]]) + add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) + add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) + + add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) + + def setup_partials(self): + self.declare_partials('*', '*') + + def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): + options: AviaryValues = self.options['aviary_options'] + # TODO temp using first engine, multi-engine not supported + num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] + num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] + + y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] + + # TODO: high engine-count configuation. + y_eng_aft = 0 + + if num_wing_eng > 0: + tan_dih = np.tan(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) + fuse_half_width = inputs[Aircraft.Fuselage.MAX_WIDTH] * 6.0 + + d_nacelle = inputs[Aircraft.Nacelle.AVG_DIAMETER][0] + # f_nacelle = d_nacelle + # if num_eng > 4: + # f_nacelle = 0.5 * d_nacelle * num_eng ** 0.5 + + f_nacelle = distributed_nacelle_diam_factor(d_nacelle, num_eng) + + yee = y_eng_fore + if num_wing_eng > 2 and y_eng_aft > 0.0: + yee = y_eng_aft + + if yee < 1.0: + # This is triggered when the input engine locations are normalized. + yee *= 6.0 * inputs[Aircraft.Wing.SPAN] + + cmlg = 12.0 * f_nacelle + (0.26 - tan_dih) * (yee - fuse_half_width) + + else: + cmlg = 0.0 + + if cmlg < 12.0: + cmlg = 0.75 * inputs[Aircraft.Fuselage.LENGTH] + + outputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = cmlg + + def compute_partials(self, inputs, partials, discrete_inputs=None): + options: AviaryValues = self.options['aviary_options'] + # TODO temp using first engine, multi-engine not supported + num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] + num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] + + y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] + y_eng_aft = 0 + + if num_wing_eng > 0: + tan_dih = np.tan(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) + dtan_dih = DEG2RAD / np.cos(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) ** 2 + + fuse_half_width = inputs[Aircraft.Fuselage.MAX_WIDTH] * 6.0 + dhw_dfuse_wid = 6.0 + + d_nacelle = inputs[Aircraft.Nacelle.AVG_DIAMETER][0] + # f_nacelle = d_nacelle + # d_nac = 1.0 + # if num_eng > 4: + # f_nacelle = 0.5 * d_nacelle * num_eng ** 0.5 + # d_nac = 0.5 * num_eng ** 0.5 + + f_nacelle = distributed_nacelle_diam_factor(d_nacelle, num_eng) + d_nac = distributed_nacelle_diam_factor_deriv(num_eng) + + yee = y_eng_fore + if num_wing_eng > 2 and y_eng_aft > 0.0: + yee = y_eng_aft + + dyee_dwel = 1.0 + dyee_dspan = 1.0 + if yee < 1.0: + dyee_dwel = 6.0 * inputs[Aircraft.Wing.SPAN] + dyee_dspan = 6.0 * yee + + yee *= 6.0 * inputs[Aircraft.Wing.SPAN] + + cmlg = 12.0 * f_nacelle + (0.26 - tan_dih) * (yee - fuse_half_width) + dcmlg_dnac = 12.0 * d_nac + dcmlg_dtan = -(yee - fuse_half_width) + dcmlg_dyee = (0.26 - tan_dih) + dcmlg_dhw = (tan_dih - 0.26) + + else: + cmlg = 0.0 + + if cmlg < 12.0: + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Fuselage.LENGTH] = 0.75 + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Fuselage.MAX_WIDTH] = 0.0 + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Nacelle.AVG_DIAMETER] = 0.0 + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Engine.WING_LOCATIONS] = 0.0 + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Wing.DIHEDRAL] = 0.0 + + partials[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Wing.SPAN] = \ + 0.0 + + else: + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Fuselage.LENGTH] = \ + 0.0 + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Fuselage.MAX_WIDTH] = dcmlg_dhw * dhw_dfuse_wid + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Nacelle.AVG_DIAMETER][:] = dcmlg_dnac + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Engine.WING_LOCATIONS] = dcmlg_dyee * dyee_dwel + + partials[ + Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, + Aircraft.Wing.DIHEDRAL] = dcmlg_dtan * dtan_dih + + partials[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Wing.SPAN] = \ + dcmlg_dyee * dyee_dspan + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=[[0]]) add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) @@ -306,7 +743,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): # TODO temp using first engine, multi-engine not supported num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] - y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0] + y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] # TODO: high engine-count configuation. y_eng_aft = 0 diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 59ca2f004..aacc03b90 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -49,7 +49,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR, val=0.0) add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - + if total_num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros(int(total_num_wing_engines/2))) @@ -243,4 +243,4 @@ def compute(self, inputs, outputs): if inertia_factor_prod < 0.84: inertia_factor_prod = 0.84 - outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = inertia_factor_prod + outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = inertia_factor_prod \ No newline at end of file From 8d00fae036289f8fe639a75870694f1bca2163da Mon Sep 17 00:00:00 2001 From: Manning Date: Fri, 26 Jul 2024 14:35:41 -0400 Subject: [PATCH 05/17] 'update' --- .../mass/flops_based/landing_gear.py | 437 ------------------ 1 file changed, 437 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index cdd85e865..633595812 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -290,444 +290,7 @@ def setup(self): if num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) - else:import numpy as np -import openmdao.api as om - -from aviary.constants import GRAV_ENGLISH_LBM -from aviary.subsystems.mass.flops_based.distributed_prop import ( - distributed_nacelle_diam_factor, distributed_nacelle_diam_factor_deriv) -from aviary.utils.aviary_values import AviaryValues -from aviary.variable_info.functions import add_aviary_input, add_aviary_output -from aviary.variable_info.variables import Aircraft, Mission - -DEG2RAD = np.pi / 180.0 - - -class LandingGearMass(om.ExplicitComponent): - ''' - Calculate the mass of the landing gear. The methodology is based on the - FLOPS weight equations, modified to output mass instead of weight. - ''' - # TODO: add in aircraft type and carrier factors as options and modify - # equations - - def initialize(self): - self.options.declare( - 'aviary_options', types=AviaryValues, - desc='collection of Aircraft/Mission specific options') - - def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.Design.TOUCHDOWN_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) - - # TODO landing weight is not a landing_gear component level variable - # self.add_input('aircraft:landing_gear:weights:landing_weight', val=0.0, desc='design landing weight', units='lbf') - # self.add_input('aircraft:landing_gear:dimensions:extend_main_gear_oleo_len', val=0.0, desc='length of extended \ - # main landing gear oleo', units='inch') - # self.add_input('aircraft:landing_gear:dimensions:extend_nose_gear_oleo_len', val=0.0, desc='length of extended \ - # nose landing gear oleo', units='inch') - # self.add_input('TBD:aircraft:landing_gear:main_landing_gear_weight_multipler', val=1.0, desc='weight multiplier for \ - # main landing gear weight', units='unitless') - # self.add_input('TBD:aircraft:landing_gear:nose_landing_gear_weight_multipler', val=1.0, desc='weight multiplier for \ - # nose landing gear weight', units='unitless') - - # self.add_output('TBD:landing_gear:weights:main_landing_gear_weight', val=0.0, desc='main landing gear weight', units='lbf') - # self.add_output('TBD:landing_gear:weights:nose_landing_gear_weight', val=0.0, desc='nose landing gear weight', units='lbf') - - def setup_partials(self): - self.declare_partials( - Aircraft.LandingGear.MAIN_GEAR_MASS, - [ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, - Aircraft.Design.TOUCHDOWN_MASS]) - self.declare_partials( - Aircraft.LandingGear.NOSE_GEAR_MASS, - [ - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, - Aircraft.Design.TOUCHDOWN_MASS]) - - def compute(self, inputs, outputs): - - main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] - main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] - nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] - nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] - landing_weight = inputs[Aircraft.Design.TOUCHDOWN_MASS] * \ - GRAV_ENGLISH_LBM - - outputs[Aircraft.LandingGear.MAIN_GEAR_MASS] = 0.0117 * \ - landing_weight**0.95 * main_gear_length**0.43 * \ - main_gear_scaler / GRAV_ENGLISH_LBM - outputs[Aircraft.LandingGear.NOSE_GEAR_MASS] = 0.048 * \ - landing_weight**0.67 * nose_gear_length**0.43 * \ - nose_gear_scaler / GRAV_ENGLISH_LBM - - # main_gear_weight = (0.0117 - 0.0012 * type_factor) * landing_weight**0.95 * main_gear_length**0.43 - # outputs['TBD:landing_gear:weights:main_landing_gear_weight'] = main_gear_weight * inputs['TBD:aircraft:landing_gear:main_landing_gear_weight_multipler'] - # nose_gear_weight = (0.048 - 0.008 * type_factor) * landing_weight**0.67 * nose_gear_length**0.43 * (1 + 0.8*carrier_factor) - # outputs['TBD:landing_gear:weights:nose_landing_gear_weight'] = nose_gear_weight * inputs['TBD:aircraft:landing_gear:nose_landing_gear_weight_multipler'] - - def compute_partials(self, inputs, J): - main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] - main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] - nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] - nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] - landing_weight = \ - inputs[Aircraft.Design.TOUCHDOWN_MASS] * GRAV_ENGLISH_LBM - - landing_weight_exp1 = landing_weight**0.95 - landing_weight_exp2 = landing_weight**0.67 - main_gear_length_exp = main_gear_length**0.43 - nose_gear_length_exp = nose_gear_length**0.43 - - J[ - Aircraft.LandingGear.MAIN_GEAR_MASS, - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = 0.005031 * \ - landing_weight_exp1 * main_gear_length**-0.57 * \ - main_gear_scaler / GRAV_ENGLISH_LBM - J[ - Aircraft.LandingGear.MAIN_GEAR_MASS, - Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] = 0.0117 * \ - landing_weight_exp1 * main_gear_length_exp / GRAV_ENGLISH_LBM - J[Aircraft.LandingGear.MAIN_GEAR_MASS, Aircraft.Design.TOUCHDOWN_MASS] = \ - 0.011115 * \ - landing_weight**-0.05 * main_gear_length_exp * main_gear_scaler - - J[ - Aircraft.LandingGear.NOSE_GEAR_MASS, - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = 0.02064 * \ - landing_weight_exp2 * nose_gear_length**-0.57 * \ - nose_gear_scaler / GRAV_ENGLISH_LBM - J[ - Aircraft.LandingGear.NOSE_GEAR_MASS, - Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] = 0.048 * \ - landing_weight_exp2 * nose_gear_length_exp / GRAV_ENGLISH_LBM - J[Aircraft.LandingGear.NOSE_GEAR_MASS, Aircraft.Design.TOUCHDOWN_MASS] = \ - 0.03216 * \ - landing_weight**-0.33 * nose_gear_length_exp * \ - nose_gear_scaler - - -class AltLandingGearMass(om.ExplicitComponent): - ''' - Calculate the mass of the landing gear using the alternate method. - The methodology is based on the FLOPS weight equations, modified - to output mass instead of weight. - ''' - - def initialize(self): - self.options.declare( - 'aviary_options', types=AviaryValues, - desc='collection of Aircraft/Mission specific options') - - def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) - - add_aviary_input(self, Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, val=1.0) - - add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_MASS, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_MASS, val=0.0) - - def setup_partials(self): - self.declare_partials(Aircraft.LandingGear.MAIN_GEAR_MASS, [ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER, - Mission.Design.GROSS_MASS] - ) - self.declare_partials(Aircraft.LandingGear.NOSE_GEAR_MASS, [ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER, - Mission.Design.GROSS_MASS] - ) - - def compute(self, inputs, outputs): - main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] - main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] - nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] - nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] - gross_weight = inputs[Mission.Design.GROSS_MASS] * GRAV_ENGLISH_LBM - - total_gear_weight = gross_weight * ( - (30100.0 + - 0.3876 * main_gear_length * main_gear_length + - 0.09579 * nose_gear_length * nose_gear_length - ) / 1.0e6 - ) - - outputs[Aircraft.LandingGear.MAIN_GEAR_MASS] = 0.85 * \ - total_gear_weight * main_gear_scaler / GRAV_ENGLISH_LBM - outputs[Aircraft.LandingGear.NOSE_GEAR_MASS] = 0.15 * \ - total_gear_weight * nose_gear_scaler / GRAV_ENGLISH_LBM - - def compute_partials(self, inputs, J): - main_gear_length = inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] - main_gear_scaler = inputs[Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] - nose_gear_length = inputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] - nose_gear_scaler = inputs[Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] - gross_weight = inputs[Mission.Design.GROSS_MASS] * GRAV_ENGLISH_LBM - - total_gear_fact = (30100.0 + - 0.3876 * main_gear_length * main_gear_length + - 0.09579 * nose_gear_length * nose_gear_length - ) / 1.0e6 - total_gear_weight = gross_weight * total_gear_fact - total_gear_weight_dmain = gross_weight * 7.752e-7 * main_gear_length - total_gear_weight_dnose = gross_weight * 1.9158e-7 * nose_gear_length - - J[ - Aircraft.LandingGear.MAIN_GEAR_MASS, - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = ( - 0.85 * total_gear_weight_dmain * main_gear_scaler / GRAV_ENGLISH_LBM - ) - - J[ - Aircraft.LandingGear.MAIN_GEAR_MASS, - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = ( - 0.85 * total_gear_weight_dnose * main_gear_scaler / GRAV_ENGLISH_LBM - ) - - J[ - Aircraft.LandingGear.MAIN_GEAR_MASS, - Aircraft.LandingGear.MAIN_GEAR_MASS_SCALER] = ( - 0.85 * total_gear_weight / GRAV_ENGLISH_LBM - ) - - J[Aircraft.LandingGear.MAIN_GEAR_MASS, Mission.Design.GROSS_MASS] = ( - 0.85 * total_gear_fact * main_gear_scaler - ) - - J[ - Aircraft.LandingGear.NOSE_GEAR_MASS, - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = ( - 0.15 * total_gear_weight_dmain * nose_gear_scaler / GRAV_ENGLISH_LBM - ) - - J[ - Aircraft.LandingGear.NOSE_GEAR_MASS, - Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = ( - 0.15 * total_gear_weight_dnose * nose_gear_scaler / GRAV_ENGLISH_LBM - ) - - J[ - Aircraft.LandingGear.NOSE_GEAR_MASS, - Aircraft.LandingGear.NOSE_GEAR_MASS_SCALER] = ( - 0.15 * total_gear_weight / GRAV_ENGLISH_LBM - ) - - J[Aircraft.LandingGear.NOSE_GEAR_MASS, Mission.Design.GROSS_MASS] = ( - 0.15 * total_gear_fact * nose_gear_scaler - ) - - -class NoseGearLength(om.ExplicitComponent): - - def initialize(self): - self.options.declare( - 'aviary_options', types=AviaryValues, - desc='collection of Aircraft/Mission specific options') - - def setup(self): - add_aviary_input(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - add_aviary_output(self, Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, val=0.0) - - def setup_partials(self): - self.declare_partials(Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH, - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - val=0.7) - - def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): - outputs[Aircraft.LandingGear.NOSE_GEAR_OLEO_LENGTH] = 0.7 * \ - inputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] - - -class MainGearLength(om.ExplicitComponent): - - def initialize(self): - self.options.declare( - 'aviary_options', types=AviaryValues, - desc='collection of Aircraft/Mission specific options') - - def setup(self): - num_engine_type = len(self.options['aviary_options'].get_val( - Aircraft.Engine.NUM_ENGINES)) - num_wing_engines = self.options['aviary_options'].get_val( - Aircraft.Engine.NUM_WING_ENGINES) - - add_aviary_input(self, Aircraft.Fuselage.LENGTH, val=0.0) - add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) - add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, - val=np.zeros(num_engine_type)) - if num_wing_engines > 0: - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) else: - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=[[0.0]]) - add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) - add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) - - add_aviary_output(self, Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, val=0.0) - - def setup_partials(self): - self.declare_partials('*', '*') - - def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): - options: AviaryValues = self.options['aviary_options'] - # TODO temp using first engine, multi-engine not supported - num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] - num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] - - y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] - - # TODO: high engine-count configuation. - y_eng_aft = 0 - - if num_wing_eng > 0: - tan_dih = np.tan(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) - fuse_half_width = inputs[Aircraft.Fuselage.MAX_WIDTH] * 6.0 - - d_nacelle = inputs[Aircraft.Nacelle.AVG_DIAMETER][0] - # f_nacelle = d_nacelle - # if num_eng > 4: - # f_nacelle = 0.5 * d_nacelle * num_eng ** 0.5 - - f_nacelle = distributed_nacelle_diam_factor(d_nacelle, num_eng) - - yee = y_eng_fore - if num_wing_eng > 2 and y_eng_aft > 0.0: - yee = y_eng_aft - - if yee < 1.0: - # This is triggered when the input engine locations are normalized. - yee *= 6.0 * inputs[Aircraft.Wing.SPAN] - - cmlg = 12.0 * f_nacelle + (0.26 - tan_dih) * (yee - fuse_half_width) - - else: - cmlg = 0.0 - - if cmlg < 12.0: - cmlg = 0.75 * inputs[Aircraft.Fuselage.LENGTH] - - outputs[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH] = cmlg - - def compute_partials(self, inputs, partials, discrete_inputs=None): - options: AviaryValues = self.options['aviary_options'] - # TODO temp using first engine, multi-engine not supported - num_eng = options.get_val(Aircraft.Engine.NUM_ENGINES)[0] - num_wing_eng = options.get_val(Aircraft.Engine.NUM_WING_ENGINES)[0] - - y_eng_fore = inputs[Aircraft.Engine.WING_LOCATIONS][0][0] - y_eng_aft = 0 - - if num_wing_eng > 0: - tan_dih = np.tan(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) - dtan_dih = DEG2RAD / np.cos(inputs[Aircraft.Wing.DIHEDRAL] * DEG2RAD) ** 2 - - fuse_half_width = inputs[Aircraft.Fuselage.MAX_WIDTH] * 6.0 - dhw_dfuse_wid = 6.0 - - d_nacelle = inputs[Aircraft.Nacelle.AVG_DIAMETER][0] - # f_nacelle = d_nacelle - # d_nac = 1.0 - # if num_eng > 4: - # f_nacelle = 0.5 * d_nacelle * num_eng ** 0.5 - # d_nac = 0.5 * num_eng ** 0.5 - - f_nacelle = distributed_nacelle_diam_factor(d_nacelle, num_eng) - d_nac = distributed_nacelle_diam_factor_deriv(num_eng) - - yee = y_eng_fore - if num_wing_eng > 2 and y_eng_aft > 0.0: - yee = y_eng_aft - - dyee_dwel = 1.0 - dyee_dspan = 1.0 - if yee < 1.0: - dyee_dwel = 6.0 * inputs[Aircraft.Wing.SPAN] - dyee_dspan = 6.0 * yee - - yee *= 6.0 * inputs[Aircraft.Wing.SPAN] - - cmlg = 12.0 * f_nacelle + (0.26 - tan_dih) * (yee - fuse_half_width) - dcmlg_dnac = 12.0 * d_nac - dcmlg_dtan = -(yee - fuse_half_width) - dcmlg_dyee = (0.26 - tan_dih) - dcmlg_dhw = (tan_dih - 0.26) - - else: - cmlg = 0.0 - - if cmlg < 12.0: - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Fuselage.LENGTH] = 0.75 - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Fuselage.MAX_WIDTH] = 0.0 - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Nacelle.AVG_DIAMETER] = 0.0 - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Engine.WING_LOCATIONS] = 0.0 - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Wing.DIHEDRAL] = 0.0 - - partials[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Wing.SPAN] = \ - 0.0 - - else: - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Fuselage.LENGTH] = \ - 0.0 - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Fuselage.MAX_WIDTH] = dcmlg_dhw * dhw_dfuse_wid - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Nacelle.AVG_DIAMETER][:] = dcmlg_dnac - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Engine.WING_LOCATIONS] = dcmlg_dyee * dyee_dwel - - partials[ - Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, - Aircraft.Wing.DIHEDRAL] = dcmlg_dtan * dtan_dih - - partials[Aircraft.LandingGear.MAIN_GEAR_OLEO_LENGTH, Aircraft.Wing.SPAN] = \ - dcmlg_dyee * dyee_dspan - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=[[0]]) add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) From cd8035a7524773e989ebeff41b9a8d0e1af36ce9 Mon Sep 17 00:00:00 2001 From: Manning Date: Mon, 29 Jul 2024 08:56:28 -0400 Subject: [PATCH 06/17] fixes to failed pre_commit --- aviary/subsystems/mass/flops_based/landing_gear.py | 4 ++-- aviary/subsystems/mass/flops_based/wing_detailed.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index 633595812..77f3d04f7 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -289,10 +289,10 @@ def setup(self): val=np.zeros(num_engine_type)) if num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) + val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) else: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=[[0]]) + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index aacc03b90..69f42060d 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -52,10 +52,10 @@ def setup(self): if total_num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros(int(total_num_wing_engines/2))) + val=np.zeros(int(total_num_wing_engines/2))) else: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=[[0.0]]) + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) @@ -200,7 +200,7 @@ def compute(self, inputs, outputs): for i in range(num_engine_type): # idx2 is the last index for the range of engines of this type idx2 = idx + int(num_wing_engines[i]/2) - if num_wing_engines>0: + if num_wing_engines > 0: eng_loc = engine_locations[idx:idx2][0] else: eng_loc = engine_locations[idx:idx2] @@ -218,7 +218,7 @@ def compute(self, inputs, outputs): delme = dy * eel[1:] - if num_wing_engines>0: + if num_wing_engines > 0: delme[loc[-1]] = engine_locations[idx:idx2][0] - \ integration_stations[loc[-1]] else: @@ -243,4 +243,5 @@ def compute(self, inputs, outputs): if inertia_factor_prod < 0.84: inertia_factor_prod = 0.84 - outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = inertia_factor_prod \ No newline at end of file + outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = inertia_factor_prod + \ No newline at end of file From 486589d0a538989356e6838b481c4798f8c63a3f Mon Sep 17 00:00:00 2001 From: Manning Date: Mon, 29 Jul 2024 11:32:31 -0400 Subject: [PATCH 07/17] autopep8 formatting --- .../mass/flops_based/landing_gear.py | 6 ++--- .../mass/flops_based/wing_detailed.py | 25 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index 77f3d04f7..bfe6a53af 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -288,11 +288,11 @@ def setup(self): add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, val=np.zeros(num_engine_type)) if num_wing_engines > 0: - add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros((num_engine_type, int(num_wing_engines[0]/2)))) + add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros( + (num_engine_type, int(num_wing_engines[0] / 2)))) else: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=[[0.0]]) + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.DIHEDRAL, val=0.0) add_aviary_input(self, Aircraft.Wing.SPAN, val=0.0) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 69f42060d..f3df32f6f 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -49,13 +49,13 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR, val=0.0) add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - - if total_num_wing_engines > 0: + + if total_num_wing_engines > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=np.zeros(int(total_num_wing_engines/2))) + val=np.zeros(int(total_num_wing_engines / 2))) else: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, - val=[[0.0]]) + val=[[0.0]]) add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD, val=0.0) @@ -149,18 +149,18 @@ def compute(self, inputs, outputs): chord_int_stations *= arref / ar del_load = dy * ( - chord_int_stations[:-1] * (2*load_intensity[:-1] + load_intensity[1:]) + - chord_int_stations[1:] * (2*load_intensity[1:] + load_intensity[:-1])) / 6 + chord_int_stations[:-1] * (2 * load_intensity[:-1] + load_intensity[1:]) + + chord_int_stations[1:] * (2 * load_intensity[1:] + load_intensity[:-1])) / 6 el = np.sum(del_load) del_moment = dy**2 * ( - chord_int_stations[:-1] * (load_intensity[:-1]+load_intensity[1:]) + - chord_int_stations[1:] * (3*load_intensity[1:]+load_intensity[:-1])) / 12 + chord_int_stations[:-1] * (load_intensity[:-1] + load_intensity[1:]) + + chord_int_stations[1:] * (3 * load_intensity[1:] + load_intensity[:-1])) / 12 load_path_length = np.flip( np.append(np.zeros(1, chord.dtype), np.cumsum(np.flip(del_load)[:-1]))) - csw = 1. / np.cos(sweep_int_stations[:-1] * np.pi/180.) + csw = 1. / np.cos(sweep_int_stations[:-1] * np.pi / 180.) emi = (del_moment + dy * load_path_length) * csw # em = np.sum(emi) @@ -187,8 +187,8 @@ def compute(self, inputs, outputs): else: caya = ar - 5.0 - bt = btb / (ar**(0.25*fstrt) * (1.0 + (0.5*faert - 0.16*fstrt) - * sa**2 + 0.03*caya * (1.0-0.5*faert)*sa)) + bt = btb / (ar**(0.25 * fstrt) * (1.0 + (0.5 * faert - 0.16 * fstrt) + * sa**2 + 0.03 * caya * (1.0 - 0.5 * faert) * sa)) outputs[Aircraft.Wing.BENDING_FACTOR] = bt inertia_factor = np.zeros(num_engine_type, dtype=chord.dtype) @@ -199,7 +199,7 @@ def compute(self, inputs, outputs): # i is the counter for which engine model we are checking for i in range(num_engine_type): # idx2 is the last index for the range of engines of this type - idx2 = idx + int(num_wing_engines[i]/2) + idx2 = idx + int(num_wing_engines[i] / 2) if num_wing_engines > 0: eng_loc = engine_locations[idx:idx2][0] else: @@ -244,4 +244,3 @@ def compute(self, inputs, outputs): inertia_factor_prod = 0.84 outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = inertia_factor_prod - \ No newline at end of file From 53de008195850c0a66d5d627433df37d8abc9e70 Mon Sep 17 00:00:00 2001 From: Manning Date: Tue, 30 Jul 2024 16:25:41 -0400 Subject: [PATCH 08/17] Fixes to failed tests --- aviary/subsystems/mass/flops_based/wing_detailed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index f3df32f6f..13d988e0d 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -200,7 +200,7 @@ def compute(self, inputs, outputs): for i in range(num_engine_type): # idx2 is the last index for the range of engines of this type idx2 = idx + int(num_wing_engines[i] / 2) - if num_wing_engines > 0: + if num_wing_engines[i] > 0: eng_loc = engine_locations[idx:idx2][0] else: eng_loc = engine_locations[idx:idx2] @@ -218,7 +218,7 @@ def compute(self, inputs, outputs): delme = dy * eel[1:] - if num_wing_engines > 0: + if num_wing_engines[i] > 0: delme[loc[-1]] = engine_locations[idx:idx2][0] - \ integration_stations[loc[-1]] else: From b43f079184a1dd36407414e7e8b9410ab6ef90d5 Mon Sep 17 00:00:00 2001 From: Manning Date: Tue, 6 Aug 2024 14:38:32 -0400 Subject: [PATCH 09/17] additional updates and tests --- .../flops_based/test/test_wing_detailed.py | 128 +++++++++++++++++- .../mass/flops_based/wing_detailed.py | 2 +- 2 files changed, 126 insertions(+), 4 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py index 075fd3261..6a6a5cabb 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py @@ -25,8 +25,12 @@ def setUp(self): self.prob = om.Problem() # Skip model that doesn't use detailed wing. - @parameterized.expand(get_flops_case_names(omit=['LargeSingleAisle2FLOPS', 'LargeSingleAisle2FLOPSalt']), - name_func=print_case) + @parameterized.expand( + get_flops_case_names( + omit=[ + 'LargeSingleAisle2FLOPS', + 'LargeSingleAisle2FLOPSalt']), + name_func=print_case) def test_case(self, case_name): prob = self.prob @@ -121,9 +125,127 @@ def test_case_multiengine(self): assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) partial_data = prob.check_partials( - out_stream=None, compact_print=True, show_only_incorrect=True, form='central', method="fd") + out_stream=None, + compact_print=True, + show_only_incorrect=True, + form='central', + method="fd") assert_check_partials(partial_data, atol=1e-5, rtol=1e-5) + def test_case_fuselage_engines(self): + prob = self.prob + + aviary_options = get_flops_inputs('LargeSingleAisle1FLOPS') + + engine_options = AviaryValues() + engine_options.set_val(Settings.VERBOSITY, 0) + engine_options.set_val(Aircraft.Engine.DATA_FILE, + 'models/engines/turbofan_28k.deck') + engine_options.set_val(Aircraft.Engine.NUM_ENGINES, 2) + engine_options.set_val(Aircraft.Engine.NUM_WING_ENGINES, 0) + engine_options.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 2) + engineModel = EngineDeck(options=engine_options) + + preprocess_propulsion(aviary_options, [engineModel]) + + prob.model.add_subsystem('detailed_wing', DetailedWingBendingFact( + aviary_options=aviary_options), promotes=['*']) + + prob.setup(force_alloc_complex=True) + + input_keys = [Aircraft.Wing.LOAD_PATH_SWEEP_DIST, + Aircraft.Wing.THICKNESS_TO_CHORD_DIST, + Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, + Mission.Design.GROSS_MASS, + Aircraft.Wing.ASPECT_RATIO, + Aircraft.Wing.ASPECT_RATIO_REF, + Aircraft.Wing.STRUT_BRACING_FACTOR, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Wing.THICKNESS_TO_CHORD, + Aircraft.Wing.THICKNESS_TO_CHORD_REF] + + for key in input_keys: + val, units = aviary_options.get_item(key) + prob.set_val(key, val, units) + + prob.set_val(Aircraft.Engine.POD_MASS, np.array([0]), units='lbm') + + wing_location = np.zeros(0) + wing_location = np.append(wing_location, [0.0]) + + prob.set_val(Aircraft.Engine.WING_LOCATIONS, wing_location) + + prob.run_model() + + bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) + pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) + + # manual computation of expected thrust reverser mass + bending_factor_expected = 11.59165669761 + pod_inertia_expected = 0.84 + assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) + assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) + + def test_case_fuselage_multiengine(self): + prob = self.prob + + aviary_options = get_flops_inputs('LargeSingleAisle1FLOPS') + + engine_options = AviaryValues() + engine_options.set_val(Aircraft.Engine.DATA_FILE, + 'models/engines/turbofan_28k.deck') + engine_options.set_val(Aircraft.Engine.NUM_ENGINES, 2) + engine_options.set_val(Aircraft.Engine.NUM_WING_ENGINES, 2) + engine_options.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 0) + engineModel1 = EngineDeck(options=engine_options) + + engine_options.set_val(Aircraft.Engine.DATA_FILE, + 'models/engines/turbofan_22k.deck') + engine_options.set_val(Aircraft.Engine.NUM_ENGINES, 2) + engine_options.set_val(Aircraft.Engine.NUM_WING_ENGINES, 0) + engine_options.set_val(Aircraft.Engine.NUM_FUSELAGE_ENGINES, 2) + engineModel2 = EngineDeck(options=engine_options) + + preprocess_propulsion(aviary_options, [engineModel1, engineModel2]) + + prob.model.add_subsystem('detailed_wing', DetailedWingBendingFact( + aviary_options=aviary_options), promotes=['*']) + + prob.setup(force_alloc_complex=True) + + input_keys = [Aircraft.Wing.LOAD_PATH_SWEEP_DIST, + Aircraft.Wing.THICKNESS_TO_CHORD_DIST, + Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, + Mission.Design.GROSS_MASS, + Aircraft.Wing.ASPECT_RATIO, + Aircraft.Wing.ASPECT_RATIO_REF, + Aircraft.Wing.STRUT_BRACING_FACTOR, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Wing.THICKNESS_TO_CHORD, + Aircraft.Wing.THICKNESS_TO_CHORD_REF] + + for key in input_keys: + val, units = aviary_options.get_item(key) + prob.set_val(key, val, units) + + prob.set_val(Aircraft.Engine.POD_MASS, np.array([1130, 0]), units='lbm') + + wing_locations = np.zeros(0) + wing_locations = np.append(wing_locations, [0.5]) + + prob.set_val(Aircraft.Engine.WING_LOCATIONS, wing_locations) + + prob.run_model() + + bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) + pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) + + # manual computation of expected thrust reverser mass + bending_factor_expected = 11.59165669761 + pod_inertia_expected = 0.84 + assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) + assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) + def test_extreme_engine_loc(self): aviary_options = get_flops_inputs('LargeSingleAisle1FLOPS') diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 13d988e0d..06e4b2428 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -203,7 +203,7 @@ def compute(self, inputs, outputs): if num_wing_engines[i] > 0: eng_loc = engine_locations[idx:idx2][0] else: - eng_loc = engine_locations[idx:idx2] + continue if eng_loc <= integration_stations[0]: inertia_factor[i] = 1.0 From 49ea42fab1274aa444f0f6bfa3b7cd31d92a6540 Mon Sep 17 00:00:00 2001 From: Manning Date: Thu, 8 Aug 2024 09:42:07 -0400 Subject: [PATCH 10/17] Updates to wing_detailed --- aviary/subsystems/mass/flops_based/wing_detailed.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 06e4b2428..eb3eeb360 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -218,12 +218,8 @@ def compute(self, inputs, outputs): delme = dy * eel[1:] - if num_wing_engines[i] > 0: - delme[loc[-1]] = engine_locations[idx:idx2][0] - \ - integration_stations[loc[-1]] - else: - delme[loc] = engine_locations[idx:idx2] - \ - integration_stations[loc] + delme[loc[-1]] = engine_locations[idx:idx2][0] - \ + integration_stations[loc[-1]] eem = delme * csw eem = np.cumsum(eem[::-1])[::-1] From d32bd5da65fd30d68e6b27df1ffe78fab33fcd46 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Mon, 30 Dec 2024 15:01:00 -0500 Subject: [PATCH 11/17] minor update to wing bending for edge cases --- .../mass/flops_based/test/test_wing_detailed.py | 11 ++++------- .../subsystems/mass/flops_based/wing_detailed.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py index 6a6a5cabb..d93a59381 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py @@ -117,7 +117,6 @@ def test_case_multiengine(self): bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - # manual computation of expected thrust reverser mass bending_factor_expected = 11.59165669761 # 0.9600334354133278 if the factors are additive pod_inertia_expected = 0.9604608395586276 @@ -180,7 +179,6 @@ def test_case_fuselage_engines(self): bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - # manual computation of expected thrust reverser mass bending_factor_expected = 11.59165669761 pod_inertia_expected = 0.84 assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) @@ -240,7 +238,6 @@ def test_case_fuselage_multiengine(self): bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - # manual computation of expected thrust reverser mass bending_factor_expected = 11.59165669761 pod_inertia_expected = 0.84 assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) @@ -306,8 +303,8 @@ def test_IO(self): if __name__ == "__main__": - unittest.main() - # test = DetailedWingBendingTest() - # test.setUp() + # unittest.main() + test = DetailedWingBendingTest() + test.setUp() # test.test_case(case_name='LargeSingleAisle1FLOPS') - # test.test_extreme_engine_loc() + test.test_case_multiengine() diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index eb3eeb360..990024843 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -201,25 +201,27 @@ def compute(self, inputs, outputs): # idx2 is the last index for the range of engines of this type idx2 = idx + int(num_wing_engines[i] / 2) if num_wing_engines[i] > 0: - eng_loc = engine_locations[idx:idx2][0] + # engine locations must be in order from wing root to tip + eng_loc = np.sort(engine_locations[idx:idx2]) + else: continue - if eng_loc <= integration_stations[0]: + if all(eng_loc <= integration_stations[0]): inertia_factor[i] = 1.0 - elif eng_loc >= integration_stations[-1]: + elif all(eng_loc >= integration_stations[-1]): inertia_factor[i] = 0.84 else: eel[:] = 0.0 - loc = np.where(integration_stations < eng_loc)[0] + # Find all points on integration station before first engine + loc = np.where(integration_stations < eng_loc[0])[0] eel[loc] = 1.0 delme = dy * eel[1:] - delme[loc[-1]] = engine_locations[idx:idx2][0] - \ - integration_stations[loc[-1]] + delme[loc[-1]] = eng_loc[0] - integration_stations[loc[-1]] eem = delme * csw eem = np.cumsum(eem[::-1])[::-1] From 4ad9599258d72052eb13f38c03e44e3eb916483d Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Mon, 30 Dec 2024 15:01:14 -0500 Subject: [PATCH 12/17] variable name updates --- aviary/models/N3CC/N3CC_data.py | 6 +- ...N3CC_generic_low_speed_polars_FLOPSinp.csv | 2 +- .../large_single_aisle_1_FLOPS_data.py | 6 +- .../large_single_aisle_2_FLOPS_data.py | 6 +- .../large_single_aisle_2_altwt_FLOPS_data.py | 6 +- ...ge_single_aisle_2_detailwing_FLOPS_data.py | 6 +- .../multi_engine_single_aisle_data.py | 6 +- .../test_aircraft/aircraft_for_bench_FwFm.csv | 2 +- .../aircraft_for_bench_FwFm_with_electric.csv | 2 +- .../test_aircraft/aircraft_for_bench_FwGm.csv | 2 +- .../test_aircraft/aircraft_for_bench_GwFm.csv | 2 +- .../aircraft_for_bench_solved2dof.csv | 2 +- .../test/data/high_wing_single_aisle.csv | 2 +- .../mass/flops_based/test/test_wing_common.py | 37 ++++---- .../flops_based/test/test_wing_detailed.py | 67 ++++++++------ .../mass/flops_based/test/test_wing_simple.py | 27 +++--- .../mass/flops_based/wing_common.py | 87 ++++++++++++------- .../mass/flops_based/wing_detailed.py | 4 +- .../subsystems/mass/flops_based/wing_group.py | 18 ++-- .../mass/flops_based/wing_simple.py | 62 ++++++++----- aviary/variable_info/variable_meta_data.py | 74 +++++++++------- aviary/variable_info/variables.py | 6 +- 22 files changed, 251 insertions(+), 181 deletions(-) diff --git a/aviary/models/N3CC/N3CC_data.py b/aviary/models/N3CC/N3CC_data.py index 4b4d66971..b3010d08d 100644 --- a/aviary/models/N3CC/N3CC_data.py +++ b/aviary/models/N3CC/N3CC_data.py @@ -241,7 +241,7 @@ inputs.set_val(Aircraft.Wing.AREA, 1220.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 11.5587605382765) inputs.set_val(Aircraft.Wing.ASPECT_RATIO_REF, 11.5587605382765) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val( Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, np.array( @@ -426,8 +426,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1000) outputs.set_val(Aircraft.VerticalTail.MASS, 1175.0, 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 11.9602) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 5410.5, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 11.9602) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 5410.5, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 10.27, 'ft') outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 0.333 * 1220, 'ft**2') outputs.set_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR, 0.960516) diff --git a/aviary/models/N3CC/N3CC_generic_low_speed_polars_FLOPSinp.csv b/aviary/models/N3CC/N3CC_generic_low_speed_polars_FLOPSinp.csv index eb5a3f644..b24dc55b2 100644 --- a/aviary/models/N3CC/N3CC_generic_low_speed_polars_FLOPSinp.csv +++ b/aviary/models/N3CC/N3CC_generic_low_speed_polars_FLOPSinp.csv @@ -114,7 +114,7 @@ aircraft:wing:airfoil_technology,1.6,unitless aircraft:wing:area,1220,1,0,0,0,0,ft**2 aircraft:wing:aspect_ratio,11.5587605382765,1,0,0,0,0,unitless aircraft:wing:aspect_ratio_reference,11.5587605382765,unitless -aircraft:wing:bending_mass_scaler,1,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1,unitless aircraft:wing:bwb_aft_body_mass_scaler,1,unitless aircraft:wing:chord_per_semispan,0.273522534166506,0.204274849507037,0.0888152947868224,0.0725353313595661,unitless aircraft:wing:composite_fraction,0.33333,unitless diff --git a/aviary/models/large_single_aisle_1/large_single_aisle_1_FLOPS_data.py b/aviary/models/large_single_aisle_1/large_single_aisle_1_FLOPS_data.py index c5fd70877..6e937eeeb 100644 --- a/aviary/models/large_single_aisle_1/large_single_aisle_1_FLOPS_data.py +++ b/aviary/models/large_single_aisle_1/large_single_aisle_1_FLOPS_data.py @@ -189,7 +189,7 @@ inputs.set_val(Aircraft.Wing.AIRFOIL_TECHNOLOGY, 1.92669766647637) inputs.set_val(Aircraft.Wing.AREA, 1370.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 11.22091) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val(Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, np.array([0.31, 0.23, 0.084])) inputs.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.2) inputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 137, 'ft**2') @@ -364,8 +364,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1195) outputs.set_val(Aircraft.VerticalTail.MASS, 1221.8, 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 11.5918) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 8184.8, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 11.5918) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 8184.8, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 10.49, 'ft') # Not in FLOPS output; calculated from inputs. outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 137, 'ft**2') diff --git a/aviary/models/large_single_aisle_2/large_single_aisle_2_FLOPS_data.py b/aviary/models/large_single_aisle_2/large_single_aisle_2_FLOPS_data.py index c6c0f8e34..af6f6a1d9 100644 --- a/aviary/models/large_single_aisle_2/large_single_aisle_2_FLOPS_data.py +++ b/aviary/models/large_single_aisle_2/large_single_aisle_2_FLOPS_data.py @@ -213,7 +213,7 @@ inputs.set_val(Aircraft.Wing.AIRFOIL_TECHNOLOGY, 1.87) inputs.set_val(Aircraft.Wing.AREA, 1341.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 9.45) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.0) inputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA_RATIO, 0.333) inputs.set_val(Aircraft.Wing.GLOVE_AND_BAT, 0.0, 'ft**2') @@ -393,8 +393,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1375) outputs.set_val(Aircraft.VerticalTail.MASS, 1035.6, 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 8.8294) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 6016.9, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 8.8294) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 6016.9, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 11.91, 'ft') outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 0.333 * 1341.0, 'ft**2') outputs.set_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR, 0.940000) diff --git a/aviary/models/large_single_aisle_2/large_single_aisle_2_altwt_FLOPS_data.py b/aviary/models/large_single_aisle_2/large_single_aisle_2_altwt_FLOPS_data.py index c08f43020..ed2d08695 100644 --- a/aviary/models/large_single_aisle_2/large_single_aisle_2_altwt_FLOPS_data.py +++ b/aviary/models/large_single_aisle_2/large_single_aisle_2_altwt_FLOPS_data.py @@ -200,7 +200,7 @@ inputs.set_val(Aircraft.Wing.AIRFOIL_TECHNOLOGY, 1.87) inputs.set_val(Aircraft.Wing.AREA, 1341.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 9.45) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.0) inputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA_RATIO, 0.333) inputs.set_val(Aircraft.Wing.GLOVE_AND_BAT, 0.0, 'ft**2') @@ -371,8 +371,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1375) outputs.set_val(Aircraft.VerticalTail.MASS, 1707., 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 8.8294) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 6016.9, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 8.8294) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 6016.9, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 11.91, 'ft') outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 0.333 * 1341.0, 'ft**2') outputs.set_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR, 0.940000) diff --git a/aviary/models/large_single_aisle_2/large_single_aisle_2_detailwing_FLOPS_data.py b/aviary/models/large_single_aisle_2/large_single_aisle_2_detailwing_FLOPS_data.py index 2aca006c4..39a39a380 100644 --- a/aviary/models/large_single_aisle_2/large_single_aisle_2_detailwing_FLOPS_data.py +++ b/aviary/models/large_single_aisle_2/large_single_aisle_2_detailwing_FLOPS_data.py @@ -205,7 +205,7 @@ inputs.set_val(Aircraft.Wing.AIRFOIL_TECHNOLOGY, 1.87) inputs.set_val(Aircraft.Wing.AREA, 1341.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 9.42519) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val( Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, np.array([0.4441, 0.2313, 0.0729])) inputs.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.0) @@ -395,8 +395,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1375) outputs.set_val(Aircraft.VerticalTail.MASS, 1035.6, 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 9.0236) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 6276.3, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 9.0236) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 6276.3, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 11.91, 'ft') outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 0.333 * 1341.0, 'ft**2') outputs.set_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR, 0.959104) diff --git a/aviary/models/multi_engine_single_aisle/multi_engine_single_aisle_data.py b/aviary/models/multi_engine_single_aisle/multi_engine_single_aisle_data.py index 1966ed2af..2a30f1422 100644 --- a/aviary/models/multi_engine_single_aisle/multi_engine_single_aisle_data.py +++ b/aviary/models/multi_engine_single_aisle/multi_engine_single_aisle_data.py @@ -226,7 +226,7 @@ inputs.set_val(Aircraft.Wing.AIRFOIL_TECHNOLOGY, 1.87) inputs.set_val(Aircraft.Wing.AREA, 1341.0, 'ft**2') inputs.set_val(Aircraft.Wing.ASPECT_RATIO, 9.42519) -inputs.set_val(Aircraft.Wing.BENDING_MASS_SCALER, 1.0) +inputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, 1.0) inputs.set_val( Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, np.array([0.4441, 0.2313, 0.0729])) inputs.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.0) @@ -404,8 +404,8 @@ outputs.set_val(Aircraft.VerticalTail.FINENESS, 0.1195) outputs.set_val(Aircraft.VerticalTail.MASS, 1221.8, 'lbm') -outputs.set_val(Aircraft.Wing.BENDING_FACTOR, 11.5918) -outputs.set_val(Aircraft.Wing.BENDING_MASS, 8184.8, 'lbm') +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 11.5918) +outputs.set_val(Aircraft.Wing.BENDING_MATERIAL_MASS, 8184.8, 'lbm') outputs.set_val(Aircraft.Wing.CHARACTERISTIC_LENGTH, 10.49, 'ft') # Not in FLOPS output; calculated from inputs. outputs.set_val(Aircraft.Wing.CONTROL_SURFACE_AREA, 137, 'ft**2') diff --git a/aviary/models/test_aircraft/aircraft_for_bench_FwFm.csv b/aviary/models/test_aircraft/aircraft_for_bench_FwFm.csv index c2fa1d8a1..d0dea1807 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_FwFm.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_FwFm.csv @@ -114,7 +114,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless aircraft:wing:airfoil_technology,1.92669766647637,unitless aircraft:wing:area,1370.0,ft**2 aircraft:wing:aspect_ratio,11.22091,unitless -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless aircraft:wing:composite_fraction,0.2,unitless aircraft:wing:control_surface_area,137,ft**2 diff --git a/aviary/models/test_aircraft/aircraft_for_bench_FwFm_with_electric.csv b/aviary/models/test_aircraft/aircraft_for_bench_FwFm_with_electric.csv index 1f408f98b..c7445b52e 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_FwFm_with_electric.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_FwFm_with_electric.csv @@ -114,7 +114,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless aircraft:wing:airfoil_technology,1.92669766647637,unitless aircraft:wing:area,1370.0,ft**2 aircraft:wing:aspect_ratio,11.22091,unitless -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless aircraft:wing:composite_fraction,0.2,unitless aircraft:wing:control_surface_area,137,ft**2 diff --git a/aviary/models/test_aircraft/aircraft_for_bench_FwGm.csv b/aviary/models/test_aircraft/aircraft_for_bench_FwGm.csv index 1e67d1ee5..38ad2c3bd 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_FwGm.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_FwGm.csv @@ -229,7 +229,7 @@ aircraft:vertical_tail:wetted_area_scaler,1.0,unitless aircraft:vertical_tail:wetted_area,581.13,ft**2 aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless aircraft:wing:airfoil_technology,1.92669766647637,unitless -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless aircraft:wing:composite_fraction,0.2,unitless aircraft:wing:control_surface_area,137,ft**2 diff --git a/aviary/models/test_aircraft/aircraft_for_bench_GwFm.csv b/aviary/models/test_aircraft/aircraft_for_bench_GwFm.csv index 88adc9307..38568fc54 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_GwFm.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_GwFm.csv @@ -207,7 +207,7 @@ aircraft:wing:airfoil_technology,1.92669766647637,unitless aircraft:wing:area,1370.0,ft**2 aircraft:wing:aspect_ratio,10.13,unitless aircraft:wing:average_chord,12.615,ft -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless aircraft:wing:center_distance,0.463,unitless aircraft:wing:choose_fold_location,True,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless diff --git a/aviary/models/test_aircraft/aircraft_for_bench_solved2dof.csv b/aviary/models/test_aircraft/aircraft_for_bench_solved2dof.csv index 1d2c97329..efa546f92 100644 --- a/aviary/models/test_aircraft/aircraft_for_bench_solved2dof.csv +++ b/aviary/models/test_aircraft/aircraft_for_bench_solved2dof.csv @@ -114,7 +114,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless aircraft:wing:airfoil_technology,1.92669766647637,unitless aircraft:wing:area,1370.0,ft**2 aircraft:wing:aspect_ratio,11.22091,unitless -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless aircraft:wing:composite_fraction,0.2,unitless aircraft:wing:control_surface_area,137,ft**2 diff --git a/aviary/subsystems/aerodynamics/flops_based/test/data/high_wing_single_aisle.csv b/aviary/subsystems/aerodynamics/flops_based/test/data/high_wing_single_aisle.csv index ebde1eae7..d798dfe0b 100644 --- a/aviary/subsystems/aerodynamics/flops_based/test/data/high_wing_single_aisle.csv +++ b/aviary/subsystems/aerodynamics/flops_based/test/data/high_wing_single_aisle.csv @@ -98,7 +98,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.01,unitless #check aircraft:wing:airfoil_technology,1.01,unitless #check aircraft:wing:area,1480,ft**2 aircraft:wing:aspect_ratio_reference,0.01,unitless #check -aircraft:wing:bending_mass_scaler,1.01,unitless #check +aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.01,unitless #check aircraft:wing:chord_per_semispan,0.13,0.115,0.06,unitless aircraft:wing:composite_fraction,0.01,unitless #check aircraft:wing:dihedral,-1.0,deg diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_common.py b/aviary/subsystems/mass/flops_based/test/test_wing_common.py index 2fce180f7..3b4c10886 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_common.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_common.py @@ -99,24 +99,27 @@ def test_case(self, case_name): flops_validation_test( prob, case_name, - input_keys=[Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, - Aircraft.Wing.BENDING_FACTOR, - Aircraft.Wing.BENDING_MASS_SCALER, - Aircraft.Wing.COMPOSITE_FRACTION, - Aircraft.Wing.ENG_POD_INERTIA_FACTOR, - Mission.Design.GROSS_MASS, - Aircraft.Wing.LOAD_FRACTION, - Aircraft.Wing.MISC_MASS, - Aircraft.Wing.MISC_MASS_SCALER, - Aircraft.Wing.SHEAR_CONTROL_MASS, - Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER, - Aircraft.Wing.SPAN, - Aircraft.Wing.SWEEP, - Aircraft.Wing.ULTIMATE_LOAD_FACTOR, - Aircraft.Wing.VAR_SWEEP_MASS_PENALTY], - output_keys=Aircraft.Wing.BENDING_MASS, + input_keys=[ + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Wing.BENDING_MATERIAL_FACTOR, + Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, + Aircraft.Wing.COMPOSITE_FRACTION, + Aircraft.Wing.ENG_POD_INERTIA_FACTOR, + Mission.Design.GROSS_MASS, + Aircraft.Wing.LOAD_FRACTION, + Aircraft.Wing.MISC_MASS, + Aircraft.Wing.MISC_MASS_SCALER, + Aircraft.Wing.SHEAR_CONTROL_MASS, + Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER, + Aircraft.Wing.SPAN, + Aircraft.Wing.SWEEP, + Aircraft.Wing.ULTIMATE_LOAD_FACTOR, + Aircraft.Wing.VAR_SWEEP_MASS_PENALTY, + ], + output_keys=Aircraft.Wing.BENDING_MATERIAL_MASS, atol=1e-11, - rtol=1e-11) + rtol=1e-11, + ) def test_IO(self): assert_match_varnames(self.prob.model) diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py index d93a59381..9653d13dd 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_detailed.py @@ -47,23 +47,28 @@ def test_case(self, case_name): flops_validation_test( prob, case_name, - input_keys=[Aircraft.Wing.LOAD_PATH_SWEEP_DIST, - Aircraft.Wing.THICKNESS_TO_CHORD_DIST, - Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, - Mission.Design.GROSS_MASS, - Aircraft.Engine.POD_MASS, - Aircraft.Wing.ASPECT_RATIO, - Aircraft.Wing.ASPECT_RATIO_REF, - Aircraft.Wing.STRUT_BRACING_FACTOR, - Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, - Aircraft.Engine.WING_LOCATIONS, - Aircraft.Wing.THICKNESS_TO_CHORD, - Aircraft.Wing.THICKNESS_TO_CHORD_REF], - output_keys=[Aircraft.Wing.BENDING_FACTOR, - Aircraft.Wing.ENG_POD_INERTIA_FACTOR], + input_keys=[ + Aircraft.Wing.LOAD_PATH_SWEEP_DIST, + Aircraft.Wing.THICKNESS_TO_CHORD_DIST, + Aircraft.Wing.CHORD_PER_SEMISPAN_DIST, + Mission.Design.GROSS_MASS, + Aircraft.Engine.POD_MASS, + Aircraft.Wing.ASPECT_RATIO, + Aircraft.Wing.ASPECT_RATIO_REF, + Aircraft.Wing.STRUT_BRACING_FACTOR, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Engine.WING_LOCATIONS, + Aircraft.Wing.THICKNESS_TO_CHORD, + Aircraft.Wing.THICKNESS_TO_CHORD_REF, + ], + output_keys=[ + Aircraft.Wing.BENDING_MATERIAL_FACTOR, + Aircraft.Wing.ENG_POD_INERTIA_FACTOR, + ], method='fd', atol=1e-3, - rtol=1e-5) + rtol=1e-5, + ) def test_case_multiengine(self): prob = self.prob @@ -114,13 +119,15 @@ def test_case_multiengine(self): prob.run_model() - bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) + BENDING_MATERIAL_FACTOR = prob.get_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - bending_factor_expected = 11.59165669761 + BENDING_MATERIAL_FACTOR_expected = 11.59165669761 # 0.9600334354133278 if the factors are additive pod_inertia_expected = 0.9604608395586276 - assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) + assert_near_equal( + BENDING_MATERIAL_FACTOR, BENDING_MATERIAL_FACTOR_expected, tolerance=1e-10 + ) assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) partial_data = prob.check_partials( @@ -176,12 +183,14 @@ def test_case_fuselage_engines(self): prob.run_model() - bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) + BENDING_MATERIAL_FACTOR = prob.get_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - bending_factor_expected = 11.59165669761 + BENDING_MATERIAL_FACTOR_expected = 11.59165669761 pod_inertia_expected = 0.84 - assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) + assert_near_equal( + BENDING_MATERIAL_FACTOR, BENDING_MATERIAL_FACTOR_expected, tolerance=1e-10 + ) assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) def test_case_fuselage_multiengine(self): @@ -235,12 +244,14 @@ def test_case_fuselage_multiengine(self): prob.run_model() - bending_factor = prob.get_val(Aircraft.Wing.BENDING_FACTOR) + BENDING_MATERIAL_FACTOR = prob.get_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR) pod_inertia = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR) - bending_factor_expected = 11.59165669761 + BENDING_MATERIAL_FACTOR_expected = 11.59165669761 pod_inertia_expected = 0.84 - assert_near_equal(bending_factor, bending_factor_expected, tolerance=1e-10) + assert_near_equal( + BENDING_MATERIAL_FACTOR, BENDING_MATERIAL_FACTOR_expected, tolerance=1e-10 + ) assert_near_equal(pod_inertia, pod_inertia_expected, tolerance=1e-10) def test_extreme_engine_loc(self): @@ -303,8 +314,8 @@ def test_IO(self): if __name__ == "__main__": - # unittest.main() - test = DetailedWingBendingTest() - test.setUp() + unittest.main() + # test = DetailedWingBendingTest() + # test.setUp() # test.test_case(case_name='LargeSingleAisle1FLOPS') - test.test_case_multiengine() + # test.test_case_multiengine() diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_simple.py b/aviary/subsystems/mass/flops_based/test/test_wing_simple.py index da5d4148b..4485c5954 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_simple.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_simple.py @@ -36,18 +36,23 @@ def test_case(self, case_name): flops_validation_test( prob, case_name, - input_keys=[Aircraft.Wing.AREA, - Aircraft.Wing.SPAN, - Aircraft.Wing.TAPER_RATIO, - Aircraft.Wing.THICKNESS_TO_CHORD, - Aircraft.Wing.STRUT_BRACING_FACTOR, - Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, - Aircraft.Wing.ASPECT_RATIO, - Aircraft.Wing.SWEEP], - output_keys=[Aircraft.Wing.BENDING_FACTOR, - Aircraft.Wing.ENG_POD_INERTIA_FACTOR], + input_keys=[ + Aircraft.Wing.AREA, + Aircraft.Wing.SPAN, + Aircraft.Wing.TAPER_RATIO, + Aircraft.Wing.THICKNESS_TO_CHORD, + Aircraft.Wing.STRUT_BRACING_FACTOR, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Wing.ASPECT_RATIO, + Aircraft.Wing.SWEEP, + ], + output_keys=[ + Aircraft.Wing.BENDING_MATERIAL_FACTOR, + Aircraft.Wing.ENG_POD_INERTIA_FACTOR, + ], atol=1e-11, - rtol=1e-11) + rtol=1e-11, + ) def test_IO(self): assert_match_varnames(self.prob.model) diff --git a/aviary/subsystems/mass/flops_based/wing_common.py b/aviary/subsystems/mass/flops_based/wing_common.py index 20098e0a5..6b6fd0b74 100644 --- a/aviary/subsystems/mass/flops_based/wing_common.py +++ b/aviary/subsystems/mass/flops_based/wing_common.py @@ -21,8 +21,8 @@ def initialize(self): def setup(self): add_aviary_input(self, Mission.Design.GROSS_MASS, val=0.0) add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) - add_aviary_input(self, Aircraft.Wing.BENDING_MASS_SCALER, val=1.0) + add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR, val=0.0) + add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, val=1.0) add_aviary_input(self, Aircraft.Wing.COMPOSITE_FRACTION, val=0.0) add_aviary_input(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) add_aviary_input(self, Aircraft.Wing.LOAD_FRACTION, val=0.0) @@ -35,7 +35,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.ULTIMATE_LOAD_FACTOR, val=3.75) add_aviary_input(self, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY, val=0.0) - add_aviary_output(self, Aircraft.Wing.BENDING_MASS, val=0.0) + add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_MASS, val=0.0) self.A1 = 8.80 self.A2 = 6.25 @@ -44,7 +44,7 @@ def setup_partials(self): self.declare_partials("*", "*") def compute(self, inputs, outputs): - bt = inputs[Aircraft.Wing.BENDING_FACTOR] + bt = inputs[Aircraft.Wing.BENDING_MATERIAL_FACTOR] ulf = inputs[Aircraft.Wing.ULTIMATE_LOAD_FACTOR] span = inputs[Aircraft.Wing.SPAN] comp_frac = inputs[Aircraft.Wing.COMPOSITE_FRACTION] @@ -54,7 +54,7 @@ def compute(self, inputs, outputs): sweep = inputs[Aircraft.Wing.SWEEP] gross_weight = inputs[Mission.Design.GROSS_MASS] * GRAV_ENGLISH_LBM CAYE = inputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] - scaler = inputs[Aircraft.Wing.BENDING_MASS_SCALER] + scaler = inputs[Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER] num_fuse = self.options['aviary_options'].get_val( Aircraft.Fuselage.NUM_FUSELAGES) @@ -72,12 +72,14 @@ def compute(self, inputs, outputs): W1NIR = self.A1 * bt * (1.0 + (self.A2 / span)**0.5) * ulf * span * \ (1.0 - 0.4 * comp_frac) * (1.0 - 0.1 * faert) * cayf * vfact * pctl * 1.0e-6 - outputs[Aircraft.Wing.BENDING_MASS] = ( - (gross_weight * CAYE * W1NIR + W2 + W3) / (1.0 + W1NIR) - W2 - W3) \ - * scaler / GRAV_ENGLISH_LBM + outputs[Aircraft.Wing.BENDING_MATERIAL_MASS] = ( + ((gross_weight * CAYE * W1NIR + W2 + W3) / (1.0 + W1NIR) - W2 - W3) + * scaler + / GRAV_ENGLISH_LBM + ) def compute_partials(self, inputs, J): - bt = inputs[Aircraft.Wing.BENDING_FACTOR] + bt = inputs[Aircraft.Wing.BENDING_MATERIAL_FACTOR] ulf = inputs[Aircraft.Wing.ULTIMATE_LOAD_FACTOR] span = inputs[Aircraft.Wing.SPAN] comp_frac = inputs[Aircraft.Wing.COMPOSITE_FRACTION] @@ -91,7 +93,7 @@ def compute_partials(self, inputs, J): W3 = inputs[Aircraft.Wing.MISC_MASS] * GRAV_ENGLISH_LBM W2scale = inputs[Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER] W3scale = inputs[Aircraft.Wing.MISC_MASS_SCALER] - scaler = inputs[Aircraft.Wing.BENDING_MASS_SCALER] + scaler = inputs[Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER] num_fuse = self.options['aviary_options'].get_val( Aircraft.Fuselage.NUM_FUSELAGES) @@ -136,50 +138,69 @@ def compute_partials(self, inputs, J): fact2 = 1.0 / (1.0 + W1NIR) dbend_w1nir = scaler * (gross_weight * CAYE * fact2 - fact1 * fact2**2) - J[Aircraft.Wing.BENDING_MASS, Mission.Design.GROSS_MASS] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Mission.Design.GROSS_MASS] = ( CAYE * W1NIR * fact2 * scaler + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = ( gross_weight * W1NIR * fact2 * scaler / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.SHEAR_CONTROL_MASS] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.SHEAR_CONTROL_MASS] = ( (fact2 - 1.0) * scaler / W2scale + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER] = \ - -(fact2 - 1.0) * scaler * W2 / W2scale ** 2 / GRAV_ENGLISH_LBM + J[ + Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.SHEAR_CONTROL_MASS_SCALER + ] = (-(fact2 - 1.0) * scaler * W2 / W2scale**2 / GRAV_ENGLISH_LBM) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.MISC_MASS] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.MISC_MASS] = ( (fact2 - 1.0) * scaler / W3scale + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.MISC_MASS_SCALER] = \ - -(fact2 - 1.0) * scaler * W3 / W3scale ** 2 / GRAV_ENGLISH_LBM + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.MISC_MASS_SCALER] = ( + -(fact2 - 1.0) * scaler * W3 / W3scale**2 / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.BENDING_MASS_SCALER] = \ - (fact1 * fact2 - W2/W2scale - W3/W3scale) / GRAV_ENGLISH_LBM + J[ + Aircraft.Wing.BENDING_MATERIAL_MASS, + Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, + ] = (fact1 * fact2 - W2 / W2scale - W3 / W3scale) / GRAV_ENGLISH_LBM - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.BENDING_FACTOR] = \ - dbend_w1nir * dW1NIR_bt / GRAV_ENGLISH_LBM + J[ + Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.BENDING_MATERIAL_FACTOR + ] = (dbend_w1nir * dW1NIR_bt / GRAV_ENGLISH_LBM) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.ULTIMATE_LOAD_FACTOR] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.ULTIMATE_LOAD_FACTOR] = ( dbend_w1nir * dW1NIR_ulf / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.LOAD_FRACTION] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.LOAD_FRACTION] = ( dbend_w1nir * dW1NIR_pctl / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.COMPOSITE_FRACTION] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.COMPOSITE_FRACTION] = ( dbend_w1nir * dW1NIR_compfrac / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR] = \ + J[ + Aircraft.Wing.BENDING_MATERIAL_MASS, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + ] = ( dbend_w1nir * dW1NIR_faert / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.VAR_SWEEP_MASS_PENALTY] = ( dbend_w1nir * dW1NIR_varswp / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.SWEEP] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.SWEEP] = ( dbend_w1nir * dW1NIR_sweep / GRAV_ENGLISH_LBM + ) - J[Aircraft.Wing.BENDING_MASS, Aircraft.Wing.SPAN] = \ + J[Aircraft.Wing.BENDING_MATERIAL_MASS, Aircraft.Wing.SPAN] = ( dbend_w1nir * dW1NIR_span / GRAV_ENGLISH_LBM + ) class WingShearControlMass(om.ExplicitComponent): @@ -333,7 +354,7 @@ def initialize(self): desc='collection of Aircraft/Mission specific options') def setup(self): - add_aviary_input(self, Aircraft.Wing.BENDING_MASS, val=0.0) + add_aviary_input(self, Aircraft.Wing.BENDING_MATERIAL_MASS, val=0.0) add_aviary_input(self, Aircraft.Wing.SHEAR_CONTROL_MASS, val=0.0) @@ -349,7 +370,7 @@ def setup_partials(self): self.declare_partials("*", "*") def compute(self, inputs, outputs): - m1 = inputs[Aircraft.Wing.BENDING_MASS] + m1 = inputs[Aircraft.Wing.BENDING_MATERIAL_MASS] m2 = inputs[Aircraft.Wing.SHEAR_CONTROL_MASS] m3 = inputs[Aircraft.Wing.MISC_MASS] m4 = inputs[Aircraft.Wing.BWB_AFTBODY_MASS] @@ -358,13 +379,13 @@ def compute(self, inputs, outputs): outputs[Aircraft.Wing.MASS] = (m1 + m2 + m3 + m4) * m_scalar def compute_partials(self, inputs, J): - m1 = inputs[Aircraft.Wing.BENDING_MASS] + m1 = inputs[Aircraft.Wing.BENDING_MATERIAL_MASS] m2 = inputs[Aircraft.Wing.SHEAR_CONTROL_MASS] m3 = inputs[Aircraft.Wing.MISC_MASS] m4 = inputs[Aircraft.Wing.BWB_AFTBODY_MASS] m_scaler = inputs[Aircraft.Wing.MASS_SCALER] - J[Aircraft.Wing.MASS, Aircraft.Wing.BENDING_MASS] = m_scaler + J[Aircraft.Wing.MASS, Aircraft.Wing.BENDING_MATERIAL_MASS] = m_scaler J[Aircraft.Wing.MASS, Aircraft.Wing.SHEAR_CONTROL_MASS] = m_scaler J[Aircraft.Wing.MASS, Aircraft.Wing.MISC_MASS] = m_scaler J[Aircraft.Wing.MASS, Aircraft.Wing.BWB_AFTBODY_MASS] = m_scaler diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 990024843..f203e3cf6 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -61,7 +61,7 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.THICKNESS_TO_CHORD_REF, val=0.0) - add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) + add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR, val=0.0) add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) @@ -189,7 +189,7 @@ def compute(self, inputs, outputs): bt = btb / (ar**(0.25 * fstrt) * (1.0 + (0.5 * faert - 0.16 * fstrt) * sa**2 + 0.03 * caya * (1.0 - 0.5 * faert) * sa)) - outputs[Aircraft.Wing.BENDING_FACTOR] = bt + outputs[Aircraft.Wing.BENDING_MATERIAL_FACTOR] = bt inertia_factor = np.zeros(num_engine_type, dtype=chord.dtype) eel = np.zeros(len(dy) + 1, dtype=chord.dtype) diff --git a/aviary/subsystems/mass/flops_based/wing_group.py b/aviary/subsystems/mass/flops_based/wing_group.py index 2a2d8df75..2efbc38a1 100644 --- a/aviary/subsystems/mass/flops_based/wing_group.py +++ b/aviary/subsystems/mass/flops_based/wing_group.py @@ -24,14 +24,20 @@ def setup(self): promotes_inputs=['*'], promotes_outputs=['*']) if Aircraft.Wing.INPUT_STATION_DIST in aviary_options: - self.add_subsystem('wing_bending_factor', - DetailedWingBendingFact(aviary_options=aviary_options), - promotes_inputs=['*'], promotes_outputs=['*']) + self.add_subsystem( + 'wing_BENDING_MATERIAL_FACTOR', + DetailedWingBendingFact(aviary_options=aviary_options), + promotes_inputs=['*'], + promotes_outputs=['*'], + ) else: - self.add_subsystem('wing_bending_factor', - SimpleWingBendingFact(aviary_options=aviary_options), - promotes_inputs=['*'], promotes_outputs=['*']) + self.add_subsystem( + 'wing_BENDING_MATERIAL_FACTOR', + SimpleWingBendingFact(aviary_options=aviary_options), + promotes_inputs=['*'], + promotes_outputs=['*'], + ) self.add_subsystem('wing_misc', WingMiscMass(aviary_options=aviary_options), diff --git a/aviary/subsystems/mass/flops_based/wing_simple.py b/aviary/subsystems/mass/flops_based/wing_simple.py index 9d101af64..24919154b 100644 --- a/aviary/subsystems/mass/flops_based/wing_simple.py +++ b/aviary/subsystems/mass/flops_based/wing_simple.py @@ -30,20 +30,24 @@ def setup(self): add_aviary_input(self, Aircraft.Wing.SWEEP, val=0.0) - add_aviary_output(self, Aircraft.Wing.BENDING_FACTOR, val=0.0) + add_aviary_output(self, Aircraft.Wing.BENDING_MATERIAL_FACTOR, val=0.0) add_aviary_output(self, Aircraft.Wing.ENG_POD_INERTIA_FACTOR, val=0.0) def setup_partials(self): - self.declare_partials(of=Aircraft.Wing.BENDING_FACTOR, - wrt=[Aircraft.Wing.STRUT_BRACING_FACTOR, - Aircraft.Wing.SPAN, - Aircraft.Wing.TAPER_RATIO, - Aircraft.Wing.AREA, - Aircraft.Wing.THICKNESS_TO_CHORD, - Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, - Aircraft.Wing.ASPECT_RATIO, - Aircraft.Wing.SWEEP]) + self.declare_partials( + of=Aircraft.Wing.BENDING_MATERIAL_FACTOR, + wrt=[ + Aircraft.Wing.STRUT_BRACING_FACTOR, + Aircraft.Wing.SPAN, + Aircraft.Wing.TAPER_RATIO, + Aircraft.Wing.AREA, + Aircraft.Wing.THICKNESS_TO_CHORD, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + Aircraft.Wing.ASPECT_RATIO, + Aircraft.Wing.SWEEP, + ], + ) def compute(self, inputs, outputs): aviary_options: AviaryValues = self.options['aviary_options'] @@ -73,8 +77,9 @@ def compute(self, inputs, outputs): ems = 1.0 - 0.25 * fstrt - outputs[Aircraft.Wing.BENDING_FACTOR] = \ - 0.215 * (0.37 + 0.7 * tr) * (span**2 / area)**ems / (cayl * tca) + outputs[Aircraft.Wing.BENDING_MATERIAL_FACTOR] = ( + 0.215 * (0.37 + 0.7 * tr) * (span**2 / area) ** ems / (cayl * tca) + ) outputs[Aircraft.Wing.ENG_POD_INERTIA_FACTOR] = 1.0 - 0.03 * num_wing_eng @@ -130,26 +135,37 @@ def compute_partials(self, inputs, J): dbend_tr = 0.215 * 0.7 * term2 * term3 dbend_cayl = -0.215 * term1 * term2 * tca * term3**2 - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.STRUT_BRACING_FACTOR] = \ + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.STRUT_BRACING_FACTOR] = ( dbend_exp + dbend_cayl * dcayl_fstrt + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.SPAN] = \ - 2.0 * 0.215 * term1 * ems * term2a**(ems - 1) * term3 * span / area + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.SPAN] = ( + 2.0 * 0.215 * term1 * ems * term2a ** (ems - 1) * term3 * span / area + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.TAPER_RATIO] = \ + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.TAPER_RATIO] = ( dbend_tr + dbend_cayl * (dcayl_slam * dslam * dtlam_tr) + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.AREA] = \ - -0.215 * term1 * ems * term2a**(ems - 1) * term3 * term2a / area + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.AREA] = ( + -0.215 * term1 * ems * term2a ** (ems - 1) * term3 * term2a / area + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.THICKNESS_TO_CHORD] = \ + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.THICKNESS_TO_CHORD] = ( -0.215 * term1 * term2 * cayl * term3**2 + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR] = \ + J[ + Aircraft.Wing.BENDING_MATERIAL_FACTOR, + Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, + ] = ( dbend_cayl * dcayl_faert + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.ASPECT_RATIO] = \ + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.ASPECT_RATIO] = ( dbend_cayl * (dcayl_ar + dcayl_slam * dslam * dtlam_ar) + ) - J[Aircraft.Wing.BENDING_FACTOR, Aircraft.Wing.SWEEP] = \ - dbend_cayl * (dcayl_slam * dslam * dtlam_sweep) + J[Aircraft.Wing.BENDING_MATERIAL_FACTOR, Aircraft.Wing.SWEEP] = dbend_cayl * ( + dcayl_slam * dslam * dtlam_sweep + ) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index 6fe831540..8feba47cc 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -4984,12 +4984,13 @@ add_meta_data( Aircraft.Wing.ASPECT_RATIO_REF, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": 'WTIN.ARREF', # ['&DEFINE.WTIN.ARREF'], - "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_aspect_ratio' - }, + historical_name={ + "GASP": None, + "FLOPS": 'WTIN.ARREF', # ['&DEFINE.WTIN.ARREF'], + "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_aspect_ratio', + }, units='unitless', - desc='Reference aspect ratio, used for detailed wing bending.' + desc='Reference aspect ratio, used for detailed wing mass estimation.', ) add_meta_data( @@ -5004,37 +5005,41 @@ ) add_meta_data( - Aircraft.Wing.BENDING_FACTOR, + Aircraft.Wing.BENDING_MATERIAL_FACTOR, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": None, # ['~WWGHT.BT', '~BNDMAT.W'], - "LEAPS1": 'aircraft.outputs.L0_wing.bending_material_factor' - }, + historical_name={ + "GASP": None, + "FLOPS": None, # ['~WWGHT.BT', '~BNDMAT.W'], + "LEAPS1": 'aircraft.outputs.L0_wing.bending_material_factor', + }, units='unitless', - desc='wing bending factor' + desc='Wing bending material factor with sweep adjustment. Used to compute ' + 'Aircraft.Wing.BENDING_MATERIAL_MASS', ) add_meta_data( # Note user override - # - see also: Aircraft.Wing.BENDING_MASS_SCALER - Aircraft.Wing.BENDING_MASS, + # - see also: Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER + Aircraft.Wing.BENDING_MATERIAL_MASS, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": None, # '~WWGHT.W1', - "LEAPS1": 'aircraft.outputs.L0_wing.bending_mat_weight' - }, + historical_name={ + "GASP": None, + "FLOPS": None, # '~WWGHT.W1', + "LEAPS1": 'aircraft.outputs.L0_wing.bending_mat_weight', + }, units='lbm', desc='wing mass breakdown term 1', default_value=None, ) add_meta_data( - Aircraft.Wing.BENDING_MASS_SCALER, + Aircraft.Wing.BENDING_MATERIAL_MASS_SCALER, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": 'WTIN.FRWI1', # ['&DEFINE.WTIN.FRWI1', 'WIOR3.FRWI1'], - "LEAPS1": 'aircraft.inputs.L0_overrides.wing_bending_mat_weight' - }, + historical_name={ + "GASP": None, + "FLOPS": 'WTIN.FRWI1', # ['&DEFINE.WTIN.FRWI1', 'WIOR3.FRWI1'], + "LEAPS1": 'aircraft.inputs.L0_overrides.wing_bending_mat_weight', + }, units='unitless', desc='mass scaler of the bending wing mass term', default_value=1.0, @@ -5207,12 +5212,14 @@ add_meta_data( Aircraft.Wing.ENG_POD_INERTIA_FACTOR, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": None, # '~WWGHT.CAYE', - "LEAPS1": 'aircraft.outputs.L0_wing.engine_inertia_relief_factor' - }, + historical_name={ + "GASP": None, + "FLOPS": None, # '~WWGHT.CAYE', + "LEAPS1": 'aircraft.outputs.L0_wing.engine_inertia_relief_factor', + }, units='unitless', - desc='engine inertia relief factor' + desc='Engine inertia relief factor for wingspan inboard of engine locations. Used ' + 'to compute Aircraft.Wing.BENDING_MATERIAL_MASS', ) add_meta_data( @@ -6093,13 +6100,14 @@ add_meta_data( Aircraft.Wing.THICKNESS_TO_CHORD_REF, meta_data=_MetaData, - historical_name={"GASP": None, - "FLOPS": 'WTIN.TCREF', # ['&DEFINE.WTIN.TCREF'], - "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_thickness_to_chord_ratio' - }, + historical_name={ + "GASP": None, + "FLOPS": 'WTIN.TCREF', # ['&DEFINE.WTIN.TCREF'], + "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_thickness_to_chord_ratio', + }, units='unitless', - desc='Reference thickness-to-chord ratio, used for detailed wing bending.', - default_value=0.0 + desc='Reference thickness-to-chord ratio, used for detailed wing mass estimation.', + default_value=0.0, ) add_meta_data( diff --git a/aviary/variable_info/variables.py b/aviary/variable_info/variables.py index ca8ab5666..d7fe25472 100644 --- a/aviary/variable_info/variables.py +++ b/aviary/variable_info/variables.py @@ -502,11 +502,11 @@ class Wing: ASPECT_RATIO = 'aircraft:wing:aspect_ratio' ASPECT_RATIO_REF = 'aircraft:wing:aspect_ratio_reference' AVERAGE_CHORD = 'aircraft:wing:average_chord' - BENDING_FACTOR = 'aircraft:wing:bending_factor' - BENDING_MASS = 'aircraft:wing:bending_mass' + BENDING_MATERIAL_FACTOR = 'aircraft:wing:bending_material_factor' + BENDING_MATERIAL_MASS = 'aircraft:wing:bending_material_mass' # Not defined in metadata! # BENDING_MASS_NO_INERTIA = 'aircraft:wing:bending_mass_no_inertia' - BENDING_MASS_SCALER = 'aircraft:wing:bending_mass_scaler' + BENDING_MATERIAL_MASS_SCALER = 'aircraft:wing:bending_material_mass_scaler' BWB_AFTBODY_MASS = 'aircraft:wing:bwb_aft_body_mass' BWB_AFTBODY_MASS_SCALER = 'aircraft:wing:bwb_aft_body_mass_scaler' CENTER_CHORD = 'aircraft:wing:center_chord' From 449490f6037471c2c70cf385a2d3bfa7574855a6 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Mon, 30 Dec 2024 15:18:42 -0500 Subject: [PATCH 13/17] fix duplicate metadata from merge --- aviary/variable_info/variable_meta_data.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/aviary/variable_info/variable_meta_data.py b/aviary/variable_info/variable_meta_data.py index ee226e555..c281aa3c8 100644 --- a/aviary/variable_info/variable_meta_data.py +++ b/aviary/variable_info/variable_meta_data.py @@ -4996,11 +4996,6 @@ "FLOPS": 'WTIN.ARREF', # ['&DEFINE.WTIN.ARREF'], "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_aspect_ratio', }, - historical_name={ - "GASP": None, - "FLOPS": 'WTIN.ARREF', # ['&DEFINE.WTIN.ARREF'], - "LEAPS1": 'aircraft.inputs.L0_detailed_wing.ref_aspect_ratio', - }, units='unitless', desc='Reference aspect ratio, used for detailed wing mass estimation.', ) From 5148d19d12a63a10061c7e2935074f87cd91d3c2 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Mon, 30 Dec 2024 15:30:26 -0500 Subject: [PATCH 14/17] formatting fix --- aviary/subsystems/mass/flops_based/wing_detailed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 90bd7fb39..1a04db4aa 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -163,8 +163,8 @@ def compute(self, inputs, outputs): load_intensity = np.ones(num_integration_stations + 1) else: raise om.AnalysisError( - f'{load_distribution_factor} is not a valid value for { - Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL}, it must be "1", "2", or "3".' + f'{load_distribution_factor} is not a valid value for ' + f'{Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL}, it must be "1", "2", or "3".' ) chord_interp = InterpND( From 74f036eb941774106484b7fc1348e59b5cd535e9 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Mon, 30 Dec 2024 16:50:30 -0500 Subject: [PATCH 15/17] fixes for tests --- aviary/docs/examples/modified_aircraft.csv | 2 +- aviary/interface/methods_for_level2.py | 10 +++++++--- aviary/subsystems/mass/flops_based/landing_gear.py | 2 +- .../mass/flops_based/test/test_wing_common.py | 2 +- .../mass/test/test_flops_mass_builder.py | 14 ++++++++++---- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/aviary/docs/examples/modified_aircraft.csv b/aviary/docs/examples/modified_aircraft.csv index b2ab642a3..278803444 100644 --- a/aviary/docs/examples/modified_aircraft.csv +++ b/aviary/docs/examples/modified_aircraft.csv @@ -114,7 +114,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless aircraft:wing:airfoil_technology,1.92669766647637,unitless aircraft:wing:area,1370.0,ft**2 aircraft:wing:aspect_ratio,11.02091,unitless -aircraft:wing:bending_mass_scaler,1.0,unitless +aircraft:wing:bending_material_mass_scaler,1.0,unitless aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless aircraft:wing:composite_fraction,0.2,unitless aircraft:wing:control_surface_area,137,ft**2 diff --git a/aviary/interface/methods_for_level2.py b/aviary/interface/methods_for_level2.py index 1c248b1ba..c55e160cb 100644 --- a/aviary/interface/methods_for_level2.py +++ b/aviary/interface/methods_for_level2.py @@ -286,6 +286,7 @@ def load_inputs( self.mass_method = mass_method = aviary_inputs.get_val(Settings.MASS_METHOD) if mission_method is TWO_DEGREES_OF_FREEDOM or mass_method is GASP: + # TODO this should be a preprocessor step if it is required here aviary_inputs = update_GASP_options(aviary_inputs) initialization_guesses = initialization_guessing( aviary_inputs, initialization_guesses, engine_builders) @@ -2090,7 +2091,8 @@ def _add_bus_variables_and_connect(self): if 'post_mission_name' in variable_data: self.model.connect( f'pre_mission.{external_subsystem.name}.{bus_variable}', - f'post_mission.{external_subsystem.name}.{variable_data["post_mission_name"]}' + f'post_mission.{external_subsystem.name}.' + f'{variable_data["post_mission_name"]}', ) def setup(self, **kwargs): @@ -2362,7 +2364,8 @@ def _add_guesses(self, phase_name, phase, guesses, setvalprob, parent_prefix): # are not consistent if initial_bounds[1] != duration_bounds[1]: raise ValueError( - f"Initial and duration bounds for {phase_name} are not consistent." + f"Initial and duration bounds for { + phase_name} are not consistent." ) guesses["time"] = ([np.mean(initial_bounds[0]), np.mean( duration_bounds[0])], initial_bounds[1]) @@ -2425,7 +2428,8 @@ def _add_guesses(self, phase_name, phase, guesses, setvalprob, parent_prefix): else: # raise error if the guess key is not recognized raise ValueError( - f"Initial guess key {guess_key} in {phase_name} is not recognized." + f"Initial guess key {guess_key} in { + phase_name} is not recognized." ) if self.mission_method is SOLVED_2DOF: diff --git a/aviary/subsystems/mass/flops_based/landing_gear.py b/aviary/subsystems/mass/flops_based/landing_gear.py index bdd3cd43e..f053a2586 100644 --- a/aviary/subsystems/mass/flops_based/landing_gear.py +++ b/aviary/subsystems/mass/flops_based/landing_gear.py @@ -294,7 +294,7 @@ def setup(self): add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, val=0.0) add_aviary_input(self, Aircraft.Nacelle.AVG_DIAMETER, val=np.zeros(num_engine_type)) - if num_wing_engines > 0: + if any(num_wing_engines) > 0: add_aviary_input(self, Aircraft.Engine.WING_LOCATIONS, val=np.zeros( (num_engine_type, int(num_wing_engines[0] / 2)))) else: diff --git a/aviary/subsystems/mass/flops_based/test/test_wing_common.py b/aviary/subsystems/mass/flops_based/test/test_wing_common.py index 552521903..cfa95cb4a 100644 --- a/aviary/subsystems/mass/flops_based/test/test_wing_common.py +++ b/aviary/subsystems/mass/flops_based/test/test_wing_common.py @@ -209,7 +209,7 @@ def test_case(self): ) prob.setup(check=False, force_alloc_complex=True) prob.set_val(Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, 0.333, 'unitless') - prob.set_val(Aircraft.Wing.BENDING_FACTOR, 10, 'unitless') + prob.set_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR, 10, 'unitless') prob.set_val(Aircraft.Wing.COMPOSITE_FRACTION, 0.333, 'unitless') prob.set_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR, 1, 'unitless') prob.set_val(Mission.Design.GROSS_MASS, 100000, 'lbm') diff --git a/aviary/subsystems/mass/test/test_flops_mass_builder.py b/aviary/subsystems/mass/test/test_flops_mass_builder.py index 2e9b0ee98..98b152507 100644 --- a/aviary/subsystems/mass/test/test_flops_mass_builder.py +++ b/aviary/subsystems/mass/test/test_flops_mass_builder.py @@ -26,9 +26,12 @@ def setUp(self): 'test_core_mass', meta_data=BaseMetaData, code_origin=FLOPS) self.aviary_values = av.AviaryValues() self.aviary_values.set_val(Aircraft.Design.USE_ALT_MASS, False, units='unitless') - self.aviary_values.set_val(Aircraft.Engine.NUM_ENGINES, [1], units='unitless') self.aviary_values.set_val( - Aircraft.Engine.NUM_WING_ENGINES, [2], units='unitless') + Aircraft.Engine.NUM_ENGINES, np.array([1]), units='unitless' + ) + self.aviary_values.set_val( + Aircraft.Engine.NUM_WING_ENGINES, np.array([2]), units='unitless' + ) class TestFLOPSMassBuilderAltMass(av.TestSubsystemBuilderBase): @@ -43,9 +46,12 @@ def setUp(self): 'test_core_mass', meta_data=BaseMetaData, code_origin=FLOPS) self.aviary_values = av.AviaryValues() self.aviary_values.set_val(Aircraft.Design.USE_ALT_MASS, True, units='unitless') - self.aviary_values.set_val(Aircraft.Engine.NUM_ENGINES, [1], units='unitless') self.aviary_values.set_val( - Aircraft.Engine.NUM_WING_ENGINES, [2], units='unitless') + Aircraft.Engine.NUM_ENGINES, np.array([1]), units='unitless' + ) + self.aviary_values.set_val( + Aircraft.Engine.NUM_WING_ENGINES, np.array([2]), units='unitless' + ) if __name__ == '__main__': From b5353ea26f675ed605dde95492ca7bad11a6a4d0 Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Tue, 31 Dec 2024 12:32:18 -0500 Subject: [PATCH 16/17] more quick fixes --- aviary/interface/methods_for_level2.py | 4 ++-- aviary/subsystems/mass/flops_based/wing_detailed.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aviary/interface/methods_for_level2.py b/aviary/interface/methods_for_level2.py index c55e160cb..5a0b757da 100644 --- a/aviary/interface/methods_for_level2.py +++ b/aviary/interface/methods_for_level2.py @@ -2364,8 +2364,8 @@ def _add_guesses(self, phase_name, phase, guesses, setvalprob, parent_prefix): # are not consistent if initial_bounds[1] != duration_bounds[1]: raise ValueError( - f"Initial and duration bounds for { - phase_name} are not consistent." + f"Initial and duration bounds for {phase_name} " + "are not consistent." ) guesses["time"] = ([np.mean(initial_bounds[0]), np.mean( duration_bounds[0])], initial_bounds[1]) diff --git a/aviary/subsystems/mass/flops_based/wing_detailed.py b/aviary/subsystems/mass/flops_based/wing_detailed.py index 1a04db4aa..725d882d9 100644 --- a/aviary/subsystems/mass/flops_based/wing_detailed.py +++ b/aviary/subsystems/mass/flops_based/wing_detailed.py @@ -258,10 +258,10 @@ def compute(self, inputs, outputs): else: continue - if all(eng_loc <= integration_stations[0]): + if eng_loc[0] <= integration_stations[0]: inertia_factor[i] = 1.0 - elif all(eng_loc >= integration_stations[-1]): + elif eng_loc[0] >= integration_stations[-1]: inertia_factor[i] = 0.84 else: From 7454a618e5abb9b5dbef39ecccb982a74a67b03b Mon Sep 17 00:00:00 2001 From: jkirk5 Date: Tue, 31 Dec 2024 12:48:38 -0500 Subject: [PATCH 17/17] formatting fix --- aviary/interface/methods_for_level2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aviary/interface/methods_for_level2.py b/aviary/interface/methods_for_level2.py index 5a0b757da..041152883 100644 --- a/aviary/interface/methods_for_level2.py +++ b/aviary/interface/methods_for_level2.py @@ -2428,8 +2428,8 @@ def _add_guesses(self, phase_name, phase, guesses, setvalprob, parent_prefix): else: # raise error if the guess key is not recognized raise ValueError( - f"Initial guess key {guess_key} in { - phase_name} is not recognized." + f"Initial guess key {guess_key} in {phase_name} is not " + "recognized." ) if self.mission_method is SOLVED_2DOF: