Skip to content

Commit bd9caa0

Browse files
author
jkirk5
committed
Merge remote-tracking branch 'remotes/origin/main' into cleanup
2 parents a319a15 + d4cc805 commit bd9caa0

File tree

206 files changed

+2693
-2532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+2693
-2532
lines changed

.github/workflows/test_benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
jobs:
1919

2020
latest_benchmarks:
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222
timeout-minutes: 90
2323

2424
steps:

.github/workflows/test_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
jobs:
1919

2020
latest_docs:
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222
timeout-minutes: 90
2323

2424
steps:

.github/workflows/test_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
pre_commit:
2020
# run pre-commit checks
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222

2323
steps:
2424
- uses: actions/checkout@v4
@@ -28,7 +28,7 @@ jobs:
2828
- uses: pre-commit/action@v3.0.1
2929

3030
test_ubuntu:
31-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-22.04
3232
strategy:
3333
fail-fast: false
3434
matrix:

.github/workflows/test_workflow_dev_deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515

1616
test_ubuntu:
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-22.04
1818
strategy:
1919
fail-fast: false
2020
matrix:

.github/workflows/test_workflow_no_dev_install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
jobs:
1818

1919
test_ubuntu_no_dev_install:
20-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-22.04
2121

2222
timeout-minutes: 90
2323

aviary/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from aviary.variable_info.options import get_option_defaults, is_option
2424
from aviary.utils.develop_metadata import add_meta_data, update_meta_data
2525
from aviary.variable_info.variable_meta_data import CoreMetaData
26-
from aviary.variable_info.functions import add_aviary_input, add_aviary_output, get_units, override_aviary_vars, setup_trajectory_params
26+
from aviary.variable_info.functions import add_aviary_input, add_aviary_output, get_units, override_aviary_vars, setup_trajectory_params, setup_model_options
2727
from aviary.utils.merge_hierarchies import merge_hierarchies
2828
from aviary.utils.merge_variable_metadata import merge_meta_data
2929
from aviary.utils.named_values import NamedValues, get_keys, get_items, get_values

aviary/docs/developer_guide/doctape.ipynb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,41 +82,17 @@
8282
" doctape.glue_variable(key, md_code=True)\n",
8383
" class_list += f'- `{key}` {val}\\n'\n",
8484
"\n",
85-
"# testing_list = ''\n",
86-
"# for key,val in testing_functions.items():\n",
87-
"# testing_list += f'- `{key}` {val}\\n'\n",
88-
"\n",
8985
"utility_list = '```{eval-rst}\\n'\n",
9086
"for key in utility_functions:\n",
9187
" doctape.glue_variable(key, md_code=True)\n",
9288
" utility_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n",
9389
"utility_list += '```'\n",
9490
"\n",
95-
"# testing_list = '```{eval-rst}\\n'\n",
96-
"# for key in testing_functions:\n",
97-
"# utils.glue_variable(key, md_code=True)\n",
98-
"# testing_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n",
99-
"# testing_list += '```'\n",
100-
"\n",
101-
"# testing_list = '<details>\\n\\n<summary>Function Docs</summary>\\n\\n'\n",
10291
"testing_list = '```{eval-rst}\\n'\n",
10392
"for key in testing_functions:\n",
10493
" doctape.glue_variable(key, md_code=True)\n",
10594
" testing_list += ' '*4+f'.. autofunction:: aviary.utils.doctape.{key}\\n{\" \"*8}:noindex:\\n\\n'\n",
10695
"testing_list += '```'\n",
107-
"# testing_list += '\\n\\n</details>'\n",
108-
"\n",
109-
"# glue_list = ''\n",
110-
"# for key,val in glue_functions.items():\n",
111-
"# glue_list += f'- `{key}` {key}\\n'\n",
112-
"\n",
113-
"# glue_list = ''\n",
114-
"# for key in glue_functions:\n",
115-
"# # doc_str = inspect.getdoc(imported_functions[key])\n",
116-
"# doc_str = imported_functions[key].__doc__.split('\\n')[1]\n",
117-
"# # doc_str = '\\n'.join([s+' ' for s in imported_functions[key].__doc__.split('\\n')])\n",
118-
"# print(doc_str)\n",
119-
"# glue_list += f'- `{key}`: {doc_str}\\n'\n",
12096
"\n",
12197
"glue_list = '```{eval-rst}\\n'\n",
12298
"for key in glue_functions:\n",

aviary/docs/developer_guide/doctape_examples.ipynb

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,12 @@
407407
"outputs": [],
408408
"source": [
409409
"# Testing Cell\n",
410-
"from aviary.api import Mission\n",
410+
"from aviary.api import Aircraft\n",
411411
"from aviary.utils.doctape import glue_variable, get_previous_line, get_variable_name\n",
412412
"\n",
413-
"glue_variable('value', Mission.Design.MACH, md_code=True)\n",
413+
"glue_variable('value', Aircraft.Design.EMPTY_MASS, md_code=True)\n",
414414
"glue_variable('var_value_code', get_previous_line(), md_code=True)\n",
415-
"glue_variable(get_variable_name(Mission.Design.MACH), md_code=True)\n",
415+
"glue_variable(get_variable_name(Aircraft.Design.EMPTY_MASS), md_code=True)\n",
416416
"glue_variable('var_name_code', get_previous_line(), md_code=True)\n"
417417
]
418418
},
@@ -423,7 +423,7 @@
423423
"If you want to glue the name of a variable, instead of the value that variable holds, you can use the {glue:md}`get_variable_name` to extract it.\n",
424424
"\n",
425425
"For example:\n",
426-
"Using {glue:md}`var_value_code` will result in {glue:md}`value`, whereas using {glue:md}`var_name_code` will result in {glue:md}`Mission.Design.MACH`\n",
426+
"Using {glue:md}`var_value_code` will result in {glue:md}`value`, whereas using {glue:md}`var_name_code` will result in {glue:md}`Aircraft.Design.EMPTY_MASS`\n",
427427
"\n",
428428
"### {glue:md}`get_attribute_name`\n",
429429
"allows users to get the name of object attributes in order to glue them into documentation. This works well for Enums or Class Variables that have unique values."
@@ -482,6 +482,71 @@
482482
"p1_alt = get_value(simplified_dict, 'phase1.altitude.val')\n",
483483
"print(p1_alt)"
484484
]
485+
},
486+
{
487+
"cell_type": "code",
488+
"execution_count": null,
489+
"metadata": {
490+
"tags": [
491+
"remove-cell"
492+
]
493+
},
494+
"outputs": [],
495+
"source": [
496+
"# Testing Cell\n",
497+
"from aviary.utils.doctape import glue_variable, check_args, get_all_keys, get_previous_line\n",
498+
"from aviary.api import Aircraft, Mission\n",
499+
"\n",
500+
"glue_variable(Aircraft.__name__)\n",
501+
"glue_variable(Mission.__name__)\n",
502+
"\n",
503+
"track_layers = 'track_layers'\n",
504+
"check_args(get_all_keys, track_layers)\n",
505+
"glue_variable(track_layers)\n",
506+
"\n",
507+
"get_all_keys(Mission, track_layers='Mission')\n",
508+
"track_layers_with_name = get_previous_line().split(', ')[1].split(')')[0]\n",
509+
"glue_variable('track_layers_with_Mission', track_layers_with_name, display=False)\n"
510+
]
511+
},
512+
{
513+
"cell_type": "markdown",
514+
"metadata": {},
515+
"source": [
516+
"These can also be used to recursively get all of the attributes from a complex object, like the {glue:md}`Aircraft` or {glue:md}`Mission` hierarchies.\n"
517+
]
518+
},
519+
{
520+
"cell_type": "code",
521+
"execution_count": null,
522+
"metadata": {},
523+
"outputs": [],
524+
"source": [
525+
"from aviary.utils.doctape import get_all_keys, get_value, glue_keys\n",
526+
"from aviary.api import Mission\n",
527+
"\n",
528+
"k1=get_all_keys(Mission)\n",
529+
"print(k1[:5]) # Display the first 5 keys in Mission\n",
530+
"k2=get_all_keys(Mission, track_layers=True)\n",
531+
"print(k2[:5]) # Display the first 5 keys in Mission\n",
532+
"k3=get_all_keys(Mission, track_layers='Mission')\n",
533+
"print(k3[:5]) # Display the first 5 keys in Mission\n",
534+
"\n",
535+
"glue_keys(Mission, False)\n",
536+
"\n",
537+
"print(get_value(Mission,'Constraints.GEARBOX_SHAFT_POWER_RESIDUAL'))\n"
538+
]
539+
},
540+
{
541+
"cell_type": "markdown",
542+
"metadata": {},
543+
"source": [
544+
"If {glue:md}`get_all_keys` is used on an object like {glue:md}`Mission` without specifying a value for {glue:md}`track_layers` will return all of the uniquely named attributes of the object (such as {glue:md}GEARBOX_SHAFT_POWER_RESIDUAL). Setting {glue:md}`track_layers` to `True` will get all of the attributes in dot notation, but will not include the name of the original object ({glue:md}Constraints.GEARBOX_SHAFT_POWER_RESIDUAL). If you want the full name of the attribute, including the name of the original object, you can use that name as the value of {glue:md}`track_layers` (using {glue:md}track_layers_with_Mission gives us access to {glue:md}Mission.Constraints.GEARBOX_SHAFT_POWER_RESIDUAL)\n",
545+
"\n",
546+
"Using {glue:md}`glue_keys` handles this for us automatically by using the `__name__` attribute of the object passed to it as the value of {glue:md}`track_layers`.\n",
547+
"\n",
548+
"As with the dict_of_dicts, we can recusively get the value of an attribute using the full path along with {glue:md}`get_value`."
549+
]
485550
}
486551
],
487552
"metadata": {

aviary/docs/examples/modified_aircraft.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ aircraft:wing:aeroelastic_tailoring_factor,0.0,unitless
114114
aircraft:wing:airfoil_technology,1.92669766647637,unitless
115115
aircraft:wing:area,1370.0,ft**2
116116
aircraft:wing:aspect_ratio,11.02091,unitless
117-
aircraft:wing:bending_material_mass_scaler,1.0,unitless
117+
aircraft:wing:BENDING_MATERIAL_MASS_SCALER,1.0,unitless
118118
aircraft:wing:chord_per_semispan,0.31,0.23,0.084,unitless
119119
aircraft:wing:composite_fraction,0.2,unitless
120120
aircraft:wing:control_surface_area,137,ft**2

aviary/docs/getting_started/onboarding_level3.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"\n",
9696
"import aviary.api as av\n",
9797
"from aviary.validation_cases.validation_tests import get_flops_inputs\n",
98+
"from aviary.variable_info.functions import setup_model_options\n",
9899
"\n",
99100
"\n",
100101
"prob = om.Problem(model=om.Group())\n",
@@ -459,6 +460,8 @@
459460
"]\n",
460461
"av.set_aviary_input_defaults(prob.model, varnames, aviary_inputs)\n",
461462
"\n",
463+
"av.setup_model_options(prob, aviary_inputs)\n",
464+
"\n",
462465
"prob.setup(force_alloc_complex=True)\n",
463466
"\n",
464467
"av.set_aviary_initial_values(prob, aviary_inputs)\n",
@@ -709,7 +712,7 @@
709712
"name": "python",
710713
"nbconvert_exporter": "python",
711714
"pygments_lexer": "ipython3",
712-
"version": "3.10.13"
715+
"version": "3.12.3"
713716
}
714717
},
715718
"nbformat": 4,

aviary/docs/user_guide/examples_of_the_same_mission_at_different_UI_levels.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@
434434
"]\n",
435435
"av.set_aviary_input_defaults(prob.model, varnames, aviary_inputs)\n",
436436
"\n",
437+
"av.setup_model_options(prob, aviary_inputs)\n",
438+
"\n",
437439
"prob.setup(force_alloc_complex=True)\n",
438440
"\n",
439441
"av.set_aviary_initial_values(prob, aviary_inputs)\n",
@@ -505,7 +507,7 @@
505507
"name": "python",
506508
"nbconvert_exporter": "python",
507509
"pygments_lexer": "ipython3",
508-
"version": "3.10.13"
510+
"version": "3.12.3"
509511
}
510512
},
511513
"nbformat": 4,

aviary/docs/user_guide/variable_metadata.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
" 'option': False,\n",
4343
" 'types': None,\n",
4444
" 'historical_name': None,\n",
45+
" 'multivalue': False,\n",
4546
" }\n",
4647
"\n",
4748
"meta_data = {}\n",
@@ -447,7 +448,7 @@
447448
"hash": "e6c7471802ed76737b16357fb02af5587f3a4cbee5ea7658f3f9a6981469039b"
448449
},
449450
"kernelspec": {
450-
"display_name": "Python 3",
451+
"display_name": "Python 3 (ipykernel)",
451452
"language": "python",
452453
"name": "python3"
453454
},
@@ -461,7 +462,7 @@
461462
"name": "python",
462463
"nbconvert_exporter": "python",
463464
"pygments_lexer": "ipython3",
464-
"version": "3.10.13"
465+
"version": "3.12.3"
465466
},
466467
"orphan": true
467468
},

aviary/examples/external_subsystems/OAS_weight/OAS_wing_weight_analysis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ def compute(self, inputs, outputs):
491491
prob.driver = om.ScipyOptimizeDriver()
492492
prob.driver.options['optimizer'] = 'SLSQP'
493493
prob.driver.options['tol'] = 1e-8
494-
495494
# Set up the problem
496495
with warnings.catch_warnings():
497496
warnings.filterwarnings("ignore", category=om.PromotionWarning)

aviary/examples/multi_mission/run_multimission_example_large_single_aisle.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
authors: Jatin Soni, Eliot Aretskin
33
Multi Mission Optimization Example using Aviary
44
5-
In this example, a monolithic optimization is created by instantiating two aviary problems
6-
using typical AviaryProblem calls like load_inputs(), check_and_preprocess_payload(),
7-
etc. Once those problems are setup and all of their phases are linked together, we copy
8-
those problems as group into a super_problem. We then promote GROSS_MASS, RANGE, and
9-
wing SWEEP from each of those sub-groups (group1 and group2) up to the super_probem so
10-
the optimizer can control them. The fuel_burn results from each of the group1 and group2
5+
In this example, a monolithic optimization is created by instantiating two aviary problems
6+
using typical AviaryProblem calls like load_inputs(), check_and_preprocess_payload(),
7+
etc. Once those problems are setup and all of their phases are linked together, we copy
8+
those problems as group into a super_problem. We then promote GROSS_MASS, RANGE, and
9+
wing SWEEP from each of those sub-groups (group1 and group2) up to the super_probem so
10+
the optimizer can control them. The fuel_burn results from each of the group1 and group2
1111
dymos missions are summed and weighted to create the objective function the optimizer sees.
1212
1313
"""
1414
import copy as copy
1515
from aviary.examples.example_phase_info import phase_info
16+
from aviary.variable_info.functions import setup_model_options
1617
from aviary.variable_info.variables import Mission, Aircraft, Settings
1718
from aviary.variable_info.enums import ProblemType
1819
import aviary.api as av
@@ -146,11 +147,16 @@ def add_objective(self):
146147

147148
def setup_wrapper(self):
148149
"""Wrapper for om.Problem setup with warning ignoring and setting options"""
149-
for prob in self.probs:
150+
for i, prob in enumerate(self.probs):
150151
prob.model.options['aviary_options'] = prob.aviary_inputs
151152
prob.model.options['aviary_metadata'] = prob.meta_data
152153
prob.model.options['phase_info'] = prob.phase_info
153154

155+
# Use OpenMDAO's model options to pass all options through the system hierarchy.
156+
prefix = self.group_prefix + f'_{i}'
157+
setup_model_options(self, prob.aviary_inputs, prob.meta_data,
158+
prefix=f'{prefix}.')
159+
154160
# Aviary's problem setup wrapper uses these ignored warnings to suppress
155161
# some warnings related to variable promotion. Replicating that here with
156162
# setup for the super problem

aviary/interface/methods_for_level2.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@
7777
LegacyCode,
7878
Verbosity,
7979
)
80-
from aviary.variable_info.functions import setup_trajectory_params, override_aviary_vars
80+
from aviary.variable_info.functions import (
81+
setup_trajectory_params,
82+
override_aviary_vars,
83+
setup_model_options,
84+
)
8185
from aviary.variable_info.variables import Aircraft, Mission, Dynamic, Settings
8286
from aviary.variable_info.variable_meta_data import _MetaData as BaseMetaData
8387

@@ -2506,6 +2510,9 @@ def setup(self, **kwargs):
25062510
"""
25072511
Lightly wrapped setup() method for the problem.
25082512
"""
2513+
# Use OpenMDAO's model options to pass all options through the system hierarchy.
2514+
setup_model_options(self, self.aviary_inputs, self.meta_data)
2515+
25092516
# suppress warnings:
25102517
# "input variable '...' promoted using '*' was already promoted using 'aircraft:*'
25112518
with warnings.catch_warnings():
@@ -2516,6 +2523,7 @@ def setup(self, **kwargs):
25162523

25172524
warnings.simplefilter("ignore", om.OpenMDAOWarning)
25182525
warnings.simplefilter("ignore", om.PromotionWarning)
2526+
25192527
super().setup(**kwargs)
25202528

25212529
def set_initial_guesses(self, parent_prob=None, parent_prefix="", verbosity=None):

aviary/mission/energy_phase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from aviary.mission.flight_phase_builder import FlightPhaseBase, register
44
from aviary.mission.initial_guess_builders import InitialGuessIntegrationVariable, InitialGuessState
55

6-
from aviary.utils.aviary_values import AviaryValues
76
from aviary.mission.flops_based.ode.mission_ODE import MissionODE
87

98

aviary/mission/flops_based/ode/mission_ODE.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ def setup(self):
230230
"throttle_allocator",
231231
ThrottleAllocator(
232232
num_nodes=nn,
233-
aviary_options=aviary_options,
234-
throttle_allocation=self.options['throttle_allocation'],
233+
throttle_allocation=self.options['throttle_allocation']
235234
),
236235
promotes_inputs=['*'],
237236
promotes_outputs=['*'],

0 commit comments

Comments
 (0)