Skip to content

Commit

Permalink
Merge branch 'main' into add_simple_mission_benches
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjasa authored Jan 12, 2024
2 parents 2113a7d + 1be4116 commit 84ecbc1
Show file tree
Hide file tree
Showing 29 changed files with 704 additions and 219 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_workflow_no_dev_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
echo "Install Aviary"
echo "============================================================="
pip install packaging
pip install .[test]
pip install .[all]
- name: Display conda environment info
shell: bash -l {0}
Expand Down
407 changes: 407 additions & 0 deletions aviary/docs/examples/OAS_subsystem.ipynb

Large diffs are not rendered by default.

120 changes: 0 additions & 120 deletions aviary/docs/examples/OAS_subsystem.md

This file was deleted.

17 changes: 3 additions & 14 deletions aviary/docs/examples/coupled_aircraft_mission_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -215,9 +208,7 @@
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename, phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"prob.check_inputs()\n",
"prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down Expand Up @@ -335,10 +326,8 @@
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename, phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"prob.check_inputs()\n",
"\n",
"prob.check_and_preprocess_inputs()\n",
"# Preprocess inputs\n",
"prob.add_pre_mission_systems()\n",
"\n",
"prob.add_phases()\n",
Expand Down
10 changes: 5 additions & 5 deletions aviary/docs/getting_started/onboarding_ext_subsystem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"# prob.check_inputs()\n",
"# prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down Expand Up @@ -123,7 +123,7 @@
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"# prob.check_inputs()\n",
"# prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down Expand Up @@ -170,7 +170,7 @@
"\n",
"- **init**\n",
"- **load_inputs**\n",
"- **check_inputs**\n",
"- **check_and_preprocess_inputs**\n",
"- **add_pre_mission_systems**\n",
"- **add_phases**\n",
"- **add_post_mission_systems**\n",
Expand Down Expand Up @@ -260,7 +260,7 @@
"source": [
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on severity of the issues\n",
"prob.check_inputs()"
"prob.check_and_preprocess_inputs()"
]
},
{
Expand Down Expand Up @@ -630,7 +630,7 @@
"prob = av.AviaryProblem()\n",
"\n",
"prob.load_inputs(aircraft_definition_file, phase_info)\n",
"prob.check_inputs()\n",
"prob.check_and_preprocess_inputs()\n",
"prob.add_pre_mission_systems()\n",
"prob.add_phases()\n",
"prob.add_post_mission_systems()\n",
Expand Down
19 changes: 8 additions & 11 deletions aviary/docs/getting_started/onboarding_level2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"\n",
"- `prob = AviaryProblem()`\n",
"- `prob.load_inputs()`\n",
"- `prob.check_inputs()`\n",
"- `prob.check_and_preprocess_inputs()`\n",
"- `prob.add_pre_mission_systems()`\n",
"- `prob.add_phases()`\n",
"- `prob.add_post_mission_systems()`\n",
Expand Down Expand Up @@ -94,9 +94,8 @@
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename, av.default_2DOF_phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"prob.check_inputs()\n",
"# Preprocess inputs\n",
"prob.check_and_preprocess_inputs()\n",
"\n",
"# adds a pre-mission group (propulsion, geometry, static aerodynamics, and mass)\n",
"prob.add_pre_mission_systems()\n",
Expand Down Expand Up @@ -241,7 +240,7 @@
"metadata": {},
"outputs": [],
"source": [
"prob.check_inputs()"
"prob.check_and_preprocess_inputs()"
]
},
{
Expand Down Expand Up @@ -686,9 +685,8 @@
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename, phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"prob.check_inputs()\n",
"# Preprocess inputs\n",
"prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down Expand Up @@ -866,9 +864,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
"prob.check_inputs()\n",
"# Preprocess inputs\n",
"prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions aviary/docs/getting_started/onboarding_level3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"In `aviary/validation_cases/benchmark_tests` folder, there is an N3CC aircraft full mission benchmark test `test_FLOPS_based_full_mission_N3CC.py`. Now, we will show how to create an N3CC example in level3. The key is that we follow the same steps:\n",
"- init\n",
"- load_inputs\n",
"- check_inputs (optional)\n",
"- check_and_preprocess_inputs (optional)\n",
"- add_pre_mission_systems\n",
"- add_phases\n",
"- add_post_mission_systems\n",
Expand Down Expand Up @@ -556,7 +556,7 @@
"\n",
"This code is quite verbose!\n",
"\n",
"To make it easier to follow the steps mentioned above, we split this script into several functions each representing a step at the beginning of this section (except `check_inputs()` and `add_design_variables()`).\n",
"To make it easier to follow the steps mentioned above, we split this script into several functions each representing a step at the beginning of this section (except `check_and_preprocess_inputs()` and `add_design_variables()`).\n",
"These methods also closely mirror those from `aviary/interface/methods_for_level2.py`, so you can draw parallels between Level 2 and 3.\n",
"\n",
"Here's what the new run script looks like:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@
"# Allow for user overrides here\n",
"prob.load_inputs(csv_path, phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"prob.check_inputs()\n",

"prob.check_and_preprocess_inputs()\n",
"\n",
"prob.add_pre_mission_systems()\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion aviary/docs/user_guide/subsystems.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In the following outline, the methods listed at the top-level are defined in `me
Any sub-listed method is one that you can provide with your subsystem builder, showing where within the level 3 method hierarchy that subsystem method gets used.

- `load_inputs` - loads the aviary_values inputs and options that the user specifies.
- `check_inputs` - checks the user-supplied input values for any potential problems.
- `check_and_preprocess_inputs` - checks the user-supplied input values for any potential problems.
- `preprocess_inputs`
- `add_pre_mission_systems` - adds pre-mission Systems to the Aviary problem
- `get_mass_names`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'''
OpenMDAO component for aerostructural analysis using OpenAeroStruct.
This analysis is based on the bench_4.csv input data representing a
This analysis is based on the aircraft_for_bench_FwFm.csv input data representing a
single-aisle commercial transport aircraft. The user_mesh method is currently
hard-coded with values taken from the bench_4 data, but should be coded
hard-coded with values taken from the aircraft_for_bench_FwFm data, but should be coded
to use the Aircraft.Wing.* variables for a more general capability.
The OAStructures class performs a structural analysis of the given wing
Expand Down Expand Up @@ -551,7 +551,7 @@ def compute(self, inputs, outputs):
prob.setup()

# test data taken from the OpenAeroStruct example aeroelastic wingbox example
# and the bench_4.csv benchmark data file. All length units are in meters
# and the aircraft_for_bench_FwFm.csv benchmark data file. All length units are in meters
# and all mass units are in kilograms for this test data.
prob['OAS.box_upper_x'] = np.array([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32,
0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,18 @@

aircraft_definition_file = 'models/test_aircraft/aircraft_for_bench_FwFm_simple.csv'
make_plots = False
max_iter = 100
optimizer = 'SNOPT'

max_iter = 1 # set this to a higher number to fully run the optimization
optimizer = 'SLSQP'

prob = av.AviaryProblem()

prob.load_inputs(aircraft_definition_file, phase_info)
prob.check_inputs()
prob.check_and_preprocess_inputs()
prob.add_pre_mission_systems()
prob.add_phases()
prob.add_post_mission_systems()
prob.link_phases()

driver = prob.driver = om.pyOptSparseDriver()
driver.options["optimizer"] = optimizer
driver.declare_coloring()
driver.opt_settings["Major iterations limit"] = max_iter
driver.opt_settings["Major optimality tolerance"] = 1e-4
driver.opt_settings["Major feasibility tolerance"] = 1e-5
driver.opt_settings["iSumm"] = 6

prob.add_driver(optimizer=optimizer, max_iter=max_iter)
prob.add_design_variables()
prob.add_objective()
prob.setup()
Expand Down
2 changes: 1 addition & 1 deletion aviary/examples/external_subsystems/battery/run_cruise.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Load aircraft and options data from user
# Allow for user overrides here
prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info)
prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv', phase_info)

prob.add_pre_mission_systems()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
# Allow for user overrides here
prob.load_inputs(input_file, phase_info)

# Have checks for clashing user inputs
# Raise warnings or errors depending on how clashing the issues are
prob.check_inputs()

# Preprocess inputs
prob.check_and_preprocess_inputs()

prob.add_pre_mission_systems()

Expand All @@ -37,7 +37,7 @@
# Link phases and variables
prob.link_phases()

prob.add_driver("SNOPT")
prob.add_driver("SLSQP")

prob.add_design_variables()

Expand Down
Loading

0 comments on commit 84ecbc1

Please sign in to comment.