ansys / pyfluent-visualization

Visualize Ansys Fluent simulations using Python
https://visualization.fluent.docs.pyansys.com
MIT License
27 stars 3 forks source link

Bug when running User Guide graphics example #261

Open PProfizi opened 1 year ago

PProfizi commented 1 year ago

πŸ” Before submitting the issue

🐞 Description of the bug

Hi! When running the examples found here with an Ansys 2023R2 install dating from 2023-01-13:

import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
from ansys.fluent.visualization import set_config
from ansys.fluent.visualization.matplotlib import Plots
from ansys.fluent.visualization.pyvista import Graphics

set_config(blocking=True, set_view_on_display="isometric")

import_case = examples.download_file(
    filename="exhaust_system.cas.h5", directory="pyfluent/exhaust_system"
)

import_data = examples.download_file(
    filename="exhaust_system.dat.h5", directory="pyfluent/exhaust_system"
)

solver_session = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver")

solver_session.tui.file.read_case(import_case)
solver_session.tui.file.read_data(import_data)

graphics = Graphics(session=solver_session)

# Display y-coordinate iso-surface
surf_outlet_plane = graphics.Surfaces["outlet-plane"]
surf_outlet_plane.surface.type = "iso-surface"
iso_surf1 = surf_outlet_plane.surface.iso_surface
iso_surf1.field = "y-coordinate"
iso_surf1.iso_value = -0.125017
surf_outlet_plane.display("window-2")

results in:

Traceback (most recent call last):
  File "D:\ANSYSDev\Sandbox\pydpf-post\temp\pyfluent\pyfluent_display.py", line 26, in <module>
    surf_outlet_plane.surface.type = "iso-surface"
  File "D:\temp\pydpf-core\232_CFF\lib\site-packages\ansys\fluent\core\meta.py", line 279, in wrapper
    return object.__getattribute__(self, name)
AttributeError: 'Surface' object has no attribute 'surface'

πŸ“ Steps to reproduce

See above.

Would that be a problem with my Ansys install?

πŸ’» Which operating system are you using?

Windows

πŸ“€ Which ANSYS version are you using?

232 build from 2023-01-13

🐍 Which Python version are you using?

3.10

πŸ“¦ Installed packages

Package                               Version    Editable project location
------------------------------------- ---------- -----------------------------------------
ansys-api-fluent                      0.3.12
ansys-api-platform-instancemanagement 1.0.0b3
ansys-dpf-core                        0.7.5.dev0 D:\ANSYSDev\Sandbox\pydpf-core
ansys-dpf-gate                        0.3.2.dev0
ansys-dpf-gatebin                     0.3.2.dev0
ansys-dpf-post                        0.3.1.dev0 D:\ANSYSDev\Sandbox\pydpf-post
ansys-dpf-server-2023-2-pre2          2023.2rc2  d:\ansysdev\dpf_standalone\cff_fixes\v232
ansys-fluent-core                     0.14.dev1
ansys-fluent-visualization            0.7.1
ansys-grpc-dpf                        0.7.2.dev0
ansys-platform-instancemanagement     1.1.1
appdirs                               1.4.4
attrs                                 22.2.0
black                                 23.1.0
cachetools                            5.3.0
certifi                               2022.12.7
charset-normalizer                    3.1.0
chevron                               0.14.0
click                                 8.1.3
colorama                              0.4.6
contourpy                             1.0.7
coverage                              7.2.1
cycler                                0.11.0
exceptiongroup                        1.1.1
fonttools                             4.39.2
google-api-core                       2.11.0
google-api-python-client              2.82.0
google-auth                           2.16.2
google-auth-httplib2                  0.1.0
googleapis-common-protos              1.59.0
grpcio                                1.51.3
h5py                                  3.8.0
httplib2                              0.21.0
idna                                  3.4
imageio                               2.26.1
importlib-metadata                    6.1.0
iniconfig                             2.0.0
kiwisolver                            1.4.4
lxml                                  4.9.2
matplotlib                            3.7.1
mypy-extensions                       1.0.0
numpy                                 1.24.2
packaging                             23.0
pandas                                1.5.3
pathspec                              0.11.1
Pillow                                9.4.0
pip                                   21.3.1
platformdirs                          3.1.1
pluggy                                1.0.0
pooch                                 1.7.0
protobuf                              3.20.3
protoc-gen-swagger                    0.1.0
psutil                                5.9.4
pyasn1                                0.4.8
pyasn1-modules                        0.2.8
pyparsing                             3.0.9
PySide6                               6.5.0
PySide6-Addons                        6.5.0
PySide6-Essentials                    6.5.0
pytest                                7.2.1
pytest-cov                            4.0.0
zipp                                  3.15.0
PProfizi commented 1 year ago

From debugging, it seems that it should be:

surf_outlet_plane.definition.type = "iso-surface"
iso_surf1 = surf_outlet_plane.definition.iso_surface
seanpearsonuk commented 1 year ago

@ajain-work do we need a doc update?

seanpearsonuk commented 4 days ago

@prmukherj please could you check that the referenced documentation has been correctly updated.