Skip to content

Commit

Permalink
Maintenance update (formatting, automated build, publications, and Op…
Browse files Browse the repository at this point in the history
…enMDAO updates) (#45)

* Formatted with new version of black

* GitHub Actions build regularly tests oldest and latest supported package versions

* Updated publications and citations

* Adjusted readme bib formatting

* Removed title from build version table in RTD

* Fixed flake8 complaints

* NumPy 1.14 doesn't work with Python 3.8, rolling back to Python 3.6 for old build

* Updated lower bounds on versions to match OpenAeroStruct

* Moved matplotlib import on doc examples so it isn't required to run tests

* Fixed error in test due to OpenMDAO throwing a different error in newer versions

* Ran black

* Try finite difference instead of complex step to see if that's the problem

* Not complex step fault, try adding component as subsystem instead of directly as model

* Adding stuff to debug through GHA

* Try in place install

* Try finite differencing on my own

* Manual finite difference changes output, try fd without force_alloc_complex

* Those were nonzero, now try adding back in force_alloc_complex and see if it breaks again

* Found the problem, but shouldn't be checking partials of OM comps anyway so remove

* Removed unused assert_check_partials import

* Removed debugging from GHA yaml

* Fixed cases in tests where OM Problem models were not groups for future OM deprecations

* Bumped patch version since dependency versions change

* A couple more cases where a component was a problem's model

* Oops, still missed a few more
  • Loading branch information
eytanadler committed Mar 3, 2023
1 parent ae1d52e commit 573f1eb
Show file tree
Hide file tree
Showing 29 changed files with 240 additions and 132 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/openconcept.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- main
tags:
- v*.*.*
schedule:
# Run the tests at 7:23pm UTC on the 9th and 24th of every month
- cron: '23 19 9,24 * *'

jobs:
black:
Expand All @@ -18,7 +21,13 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.8", "3.9", "3.10"]
dep-versions: ["oldest", "latest"]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set versions to test here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PYTHON_VERSION_OLDEST: ['3.8']
PYTHON_VERSION_LATEST: ['3.11']
NUMPY_VERSION_OLDEST: ['1.20'] # latest is most recent on PyPI
SCIPY_VERSION_OLDEST: ['1.6.0'] # latest is most recent on PyPI
OPENMDAO_VERSION_OLDEST: ['3.10'] # latest is most recent on PyPI
fail-fast: false
env:
OMP_NUM_THREADS: 1
Expand All @@ -27,23 +36,40 @@ jobs:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set Python Version
- name: Setup Python ${{ matrix.PYTHON_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Setup conda
python-version: ${{ matrix.PYTHON_VERSION_OLDEST }}
- name: Setup Python ${{ matrix.PYTHON_VERSION_LATEST }}
if: ${{ matrix.dep-versions == 'latest' }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.PYTHON_VERSION_LATEST }}

- name: Install dependencies (oldest versions)
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
conda config --set always_yes yes
conda install numpy scipy
- name: Install
pip install numpy==${{ matrix.NUMPY_VERSION_OLDEST }} scipy==${{ matrix.SCIPY_VERSION_OLDEST }} openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }}
- name: Install dependencies (latest versions)
if: ${{ matrix.dep-versions == 'latest' }}
run: |
pip install .[testing]
pip install .[docs]
conda config --set always_yes yes
pip install numpy scipy openmdao
- name: Install OpenConcept
run: |
pip install -e .[testing]
pip install -e .[docs]
- name: List Python and package info
run: |
python --version
pip list
- name: Download engine deck surrogate model
run: |
curl -L -o engine_kriging_surrogate_model.tar.gz http://umich.edu/~mdolaboratory/repo_files/openconcept/engine_kriging_surrogate_model.tar.gz
Expand All @@ -53,9 +79,11 @@ jobs:
mv cfm56* ./openconcept/propulsion/empirical_data/cfm56
mv n3_hybrid* ./openconcept/propulsion/empirical_data/n+3_hybrid
mv n3* ./openconcept/propulsion/empirical_data/n+3
- name: Build and Test
- name: Test
run: |
python -m pytest --cov-config=.coveragerc --cov=openconcept --cov-report=xml
- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v2
Expand Down
44 changes: 25 additions & 19 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,29 @@ Dependencies

.. Remember to change in the readme too!
This toolkit requires the use of `OpenMDAO <https://openmdao.org>`__ 3.10.0 or later due to backward-incompatible changes.
OpenMDAO requires a recent NumPy and SciPy.
Python 3.8, 3.9, or 3.10 are recommended since they are the versions with which the code is tested, but newer Python versions will likely work as well.
OpenConcept is tested regularly on builds with the oldest and latest supported package versions. The package versions in the oldest and latest builds are the following:

.. list-table:: Latest tested dependencies
.. list-table::
:header-rows: 1

* - Package
- Version
- Oldest
- Latest
* - Python
- 3.10.4
- 3.8
- 3.11
* - OpenMDAO
- 3.16.0
- 3.10
- latest
* - NumPy
- 1.22.4
- 1.20
- latest
* - SciPy
- 1.7.3
- 1.6.0
- latest
* - OpenAeroStruct
- 2.5.1
- latest
- latest

---------------
Please Cite Us!
Expand All @@ -95,19 +99,21 @@ AIAA Propulsion and Energy Forum, (AIAA 2018-4979) DOI: 10.2514/6.2018-4979
doi = {10.2514/6.2018-4979}
}
If using the integrated OpenAeroStruct VLM or aerostructural aerodynamic models, please cite the following `conference paper <https://www.researchgate.net/publication/357559489_Aerostructural_wing_design_optimization_considering_full_mission_analysis>`__:
If using the integrated OpenAeroStruct VLM or aerostructural aerodynamic models, please cite the following `journal paper <https://www.researchgate.net/publication/366553107_Efficient_Aerostructural_Wing_Optimization_Considering_Mission_Analysis>`__:

Eytan J. Adler and Joaquim R.R.A. Martins, "Aerostructural wing design optimization considering full mission analysis", 2022 AIAA SciTech Forum, San Diego, CA, January 2022. DOI: 10.2514/6.2022-0382
Eytan J. Adler and Joaquim R.R.A. Martins, "Efficient Aerostructural Wing Optimization Considering Mission Analysis", AIAA Journal of Aircraft, December 2022. DOI: 10.2514/1.c037096

.. code-block:: bibtex
@inproceedings{Adler2022a,
author = {Eytan J. Adler and Joaquim R. R. A. Martins},
title = {Aerostructural wing design optimization considering full mission analysis},
booktitle = {AIAA SciTech Forum},
doi = {10.2514/6.2022-0382},
month = {January},
year = {2022}
@article{Adler2022d,
author = {Adler, Eytan J. and Martins, Joaquim R. R. A.},
doi = {10.2514/1.c037096},
issn = {1533-3868},
journal = {Journal of Aircraft},
month = {December},
publisher = {American Institute of Aeronautics and Astronautics},
title = {Efficient Aerostructural Wing Optimization Considering Mission Analysis},
year = {2022}
}
.. currentmodule:: openconcept
Expand Down
36 changes: 35 additions & 1 deletion doc/publications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,45 @@ Publications
2022
====

Eytan J. Adler and Joaquim R.R.A. Martins,
*Efficient Aerostructural Wing Optimization Considering Mission Analysis*,
Journal of Aircraft, 2022
DOI: `10.2514/1.c037096 <https://doi.org/10.2514/1.c037096>`_.
PDF is available `here <https://www.researchgate.net/publication/366553107_Efficient_Aerostructural_Wing_Optimization_Considering_Mission_Analysis>`__.

.. code-block:: bibtex
@article{Adler2022d,
author = {Adler, Eytan J. and Martins, Joaquim R. R. A.},
title = {Efficient Aerostructural Wing Optimization Considering Mission Analysis},
doi = {10.2514/1.c037096},
issn = {1533-3868},
journal = {Journal of Aircraft},
month = {December},
publisher = {American Institute of Aeronautics and Astronautics},
year = {2022}
}
Mahmoud Fouda, Eytan J. Adler, Jasper H. Bussemaker, Joaquim R. R. A. Martins, D. F. Kurtulus, Luca Boggero, and Björn Nagel,
*Automated Hybrid Propulsion Model Construction for Conceptual Aircraft Design and Optimization*,
33rd Congress of the International Council of the Aeronautical Sciences, Stockholm, Sweden, September 2022,
PDF is available `here <https://www.researchgate.net/publication/363405270_Automated_hybrid_propulsion_model_construction_for_conceptual_aircraft_design_and_optimization>`__.

.. code-block:: bibtex
@inproceedings{Fouda2022,
author = {Mahmoud Fouda and Eytan J. Adler and Jasper H. Bussemaker and Joaquim R. R. A. Martins and D. F. Kurtulus and Luca Boggero and Bj\"orn Nagel},
title = {Automated Hybrid Propulsion Model Construction for Conceptual Aircraft Design and Optimization},
booktitle = {33rd Congress of the International Council of the Aeronautical Sciences},
month = {September},
year = {2022}
}
Eytan J. Adler, Benjamin J. Brelje, and Joaquim R.R.A. Martins,
*Thermal Management System Optimization for a Parallel Hybrid Aircraft Considering Mission Fuel Burn*,
Aerospace, 9(5), 2022
DOI: `10.3390/aerospace9050243 <https://doi.org/10.3390/aerospace9050243>`_.
PDF is available `here <https://mdolab.engin.umich.edu/bibliography/Adler2022b>`__.
PDF is available `here <https://www.researchgate.net/publication/360208814_Thermal_Management_System_Optimization_for_a_Parallel_Hybrid_Aircraft_Considering_Mission_Fuel_Burn>`__.

.. code-block:: bibtex
Expand Down
2 changes: 1 addition & 1 deletion openconcept/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.1"
__version__ = "1.0.2"
16 changes: 9 additions & 7 deletions openconcept/aerodynamics/openaerostruct/aerostructural.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
raise ImportError("OpenAeroStruct must be installed to use the AerostructDragPolar component")

CITATION = """
@InProceedings{Adler2022a,
author = {Eytan J. Adler and Joaquim R. R. A. Martins},
title = {Aerostructural wing design optimization considering full mission analysis},
booktitle = {AIAA SciTech Forum},
doi = {10.2514/6.2022-0382},
month = {January},
year = {2022}
@article{Adler2022d,
author = {Adler, Eytan J. and Martins, Joaquim R. R. A.},
doi = {10.2514/1.c037096},
issn = {1533-3868},
journal = {Journal of Aircraft},
month = {December},
publisher = {American Institute of Aeronautics and Astronautics},
title = {Efficient Aerostructural Wing Optimization Considering Mission Analysis},
year = {2022}
}
"""

Expand Down
16 changes: 9 additions & 7 deletions openconcept/aerodynamics/openaerostruct/drag_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
raise ImportError("OpenAeroStruct must be installed to use the VLMDragPolar component")

CITATION = """
@InProceedings{Adler2022a,
author = {Eytan J. Adler and Joaquim R. R. A. Martins},
title = {Aerostructural wing design optimization considering full mission analysis},
booktitle = {AIAA SciTech Forum},
doi = {10.2514/6.2022-0382},
month = {January},
year = {2022}
@article{Adler2022d,
author = {Adler, Eytan J. and Martins, Joaquim R. R. A.},
doi = {10.2514/1.c037096},
issn = {1533-3868},
journal = {Journal of Aircraft},
month = {December},
publisher = {American Institute of Aeronautics and Astronautics},
title = {Efficient Aerostructural Wing Optimization Considering Mission Analysis},
year = {2022}
}
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def test_defaults(self):
toverc = np.array([0.05, 0.1, 0.12])
t_skin = np.array([5, 13, 15]) # mm
t_spar = np.array([5, 13, 15]) # mm
p = om.Problem(
p = om.Problem()
p.model.add_subsystem(
"comp",
OASDataGen(
num_x=3,
num_y=7,
Expand All @@ -249,7 +251,8 @@ def test_defaults(self):
Mach_train=np.linspace(0.1, 0.85, 2),
alpha_train=np.linspace(-10, 15, 2),
alt_train=np.linspace(0, 15e3, 2),
)
),
promotes=["*"],
)
p.setup()
p.set_val("fltcond|TempIncrement", 0, units="degC")
Expand Down
25 changes: 17 additions & 8 deletions openconcept/aerodynamics/openaerostruct/tests/test_drag_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,18 @@ def tearDown(self):
def test_defaults(self):
# Regression test
twist = np.array([-1, -0.5, 2])
p = om.Problem(
p = om.Problem()
p.model.add_subsystem(
"comp",
VLMDataGen(
num_x=3,
num_y=5,
num_twist=twist.size,
Mach_train=np.linspace(0.1, 0.85, 2),
alpha_train=np.linspace(-10, 15, 2),
alt_train=np.linspace(0, 15e3, 2),
)
),
promotes=["*"],
)
p.setup()
p.set_val("fltcond|TempIncrement", 0, units="degC")
Expand Down Expand Up @@ -375,7 +378,8 @@ class PlanformMeshTestCase(unittest.TestCase):
def test_easy(self):
nx = 3
ny = 5
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup()
p.set_val("S", 2, units="m**2")
p.set_val("AR", 2)
Expand All @@ -394,7 +398,8 @@ def test_easy(self):
def test_S_AR(self):
nx = 3
ny = 5
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup(force_alloc_complex=True)
p.set_val("S", 48, units="m**2")
p.set_val("AR", 3)
Expand All @@ -413,7 +418,8 @@ def test_S_AR(self):
def test_taper(self):
nx = 2
ny = 3
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup()
p.set_val("S", 1.3, units="m**2")
p.set_val("AR", 4 / 1.3) # pick S and AR for half span and root chord of 1
Expand All @@ -433,7 +439,8 @@ def test_taper(self):
def test_sweep(self):
nx = 3
ny = 3
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup()
p.set_val("S", 2, units="m**2")
p.set_val("AR", 2)
Expand All @@ -455,7 +462,8 @@ def test_sweep(self):
def test_taper_sweep(self):
nx = 2
ny = 3
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup()
p.set_val("S", 1.3, units="m**2")
p.set_val("AR", 4 / 1.3) # pick S and AR for half span and root chord of 1
Expand All @@ -477,7 +485,8 @@ def test_taper_sweep(self):
def test_777ish_regression(self):
nx = 3
ny = 4
p = om.Problem(PlanformMesh(num_x=nx, num_y=ny))
p = om.Problem()
p.model.add_subsystem("comp", PlanformMesh(num_x=nx, num_y=ny), promotes=["*"])
p.setup()
p.set_val("S", 427.8, units="m**2")
p.set_val("AR", 9.82)
Expand Down
1 change: 1 addition & 0 deletions openconcept/atmospherics/atmospherics_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
)
temp_coeffs = np.linalg.solve(tropopause_matrix, temp_rhs)


# functions
def get_mask_arrays(h_m):
tropos_mask = h_m <= h_lower
Expand Down
4 changes: 3 additions & 1 deletion openconcept/examples/TBM850.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# rst Imports (beg)
import numpy as np
import openmdao.api as om
import matplotlib.pyplot as plt

# OpenConcept imports for the airplane model
from openconcept.propulsion import TurbopropPropulsionSystem
Expand All @@ -13,6 +12,7 @@

# rst Imports (end)


# rst Aircraft (beg)
class TBM850AirplaneModel(om.Group):
"""
Expand Down Expand Up @@ -245,6 +245,8 @@ def run_tbm_analysis():
print(f"{var['name']}: {prob.get_val(var['var'], units=var['units']).item()} {var['units']}")

# =============== Takeoff plot ================
import matplotlib.pyplot as plt

takeoff_fig, takeoff_axs = plt.subplots(1, 3, figsize=[9, 2.7], constrained_layout=True)
takeoff_axs = takeoff_axs.flatten() # change 1x3 mtx of axes into 4-element vector

Expand Down

0 comments on commit 573f1eb

Please sign in to comment.