Skip to content

Save Jpar0 to output tokamak grids #1174

Save Jpar0 to output tokamak grids

Save Jpar0 to output tokamak grids #1174

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
[push, pull_request]
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
pytest:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
run: |
pip install pytest
pytest
integrated-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
if: always()
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Integrated tests
run: |
pip install pytest xarray
cd integrated_tests/
./test_suite.py
examples:
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install sympy
pip install -e .
- name: Examples
run: |
cd examples/tokamak
./tokamak_example.py --no-plot lsn
./tokamak_example.py --no-plot usn
./tokamak_example.py --no-plot cdn
./tokamak_example.py --no-plot ldn
./tokamak_example.py --no-plot udn
./tokamak_example.py --no-plot udn2
cd ../torpex-xpoint
hypnotoad-torpex --noplot torpex-coils.yaml
hypnotoad-torpex --noplot torpex-coils-nonorth.yaml
utilities:
# Check that various command line utilities provided by hypnotoad keep
# running without errors. Correctness of output is not tested!
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install xbout
pip install -e .
- name: Utilities
run: |
cd integrated_tests/grid_files
hypnotoad-plot-equilibrium --no-show --output test-single-null.pdf test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_connected-double-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_disconnected-double-null.eqdsk
echo "psinorm_core: 0.99" > test.yml
echo "psinorm_sol: 1.01" >> test.yml
hypnotoad-get-flux-surfaces test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test1.nc --save-plot test.png test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test2.nc --save-plot test.pdf test_connected-double-null.eqdsk test.yml
# modify input file so that we actually detect the disconnection within the grid
echo "nx_inter_sep: 2" >> test.yml
hypnotoad-get-flux-surfaces --output test3.nc --save-plot test.pdf test_disconnected-double-null.eqdsk test.yml
cd ../connected_doublenull_orthogonal
hypnotoad-plot-grid-cells --no-show --save-as test.svg expected_orthogonal.grd.nc
hypnotoad-plot-grid-cells --no-show --mxg 3 --branch-cuts --separatrix --targets expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test1.eqdsk expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test2.eqdsk -y test.yml expected_orthogonal.grd.nc
flake8:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8
black:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check formatting with black
run: |
pip install black
black --check --diff --color .