Skip to content
Closed
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
22 changes: 11 additions & 11 deletions doc/source/api/visualization/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
--------------------------
Expand All @@ -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"]
Expand Down Expand Up @@ -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"]
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -259,4 +259,4 @@
# ~~~~~~~~~~~~
# Close Fluent.

session.exit()
solver_session.exit()
2 changes: 1 addition & 1 deletion doc/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 11 additions & 14 deletions doc/source/users_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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"
Expand All @@ -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")
Expand All @@ -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")



26 changes: 13 additions & 13 deletions examples/00-postprocessing/post_processing_exhaust_manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -259,4 +259,4 @@
# ~~~~~~~~~~~~
# Close Fluent.

session.exit()
solver_session.exit()
4 changes: 2 additions & 2 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-fluent-visualization"
version = "0.4.0"
version = "0.5.0"
description = "A python wrapper for ansys Fluent visualization"
license = "MIT"
authors = ["ANSYS, Inc. <ansys.support@ansys.com>"]
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/visualization/post_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_pkg_version():
assert __version__ == "0.4.0"
assert __version__ == "0.5.0"