Skip to content

DRAFT: PyMAPDL + Py DPF #89

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
12 changes: 9 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,29 @@ jobs:
uses: ./.github/workflows/geometry-mesh.yml
secrets: inherit
with:
doc-build: true
doc-build: false

geometry-mesh-fluent:
uses: ./.github/workflows/geometry-mesh-fluent.yml
secrets: inherit
with:
doc-build: true
doc-build: false

geometry-mechanical-dpf:
uses: ./.github/workflows/geometry-mechanical-dpf.yml
secrets: inherit
with:
doc-build: true
doc-build: false

fluent-mechanical:
uses: ./.github/workflows/fluent-mechanical.yml
secrets: inherit
with:
doc-build: false

mapdl-dpf:
uses: ./.github/workflows/mapdl-dpf.yml
secrets: inherit
with:
doc-build: true

Expand Down
232 changes: 232 additions & 0 deletions .github/workflows/mapdl-dpf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: MAPDL-DPF Workflow

on:
workflow_dispatch:
inputs:
doc-build:
required: false
default: false
type: boolean
description: 'Whether to build the documentation'
workflow_call:
inputs:
doc-build:
required: false
default: false
type: boolean
description: 'Whether to build the documentation'
push:
branches:
- main
pull_request:
paths:
- 'fluent-mechanical/**'

env:
MAIN_PYTHON_VERSION: '3.12'
FLUENT_DOCKER_IMAGE: 'ghcr.io/ansys/pyfluent'
MECHANICAL_DOCKER_IMAGE: 'ghcr.io/ansys/mechanical'
DOCKER_MECH_CONTAINER_NAME: mechanical
PYMECHANICAL_PORT: 10000
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER )}}
PYANSYS_WORKFLOWS_CI: true
ANSYS_RELEASE_FOR_DOCS: 25.1
RUN_DOC_BUILD: false
PYMECHANICAL_START_INSTANCE: false

jobs:
fluent:
name: Fluent
runs-on: public-ubuntu-latest-8-cores
strategy:
fail-fast: false
matrix:
ansys-release: [24.1, 24.2, 25.1]
steps:

- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: |
fluent-mechanical
doc

- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r fluent-mechanical/requirements_${{ matrix.ansys-release }}.txt

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download Fluent service container
run: docker pull ${{ env.FLUENT_DOCKER_IMAGE }}:v${{ matrix.ansys-release }}.0

- name: Run the Fluent script
env:
FLUENT_IMAGE_TAG: v${{ matrix.ansys-release }}.0
run: |
python fluent-mechanical/wf_fm_01_fluent.py

- name: Store the outputs
uses: actions/upload-artifact@v4
with:
name: fluent-mechanical-workflow-fluent-outputs-${{ matrix.ansys-release }}
path: |
fluent-mechanical/outputs/htc_temp_mapping_LOW_TEMP.csv
fluent-mechanical/outputs/htc_temp_mapping_MEDIUM_TEMP.csv
fluent-mechanical/outputs/htc_temp_mapping_HIGH_TEMP.csv

- name: Stop all containers (if any)
run: |
if [ -n "$(docker ps -a -q)" ]; then
docker rm -f $(docker ps -a -q)
fi

- name: (DOCS) Check if docs should be built
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && inputs.doc-build
run: |
echo "Requested to build docs..."
if [ "${{ matrix.ansys-release }}" == "${{ env.ANSYS_RELEASE_FOR_DOCS }}" ]; then
echo "Building docs"
echo "RUN_DOC_BUILD=true" >> $GITHUB_ENV
else
echo "Not building docs - since not primary release"
echo "RUN_DOC_BUILD=false" >> $GITHUB_ENV
fi

- name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS}})
if: ${{ env.RUN_DOC_BUILD == 'true' }}
env:
FLUENT_IMAGE_TAG: v${{ matrix.ansys-release }}.0
BUILD_DOCS_SCRIPT: 'fluent-mechanical/wf_fm_01_fluent.py'
run: |
cd doc
pip install -r requirements.txt
make html

- name: (DOCS) Upload docs artifacts
if: ${{ env.RUN_DOC_BUILD == 'true' }}
uses: actions/upload-artifact@v4
with:
name: fluent-mechanical-docs-stage-fluent
path: |
doc/_build/
doc/source/examples/fluent-mechanical/
overwrite: true

mechanical:
name: Mechanical
runs-on: [public-ubuntu-latest-8-cores]
needs: fluent
strategy:
fail-fast: false
matrix:
ansys-release: [24.1, 24.2, 25.1]
steps:

- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: |
fluent-mechanical
doc

- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y nodejs npm graphviz xvfb
npm install -g @mermaid-js/mermaid-cli

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv .venv
. .venv/bin/activate
pip install -r fluent-mechanical/requirements_${{ matrix.ansys-release }}.txt

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download (if needed) launch, and validate Mechanical service
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
MECHANICAL_IMAGE: ${{ env.MECHANICAL_DOCKER_IMAGE }}:${{ matrix.ansys-release }}.0
run: |
docker pull ${{ env.MECHANICAL_IMAGE }}
docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt &
grep -q 'WB Initialize Done' <(timeout 60 tail -f log.txt)

- name: Check out the fluent outputs
uses: actions/download-artifact@v4
with:
name: fluent-mechanical-workflow-fluent-outputs-${{ matrix.ansys-release }}
path: fluent-mechanical/outputs

- name: Run the PyMechanical script
run: |
. .venv/bin/activate
xvfb-run python fluent-mechanical/wf_fm_02_mechanical.py

- name: Store the outputs
uses: actions/upload-artifact@v4
with:
name: fluent-mechanical-workflow-mechanical-outputs-${{ matrix.ansys-release }}
path: fluent-mechanical/outputs

- name: (DOCS) Check if docs should be built
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && inputs.doc-build
run: |
echo "Requested to build docs..."
if [ "${{ matrix.ansys-release }}" = "${{ env.ANSYS_RELEASE_FOR_DOCS }}" ]; then
echo "Building docs"
echo "RUN_DOC_BUILD=true" >> $GITHUB_ENV
else
echo "Not building docs - since not primary release"
echo "RUN_DOC_BUILD=false" >> $GITHUB_ENV
fi

- name: (DOCS) Download the docs artifacts
uses: actions/download-artifact@v4
if: ${{ env.RUN_DOC_BUILD == 'true' }}
with:
name: fluent-mechanical-docs-stage-fluent
path: doc

- name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS }})
if: ${{ env.RUN_DOC_BUILD == 'true' }}
env:
BUILD_DOCS_SCRIPT: 'fluent-mechanical/wf_fm_02_mechanical.py'
run: |
. .venv/bin/activate
cd doc
pip install -r requirements.txt
xvfb-run make html

- name: (DOCS) Upload docs artifacts
if: ${{ env.RUN_DOC_BUILD == 'true' }}
uses: actions/upload-artifact@v4
with:
name: fluent-mechanical-docs
path: |
doc/_build/
doc/source/examples/fluent-mechanical/
overwrite: true
4 changes: 4 additions & 0 deletions mapdl-dpf/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TBD
===

TBD
2 changes: 2 additions & 0 deletions mapdl-dpf/requirements_24.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansys-mapdl-core[graphics]==0.70.2
ansys-dpf-core==0.14.1
2 changes: 2 additions & 0 deletions mapdl-dpf/requirements_24.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansys-mapdl-core[graphics]==0.70.2
ansys-dpf-core==0.14.1
2 changes: 2 additions & 0 deletions mapdl-dpf/requirements_25.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansys-mapdl-core[graphics]==0.70.2
ansys-dpf-core==0.14.1
Loading
Loading