Skip to content

Commit

Permalink
Merge pull request OpenMDAO#463 from Dawson-Manning/only_fuse_eng_final
Browse files Browse the repository at this point in the history
Addition of Fuselage Engine Modeling
  • Loading branch information
jkirk5 authored Dec 31, 2024
2 parents 0eab7f6 + 7454a61 commit 98cda9a
Show file tree
Hide file tree
Showing 26 changed files with 528 additions and 270 deletions.
2 changes: 1 addition & 1 deletion aviary/docs/examples/modified_aircraft.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions aviary/interface/methods_for_level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions aviary/models/N3CC/N3CC_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,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(
Expand Down Expand Up @@ -431,8 +431,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,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')
Expand Down Expand Up @@ -369,8 +369,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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,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')
Expand Down Expand Up @@ -397,8 +397,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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')
Expand Down Expand Up @@ -375,8 +375,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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)
Expand Down Expand Up @@ -394,8 +394,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,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)
Expand Down Expand Up @@ -410,8 +410,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')
Expand Down
2 changes: 1 addition & 1 deletion aviary/models/test_aircraft/aircraft_for_bench_FwFm.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aviary/models/test_aircraft/aircraft_for_bench_FwGm.csv
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ aircraft:vertical_tail:mass_scaler,1.0,unitless
aircraft:vertical_tail:num_tails,1,unitless
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
Expand Down
2 changes: 1 addition & 1 deletion aviary/models/test_aircraft/aircraft_for_bench_GwFm.csv
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions aviary/subsystems/mass/flops_based/landing_gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,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 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:
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)

Expand All @@ -309,7 +313,6 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None):
# TODO temp using first engine, heterogeneous engines 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.
Expand Down Expand Up @@ -349,7 +352,6 @@ def compute_partials(self, inputs, partials, discrete_inputs=None):
# TODO temp using first engine, heterogeneous engines 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

Expand Down
39 changes: 21 additions & 18 deletions aviary/subsystems/mass/flops_based/test/test_wing_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,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)
Expand Down Expand Up @@ -206,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')
Expand Down
Loading

0 comments on commit 98cda9a

Please sign in to comment.