Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
225 changes: 52 additions & 173 deletions .github/workflows/pycycle_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,77 +11,64 @@ on:
# Allow running the workflow manually from the Actions tab
workflow_dispatch:

inputs:

run_name:
type: string
description: 'Name of workflow run as it will appear under Actions tab:'
required: false
default: ""

Ubuntu_Baseline:
type: boolean
description: 'Include Ubuntu Baseline test in the test matrix'
required: false
default: true

MacOS_Baseline:
type: boolean
description: 'Include MacOS Baseline test in the test matrix'
required: false
default: true

Windows_Baseline:
type: boolean
description: 'Include Windows Baseline test in the test matrix'
required: false
default: true

OpenMDAO_Dev:
type: boolean
description: 'Include latest/development test in the test matrix'
required: false
default: true

run-name: ${{ inputs.run_name }}
concurrency:
# Cancel any existing CI runs if we push to this branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

tests:
test_pycycle:

timeout-minutes: 120
timeout-minutes: 90

strategy:
fail-fast: false
matrix:
include:

# test baseline versions on Ubuntu
- NAME: Ubuntu Baseline
OS: ubuntu-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
OPENMDAO: 'latest'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.Ubuntu_Baseline }}
OS: ubuntu-24.04
OPENMDAO_PIXI_ENVIRONMENT: 'py314'
OPENMDAO_INSTALL_FROM: 'pypi'
OPENMDAO: ''
COVERAGE: true

# test baseline versions on MacOS
# latest versions of openmdao/dymos
- NAME: MacOS Baseline
OS: macos-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
OPENMDAO: 'latest'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.MacOS_Baseline }}
OPENMDAO_PIXI_ENVIRONMENT: 'py314'
OPENMDAO_INSTALL_FROM: 'pypi'
OPENMDAO: ''
COVERAGE: true

# latest versions of openmdao/dymos
# Coverage currently has some problems in windows, according to the openmdao workflows.
- NAME: Windows Baseline
OS: windows-latest
OPENMDAO_PIXI_ENVIRONMENT: 'py314'
OPENMDAO_INSTALL_FROM: 'pypi'
OPENMDAO: ''
COVERAGE: false

# oldest supported versions of openmdao/dymos
# Note: bugfixes sometimes require incrementing the minimal version of openmdao or dymos.
- NAME: Ubuntu Oldest
OS: ubuntu-24.04
OPENMDAO_PIXI_ENVIRONMENT: 'py311'
OPENMDAO_INSTALL_FROM: 'pypi'
OPENMDAO: '3.41.0'
COVERAGE: true

# test with latest/development versions
# only run when selected via workflow_dispatch
- NAME: OpenMDAO Dev
OS: ubuntu-latest
PY: 3
NUMPY: 2
SCIPY: 1
OPENMDAO: 'dev'
EXCLUDE: ${{ github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && ! inputs.OpenMDAO_Dev) }}
OS: ubuntu-24.04
OPENMDAO_PIXI_ENVIRONMENT: 'py314'
OPENMDAO_INSTALL_FROM: 'github'
OPENMDAO: ''


runs-on: ${{ matrix.OS }}

Expand All @@ -100,57 +87,31 @@ jobs:
echo "Testing: ${GITHUB_REPOSITORY}"
echo "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "Excluded: ${{ matrix.EXCLUDE }}"
echo "============================================================="

- name: Checkout code
if: ${{ ! matrix.EXCLUDE }}
uses: actions/checkout@v3
- name: Checkout Aviary
uses: actions/checkout@v6

- name: Setup conda
if: ${{ ! matrix.EXCLUDE }}
uses: conda-incubator/setup-miniconda@v3
- name: 'Setup OpenMDAO pixi Environment'
id: setup_pixi_environment
uses: OpenMDAO/OpenMDAO/.github/actions/setup_openmdao_pixi@master
with:
python-version: ${{ matrix.PY }}
miniforge-version: "latest"

- name: Install OpenMDAO
if: ${{ ! matrix.EXCLUDE }}
shell: bash -l {0}
run: |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y

python -m pip install --upgrade pip

echo "============================================================="
echo "Install OpenMDAO"
echo "============================================================="
if [[ "${{ matrix.OPENMDAO }}" == "dev" ]]; then
pip install git+https://github.com/OpenMDAO/OpenMDAO
elif [[ "${{ matrix.OPENMDAO }}" == "latest" ]]; then
echo "The latest release of OpenMDAO will be installed from pypi per the pyCycle dependency"
else
pip install openmdao==${{ matrix.OPENMDAO }}
fi
environment: '${{ matrix.OPENMDAO_PIXI_ENVIRONMENT }}'
openmdao_install_from: '${{ matrix.OPENMDAO_INSTALL_FROM }}'
openmdao_version: '${{ matrix.OPENMDAO }}'

- name: Install pyCycle
if: ${{ ! matrix.EXCLUDE }}
run: |
eval "$(pixi shell-hook -e ${{ matrix.OPENMDAO_PIXI_ENVIRONMENT }} --manifest-path=${{ env.PIXI_MANIFEST }})"
echo "============================================================="
echo "Install pyCycle"
echo "============================================================="
python -m pip install -e .[all]

- name: Display environment info
if: ${{ ! matrix.EXCLUDE }}
run: |
conda info
conda list

- name: Run tests
if: ${{ ! matrix.EXCLUDE }}
id: run_tests
run: |
eval "$(pixi shell-hook -e ${{ matrix.OPENMDAO_PIXI_ENVIRONMENT }} --manifest-path=${{ env.PIXI_MANIFEST }})"
echo "============================================================="
echo "Run tests (from directory other than repo root)"
echo "============================================================="
Expand All @@ -160,10 +121,10 @@ jobs:
testflo -n 1 pycycle --timeout=240 --show_skipped --deprecations_report=$RPT_FILE --coverage --coverpkg pycycle --durations=20

- name: Deprecations Report
if: ${{ ! matrix.EXCLUDE }}
id: deprecations_report
continue-on-error: true
run: |
eval "$(pixi shell-hook -e ${{ matrix.OPENMDAO_PIXI_ENVIRONMENT }} --manifest-path=${{ env.PIXI_MANIFEST }})"
echo "============================================================="
echo "Display deprecations report"
echo "============================================================="
Expand All @@ -176,8 +137,8 @@ jobs:
grep '^0 unique deprecation warnings' $RPT_FILE

- name: Check NumPy 2.0 Compatibility
if: ${{ ! matrix.EXCLUDE }}
run: |
eval "$(pixi shell-hook -e ${{ matrix.OPENMDAO_PIXI_ENVIRONMENT }} --manifest-path=${{ env.PIXI_MANIFEST }})"
echo "============================================================="
echo "Check code for NumPy 2.0 compatibility"
echo "See: https://numpy.org/devdocs/numpy_2_0_migration_guide.html"
Expand Down Expand Up @@ -206,85 +167,3 @@ jobs:
`pyCycle`: Deprecations were detected on `${{ matrix.NAME }}` build.
```${{ steps.deprecations_report.outputs.summary }}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

windows_tests:
runs-on: windows-latest

timeout-minutes: 60

strategy:
fail-fast: false
matrix:
include:
# baseline versions
- NAME: Windows Baseline
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.Windows_Baseline }}

name: ${{ matrix.NAME }}

defaults:
run:
shell: pwsh

steps:
- name: Display run details
run: |
echo "============================================================="
echo "Run #$env:GITHUB_RUN_NUMBER"
echo "Run ID: $env:GITHUB_RUN_ID"
echo "Testing: $env:GITHUB_REPOSITORY"
echo "Triggered by: $env:GITHUB_EVENT_NAME"
echo "Initiated by: $env:GITHUB_ACTOR"
echo "Excluded: ${{ matrix.EXCLUDE }}"
echo "============================================================="

- name: Checkout code
if: ${{ ! matrix.EXCLUDE }}
uses: actions/checkout@v3

- name: Setup conda
if: ${{ ! matrix.EXCLUDE }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.PY }}
miniforge-version: "latest"

- name: Install pyCycle
if: ${{ ! matrix.EXCLUDE }}
run: |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y

python -m pip install --upgrade pip

echo "============================================================="
echo "Install pyCycle"
echo "============================================================="
python -m pip install -e .[all]

- name: Display environment info
if: ${{ ! matrix.EXCLUDE }}
run: |
conda info
conda list

- name: Run tests
if: ${{ ! matrix.EXCLUDE }}
id: run_tests
run: |
echo "============================================================="
echo "Run tests with coverage"
echo "============================================================="
testflo -n 1 pycycle --timeout=240 --show_skipped --coverage --coverpkg pycycle --durations=20

- name: Slack unit test failure
if: failure()
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.run_tests.outcome }}
message: |
`pyCycle`: Unit testing failed on `${{ matrix.NAME }}` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
4 changes: 2 additions & 2 deletions .github/workflows/release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- uses: actions/setup-python@v4
- uses: actions/setup-python@v6
with:
python-version: "3.x"

Expand Down
18 changes: 9 additions & 9 deletions example_cycles/simple_turbojet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def setup(self):

USE_TABULAR = True

if USE_TABULAR:
if USE_TABULAR:
self.options['thermo_method'] = 'TABULAR'
self.options['thermo_data'] = pyc.AIR_JETA_TAB_SPEC
FUEL_TYPE = "FAR"
else:
else:
self.options['thermo_method'] = 'CEA'
self.options['thermo_data'] = pyc.species_data.janaf
FUEL_TYPE = "Jet-A(g)"
Expand Down Expand Up @@ -86,7 +86,7 @@ def setup(self):
self.connect('balance.W', 'inlet.Fl_I:stat:W')
self.connect('nozz.Throat:stat:area', 'balance.lhs:W')


newton = self.nonlinear_solver = om.NewtonSolver()
newton.options['atol'] = 1e-6
newton.options['rtol'] = 1e-6
Expand All @@ -95,7 +95,7 @@ def setup(self):
newton.options['solve_subsystems'] = True
newton.options['max_sub_solves'] = 100
newton.options['reraise_child_analysiserror'] = False

self.linear_solver = om.DirectSolver()

super().setup()
Expand All @@ -105,7 +105,7 @@ def viewer(prob, pt, file=sys.stdout):
print a report of all the relevant cycle properties
"""

summary_data = (prob[pt+'.fc.Fl_O:stat:MN'], prob[pt+'.fc.alt'], prob[pt+'.inlet.Fl_O:stat:W'],
summary_data = (prob[pt+'.fc.Fl_O:stat:MN'], prob[pt+'.fc.alt'], prob[pt+'.inlet.Fl_O:stat:W'],
prob[pt+'.perf.Fn'], prob[pt+'.perf.Fg'], prob[pt+'.inlet.F_ram'],
prob[pt+'.perf.OPR'], prob[pt+'.perf.TSFC'])

Expand Down Expand Up @@ -172,7 +172,7 @@ def setup(self):
self.pyc_add_cycle_param('burner.dPqP', 0.03)
self.pyc_add_cycle_param('nozz.Cv', 0.99)


# define the off-design conditions we want to run
self.od_pts = ['OD0', 'OD1']
self.od_MNs = [0.000001, 0.2]
Expand All @@ -184,7 +184,7 @@ def setup(self):

self.set_input_defaults(pt+'.fc.MN', val=self.od_MNs[i])
self.set_input_defaults(pt+'.fc.alt', self.od_alts[i], units='ft')
self.set_input_defaults(pt+'.balance.Fn_target', self.od_Fns[i], units='lbf')
self.set_input_defaults(pt+'.balance.Fn_target', self.od_Fns[i], units='lbf')

self.pyc_use_default_des_od_conns()

Expand All @@ -209,8 +209,8 @@ def setup(self):
prob.set_val('DESIGN.fc.alt', 0, units='ft')
prob.set_val('DESIGN.fc.MN', 0.000001)
prob.set_val('DESIGN.balance.Fn_target', 11800.0, units='lbf')
prob.set_val('DESIGN.balance.T4_target', 2370.0, units='degR')
prob.set_val('DESIGN.comp.PR', 13.5)
prob.set_val('DESIGN.balance.T4_target', 2370.0, units='degR')
prob.set_val('DESIGN.comp.PR', 13.5)
prob.set_val('DESIGN.comp.eff', 0.83)
prob.set_val('DESIGN.turb.eff', 0.86)

Expand Down
Loading
Loading