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

MAINT - Update to Support Fluent 0.28 #305

Merged
merged 6 commits into from
Feb 11, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12']

steps:
- name: Build wheelhouse and perform smoke test
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
repos:

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 25.1.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 6.0.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.4.1
hooks:
- id: codespell
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt"]
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt", "--skip=*.lock"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: requirements-txt-fixer

# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.31.1
hooks:
- id: check-github-workflows

Expand Down
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sphinx documentation configuration file."""

from datetime import datetime
import os

Expand Down
1 change: 1 addition & 0 deletions doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ANSYS
Ansys
ansys
Pymaterials-manager
THIRDPARTY
1,380 changes: 1,342 additions & 38 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
# Check https://python-poetry.org/docs/pyproject/ for all available sections
name = "ansys-materials-manager"
version = "0.2.dev1"
version = "0.2.4.dev0"
description = "Python package to unify material management across the ansys portfolio"
license = "MIT"
authors = ["ANSYS, Inc. <[email protected]>"]
Expand All @@ -24,7 +24,7 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.10,<4"
python = ">=3.10,<3.13"
numpy = "^2.0"

# Documentation dependencies
Expand All @@ -37,8 +37,8 @@ sphinx-copybutton = {version = "==0.5.2", optional = true}
[tool.poetry.group.dev.dependencies]
pytest = ">=7.3,<9.0"
coolprop = "^6.4.1"
ansys-mapdl-core = ">=0.64.1,<0.69.0"
ansys-fluent-core = ">=0.12.5,<0.27.0"
ansys-mapdl-core = ">=0.68,<0.69"
ansys-fluent-core = ">=0.28,<0.29"
twine = ">=4.0.2,<7.0.0"
pytest-cov = ">=4,<7"
pre-commit = ">=3.2.2,<5.0.0"
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides a helper to manage materials in the Ansys ecosystem."""

from importlib import metadata as metadata
import sys

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/materials/manager/_models/_common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _write_fluent(self, fluent: "_FluentCore", material: "Material") -> None:
try:
fluent_property_code = fluent_property_codes[self._name.lower()]
property_state = {fluent_property_code: {"option": "constant", "value": self._value}}
fluent.setup.materials.fluid[material.name] = property_state
fluent.settings.setup.materials.fluid[material.name] = property_state
except (RuntimeError, KeyError):
pass

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/materials/manager/_models/_fluent/ideal_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
raise ModelValidationException("\n".join(issues))

fluent_property_code = fluent_property_codes[self._name.lower()]
pyansys_session.setup.materials.fluid[material.name] = {
pyansys_session.settings.setup.materials.fluid[material.name] = {

Check warning on line 69 in src/ansys/materials/manager/_models/_fluent/ideal_gas.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/materials/manager/_models/_fluent/ideal_gas.py#L69

Added line #L69 was not covered by tests
fluent_property_code: {"option": "ideal-gas"}
}

Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/material.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``Material`` class."""

from typing import List, Optional

from ._models import _BaseModel
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/materials/manager/material_manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Provides the ``MaterialManager`` class."""

import inspect
from typing import Any, Dict

import ansys.materials.manager._models as models
from ansys.materials.manager._models._common._base import _FluentCore, _MapdlCore

from ._models import _BaseModel
from .material import Material
from .util.mapdl.mapdl_reader import read_mapdl

Expand Down Expand Up @@ -70,7 +70,7 @@ def write_material(self, material: Material) -> None:
Material object to write to solver.
"""
for model in material.models:
assert isinstance(model, _BaseModel)
assert isinstance(model, models._BaseModel)
model.write_model(material, self._client)

def read_materials_from_session(self) -> Dict[str, Material]:
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/serialize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides functions to serialize materials."""

import json
import pathlib
from typing import Dict, Union
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/util/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``common`` module."""

from itertools import islice
import re
from typing import Generator, Iterable, List, Union
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/util/mapdl/mapdl_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``mapdl_reader`` module."""

from typing import Dict

from ansys.materials.manager._models._common._base import _MapdlCore
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/util/mapdl/mpdata_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``MaterialDataParser`` class."""

from typing import Dict, List, Optional

from ansys.materials.manager._models import Constant, PiecewiseLinear, _BaseModel
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/util/mapdl/tbdata_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``TableDataParser`` class."""

from typing import Dict, List, Optional

from ansys.materials.manager._models import _BaseModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``MatmlWriter`` class."""

import os
import sys
from typing import BinaryIO, Dict, Sequence, Union
Expand Down
1 change: 1 addition & 0 deletions src/ansys/materials/manager/util/matml/matml_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the ``matml_parser`` module."""

from dataclasses import dataclass
import os
from typing import Any, Dict, List, Optional, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides a function to convert MatML entries into Material objects."""

from typing import Dict, Sequence

from ansys.materials.manager._models import Constant
Expand Down
4 changes: 2 additions & 2 deletions tests/fluent/test_serialize_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_valid_constant_succeeds(self):
model = Constant("Density", 5.0)
mock_fluent = MagicMock(spec=_FluentCore)
model.write_model(TEST_MATERIAL, mock_fluent)
mock_fluent.setup.materials.fluid.__setitem__.assert_called_once()
args = mock_fluent.setup.materials.fluid.__setitem__.call_args
mock_fluent.settings.setup.materials.fluid.__setitem__.assert_called_once()
args = mock_fluent.settings.setup.materials.fluid.__setitem__.call_args
assert args[0][0] == "Fluid"
assert args[0][1] == {"density": {"option": "constant", "value": pytest.approx(5.0)}}
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[tox]
description = Default tox environments list
envlist =
style,{py39,py310,py311}{,-coverage},doc
style,{py310,py311,py312}{,-coverage},doc
skip_missing_interpreters = true
isolated_build = true

[gh-actions]
description = The tox environment to be executed in gh-actions for a given python version
python =
3.9: style,py39-coverage,doc
3.10: style,py310-coverage,doc
3.11: style,py311-coverage,doc
3.12: style,py312-coverage,doc

[testenv]
description = Checks for project unit tests and coverage (if desired)
basepython =
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
py: python3{style,reformat,doc}: python3
skip_install = true
allowlist_externals =
Expand Down