diff --git a/doc/source/api/visualization/index.rst b/doc/source/api/visualization/index.rst index 2f53eff5..5f1da46b 100644 --- a/doc/source/api/visualization/index.rst +++ b/doc/source/api/visualization/index.rst @@ -14,14 +14,14 @@ standard Fluent commands to write graphics to a file. .. code:: python - session.solver.tui.display.objects.contour['contour-1'] = {'boundary_values': True, 'color_map': {'color': 'field-velocity', 'font_automatic': True, 'font_name': 'Helvetica', 'font_size': 0.032, 'format': '%0.2e', 'length': 0.54, 'log_scale': False, 'position': 1, 'show_all': True, 'size': 100, 'user_skip': 9, 'visible': True, 'width': 6.0}, 'coloring': {'smooth': False}, 'contour_lines': False, 'display_state_name': 'None', 'draw_mesh': False, 'field': 'pressure', 'filled': True, 'mesh_object': '', 'node_values': True, 'range_option': {'auto_range_on': {'global_range': True}}, 'surfaces_list': [2, 5]} - session.solver.tui.display.objects.contour['contour-1']() - session.solver.tui.display.objects.contour['contour-1'].field.set_state('velocity-magnitude') - session.solver.tui.display.objects.contour['contour-1'].field() - session.solver.tui.display.objects.contour['contour-1'].color_map.size.set_state(80.0) - session.solver.tui.display.objects.contour['contour-1'].color_map.size() - session.solver.tui.display.objects.contour['contour-1'].rename('my-contour') - del session.solver.tui.display.objects.contour['my-contour'] + solver_session.tui.display.objects.contour['contour-1'] = {'boundary_values': True, 'color_map': {'color': 'field-velocity', 'font_automatic': True, 'font_name': 'Helvetica', 'font_size': 0.032, 'format': '%0.2e', 'length': 0.54, 'log_scale': False, 'position': 1, 'show_all': True, 'size': 100, 'user_skip': 9, 'visible': True, 'width': 6.0}, 'coloring': {'smooth': False}, 'contour_lines': False, 'display_state_name': 'None', 'draw_mesh': False, 'field': 'pressure', 'filled': True, 'mesh_object': '', 'node_values': True, 'range_option': {'auto_range_on': {'global_range': True}}, 'surfaces_list': [2, 5]} + solver_session.tui.display.objects.contour['contour-1']() + solver_session.tui.display.objects.contour['contour-1'].field.set_state('velocity-magnitude') + solver_session.tui.display.objects.contour['contour-1'].field() + solver_session.tui.display.objects.contour['contour-1'].color_map.size.set_state(80.0) + solver_session.tui.display.objects.contour['contour-1'].color_map.size() + solver_session.tui.display.objects.contour['contour-1'].rename('my-contour') + del solver_session.tui.display.objects.contour['my-contour'] PyVista example (graphics) -------------------------- @@ -36,7 +36,7 @@ environment. PyVista is then used to visualize the extracted data. # get the graphics objects for the session - graphics_session1 = Graphics(session) + graphics_session1 = Graphics(solver_session) mesh1 = graphics_session1.Meshes["mesh-1"] contour1 = graphics_session1.Contours["contour-1"] contour2 = graphics_session1.Contours["contour-2"] @@ -93,7 +93,7 @@ environment. Matplotlib is then used to plot data. from ansys.fluent.visualization.matplotlib import Plots # get the plots object for the session - plots_session1 = Plots(session) + plots_session1 = Plots(solver_session) #get xyplot object plot1=plots_session1.XYPlots["plot-1"] @@ -105,7 +105,7 @@ environment. Matplotlib is then used to plot data. #Draw plot plot1.plot("window-1") - session.exit() + solver_session.exit() .. currentmodule:: ansys.fluent.visualization diff --git a/doc/source/examples/00-postprocessing/post_processing_exhaust_manifold.py b/doc/source/examples/00-postprocessing/post_processing_exhaust_manifold.py index 194b6090..043b7ea4 100644 --- a/doc/source/examples/00-postprocessing/post_processing_exhaust_manifold.py +++ b/doc/source/examples/00-postprocessing/post_processing_exhaust_manifold.py @@ -38,19 +38,19 @@ filename="exhaust_system.dat.h5", directory="pyfluent/exhaust_system" ) -session = pyfluent.launch_fluent( - precision="double", processor_count=2, start_transcript=False +solver_session = pyfluent.launch_fluent( + precision="double", processor_count=2, start_transcript=False, mode="solver" ) -session.solver.tui.file.read_case(case_file_name=import_case) -session.solver.tui.file.read_data(case_file_name=import_data) +solver_session.tui.file.read_case(case_file_name=import_case) +solver_session.tui.file.read_data(case_file_name=import_data) ############################################################################### # Get graphics object # ~~~~~~~~~~~~~~~~~~~ # Get the graphics object. -graphics = Graphics(session=session) +graphics = Graphics(session=solver_session) ############################################################################### # Create graphics object for mesh display @@ -202,7 +202,7 @@ # ~~~~~~~~~~~~~~~~~~ # Create the plot object for the session. -plots_session_1 = Plots(session) +plots_session_1 = Plots(solver_session) ############################################################################### # Create XY plot @@ -231,7 +231,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~ # Create and display the residual plot. -matplotlib_plots1 = Plots(session) +matplotlib_plots1 = Plots(solver_session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" residual.plot("window-10") @@ -241,15 +241,15 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Solve and plot solution monitors. -session.solver.tui.solve.initialize.hyb_initialization() -session.solver.tui.solve.set.number_of_iterations(50) -session.solver.tui.solve.iterate() -matplotlib_plots1 = Plots(session) +solver_session.tui.solve.initialize.hyb_initialization() +solver_session.tui.solve.set.number_of_iterations(50) +solver_session.tui.solve.iterate() +matplotlib_plots1 = Plots(solver_session) mass_bal_rplot = matplotlib_plots1.Monitors["mass-bal-rplot"] mass_bal_rplot.monitor_set_name = "mass-bal-rplot" mass_bal_rplot.plot("window-11") -matplotlib_plots1 = Plots(session) +matplotlib_plots1 = Plots(solver_session) point_vel_rplot = matplotlib_plots1.Monitors["point-vel-rplot"] point_vel_rplot.monitor_set_name = "point-vel-rplot" point_vel_rplot.plot("window-12") @@ -259,4 +259,4 @@ # ~~~~~~~~~~~~ # Close Fluent. -session.exit() +solver_session.exit() diff --git a/doc/source/getting_started/index.rst b/doc/source/getting_started/index.rst index 466d2dce..57f9a3c5 100644 --- a/doc/source/getting_started/index.rst +++ b/doc/source/getting_started/index.rst @@ -52,7 +52,7 @@ You can launch Fluent from PyFluent using the ``launch_fluent`` function: .. code:: python import ansys.fluent.core as pyfluent - session = pyfluent.launch_fluent(precision="double", processor_count=2) + session = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver") session.check_health() session.start_transcript() # Streaming the transcript locally diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index 3dbb693f..e2fd14ba 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -33,12 +33,12 @@ This example shows how you can display a mesh: filename="exhaust_system.dat.h5", directory="pyfluent/exhaust_system" ) - session = pyfluent.launch_fluent(precision="double", processor_count=2) + solver_session = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver") - session.solver.tui.file.read_case(case_file_name=import_case) - session.solver.tui.file.read_data(case_file_name=import_data) + solver_session.tui.file.read_case(case_file_name=import_case) + solver_session.tui.file.read_data(case_file_name=import_data) - graphics = Graphics(session=session) + graphics = Graphics(session=solver_session) mesh1 = graphics.Meshes["mesh-1"] mesh1.show_edges = True mesh1.surfaces_list = [ @@ -105,7 +105,7 @@ This example shows how you can display the XY plot: .. code:: python - plots_session_1 = Plots(session) + plots_session_1 = Plots(solver_session) xy_plot = plots_session_1.XYPlots["xy-plot"] xy_plot.surfaces_list = ["outlet"] xy_plot.y_axis_function = "temperature" @@ -118,7 +118,7 @@ This example shows how you can display the solution residual plot: .. code:: python - matplotlib_plots1 = Plots(session) + matplotlib_plots1 = Plots(solver_session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" residual.plot("window-6") @@ -129,14 +129,11 @@ This example shows how you can display the solution monitors plot: .. code:: python - session.solver.tui.solve.initialize.hyb_initialization() - session.solver.tui.solve.set.number_of_iterations(50) - session.solver.tui.solve.iterate() - session.monitors_manager.get_monitor_set_names() - matplotlib_plots1 = Plots(session) + solver_session.tui.solve.initialize.hyb_initialization() + solver_session.tui.solve.set.number_of_iterations(50) + solver_session.tui.solve.iterate() + solver_session.monitors_manager.get_monitor_set_names() + matplotlib_plots1 = Plots(solver_session) mass_bal_rplot = matplotlib_plots1.Monitors["mass-bal-rplot"] mass_bal_rplot.monitor_set_name = "mass-bal-rplot" mass_bal_rplot.plot("window-7") - - - diff --git a/examples/00-postprocessing/post_processing_exhaust_manifold.py b/examples/00-postprocessing/post_processing_exhaust_manifold.py index 194b6090..043b7ea4 100644 --- a/examples/00-postprocessing/post_processing_exhaust_manifold.py +++ b/examples/00-postprocessing/post_processing_exhaust_manifold.py @@ -38,19 +38,19 @@ filename="exhaust_system.dat.h5", directory="pyfluent/exhaust_system" ) -session = pyfluent.launch_fluent( - precision="double", processor_count=2, start_transcript=False +solver_session = pyfluent.launch_fluent( + precision="double", processor_count=2, start_transcript=False, mode="solver" ) -session.solver.tui.file.read_case(case_file_name=import_case) -session.solver.tui.file.read_data(case_file_name=import_data) +solver_session.tui.file.read_case(case_file_name=import_case) +solver_session.tui.file.read_data(case_file_name=import_data) ############################################################################### # Get graphics object # ~~~~~~~~~~~~~~~~~~~ # Get the graphics object. -graphics = Graphics(session=session) +graphics = Graphics(session=solver_session) ############################################################################### # Create graphics object for mesh display @@ -202,7 +202,7 @@ # ~~~~~~~~~~~~~~~~~~ # Create the plot object for the session. -plots_session_1 = Plots(session) +plots_session_1 = Plots(solver_session) ############################################################################### # Create XY plot @@ -231,7 +231,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~ # Create and display the residual plot. -matplotlib_plots1 = Plots(session) +matplotlib_plots1 = Plots(solver_session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" residual.plot("window-10") @@ -241,15 +241,15 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Solve and plot solution monitors. -session.solver.tui.solve.initialize.hyb_initialization() -session.solver.tui.solve.set.number_of_iterations(50) -session.solver.tui.solve.iterate() -matplotlib_plots1 = Plots(session) +solver_session.tui.solve.initialize.hyb_initialization() +solver_session.tui.solve.set.number_of_iterations(50) +solver_session.tui.solve.iterate() +matplotlib_plots1 = Plots(solver_session) mass_bal_rplot = matplotlib_plots1.Monitors["mass-bal-rplot"] mass_bal_rplot.monitor_set_name = "mass-bal-rplot" mass_bal_rplot.plot("window-11") -matplotlib_plots1 = Plots(session) +matplotlib_plots1 = Plots(solver_session) point_vel_rplot = matplotlib_plots1.Monitors["point-vel-rplot"] point_vel_rplot.monitor_set_name = "point-vel-rplot" point_vel_rplot.plot("window-12") @@ -259,4 +259,4 @@ # ~~~~~~~~~~~~ # Close Fluent. -session.exit() +solver_session.exit() diff --git a/pyproject.toml b/pyproject.toml index b36aed09..0a84eeb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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-fluent-visualization" -version = "0.4.0" +version = "0.5.0" description = "A python wrapper for ansys Fluent visualization" license = "MIT" authors = ["ANSYS, Inc. "] @@ -25,7 +25,7 @@ packages = [ [tool.poetry.dependencies] python = ">=3.7,<4.0" importlib-metadata = {version = "^4.0", python = "<3.8"} -ansys-fluent-core = "~=0.10" +ansys-fluent-core = "~=0.11.dev1" # will be ~=0.11.0 vtk = {version = ">=9.0.3", python = "<=3.9"} ipyvtklink = ">=0.2.2" pyvista = ">=0.33.2" diff --git a/src/ansys/fluent/visualization/post_helper.py b/src/ansys/fluent/visualization/post_helper.py index 4401dc5b..0dd2e631 100644 --- a/src/ansys/fluent/visualization/post_helper.py +++ b/src/ansys/fluent/visualization/post_helper.py @@ -16,7 +16,7 @@ def surface_name_in_server(local_surface_name): return "_dummy_surface_for_pyfluent:" + local_surface_name.lower() def _get_api_handle(self): - return self.obj._get_top_most_parent().session.solver.tui.surface + return self.obj._get_top_most_parent().session.tui.surface def _delete_if_exist_on_server(self): field_info = self.obj._api_helper.field_info() diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 1810b719..de16ead9 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -2,4 +2,4 @@ def test_pkg_version(): - assert __version__ == "0.4.0" + assert __version__ == "0.5.0"