Skip to content
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

feat: Changes to support Fluent 25.2 dev #3412

Draft
wants to merge 2 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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,36 @@ jobs:
cat src/ansys/fluent/core/generated/fluent_version_251.py
python -c "from ansys.fluent.core.generated.solver.settings_251 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"

- name: Cache 25.2 API Code
uses: actions/cache@v4
id: cache-252-api-code
with:
path:
src/ansys/fluent/core/generated
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v25.2.0-${{ hashFiles('src/ansys/fluent/core/codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v25.2.0

- name: Pull 25.2 Fluent docker image
if: steps.cache-252-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v25.2.0

- name: Run 25.2 API codegen
if: steps.cache-252-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v25.2.0

- name: Print 25.2 Fluent version info
run: |
cat src/ansys/fluent/core/generated/fluent_version_252.py
python -c "from ansys.fluent.core.generated.solver.settings_252 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"

- name: Install again after codegen
run: |
rm -rf dist
Expand Down Expand Up @@ -457,6 +487,8 @@ jobs:
version: 242
- image-tag: v25.1.0
version: 251
- image-tag: v25.2.0
version: 252
timeout-minutes: 120
env:
FLUENT_IMAGE_TAG: ${{ matrix.version == 251 && vars.FLUENT_STABLE_IMAGE_DEV || matrix.image-tag }}
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ unittest-dev-251:
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --fluent-version=25.1 $(PYTESTEXTRA) || poetry run python -m pytest --fluent-version=25.1 $(PYTESTRERUN)

unittest-dev-252:
@echo "Running unittests"
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --fluent-version=25.2 $(PYTESTEXTRA) || poetry run python -m pytest --fluent-version=25.2 $(PYTESTRERUN)

unittest-all-222:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
Expand Down Expand Up @@ -123,6 +128,21 @@ unittest-all-251-no-codegen:
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --nightly --fluent-version=25.1 -m "not codegen_required" $(PYTESTEXTRA) || poetry run python -m pytest --nightly --fluent-version=25.1 -m "not codegen_required" $(PYTESTRERUN)

unittest-all-252:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --nightly --fluent-version=25.2 $(PYTESTEXTRA) || poetry run python -m pytest --nightly --fluent-version=25.2 $(PYTESTRERUN)

unittest-solvermode-252:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --fluent-version=25.2 --solvermode $(PYTESTEXTRA) || poetry run python -m pytest --fluent-version=25.2 --solvermode $(PYTESTRERUN)

unittest-all-252-no-codegen:
@echo "Running all unittests"
@sudo rm -rf /home/ansys/Documents/ansys_fluent_core_examples/*
@poetry run python -m pytest --nightly --fluent-version=25.2 -m "not codegen_required" $(PYTESTEXTRA) || poetry run python -m pytest --nightly --fluent-version=25.2 -m "not codegen_required" $(PYTESTRERUN)

api-codegen:
@echo "Running API codegen"
@python -m venv env
Expand Down
5 changes: 0 additions & 5 deletions devel/update_pyfluent_in_fluent.md

This file was deleted.

37 changes: 37 additions & 0 deletions devel/update_settings_builtin_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Script to update the settings_builtin_data.py file with the new Fluent version.
Usage: python devel/update_settings_builtin_data.py --version 252
"""

import argparse
from pathlib import Path

from ansys.fluent.core.utils.fluent_version import FluentVersion

parser = argparse.ArgumentParser()
parser.add_argument("--version", type=str, required=True)
args = parser.parse_args()
new_version = FluentVersion(args.version).name
index = FluentVersion._member_names_.index(new_version)
previous_version = FluentVersion._member_names_[index + 1]

file_path = (
Path(__file__).parent.parent
/ "src"
/ "ansys"
/ "fluent"
/ "core"
/ "solver"
/ "settings_builtin_data.py"
).resolve()
lines = []

with open(file_path, "r") as file:
for line in file:
if previous_version in line:
new_line = line.replace(previous_version, new_version)
lines.append(new_line)
lines.append(line)

with open(file_path, "w") as file:
file.writelines(lines)
9 changes: 7 additions & 2 deletions doc/settings_rstgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import importlib
import os

from ansys.fluent.core.utils.fluent_version import get_version_for_file_name
from ansys.fluent.core.utils.fluent_version import (
FluentVersion,
get_version_for_file_name,
)

parents_dict = {}
rst_list = []
Expand Down Expand Up @@ -216,7 +219,9 @@ def _populate_rst_from_settings(rst_dir, cls, version):
if not os.path.exists(rst_dir):
os.makedirs(rst_dir)

image_tag = os.getenv("FLUENT_IMAGE_TAG", "v24.2.0")
image_tag = os.getenv(
"FLUENT_IMAGE_TAG", FluentVersion.current_release().docker_image_tag
)
version = get_version_for_file_name(image_tag.lstrip("v"))
settings = importlib.import_module(
f"ansys.fluent.core.generated.solver.settings_{version}"
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
__version__ = ".".join(map(str, version_info))

# Current Fluent version
fluent_release_version = "24.1.0"
fluent_release_version = "24.2.0"
Loading
Loading