Skip to content

Commit

Permalink
Allow newest version of OpenMDAO (#400)
Browse files Browse the repository at this point in the history
* Removed upper bound on OM version added bi-monthly scheduled tests

* Update to Python 3.10 for GHA and use MDO Lab flake8 and black tests

* Formatted for new version of black

* Moved flake8 OAS config file so MDO Lab action will pick it up

* Trying to make flake8 happy

* More flake8 changes

* Whoops I messed up one of the tests

* Test oldest package versions in GHA build

* Fixing bugs in GHA file

* More bugs with quotation marks

* Updated oldest OM version and bumped patch version of OAS

* Try older pytest version to fix seg fault in GHA

* Try newer Python version for oldest and get rid of OpenVSP and pyGeo for debugging

* Try back to 3.8

* Add in pySpline and pyGeo

* Broke with pySpline/pyGeo, try only OpenVSP

* See if OpenVSP is changing the numpy version

* Trying an older vsp version so numpy doesn't update

* Try installing OpenVSP before OAS and other deps

* Add back in pySpline and pyGeo....*gulp*

* Move pySpline/Geo install to after OAS install since it needs numpy

* The error returns.....see if it can be reproduced without OpenVSP to save debugging time

* Does Python 3.9 work

* Try Python 3.10, otherwise it's a package issue

* Oops, numpy 1.20 doesn't work on Python 3.10, try Python 3.8 but with the newest numpy scipy and OM

* Python 3.8 with newest numpy scipy OM still breaks, try 3.10 with newest just to sanity check

* Works as expected, try back to 3.8 with newest allowed numpy scipy and OM

* See if working build on Python 3.10 works with older setuptools, the only package difference between working and not

* Python version is the problem, try 3.9 again

* See if Python 3.11 works just for fun

* Does it really work fine without pygeo, wtf matplotlib...

* How about an older matplotlib

* Try an older version of pyGeo

* Fixed type in GHA build file

* Changed name to specify pygeo version

* Try pyGeo v1.12.0

* pyGeo 1.12.0 seems to work, try 1.12.1

* pyGeo 1.12.1 seems to work, try 1.12.2

* pyGeo 1.12.2 seems to work, try latest again

* Revert back to pyGeo 1.12.2 for the old build

* Get rid of tagged matplotlib version

* Add back in OpenVSP

* Cleaning up the YAML file

* Kinda abusing the build matrix but whatchagonnado

* gabagool

* Maya Angelou: You will face many defeats in life, but never let yourself be defeated

* New table for RTD

* pyGeo v1.6.0 on oldest build

* Does pyGeo error go away if I install OAS in place

* Go back to working build with pyGeo 1.6.0 and update docs
  • Loading branch information
eytanadler committed Feb 15, 2023
1 parent 473232a commit 71045b3
Show file tree
Hide file tree
Showing 88 changed files with 148 additions and 310 deletions.
3 changes: 2 additions & 1 deletion .github/.flake8_oas_specific → .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ extend-exclude =
openaerostruct/docs/conf.py,
openaerostruct/docs/aero_walkthrough/part*.py,
openaerostruct/docs/_utils/docutil.py,
openaerostruct/docs/_utils/patch.py
openaerostruct/docs/_utils/patch.py,
openaerostruct/utils/plot_*.py,
130 changes: 68 additions & 62 deletions .github/workflows/oas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,38 @@ on:
- main
tags:
- v*.*.*
schedule:
# Run the tests at 7:23pm UTC on the 2nd and 17th of every month
- cron: '23 19 2,17 * *'

jobs:
# --- run OAS unit and regression tests ---
test:
runs-on: ubuntu-latest
env:
VSP_VERSION: 3.27.1
strategy:
matrix:
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
PYGEO_VERSION_OLDEST: ['1.6.0'] # latest is pulled from main branch, for some reason anything after 1.12.2 seg faults on the old build
VSP_VERSION: ['3.27.1'] # used for both builds

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python ${{ matrix.PYTHON_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
uses: actions/setup-python@v2
with:
python-version: '3.8'

# OAS dependencies are specified in setup.py.
- name: Install OAS and its dependencies
run: |
python -m pip install --upgrade pip wheel
pip install .[test]
# we need pySpline/pyGeo to run FFD tests.
- name: Install pySpline and pyGeo
run: |
cd ..
sudo apt-get install openmpi-bin libopenmpi-dev
pip install mpi4py
git clone https://github.com/mdolab/pyspline.git
cd pyspline
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk
make
pip install -e .
cd ..
pip install "pygeo[testing] @ git+https://github.com/mdolab/pygeo.git"
python-version: ${{ matrix.PYTHON_VERSION_OLDEST }}
- name: Set up Python ${{ matrix.PYTHON_VERSION_LATEST }}
if: ${{ matrix.dep-versions == 'latest' }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION_LATEST }}

# we need OpenVSP to run vsp tests.
- name: Install OpenVSP
Expand All @@ -59,9 +57,9 @@ jobs:
cd OpenVSP
mkdir build buildlibs
# Download source code
wget -q https://github.com/OpenVSP/OpenVSP/archive/refs/tags/OpenVSP_${VSP_VERSION}.tar.gz
tar -xf OpenVSP_${VSP_VERSION}.tar.gz
mv OpenVSP-OpenVSP_${VSP_VERSION} repo
wget -q https://github.com/OpenVSP/OpenVSP/archive/refs/tags/OpenVSP_${{ matrix.VSP_VERSION }}.tar.gz
tar -xf OpenVSP_${{ matrix.VSP_VERSION }}.tar.gz
mv OpenVSP-OpenVSP_${{ matrix.VSP_VERSION }} repo
# Build dependency libs
cd buildlibs
cmake -DVSP_USE_SYSTEM_LIBXML2=true -DVSP_USE_SYSTEM_FLTK=true -DVSP_USE_SYSTEM_GLM=true \
Expand All @@ -79,13 +77,51 @@ jobs:
make -j8
make package
# Install python interface
pushd _CPack_Packages/Linux/ZIP/OpenVSP-${VSP_VERSION}-Linux/python
pushd _CPack_Packages/Linux/ZIP/OpenVSP-${{ matrix.VSP_VERSION }}-Linux/python
pip install -r requirements.txt
pushd ..
cp vspaero vspscript vspslicer $INST_PREFIX/bin
popd
popd
# OAS dependencies are specified in setup.py.
- name: Install OAS and its dependencies (oldest versions)
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
python -m pip install --upgrade pip wheel
pip install numpy==${{ matrix.NUMPY_VERSION_OLDEST }} scipy==${{ matrix.SCIPY_VERSION_OLDEST }} openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }}
pip install -e .[test]
- name: Install OAS and its dependencies (latest versions)
if: ${{ matrix.dep-versions == 'latest' }}
run: |
python -m pip install --upgrade pip wheel
pip install -e .[test]
# We need pySpline/pyGeo to run FFD tests.
- name: Install pySpline
run: |
cd ..
sudo apt-get install openmpi-bin libopenmpi-dev
pip install mpi4py
git clone https://github.com/mdolab/pyspline.git
cd pyspline
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk
make
pip install -e .
- name: Install pyGeo ${{ matrix.PYGEO_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
pip install "pygeo[testing] @ git+https://github.com/mdolab/pygeo.git@v${{ matrix.PYGEO_VERSION_OLDEST }}"
- name: Install pyGeo latest
if: ${{ matrix.dep-versions == 'latest' }}
run: |
pip install "pygeo[testing] @ git+https://github.com/mdolab/pygeo.git"
- name: List installed Python packages
run: |
pip list -v
- name: Run tests
env:
OMPI_MCA_btl: ^openib # prevent OpenMPI warning messages
Expand All @@ -97,41 +133,11 @@ jobs:
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

# --- code style check by flake8 ---
flake8:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'

# use both MDO Lab standard config
- name: Code style (flake8)
run: |
pip install flake8==3.9.2
wget https://raw.githubusercontent.com/mdolab/.github/main/.flake8 -O .flake8_mdolab
python -m flake8 openaerostruct --append-config .flake8_mdolab --append-config .github/.flake8_oas_specific --count --show-source --statistics
# --- code format check by black ---
# --- linting and formatting ---
black:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'

# code format check by black
- name: Code format (black)
run: |
pip install black==22.3.0
black openaerostruct --check --diff -l 120 --target-version py38
uses: mdolab/.github/.github/workflows/black.yaml@main
flake8:
uses: mdolab/.github/.github/workflows/flake8.yaml@main

# --- publish to PyPI
pypi:
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,23 @@ Shamsheer S. Chauhan and Joaquim R. R. A. Martins, “Low-Fidelity Aerostructura

Version Information
-------------------
The latest version of OpenAeroStruct requires [OpenMDAO](https://github.com/OpenMDAO/openmdao) (versions 3.2.0 to 3.16.0) and Python3.
Python2 is no longer supported.
It also requires the folloing packages: `numpy, scipy, matplotlib`.
The oldest and latest versions of the dependencies that we test regularly are the following (other versions may work, but no guarantees):

| Dependency | oldest | latest |
| ---------- | ------ | ------ |
| Python | 3.8 | 3.11 |
| NumPy | 1.20 | latest |
| SciPy | 1.6.0 | latest |
| OpenMDAO | 3.10 | latest |
| Matplotlib | latest | latest |
| pyGeo (optional) | 1.6.0 | latest |
| OpenVSP (optional) | 3.27.1 | 3.27.1 |

If you are looking to use the previous version of OpenAeroStruct which uses OpenMDAO 1.7.4, use OpenAeroStruct 1.0 from [here](https://github.com/mdolab/OpenAeroStruct/releases).

License
-------
Copyright 2018-2022 MDO Lab
Copyright 2018-2023 MDO Lab

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion openaerostruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.5.2"
__version__ = "2.5.3"
1 change: 0 additions & 1 deletion openaerostruct/aerodynamics/lift_coeff_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def setup(self):
self.declare_partials("Cl", "sec_forces", rows=rows, cols=cols)

def compute(self, inputs, outputs):

# Input parameters
alpha = inputs["alpha"] * np.pi / 180.0
cosa = np.cos(alpha)
Expand Down
1 change: 0 additions & 1 deletion openaerostruct/aerodynamics/mesh_point_forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def compute(self, inputs, outputs):
le_wt = self.options["le_wt"]
te_wt = self.options["te_wt"]
for surface in surfaces:

name = surface["name"]
sec_forces_name = "{}_sec_forces".format(name)
mesh_point_forces_name = "{}_mesh_point_forces".format(name)
Expand Down
1 change: 0 additions & 1 deletion openaerostruct/aerodynamics/pg_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def initialize(self):
self.options.declare("surfaces", types=list)

def setup(self):

self.add_input("Mach_number", val=0.0)

# We'll compute all of sensitivities associated with Mach number through
Expand Down
2 changes: 1 addition & 1 deletion openaerostruct/aerodynamics/rotational_velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def compute_partials(self, inputs, J):
surfaces = self.options["surfaces"]
idx = jdx = 0
ii = self.system_size * 3
for j, surface in enumerate(surfaces):
for surface in surfaces:
mesh = surface["mesh"]
nx = mesh.shape[0]
ny = mesh.shape[1]
Expand Down
2 changes: 0 additions & 2 deletions openaerostruct/aerodynamics/viscous_drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def compute_partials(self, inputs, partials):
t_over_c = inputs["t_over_c"]

if self.with_viscous:

M = inputs["Mach_number"]
S_ref = inputs["S_ref"]
widths = inputs["widths"]
Expand Down Expand Up @@ -171,7 +170,6 @@ def compute_partials(self, inputs, partials):
if self.k_lam == 0:
cdT_Re = 0.455 / (np.log10(Re_c)) ** 3.58 / B * -2.58 / np.log(10) / Re_c
elif self.k_lam < 1.0:

cdl_Re = 1.328 / (Re_c * self.k_lam) ** 1.5 * -0.5 * self.k_lam
cdt_Re = 0.455 / (np.log10(Re_c * self.k_lam)) ** 3.58 / B * -2.58 / np.log(10) / Re_c
cdT_Re = 0.455 / (np.log10(Re_c)) ** 3.58 / B * -2.58 / np.log(10) / Re_c
Expand Down
2 changes: 0 additions & 2 deletions openaerostruct/common/atmos_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,6 @@ def setup(self):
self.declare_partials("v", "Mach_number")

def compute(self, inputs, outputs):

outputs["T"] = T_interp(inputs["altitude"])
outputs["P"] = P_interp(inputs["altitude"])
outputs["rho"] = rho_interp(inputs["altitude"])
Expand All @@ -751,7 +750,6 @@ def compute(self, inputs, outputs):
outputs["v"] = outputs["speed_of_sound"] * inputs["Mach_number"]

def compute_partials(self, inputs, partials):

partials["T", "altitude"] = T_interp_deriv(inputs["altitude"])
partials["P", "altitude"] = P_interp_deriv(inputs["altitude"])
partials["rho", "altitude"] = rho_interp_deriv(inputs["altitude"])
Expand Down
12 changes: 6 additions & 6 deletions openaerostruct/docs/_utils/generate_sourcedocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# of our source docs, as well as writing out each individual rst file.


def generate_docs(dir, top, packages, project_name="openmdao"):
def generate_docs(directory, top, packages, project_name="openmdao"):
"""
generate_docs
Expand Down Expand Up @@ -45,7 +45,7 @@ def generate_docs(dir, top, packages, project_name="openmdao"):
:maxdepth: 1
"""

docs_dir = os.path.dirname(dir)
docs_dir = os.path.dirname(directory)

doc_dir = os.path.join(docs_dir, "_srcdocs")
if os.path.isdir(doc_dir):
Expand All @@ -69,7 +69,7 @@ def generate_docs(dir, top, packages, project_name="openmdao"):
# order the packages in this list explicitly. Any new ones that
# are detected will show up at the end of the list.

# everything in openmdao dir that isn't discarded is appended as a source package.
# everything in openmdao directory that isn't discarded is appended as a source package.
for listing in os.listdir(os.path.join(top)):
if os.path.isdir(os.path.join("..", listing)):
if listing not in IGNORE_LIST and listing not in packages:
Expand All @@ -88,9 +88,9 @@ def generate_docs(dir, top, packages, project_name="openmdao"):
package_filename = os.path.join(packages_dir, project_name + "." + package + ".rst")
package_name = project_name + "." + package

# the sub_listing is going into each package dir and listing what's in it
for sub_listing in sorted(os.listdir(os.path.join(dir, package.replace(".", "/")))):
# don't want to catalog files twice, nor use init files nor test dir
# the sub_listing is going into each package directory and listing what's in it
for sub_listing in sorted(os.listdir(os.path.join(directory, package.replace(".", "/")))):
# don't want to catalog files twice, nor use init files nor test directory
if (os.path.isdir(sub_listing) and sub_listing != "tests") or (
sub_listing.endswith(".py") and not sub_listing.startswith("_")
):
Expand Down
2 changes: 1 addition & 1 deletion openaerostruct/docs/_utils/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _parse(self):
msg = "Docstring contains both a Returns and Yields section."
raise ValueError(msg)

for (section, content) in sections:
for section, content in sections:
if not section.startswith(".."):
section = (s.capitalize() for s in section.split(" "))
section = " ".join(section)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@

# Loop over each surface in the surfaces list
for surface in surfaces:

# Get the surface name and create a group to contain components
# only for this surface
name = surface["name"]
Expand All @@ -212,7 +211,6 @@

# Loop through and add a certain number of aerostruct points
for i in range(2):

point_name = "AS_point_{}".format(i)
# Connect the parameters within the model for each aerostruct point

Expand All @@ -236,7 +234,6 @@
prob.model.connect("fuel_mass", point_name + ".total_perf.CG.fuelburn")

for surface in surfaces:

name = surface["name"]

if surf_dict["distributed_fuel_weight"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@

# Loop over each surface in the surfaces list
for surface in surfaces:

# Get the surface name and create a group to contain components
# only for this surface
name = surface["name"]
Expand All @@ -145,7 +144,6 @@

# Loop through and add a certain number of aerostruct points
for i in range(2):

point_name = "AS_point_{}".format(i)
# Connect the parameters within the model for each aerostruct point

Expand All @@ -169,7 +167,6 @@
prob.model.connect("fuel_mass", point_name + ".total_perf.CG.fuelburn")

for surface in surfaces:

name = surface["name"]

if surf_dict["distributed_fuel_weight"]:
Expand Down

0 comments on commit 71045b3

Please sign in to comment.