Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move legacy code selection to input file #17

Merged
merged 29 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d8a346c
Changed mass/mission definition to input file
jkirk5 Dec 27, 2023
4fe27e7
fixed bench tests
jkirk5 Dec 27, 2023
48e0873
Merge remote-tracking branch 'remotes/origin/main' into cleanup
jkirk5 Dec 27, 2023
279a7d3
Refactor where phase_info is processed to level2
jkirk5 Dec 27, 2023
b23f168
added comment
jkirk5 Dec 28, 2023
6f5c183
linting
jkirk5 Dec 28, 2023
0a9642a
Updated docs
jkirk5 Dec 28, 2023
ff0c6a0
Removed references to legacy code for equations of motion
jkirk5 Dec 29, 2023
b73b2f1
Merge remote-tracking branch 'remotes/origin/main' into cleanup
jkirk5 Dec 29, 2023
38f7dd1
Updated functions to use equation of motion names
jkirk5 Dec 29, 2023
0397662
Update aviary/docs/getting_started/onboarding_level1.ipynb
jkirk5 Dec 29, 2023
163889c
Update aviary/docs/getting_started/onboarding_level2.ipynb
jkirk5 Dec 29, 2023
d1b0c4b
cleanup main call in tests
jkirk5 Dec 29, 2023
3676b86
Enum comments cleanup
jkirk5 Dec 29, 2023
524c9f7
Merge branch 'cleanup' of https://github.com/jkirk5/om-Aviary into cl…
jkirk5 Dec 29, 2023
c4683b3
PR feedback
jkirk5 Jan 5, 2024
8f922a6
Merge remote-tracking branch 'remotes/origin/main' into cleanup
jkirk5 Jan 5, 2024
e791f6d
Added details on how to set subsystem method in existing docs
jkirk5 Jan 8, 2024
e0fe5d9
Docs hyperlink fixes
jkirk5 Jan 8, 2024
406f365
Spelling fix
jkirk5 Jan 8, 2024
82ae1f1
Merge remote-tracking branch 'remotes/origin/main' into cleanup
Jan 8, 2024
f151e8d
Fixed doc code cells
jkirk5 Jan 9, 2024
16a876b
Merge remote-tracking branch 'remotes/origin/main' into cleanup
Jan 9, 2024
1ad22f5
Minor cleanup
johnjasa Jan 9, 2024
11eabae
2dof to 2DOF
jkirk5 Jan 9, 2024
9dea0bb
Merge branch 'cleanup' of https://github.com/jkirk5/om-Aviary into cl…
jkirk5 Jan 9, 2024
ce22fe1
Merge remote-tracking branch 'remotes/origin/main' into cleanup
jkirk5 Jan 9, 2024
98c3278
merge fixes
jkirk5 Jan 9, 2024
dec5cb5
Merge branch 'main' into cleanup
johnjasa Jan 10, 2024
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
10 changes: 5 additions & 5 deletions aviary/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
from aviary.utils.aviary_values import AviaryValues
from aviary.utils.csv_data_file import read_data_file, write_data_file
from aviary.utils.data_interpolator_builder import build_data_interpolator
from aviary.variable_info.enums import AlphaModes, AnalysisScheme, ProblemType, SpeedType, GASP_Engine_Type, Flap_Type
from aviary.interface.default_phase_info.gasp import phase_info as default_2DOF_phase_info
from aviary.interface.default_phase_info.flops import phase_info as default_height_energy_phase_info
from aviary.interface.default_phase_info.gasp_fiti import create_gasp_based_ascent_phases, create_gasp_based_descent_phases
from aviary.variable_info.enums import AlphaModes, AnalysisScheme, ProblemType, SpeedType, GASPEngineType, FlapType, EquationsOfMotion, LegacyCode, Verbosity
from aviary.interface.default_phase_info.two_dof import phase_info as default_2DOF_phase_info
from aviary.interface.default_phase_info.height_energy import phase_info as default_height_energy_phase_info
from aviary.interface.default_phase_info.two_dof_fiti import create_2dof_based_ascent_phases, create_2dof_based_descent_phases
from aviary.interface.default_phase_info.solved import phase_info as default_solved_phase_info
from aviary.interface.default_phase_info.simple import phase_info as default_simple_phase_info
from aviary.interface.methods_for_level1 import run_level_1
Expand All @@ -46,7 +46,7 @@
from aviary.utils.options import list_options
from aviary.constants import GRAV_METRIC_GASP, GRAV_ENGLISH_GASP, GRAV_METRIC_FLOPS, GRAV_ENGLISH_FLOPS, GRAV_ENGLISH_LBM, RHO_SEA_LEVEL_ENGLISH, RHO_SEA_LEVEL_METRIC, MU_TAKEOFF, MU_LANDING, PSLS_PSF, TSLS_DEGR, RADIUS_EARTH_METRIC
from aviary.subsystems.test.subsystem_tester import TestSubsystemBuilderBase, skipIfMissingDependencies
from aviary.interface.default_phase_info.flops import default_premission_subsystems, default_mission_subsystems
from aviary.interface.default_phase_info.height_energy import default_premission_subsystems, default_mission_subsystems

###################
# Level 3 Imports #
Expand Down
7 changes: 3 additions & 4 deletions aviary/docs/examples/additional_flight_phases.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@
"source": [
"import aviary.api as av\n",
"\n",
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info,\n",
" mission_method=\"simple\", mass_method=\"FLOPS\",\n",
" optimizer=\"SLSQP\", make_plots=True)"
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv',\n",
" phase_info, optimizer=\"SLSQP\", make_plots=True)"
]
},
{
Expand Down Expand Up @@ -277,7 +276,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.10.8"
}
},
"nbformat": 4,
Expand Down
24 changes: 10 additions & 14 deletions aviary/docs/examples/coupled_aircraft_mission_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,13 @@
"source": [
"import aviary.api as av\n",
"\n",
"aircraft_filename = 'models/test_aircraft/aircraft_for_bench_FwFm.csv'\n",
"mission_method = \"simple\"\n",
"mass_method = \"FLOPS\"\n",
"aircraft_filename = 'models/test_aircraft/aircraft_for_bench_FwFm_simple.csv'\n",
"optimizer = \"IPOPT\"\n",
"make_plots = True\n",
"max_iter = 200\n",
"\n",
"prob = av.run_aviary(aircraft_filename, phase_info,\n",
" mission_method=mission_method, mass_method=mass_method,\n",
" optimizer=optimizer, make_plots=make_plots, max_iter=max_iter)"
"prob = av.run_aviary(aircraft_filename, phase_info, optimizer=optimizer,\n",
" make_plots=make_plots, max_iter=max_iter)"
]
},
{
Expand Down Expand Up @@ -212,11 +209,11 @@
"metadata": {},
"outputs": [],
"source": [
"prob = av.AviaryProblem(phase_info, mission_method, mass_method, av.AnalysisScheme.COLLOCATION)\n",
"prob = av.AviaryProblem(av.AnalysisScheme.COLLOCATION)\n",
"\n",
"# Load aircraft and options data from user\n",
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename)\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",
Expand Down Expand Up @@ -289,9 +286,8 @@
"phase_info['descent_1']['user_options']['optimize_mach'] = True\n",
"phase_info['descent_1']['user_options']['optimize_altitude'] = True\n",
"\n",
"prob = av.run_aviary(aircraft_filename, phase_info,\n",
" mission_method=mission_method, mass_method=mass_method,\n",
" optimizer=optimizer, make_plots=make_plots, max_iter=max_iter)"
"prob = av.run_aviary(aircraft_filename, phase_info, optimizer=optimizer,\n",
" make_plots=make_plots, max_iter=max_iter)"
]
},
{
Expand Down Expand Up @@ -333,11 +329,11 @@
"metadata": {},
"outputs": [],
"source": [
"prob = av.AviaryProblem(phase_info, mission_method, mass_method, av.AnalysisScheme.COLLOCATION)\n",
"prob = av.AviaryProblem(av.AnalysisScheme.COLLOCATION)\n",
"\n",
"# Load aircraft and options data from user\n",
"# Allow for user overrides here\n",
"prob.load_inputs(aircraft_filename)\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",
Expand Down Expand Up @@ -440,7 +436,7 @@
"In both cases where the wing aspect ratio is optimized, it moves to the higher bound.\n",
"\n",
"If we didn't simultaneously design the aircraft and the mission, you would have to manually iterate by first optimizing the aircraft, then the mission, then the aircraft again, etc.\n",
"This cumbersome process is known as sequential optimization and can lead to non-optimal results for coupled systems, as detailed in [Section 13.1 of the free Engineering Design Optimization textbook](https://flowlab.groups.et.byu.net/mdobook.pdf).\n",
"This cumbersome process is known as sequential optimization and can lead to non-optimal results for coupled systems, as detailed in Section 13.1 of the [Engineering Design Optimization textbook](https://flowlab.groups.et.byu.net/mdobook.pdf) (available for free).\n",
"\n",
"Aviary is unique in its ability to solve these coupled systems using efficient gradient-based optimization.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion aviary/docs/examples/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Aviary provides a range of built-in examples that serve as both regression tests and demonstrations of the tool's capabilities.
These examples showcase various full mission analysis and optimization problems, incorporating different subsystem analyses from FLOPS and GASP.
You can find these examples [here](https://github.com/OpenMDAO/om-Aviary/tree/main/aviary/validation_cases/benchmark_tests), especially the files that start `test_swap`.
These cases highlight the progress and expansion of Aviary's functionality, reflecting the January milestone achieved by the Aviary team that combined basic GASP and FLOPS capabilities.
These cases highlight Aviary's ability to replicate GASP and FLOPS capabilities, as well as use both code's methods in a single analysis.

In addition to the examples for core Aviary, we also provide some examples for using external subsystems.
These are contained in the `aviary/examples/external_subsystems` folder.
Expand Down
15 changes: 6 additions & 9 deletions aviary/docs/examples/more_advanced_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@
"source": [
"import aviary.api as av\n",
"\n",
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info,\n",
" mission_method=\"simple\", mass_method=\"FLOPS\",\n",
" optimizer=\"SLSQP\", make_plots=True)"
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv',\n",
" phase_info, optimizer=\"SLSQP\", make_plots=True)"
]
},
{
Expand Down Expand Up @@ -189,7 +188,7 @@
"source": [
"import csv\n",
"\n",
"filename = 'models/test_aircraft/aircraft_for_bench_FwFm.csv'\n",
"filename = 'models/test_aircraft/aircraft_for_bench_FwFm_simple.csv'\n",
"filename = av.get_path(filename)\n",
"\n",
"# Read the file\n",
Expand Down Expand Up @@ -233,8 +232,7 @@
"outputs": [],
"source": [
"prob = av.run_aviary('modified_aircraft.csv', phase_info,\n",
" mission_method=\"simple\", mass_method=\"FLOPS\",\n",
" optimizer=\"SLSQP\", make_plots=True)"
" optimizer=\"SLSQP\", make_plots=True)"
]
},
{
Expand Down Expand Up @@ -281,9 +279,8 @@
"phase_info['cruise']['user_options']['polynomial_control_order'] = 1\n",
"phase_info['descent_1']['user_options']['polynomial_control_order'] = 3\n",
"\n",
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info,\n",
" mission_method=\"simple\", mass_method=\"FLOPS\",\n",
" optimizer=\"IPOPT\", make_plots=True)"
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv',\n",
" phase_info, optimizer=\"IPOPT\", make_plots=True)"
]
},
{
Expand Down
13 changes: 7 additions & 6 deletions aviary/docs/examples/simple_mission_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"* value: the user-defined value of the variable\n",
"* units: the units of the variable\n",
"\n",
"Let's take a look at the first few lines of an example aircraft file, `aircraft_for_bench_FwFm.csv`.\n",
"Let's take a look at the first few lines of an example aircraft file, `aircraft_for_bench_FwFm_simple.csv`.\n",
"This aircraft is a commercial single-aisle aircraft with two conventional turbofan engines.\n",
"Think of it in the same class as a Boeing 737 or Airbus A320.\n",
"\n",
Expand All @@ -40,7 +40,7 @@
"source": [
"import aviary.api as av\n",
"\n",
"filename = 'models/test_aircraft/aircraft_for_bench_FwFm.csv'\n",
"filename = 'models/test_aircraft/aircraft_for_bench_FwFm_simple.csv'\n",
"filename = av.get_path(filename)\n",
"\n",
"with open(filename, 'r') as file:\n",
Expand All @@ -62,7 +62,7 @@
"Please look at relevant examples to see what variables are needed.\n",
"```\n",
"\n",
"For this example case, we'll be using the `simple` mission method and the `FLOPS`-based mass estimation method.\n",
"For this example case, our model is using the `simple` mission method and `FLOPS`-based mass and aero estimation methods.\n",
"We strongly suggest using the `simple` mission method as it is the most robust and easiest to use.\n",
"There are relatively few reasons to use a more complex mission method and you should only do so if you have a particular reason to use a more detailed method.\n",
"\n",
Expand Down Expand Up @@ -115,6 +115,8 @@
"Phase info has been saved and formatted in /mnt/c/Users/user/Dropbox/git/Aviary/outputted_phase_info.py\n",
"```\n",
"\n",
"If you don't have the [black](https://pypi.org/project/black/) python autoformatter installed, your output may look slightly different - as long as you see confirmation that your phase info has been saved, your mission profile was successfully created.\n",
"\n",
"The `phase_info` dictionary has been saved to a file called `outputted_phase_info.py` in the current directory.\n",
"Let's dig into it.\n",
"\n",
Expand Down Expand Up @@ -277,9 +279,8 @@
"source": [
"import aviary.api as av\n",
"\n",
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info,\n",
" mission_method=\"simple\", mass_method=\"FLOPS\",\n",
" optimizer=\"SLSQP\", make_plots=True)"
"prob = av.run_aviary('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv',\n",
" phase_info, optimizer=\"SLSQP\", make_plots=True)"
]
},
{
Expand Down
24 changes: 11 additions & 13 deletions aviary/docs/getting_started/onboarding_ext_subsystem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
"# Here we just add the simple weight system to only the pre-mission\n",
"phase_info['pre_mission']['external_subsystems'] = [WingWeightBuilder(name=\"wing_external\")]\n",
"\n",
"prob = av.AviaryProblem(phase_info, mission_method=\"simple\", mass_method=\"FLOPS\")\n",
"prob = av.AviaryProblem()\n",
"\n",
"# Load aircraft and options data from user\n",
"# Allow for user overrides here\n",
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv')\n",
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv', phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
Expand Down Expand Up @@ -115,11 +115,11 @@
"\n",
"# Max iterations set to 1 to reduce runtime of example\n",
"max_iter = 1\n",
"prob = av.AviaryProblem(av.default_simple_phase_info, mission_method=\"simple\", mass_method=\"FLOPS\")\n",
"prob = av.AviaryProblem()\n",
"\n",
"# Load aircraft and options data from user\n",
"# Allow for user overrides here\n",
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv')\n",
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv', av.default_simple_phase_info)\n",
"\n",
"# Have checks for clashing user inputs\n",
"# Raise warnings or errors depending on how clashing the issues are\n",
Expand Down Expand Up @@ -229,9 +229,9 @@
"metadata": {},
"outputs": [],
"source": [
"prob = av.AviaryProblem(phase_info, mission_method=\"simple\", mass_method=\"FLOPS\")\n",
"prob = av.AviaryProblem()\n",
"\n",
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv')"
"prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm_simple.csv', phase_info)"
]
},
{
Expand Down Expand Up @@ -622,16 +622,14 @@
"metadata": {},
"outputs": [],
"source": [
"aircraft_definition_file = 'models/test_aircraft/aircraft_for_bench_FwFm.csv'\n",
"mission_method = 'simple'\n",
"mass_method = 'FLOPS'\n",
"aircraft_definition_file = 'models/test_aircraft/aircraft_for_bench_FwFm_simple.csv'\n",
"make_plots = False\n",
"max_iter = 0\n",
"optimizer = 'SNOPT'\n",
"\n",
"prob = av.AviaryProblem(phase_info, mission_method=mission_method, mass_method='FLOPS')\n",
"prob = av.AviaryProblem()\n",
"\n",
"prob.load_inputs(aircraft_definition_file)\n",
"prob.load_inputs(aircraft_definition_file, phase_info)\n",
"prob.check_inputs()\n",
"prob.add_pre_mission_systems()\n",
"prob.add_phases()\n",
Expand Down Expand Up @@ -737,7 +735,7 @@
"id": "c04ddce7",
"metadata": {},
"source": [
"The result is comparitable to the output without OpenAeroStruct external subsystem."
"The result is comparable to the output without OpenAeroStruct external subsystem."
]
}
],
Expand All @@ -757,7 +755,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.17"
"version": "3.10.8"
}
},
"nbformat": 4,
Expand Down
Loading