ansys-fluent-visualization 0.11.dev0__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/PKG-INFO +5 -7
  2. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/README.rst +2 -2
  3. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/pyproject.toml +3 -4
  4. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/__init__.py +3 -1
  5. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/_config.py +1 -1
  6. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/matplotlib/matplot_windows_manager.py +4 -4
  7. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/matplotlib/plotter_defns.py +20 -17
  8. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/post_data_extractor.py +30 -15
  9. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py +0 -3
  10. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/LICENSE +0 -0
  11. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/contour.py +0 -0
  12. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/matplotlib/__init__.py +0 -0
  13. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/matplotlib/matplot_objects.py +0 -0
  14. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/post_windows_manager.py +0 -0
  15. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/pyvista/__init__.py +0 -0
  16. {ansys_fluent_visualization-0.11.dev0 → ansys_fluent_visualization-0.12.0}/src/ansys/fluent/visualization/pyvista/pyvista_objects.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ansys-fluent-visualization
3
- Version: 0.11.dev0
3
+ Version: 0.12.0
4
4
  Summary: A python wrapper for ansys Fluent visualization
5
5
  Home-page: https://github.com/ansys/pyfluent-visualization
6
6
  License: MIT
@@ -8,21 +8,19 @@ Author: ANSYS, Inc.
8
8
  Author-email: ansys.support@ansys.com
9
9
  Maintainer: PyAnsys developers
10
10
  Maintainer-email: pyansys.maintainers@ansys.com
11
- Requires-Python: >=3.9,<4.0
11
+ Requires-Python: >=3.10,<4.0
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
20
- Requires-Dist: ansys-fluent-core (>=0.22.dev0,<1.0)
19
+ Requires-Dist: ansys-fluent-core (>=0.24.2,<0.25.0)
21
20
  Requires-Dist: importlib-metadata (>=4.0,<5.0) ; python_version < "3.9"
22
21
  Requires-Dist: matplotlib (>=3.5.1)
23
22
  Requires-Dist: pyvista (>=0.39.0)
24
23
  Requires-Dist: pyvistaqt (>=0.7.0)
25
- Requires-Dist: requests (==2.31.0)
26
24
  Requires-Dist: vtk (>=9.3.0.rc0)
27
25
  Project-URL: Documentation, https://visualization.fluent.docs.pyansys.com/
28
26
  Project-URL: Repository, https://github.com/ansys/pyfluent-visualization
@@ -82,8 +80,8 @@ the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>
82
80
 
83
81
  Installation
84
82
  ------------
85
- The ``ansys-fluent-visualization`` package supports Python 3.9 through Python
86
- 3.11 on Windows and Linux.
83
+ The ``ansys-fluent-visualization`` package supports Python 3.10 through Python
84
+ 3.12 on Windows and Linux.
87
85
 
88
86
  If you are using Python 3.10, download and install the wheel file for the ``vtk`` package from
89
87
  `here for Windows <https://github.com/pyvista/pyvista-wheels/raw/main/vtk-9.1.0.dev0-cp310-cp310-win_amd64.whl>`_
@@ -50,8 +50,8 @@ the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>
50
50
 
51
51
  Installation
52
52
  ------------
53
- The ``ansys-fluent-visualization`` package supports Python 3.9 through Python
54
- 3.11 on Windows and Linux.
53
+ The ``ansys-fluent-visualization`` package supports Python 3.10 through Python
54
+ 3.12 on Windows and Linux.
55
55
 
56
56
  If you are using Python 3.10, download and install the wheel file for the ``vtk`` package from
57
57
  `here for Windows <https://github.com/pyvista/pyvista-wheels/raw/main/vtk-9.1.0.dev0-cp310-cp310-win_amd64.whl>`_
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
  [tool.poetry]
6
6
  # Check https://python-poetry.org/docs/pyproject/ for all available sections
7
7
  name = "ansys-fluent-visualization"
8
- version = "0.11.dev0"
8
+ version = "0.12.0"
9
9
  description = "A python wrapper for ansys Fluent visualization"
10
10
  license = "MIT"
11
11
  authors = ["ANSYS, Inc. <ansys.support@ansys.com>"]
@@ -23,14 +23,13 @@ packages = [
23
23
  ]
24
24
 
25
25
  [tool.poetry.dependencies]
26
- python = ">=3.9,<4.0"
26
+ python = ">=3.10,<4.0"
27
27
  importlib-metadata = {version = "^4.0", python = "<3.9"}
28
- ansys-fluent-core = "~=0.22.dev0"
28
+ ansys-fluent-core = "~=0.24.2"
29
29
  vtk = ">=9.3.0.rc0"
30
30
  pyvista = ">=0.39.0"
31
31
  pyvistaqt = ">=0.7.0"
32
32
  matplotlib = ">=3.5.1"
33
- requests = "==2.31.0"
34
33
 
35
34
  [tool.poetry.urls]
36
35
  "Documentation" = "https://visualization.fluent.docs.pyansys.com/"
@@ -5,7 +5,7 @@ try:
5
5
  except ModuleNotFoundError:
6
6
  import importlib_metadata
7
7
 
8
- _VERSION_INFO = "Build date: July 02, 2024 18:57 UTC ShaID: 168f1b5"
8
+ _VERSION_INFO = "Build date: August 20, 2024 14:49 UTC ShaID: f9f5883"
9
9
  __version__ = importlib_metadata.version(__name__.replace(".", "-"))
10
10
 
11
11
 
@@ -23,3 +23,5 @@ def version_info() -> str:
23
23
 
24
24
 
25
25
  from ansys.fluent.visualization._config import get_config, set_config # noqa: F401
26
+ from ansys.fluent.visualization.matplotlib import Plots # noqa: F401
27
+ from ansys.fluent.visualization.pyvista import Graphics # noqa: F401
@@ -14,7 +14,7 @@ def get_config() -> dict:
14
14
  return _global_config.copy()
15
15
 
16
16
 
17
- def set_config(blocking: bool = False, set_view_on_display: str = None):
17
+ def set_config(blocking: bool = True, set_view_on_display: str = None):
18
18
  """Set visualization configuration.
19
19
 
20
20
  Parameters
@@ -172,8 +172,8 @@ class _MonitorPlot:
172
172
  """Draw a monitor plot."""
173
173
  if not self.post_object:
174
174
  return
175
- monitors_manager = self.post_object._api_helper.monitors_manager()
176
- indices, columns_data = monitors_manager.get_monitor_set_data(
175
+ monitors = self.post_object._api_helper.monitors
176
+ indices, columns_data = monitors.get_monitor_set_data(
177
177
  self.post_object.monitor_set_name()
178
178
  )
179
179
  xy_data = {}
@@ -183,8 +183,8 @@ class _MonitorPlot:
183
183
  properties = {
184
184
  "curves": list(xy_data.keys()),
185
185
  "title": monitor_set_name,
186
- "xlabel": monitors_manager.get_monitor_set_prop(monitor_set_name, "xlabel"),
187
- "ylabel": monitors_manager.get_monitor_set_prop(monitor_set_name, "ylabel"),
186
+ "xlabel": monitors.get_monitor_set_prop(monitor_set_name, "xlabel"),
187
+ "ylabel": monitors.get_monitor_set_prop(monitor_set_name, "ylabel"),
188
188
  "yscale": "log" if monitor_set_name == "residual" else "linear",
189
189
  }
190
190
 
@@ -52,9 +52,8 @@ class Plotter:
52
52
  self._data = {}
53
53
  self._closed = False
54
54
  self._visible = False
55
- if not remote_process:
56
- self.fig = plt.figure(num=self._window_id)
57
- self.ax = self.fig.add_subplot(111)
55
+ self._remote_process = remote_process
56
+ self.fig = None
58
57
 
59
58
  def plot(self, data: dict) -> None:
60
59
  """Draw plot in window.
@@ -79,11 +78,19 @@ class Plotter:
79
78
  self._min_x = min(self._min_x, min_x_value) if self._min_x else min_x_value
80
79
  self._max_x = max(self._max_x, max_x_value) if self._max_x else max_x_value
81
80
 
82
- curve_lines = self.ax.lines
83
- for curve, curve_line in zip(self._curves, curve_lines):
84
- curve_line.set_data(
85
- self._data[curve]["xvalues"], self._data[curve]["yvalues"]
86
- )
81
+ if not self._remote_process:
82
+ self.fig = plt.figure(num=self._window_id)
83
+ self.ax = self.fig.add_subplot(111)
84
+ if self._yscale:
85
+ self.ax.set_yscale(self._yscale)
86
+ self.fig.canvas.manager.set_window_title("PyFluent [" + self._window_id + "]")
87
+ plt.title(self._title)
88
+ plt.xlabel(self._xlabel)
89
+ plt.ylabel(self._ylabel)
90
+ for curve in self._curves:
91
+ self.ax.plot(self._data[curve]["xvalues"], self._data[curve]["yvalues"])
92
+ plt.legend(labels=self._curves, loc="upper right")
93
+
87
94
  if self._max_x > self._min_x:
88
95
  self.ax.set_xlim(self._min_x, self._max_x)
89
96
  y_range = self._max_y - self._min_y
@@ -142,20 +149,16 @@ class Plotter:
142
149
 
143
150
  # private methods
144
151
  def _reset(self):
145
- plt.figure(self.fig.number)
146
- self.ax.cla()
147
- if self._yscale:
148
- self.ax.set_yscale(self._yscale)
149
152
  for curve_name in self._curves:
150
153
  self._data[curve_name] = {}
151
154
  self._data[curve_name]["xvalues"] = []
152
155
  self._data[curve_name]["yvalues"] = []
156
+ if not self.fig:
157
+ return
158
+ plt.figure(self.fig.number)
159
+ self.ax.cla()
160
+ for curve_name in self._curves:
153
161
  self.ax.plot([], [], label=curve_name)
154
- self.fig.canvas.manager.set_window_title("PyFluent [" + self._window_id + "]")
155
- plt.title(self._title)
156
- plt.xlabel(self._xlabel)
157
- plt.ylabel(self._ylabel)
158
- plt.legend(labels=self._curves, loc="upper right")
159
162
 
160
163
 
161
164
  class ProcessPlotter(Plotter):
@@ -8,7 +8,7 @@ from ansys.fluent.core.post_objects.post_object_definitions import (
8
8
  GraphicsDefn,
9
9
  PlotDefn,
10
10
  )
11
- from ansys.fluent.core.services.field_data import _FieldDataConstants
11
+ from ansys.fluent.core.services.field_data import SurfaceDataType, _FieldDataConstants
12
12
  import numpy as np
13
13
 
14
14
 
@@ -69,7 +69,12 @@ class FieldDataExtractor:
69
69
  for id in surfaces_info[surf]["surface_id"]
70
70
  ]
71
71
 
72
- transaction.add_surfaces_request(surface_ids, *args, **kwargs)
72
+ transaction.add_surfaces_request(
73
+ surfaces=surface_ids,
74
+ data_types=[SurfaceDataType.Vertices, SurfaceDataType.FacesConnectivity],
75
+ *args,
76
+ **kwargs,
77
+ )
73
78
  try:
74
79
  fields = transaction.get_fields()
75
80
  # 0 is old tag
@@ -124,10 +129,15 @@ class FieldDataExtractor:
124
129
  for id in surfaces_info[surf]["surface_id"]
125
130
  ]
126
131
  # get scalar field data
127
- transaction.add_surfaces_request(surface_ids=surface_ids, *args, **kwargs)
132
+ transaction.add_surfaces_request(
133
+ surfaces=surface_ids,
134
+ data_types=[SurfaceDataType.Vertices, SurfaceDataType.FacesConnectivity],
135
+ *args,
136
+ **kwargs,
137
+ )
128
138
  transaction.add_scalar_fields_request(
129
139
  field_name=field,
130
- surface_ids=surface_ids,
140
+ surfaces=surface_ids,
131
141
  node_value=node_values,
132
142
  boundary_value=boundary_values,
133
143
  )
@@ -185,9 +195,7 @@ class FieldDataExtractor:
185
195
  for surf in map(obj._api_helper.remote_surface_name, obj.surfaces_list())
186
196
  for id in surfaces_info[surf]["surface_id"]
187
197
  ]
188
- transaction.add_pathlines_fields_request(
189
- surface_ids=surface_ids, field_name=field
190
- )
198
+ transaction.add_pathlines_fields_request(surfaces=surface_ids, field_name=field)
191
199
 
192
200
  try:
193
201
  fields = transaction.get_fields()
@@ -219,15 +227,20 @@ class FieldDataExtractor:
219
227
  for id in surfaces_info[surf]["surface_id"]
220
228
  ]
221
229
 
222
- transaction.add_surfaces_request(surface_ids=surface_ids, *args, **kwargs)
230
+ transaction.add_surfaces_request(
231
+ surfaces=surface_ids,
232
+ data_types=[SurfaceDataType.Vertices, SurfaceDataType.FacesConnectivity],
233
+ *args,
234
+ **kwargs,
235
+ )
223
236
  transaction.add_scalar_fields_request(
224
- surface_ids=surface_ids,
237
+ surfaces=surface_ids,
225
238
  field_name=field,
226
239
  node_value=False,
227
240
  boundary_value=False,
228
241
  )
229
242
  transaction.add_vector_fields_request(
230
- surface_ids=surface_ids, field_name=obj.vectors_of()
243
+ surfaces=surface_ids, field_name=obj.vectors_of()
231
244
  )
232
245
  try:
233
246
  fields = transaction.get_fields()
@@ -337,14 +350,16 @@ class XYPlotDataExtractor:
337
350
 
338
351
  # get scalar field data
339
352
  transaction.add_surfaces_request(
340
- surface_ids=surface_ids,
341
- provide_faces=False,
342
- provide_vertices=True if node_values else False,
343
- provide_faces_centroid=False if node_values else True,
353
+ surfaces=surface_ids,
354
+ data_types=(
355
+ [SurfaceDataType.Vertices]
356
+ if node_values
357
+ else [SurfaceDataType.FacesCentroid]
358
+ ),
344
359
  )
345
360
  transaction.add_scalar_fields_request(
346
361
  field_name=field,
347
- surface_ids=surface_ids,
362
+ surfaces=surface_ids,
348
363
  node_value=node_values,
349
364
  boundary_value=boundary_values,
350
365
  )
@@ -381,8 +381,6 @@ class PyVistaWindow(PostWindow):
381
381
  plotter.add_mesh(mesh.contour(isosurfaces=20))
382
382
 
383
383
  def _fetch_surface(self, obj):
384
- surface_api = obj._api_helper.surface_api
385
- surface_api.create_surface_on_server()
386
384
  dummy_object = "dummy_object"
387
385
  post_session = obj.get_root()
388
386
  if (
@@ -403,7 +401,6 @@ class PyVistaWindow(PostWindow):
403
401
  mesh.show_edges = obj.show_edges()
404
402
  self._fetch_mesh(mesh)
405
403
  del post_session.Meshes[dummy_object]
406
- surface_api.delete_surface_on_server()
407
404
 
408
405
  def _display_surface(self, obj, plotter: Union[BackgroundPlotter, pv.Plotter]):
409
406
  dummy_object = "dummy_object"