Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 55 additions & 26 deletions aviary/subsystems/mass/flops_based/test/test_wing_detailed.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ def test_case(self, case_name):
Aircraft.Wing.INPUT_STATION_DISTRIBUTION: inputs.get_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION
),
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL: inputs.get_val(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL
),
Aircraft.Wing.NUM_INTEGRATION_STATIONS: inputs.get_val(
Aircraft.Wing.NUM_INTEGRATION_STATIONS
),
Expand Down Expand Up @@ -86,6 +83,7 @@ def test_case(self, case_name):
Aircraft.Engine.WING_LOCATIONS,
Aircraft.Wing.THICKNESS_TO_CHORD,
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE,
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL,
],
output_keys=[
Aircraft.Wing.BENDING_MATERIAL_FACTOR,
Expand Down Expand Up @@ -125,9 +123,6 @@ def test_case_multiengine(self):
Aircraft.Wing.INPUT_STATION_DISTRIBUTION: aviary_options.get_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION
),
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL: aviary_options.get_val(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL
),
Aircraft.Wing.NUM_INTEGRATION_STATIONS: aviary_options.get_val(
Aircraft.Wing.NUM_INTEGRATION_STATIONS
),
Expand All @@ -150,6 +145,7 @@ def test_case_multiengine(self):
Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR,
Aircraft.Wing.THICKNESS_TO_CHORD,
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE,
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL,
]

for key in input_keys:
Expand Down Expand Up @@ -213,9 +209,6 @@ def test_case_fuselage_engines(self):
Aircraft.Wing.INPUT_STATION_DISTRIBUTION: aviary_options.get_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION
),
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL: aviary_options.get_val(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL
),
Aircraft.Wing.NUM_INTEGRATION_STATIONS: aviary_options.get_val(
Aircraft.Wing.NUM_INTEGRATION_STATIONS
),
Expand All @@ -240,6 +233,7 @@ def test_case_fuselage_engines(self):
Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR,
Aircraft.Wing.THICKNESS_TO_CHORD,
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE,
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL,
]

for key in input_keys:
Expand Down Expand Up @@ -296,9 +290,6 @@ def test_case_fuselage_multiengine(self):
Aircraft.Wing.INPUT_STATION_DISTRIBUTION: aviary_options.get_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION
),
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL: aviary_options.get_val(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL
),
Aircraft.Wing.NUM_INTEGRATION_STATIONS: aviary_options.get_val(
Aircraft.Wing.NUM_INTEGRATION_STATIONS
),
Expand All @@ -323,6 +314,7 @@ def test_case_fuselage_multiengine(self):
Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR,
Aircraft.Wing.THICKNESS_TO_CHORD,
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE,
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL,
]

for key in input_keys:
Expand Down Expand Up @@ -374,9 +366,6 @@ def test_extreme_engine_loc(self):
Aircraft.Wing.INPUT_STATION_DISTRIBUTION: aviary_options.get_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION
),
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL: aviary_options.get_val(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL
),
Aircraft.Wing.NUM_INTEGRATION_STATIONS: aviary_options.get_val(
Aircraft.Wing.NUM_INTEGRATION_STATIONS
),
Expand All @@ -401,6 +390,7 @@ def test_extreme_engine_loc(self):
Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR,
Aircraft.Wing.THICKNESS_TO_CHORD,
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE,
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL,
]

for key in input_keys:
Expand All @@ -426,7 +416,7 @@ def test_extreme_engine_loc(self):
def test_intensity_factor(self):
"""
data taken from high_wing_single_aisle.csv
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL = 3, 1, 1.5, 2.5
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL = 3, 1, 1.5, 2.5, 1.25, 2.75
"""
options = get_option_defaults()
options.set_val(Aircraft.Engine.NUM_ENGINES, val=[2], units='unitless')
Expand All @@ -435,7 +425,6 @@ def test_intensity_factor(self):
options.set_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION, val=[0.0, 0.5, 1.0], units='unitless'
)
options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=3, units='unitless')
options.set_val(Aircraft.Wing.NUM_INTEGRATION_STATIONS, val=46, units='unitless')

prob = self.prob
Expand Down Expand Up @@ -470,6 +459,9 @@ def test_intensity_factor(self):
prob.model.set_input_defaults(
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE, val=0.01, units='unitless'
)
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=3, units='unitless'
)

setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
Expand All @@ -485,7 +477,9 @@ def test_intensity_factor(self):
pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 0.9772998541, tolerance=1e-9)

options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=1, units='unitless')
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=1, units='unitless'
)
setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
prob.run_model()
Expand All @@ -496,7 +490,9 @@ def test_intensity_factor(self):
pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 1.0, tolerance=1e-9)

options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=1.5, units='unitless')
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=1.5, units='unitless'
)
setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
prob.run_model()
Expand All @@ -507,7 +503,9 @@ def test_intensity_factor(self):
pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 1.0, tolerance=1e-9)

options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=2.5, units='unitless')
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=2.5, units='unitless'
)
setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
prob.run_model()
Expand All @@ -518,6 +516,34 @@ def test_intensity_factor(self):
pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 1.0, tolerance=1e-9)

prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=1.25, units='unitless'
)
setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
prob.run_model()

bending_mat_factor = prob.get_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR)
# without smoothing, it is 1.7507575953
assert_near_equal(bending_mat_factor, 1.78032845, tolerance=1e-9)

pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 1.0, tolerance=1e-9)

prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, val=2.75, units='unitless'
)
setup_model_options(prob, options)
prob.setup(check=False, force_alloc_complex=True)
prob.run_model()

bending_mat_factor = prob.get_val(Aircraft.Wing.BENDING_MATERIAL_FACTOR)
# without smoothing, it is 2.7838124896
assert_near_equal(bending_mat_factor, 2.8107811534, tolerance=1e-9)

pod_inertia_factor = prob.get_val(Aircraft.Wing.ENG_POD_INERTIA_FACTOR)
assert_near_equal(pod_inertia_factor, 1.0, tolerance=1e-9)

def test_IO(self):
assert_match_varnames(self.prob.model)

Expand All @@ -542,7 +568,6 @@ def test_case1(self):
aviary_options.set_val(
Aircraft.Wing.INPUT_STATION_DISTRIBUTION, [0.5, 1.0], units='unitless'
)
aviary_options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless')
aviary_options.set_val(Aircraft.Wing.NUM_INTEGRATION_STATIONS, 50, units='unitless')
aviary_options.set_val(Aircraft.BWB.DETAILED_WING_PROVIDED, False, units='unitless')

Expand All @@ -564,6 +589,9 @@ def test_case1(self):
prob.model.set_input_defaults(
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE, 0.11, units='unitless'
)
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless'
)

setup_model_options(self.prob, aviary_options)
prob.setup(check=False, force_alloc_complex=True)
Expand Down Expand Up @@ -614,7 +642,6 @@ def test_case1(self):
[0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.6499, 0.7, 0.75, 0.8, 0.85, 0.8999, 0.95, 1],
units='unitless',
)
aviary_options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless')
aviary_options.set_val(Aircraft.Wing.NUM_INTEGRATION_STATIONS, 100, units='unitless')
aviary_options.set_val(Aircraft.BWB.DETAILED_WING_PROVIDED, True, units='unitless')

Expand All @@ -636,6 +663,9 @@ def test_case1(self):
prob.model.set_input_defaults(
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE, 0.11, units='unitless'
)
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless'
)

setup_model_options(self.prob, aviary_options)
prob.setup(check=False, force_alloc_complex=True)
Expand Down Expand Up @@ -734,7 +764,6 @@ def test_case2(self):
[0.0, 0.2075, 0.415, 0.6927, 0.928, 1.0],
units='unitless',
)
aviary_options.set_val(Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless')
aviary_options.set_val(Aircraft.Wing.NUM_INTEGRATION_STATIONS, 10, units='unitless')
aviary_options.set_val(Aircraft.BWB.DETAILED_WING_PROVIDED, True, units='unitless')

Expand All @@ -755,6 +784,9 @@ def test_case2(self):
prob.model.set_input_defaults(
Aircraft.Wing.THICKNESS_TO_CHORD_REFERENCE, 0.11, units='unitless'
)
prob.model.set_input_defaults(
Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL, 2.0, units='unitless'
)

setup_model_options(self.prob, aviary_options)
prob.setup(check=False, force_alloc_complex=True)
Expand Down Expand Up @@ -797,6 +829,3 @@ def test_case2(self):

if __name__ == '__main__':
unittest.main()
# test = DetailedWingBendingTest()
# test.setUp()
# test.test_intensity_factor()
38 changes: 32 additions & 6 deletions aviary/subsystems/mass/flops_based/wing_detailed.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ def load_intensity_by_factor(load_dist_factor, intn_stations):
return load_intensity


def smooth_load_intensity_by_factor(load_dist_factor, intn_stations):
"""
Calculate load intensity at wing integration stations for the given load_dist_factor.

Parameters:
load_dist_factor (float): 0 or 1 <= load_dist_factor <= 3.
1.0 : triangular distribution
2.0 : elliptical distribution (default)
3.0 : rectangular distribution
1.0-2.0 : blend of triangular and elliptical by quartic polynomial
2.0-3.0 : blend of elliptical and rectangular by quartic polynomial
intn_stations (array): integration stations

Note: In FLOPS, load_dist_factor can be 0 in which case load intensities are computed
based on input pressure distribution. This is NOT currently implemented in Aviary.
"""
a = 1.0 - intn_stations
b = np.sqrt(1.0 - intn_stations**2)
c = np.ones(len(intn_stations))
t = load_dist_factor - 2.0
load_intensity = (
b + (c - a) / 2 * t + 7 * (a - 2 * b + c) / 6 * t**2 + 2 * (-a + 2 * b - c) / 3 * t**4
)
return load_intensity


class DetailedWingBendingFact(om.ExplicitComponent):
"""
Computation of wing bending factor and engine inertia relief factor
Expand All @@ -62,7 +88,6 @@ def initialize(self):
add_aviary_option(self, Aircraft.Engine.NUM_WING_ENGINES)
add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES)
add_aviary_option(self, Aircraft.Wing.INPUT_STATION_DISTRIBUTION)
add_aviary_option(self, Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL)
add_aviary_option(self, Aircraft.Wing.NUM_INTEGRATION_STATIONS)

def setup(self):
Expand Down Expand Up @@ -95,6 +120,7 @@ def setup(self):
add_aviary_input(self, Aircraft.Wing.ASPECT_RATIO_REFERENCE, units='unitless')
add_aviary_input(self, Aircraft.Wing.STRUT_BRACING_FACTOR, units='unitless')
add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, units='unitless')
add_aviary_input(self, Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL)

if total_num_wing_engines > 1:
add_aviary_input(
Expand Down Expand Up @@ -167,8 +193,8 @@ def compute(self, inputs, outputs):
(dy[1:] + 2.0 * integration_stations[1:-1]) * dy[1:] * sweep_int_stations[1:-1]
)

load_distribution_factor = self.options[Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL]
load_intensity = load_intensity_by_factor(load_distribution_factor, integration_stations)
load_distrib_factor = inputs[Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL]
load_intensity = smooth_load_intensity_by_factor(load_distrib_factor, integration_stations)

chord_interp = InterpND(
method='slinear', points=(inp_stations), x_interp=integration_stations
Expand Down Expand Up @@ -308,7 +334,6 @@ def initialize(self):
add_aviary_option(self, Aircraft.Engine.NUM_WING_ENGINES)
add_aviary_option(self, Aircraft.Propulsion.TOTAL_NUM_WING_ENGINES)
add_aviary_option(self, Aircraft.Wing.INPUT_STATION_DISTRIBUTION)
add_aviary_option(self, Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL)
add_aviary_option(self, Aircraft.Wing.NUM_INTEGRATION_STATIONS)
add_aviary_option(self, Aircraft.BWB.DETAILED_WING_PROVIDED)
add_aviary_option(self, Settings.VERBOSITY)
Expand Down Expand Up @@ -340,6 +365,7 @@ def setup(self):
add_aviary_input(self, Aircraft.Wing.AEROELASTIC_TAILORING_FACTOR, units='unitless')
add_aviary_input(self, Aircraft.Wing.SPAN, units='ft')
add_aviary_input(self, Aircraft.Fuselage.MAX_WIDTH, units='ft')
add_aviary_input(self, Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL)

if total_num_wing_engines > 1:
add_aviary_input(
Expand Down Expand Up @@ -460,8 +486,8 @@ def compute(self, inputs, outputs):
(dy[0:] + 2.0 * integration_stations[0:-1]) * dy[0:] * sweep_int_stations[0:-1]
)

load_distribution_factor = self.options[Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL]
load_intensity = load_intensity_by_factor(load_distribution_factor, integration_stations)
load_distrib_factor = inputs[Aircraft.Wing.LOAD_DISTRIBUTION_CONTROL]
load_intensity = smooth_load_intensity_by_factor(load_distrib_factor, integration_stations)

chord_interp = InterpND(
method='slinear', points=(inp_stations_mod), x_interp=integration_stations
Expand Down
Loading