ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
279 stars 41 forks source link

range_option.auto_range_off does not work properly. #3511

Closed hpohekar closed 3 days ago

hpohekar commented 4 days ago

🔍 Before submitting the issue

🐞 Description of the bug

range_option.auto_range_off does not work properly.

session.settings.results.graphics.contour["temperature-1"] = {
    "field": "temperature",
    "surfaces_list": "wall*",
    "color_map": {
        "visible": True,
        "size": 100,
        "color": "field-velocity",
        "log_scale": False,
        "format": "%0.1f",
        "user_skip": 9,
        "show_all": True,
        "position": 1,
        "font_name": "Helvetica",
        "font_automatic": True,
        "font_size": 0.032,
        "length": 0.54,
        "width": 6,
        "bground_transparent": True,
        "bground_color": "#CCD3E2",
        "title_elements": "Variable and Object Name",
    },
    "range_option": {
        "option": "auto-range-off",
        "auto_range_off": {"maximum": 400.0, "minimum": 300, "clip_to_range": False},
    },
}

Above code gives the following error -

Traceback (most recent call last):
  File "d:\pyfluent\examples\00-fluent\brake.py", line 218, in <module>
    session.settings.results.graphics.contour["temperature-1"] = {
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 1895, in __setitem__
    child.set_state(value)
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 766, in set_state
    state, outer_set_states = self._unalias(self.__class__, kwargs or state)
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 749, in _unalias
    ret[k], o_set_states = cobj._unalias(ccls, v)
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 749, in _unalias
    ret[k], o_set_states = cobj._unalias(ccls, v)
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 748, in _unalias
    cobj = getattr(self, k)
  File "D:\pyfluent\.venv\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 1099, in __getattribute__
    raise InactiveObjectError(self.python_path)
ansys.fluent.core.solver.flobject.InactiveObjectError: '<session>.settings.results.graphics.contour["temperature-1"].range_option.auto_range_off' is currently inactive.

It works fine if we set it explicitly as follows:

session.settings.results.graphics.contour["temperature-1"] = {
    "field": "temperature",
    "surfaces_list": "wall*",
    "color_map": {
        "visible": True,
        "size": 100,
        "color": "field-velocity",
        "log_scale": False,
        "format": "%0.1f",
        "user_skip": 9,
        "show_all": True,
        "position": 1,
        "font_name": "Helvetica",
        "font_automatic": True,
        "font_size": 0.032,
        "length": 0.54,
        "width": 6,
        "bground_transparent": True,
        "bground_color": "#CCD3E2",
        "title_elements": "Variable and Object Name",
    }
}

session.settings.results.graphics.contour["temperature-1"].range_option.option = "auto-range-off"

session.settings.results.graphics.contour["temperature-1"].range_option.set_state({
        "auto_range_off": {"maximum": 400.0, "minimum": 300, "clip_to_range": False},
    }
    )

📝 Steps to reproduce

Run https://github.com/ansys/pyfluent/blob/main/examples/00-fluent/brake.py

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

25R1

🐍 Which Python version are you using?

3.10

📦 Installed packages

about-time==4.2.1
accessible-pygments==0.0.5
alabaster==0.7.16
alive-progress==3.1.5
ansys-api-fluent==0.3.28
ansys-api-platform-instancemanagement==1.1.0
ansys-api-tools-filetransfer==0.1.1
ansys-fluent-core==0.26.1
ansys-fluent-visualization==0.14.0
ansys-platform-instancemanagement==1.1.2
ansys-sphinx-theme==1.2.0
ansys-tools-filetransfer==0.1.0
ansys-units==0.3.2
anyio==4.6.2.post1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-lru==2.0.4
attrs==24.2.0
autodocsumm==0.2.14
babel==2.16.0
beartype==0.17.2
beautifulsoup4==4.12.3
bleach==6.2.0
build==1.2.1
CacheControl==0.14.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
cleo==2.1.0
click==8.1.7
colorama==0.4.6
comm==0.2.2
contourpy==1.3.1
coverage==7.6.0
crashtest==0.4.1
cycler==0.12.1
debugpy==1.8.8
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.8
docker==7.1.0
docutils==0.21.2
dulwich==0.21.7
exceptiongroup==1.2.2
execnet==2.1.1
executing==2.1.0
fastjsonschema==2.20.0
filelock==3.15.4
fonttools==4.55.0
fqdn==1.5.1
grapheme==0.6.0
grpcio==1.68.0
grpcio-health-checking==1.62.3
h11==0.14.0
h5py==3.11.0
httpcore==1.0.7
httpx==0.27.2
idna==3.10
imagesize==1.4.1
importlib_metadata==8.5.0
iniconfig==2.0.0
installer==0.7.0
ipykernel==6.29.5
ipython==8.29.0
ipywidgets==8.1.5
isoduration==20.11.0
jaraco.classes==3.4.0
jedi==0.19.2
Jinja2==3.1.4
joblib==1.4.2
json5==0.9.28
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.10.0
jupyter-lsp==2.2.5
jupyter-sphinx==0.5.3
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.14.2
jupyter_server_terminals==0.5.3
jupyterlab==4.3.1
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
keyring==24.3.1
kiwisolver==1.4.7
livereload==2.7.0
lxml==5.3.0
MarkupSafe==3.0.2
matplotlib==3.9.0
matplotlib-inline==0.1.7
mistune==3.0.2
more-itertools==10.3.0
msgpack==1.0.8
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nest-asyncio==1.6.0
nltk==3.9.1
notebook==7.0.7
notebook_shim==0.2.4
numpy==1.26.4
numpydoc==1.8.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pdf2image==1.17.0
pexpect==4.9.0
pillow==11.0.0
pkginfo==1.11.1
platformdirs==4.3.6
pluggy==1.5.0
poetry==1.8.3
poetry-core==1.9.0
poetry-plugin-export==1.8.0
pooch==1.8.2
prometheus_client==0.21.0
prompt_toolkit==3.0.48
protobuf==4.25.5
psutil==6.1.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
pydata-sphinx-theme==0.16.0
Pygments==2.18.0
pypandoc==1.13
pyparsing==3.2.0
pyproject_hooks==1.1.0
PySide6==6.7.3
PySide6_Addons==6.7.3
PySide6_Essentials==6.7.3
pytest==8.3.3
pytest-cov==5.0.0
pytest-mock==3.14.0
pytest-sphinx==0.6.3
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
pytz==2024.2
pyvista==0.44.1
pyvistaqt==0.11.1
pywin32==308
pywin32-ctypes==0.2.2
pywinpty==2.0.14
PyYAML==6.0.2
pyzmq==26.2.0
QtPy==2.4.1
quarto-cli==1.5.57
rapidfuzz==3.9.4
referencing==0.35.1
regex==2024.11.6
requests==2.32.3
requests-toolbelt==1.0.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.21.0
scooby==0.10.0
Send2Trash==1.8.3
shellingham==1.5.4
shiboken6==6.7.3
six==1.16.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.6
Sphinx==7.4.7
sphinx-autobuild==2024.10.3
sphinx-autodoc-typehints==2.3.0
sphinx-copybutton==0.5.2
sphinx-gallery==0.17.1
sphinx-notfound-page==1.0.4
sphinx-toggleprompt==0.5.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
sphinxcontrib-websupport==2.0.0
sphinxemoji==0.3.1
stack-data==0.6.3
starlette==0.41.3
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
tomli==2.1.0
tomlkit==0.13.0
tornado==6.4.1
tqdm==4.67.0
traitlets==5.14.3
trove-classifiers==2024.7.2
types-python-dateutil==2.9.0.20241003
typing_extensions==4.12.2
tzdata==2024.2
uri-template==1.3.0
urllib3==2.2.3
uvicorn==0.32.0
virtualenv==20.26.3
vtk==9.3.20230807rc0
watchfiles==0.24.0
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==14.1
widgetsnbextension==4.0.13
zipp==3.21.0
hpohekar commented 4 days ago

https://github.com/ansys/pyfluent/issues/3469

mkundu1 commented 3 days ago

Not reproducible as per my testing in #3519