Skip to content

Commit

Permalink
24.1 changes (#216)
Browse files Browse the repository at this point in the history
* 24.1 changes

* 24.1 changes

* 24.1 changes

* 24.1 changes

* 24.1 changes

* 24.1 changes

* 24.1 changes

* Use default container mount path

* Use default container mount path

* Fix script

* Fix script

* pre-commit

* Revert doc changes
  • Loading branch information
mkundu1 authored Jul 18, 2023
1 parent e2a3bfc commit 70e8f9b
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 42 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
fail-fast: false
matrix:
image-tag: [v22.2.0, v23.1.0, v23.2.0]
image-tag: [v22.2.0, v23.1.0, v23.2.0, v24.1.0]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -86,20 +86,11 @@ jobs:
needs: [docs-style]
runs-on: [self-hosted, pyfluent]
env:
DOC_DEPLOYMENT_IMAGE_TAG: v23.1.0
DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0
DOCUMENTATION_CNAME: 'parametric.fluent.docs.pyansys.com'
steps:
- uses: actions/checkout@v3

# used for documentation deployment
- name: Get Bot Application Token
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/nightly-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
DOCUMENTATION_CNAME: 'parametric.fluent.docs.pyansys.com'
DOC_DEPLOYMENT_IMAGE_TAG: v23.1.0
DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_LAUNCH_CONTAINER: 1
Expand All @@ -23,14 +23,6 @@ jobs:
steps:
- uses: actions/checkout@v3

# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}

- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -65,7 +57,7 @@ jobs:
retention-days: 7

- name: Deploy
if: matrix.image-tag == 'v23.1.0'
if: matrix.image-tag == ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
uses: ansys/actions/doc-deploy-dev@v4
with:
doc-artifact-name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
image-tag: [v22.2.0, v23.1.0, v23.2.0]
image-tag: [v22.2.0, v23.1.0, v23.2.0, v24.1.0]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# necessary when building the sphinx gallery
pyvista.BUILDING_GALLERY = True
pyfluent.BUILDING_GALLERY = True
pyfluent.launcher.fluent_container.DEFAULT_CONTAINER_MOUNT_PATH = pyfluent.EXAMPLES_PATH

# -- Project information -----------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion examples/00-parametric/parametric_static_mixer_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Download the files for this example and read the case for the static mixer.

import_filename = examples.download_file(
"Static_Mixer_main.cas.h5", "pyfluent/static_mixer"
"Static_Mixer_main.cas.h5", "pyfluent/static_mixer", return_only_filename=False
)

solver_session.tui.file.read_case(import_filename)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ packages = [
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
importlib-metadata = {version = "^4.0", python = "<3.8"}
ansys-fluent-core = "~=0.14.dev0"
ansys-fluent-core = "~=0.17.dev0"
h5py = ">=3.7.0"

[tool.black]
Expand Down
9 changes: 7 additions & 2 deletions src/ansys/fluent/parametric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
>>> session2 = ParametricSession(project_filepath="nozzle_para_named.flprj")
"""
import logging
from pathlib import Path
from pathlib import Path, PurePosixPath, PureWindowsPath
import tempfile
from typing import Any, Dict, List, Optional

Expand Down Expand Up @@ -507,8 +507,13 @@ def open(
load_case : bool, optional
Whether to load the current case. The default ``True``.
"""
if (
not PureWindowsPath(project_filepath).is_absolute()
or not PurePosixPath(project_filepath).is_absolute()
):
project_filepath = str(Path(project_filepath).resolve())
self._parametric_project.open(
project_filename=str(Path(project_filepath).resolve()),
project_filename=project_filepath,
load_case=load_case,
)
self.project_filepath = project_filepath
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/parametric/local/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from typing import Any, Dict, Union

from ansys.fluent.core.filereader.casereader import CaseReader
from ansys.fluent.core.utils.async_execution import asynchronous
from ansys.fluent.core.utils.execution import asynchronous

from ansys.fluent.parametric import (
BASE_DP_NAME,
Expand Down
13 changes: 9 additions & 4 deletions tests/test_local_parametric_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@

from math import inf

import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
import pytest

from ansys.fluent.parametric.local import (
LocalParametricStudy,
convert_design_point_parameter_units,
)


def test_local_parametric_setup():
def test_local_parametric_setup(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("PYFLUENT_CONTAINER_MOUNT_PATH", pyfluent.EXAMPLES_PATH)
############################################################################
# Read the hopper/mixer case

case_filename = examples.download_file(
"Static_Mixer_Parameters.cas.h5", "pyfluent/static_mixer"
case_filepath = examples.download_file(
"Static_Mixer_Parameters.cas.h5",
"pyfluent/static_mixer",
return_only_filename=False,
)

local_study = LocalParametricStudy(case_filepath=case_filename)
local_study = LocalParametricStudy(case_filepath=case_filepath)

for idx in range(20):
design_point = local_study.add_design_point("dp_" + str(idx))
Expand Down
13 changes: 9 additions & 4 deletions tests/test_local_parametric_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
TODO
"""
import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
import pytest

from ansys.fluent.parametric.local import LocalParametricStudy

############################################################################


def test_local_parametric_setup():
def test_local_parametric_setup(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("PYFLUENT_CONTAINER_MOUNT_PATH", pyfluent.EXAMPLES_PATH)
############################################################################
# Read the hopper/mixer case

case_filename = examples.download_file(
"Static_Mixer_Parameters.cas.h5", "pyfluent/static_mixer"
case_filepath = examples.download_file(
"Static_Mixer_Parameters.cas.h5",
"pyfluent/static_mixer",
return_only_filename=False,
)

local_study = LocalParametricStudy(case_filepath=case_filename)
local_study = LocalParametricStudy(case_filepath=case_filepath)

base_design_point = local_study.design_point("Base DP")

Expand Down
9 changes: 7 additions & 2 deletions tests/test_parametric_session.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
import pytest

from ansys.fluent.parametric import ParametricSession


def test_parametric_session():
def test_parametric_session(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("PYFLUENT_CONTAINER_MOUNT_PATH", pyfluent.EXAMPLES_PATH)
project_filepath = examples.download_file(
"project-elbow-param.flprz", "pyfluent/mixing_elbow"
"project-elbow-param.flprz",
"pyfluent/mixing_elbow",
return_only_filename=False,
)
session = ParametricSession(project_filepath=project_filepath)
assert "Static_Mixer_main-Solve" in session.studies
Expand Down
9 changes: 5 additions & 4 deletions tests/test_parametric_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from ansys.fluent.parametric import ParametricProject, ParametricStudy


def test_parametric_workflow():
def test_parametric_workflow(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setenv("PYFLUENT_CONTAINER_MOUNT_PATH", pyfluent.EXAMPLES_PATH)
############################################################################
# Launch Fluent in 3D and double precision

Expand All @@ -50,11 +51,11 @@ def test_parametric_workflow():
############################################################################
# Read the hopper/mixer case

import_filename = examples.download_file(
"Static_Mixer_main.cas.h5", "pyfluent/static_mixer"
import_filepath = examples.download_file(
"Static_Mixer_main.cas.h5", "pyfluent/static_mixer", return_only_filename=False
)

solver_session.tui.file.read_case(import_filename)
solver_session.tui.file.read_case(import_filepath)

############################################################################
# Set number of iterations to 100
Expand Down

0 comments on commit 70e8f9b

Please sign in to comment.