Skip to content

Commit ce7af90

Browse files
committed
Merge branch 'main' of https://github.com/pyansys/pyfluent-visualization into main
2 parents 4fbedc5 + 2fa0f40 commit ce7af90

37 files changed

+3792
-1051
lines changed

.github/workflows/ci_cd.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ${{ matrix.os }}
4242
strategy:
4343
matrix:
44-
os: [windows-latest, ubuntu-latest]
44+
os: [windows-latest, public-ubuntu-latest-8-cores]
4545
python-version: ['3.10', '3.11', '3.12', '3.13']
4646
fail-fast: false
4747

@@ -54,17 +54,32 @@ jobs:
5454
python-version: ${{ matrix.python-version }}
5555

5656
- name: Install OS packages
57-
if: matrix.os == 'ubuntu-latest'
57+
if: matrix.os == 'public-ubuntu-latest-8-cores'
5858
run: |
5959
sudo apt update
6060
sudo apt install libegl1
6161
6262
- name: Install pyfluent-visualization
6363
run: make install
6464

65+
- name: Login to GitHub Container Registry
66+
if: matrix.os == 'public-ubuntu-latest-8-cores'
67+
uses: docker/login-action@v3
68+
with:
69+
registry: ghcr.io
70+
username: ${{ secrets.BOT_APPLICATION_ID }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Pull Fluent docker image
74+
if: matrix.os == 'public-ubuntu-latest-8-cores'
75+
run: make docker-pull
76+
env:
77+
FLUENT_IMAGE_TAG: v25.2.0
78+
6579
- name: Test with pytest
6680
run: make unittest
67-
81+
env:
82+
FLUENT_IMAGE_TAG: v25.2.0
6883

6984
docs:
7085
name: Documentation

doc/source/users_guide/index.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The following example demonstrates how to display a mesh with and without edges:
4848
from ansys.fluent.visualization import GraphicsWindow, Mesh
4949
5050
mesh = Mesh(solver=solver_session, show_edges=True, surfaces=["in1", "in2", "in3"])
51-
window = GraphicsWindow(grid=(1, 2))
51+
window = GraphicsWindow()
5252
window.add_graphics(mesh, position=(0, 0))
5353
5454
mesh = Mesh(solver=solver_session, surfaces=["in1", "in2", "in3"])
@@ -156,7 +156,7 @@ Generate an XY plot of temperature variations at an outlet:
156156
y_axis_function="temperature",
157157
)
158158
window = GraphicsWindow()
159-
window.add_graphics(xy_plot)
159+
window.add_plot(xy_plot)
160160
window.show()
161161
162162
Display solution residual plot
@@ -170,7 +170,7 @@ Plot solution residuals:
170170
residual = Monitor(solver=solver_session)
171171
residual.monitor_set_name = "residual"
172172
window = GraphicsWindow()
173-
window.add_graphics(residual)
173+
window.add_plot(residual)
174174
window.show()
175175
176176
Display solution monitors plot
@@ -184,11 +184,11 @@ Monitor solution convergence using mass balance and velocity plots:
184184
185185
mass_bal_rplot = Monitor(solver=solver_session)
186186
mass_bal_rplot.monitor_set_name = "mass-bal-rplot"
187-
window = GraphicsWindow(grid=(1, 2))
188-
window.add_graphics(mass_bal_rplot, position=(0, 0))
187+
window = GraphicsWindow()
188+
window.add_plot(mass_bal_rplot, position=(0, 0))
189189
190190
point_vel_rplot = Monitor(solver=solver_session, monitor_set_name="point-vel-rplot")
191-
window.add_graphics(point_vel_rplot, position=(0, 1))
191+
window.add_plot(point_vel_rplot, position=(0, 1))
192192
window.show()
193193
194194
Interactive Graphics
@@ -227,11 +227,11 @@ stages. Graphics updates occur:
227227
contour_window.show()
228228
229229
xy_plot_window = GraphicsWindow()
230-
xy_plot_window.add_graphics(xy_plot_object)
230+
xy_plot_window.add_plot(xy_plot_object)
231231
xy_plot_window.show()
232232
233233
monitor_window = GraphicsWindow()
234-
monitor_window.add_graphics(monitor1)
234+
monitor_window.add_plot(monitor1)
235235
monitor_window.show()
236236
237237
def auto_refresh_graphics(session, event_info):

doc/source/users_guide/integration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
Integrating Custom Rendering Libraries with PyFluent-Visualization
55
==================================================================
66

7-
Will be available soon.
7+
Coming soon.

examples/00-postprocessing/post_processing_exhaust_manifold.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@
4040
import ansys.fluent.core as pyfluent
4141
from ansys.fluent.core import examples
4242

43-
from ansys.fluent.visualization import Graphics, Plots, set_config
43+
from ansys.fluent.visualization import Graphics, Plots, config
4444

4545
pyfluent.CONTAINER_MOUNT_PATH = pyfluent.EXAMPLES_PATH
4646

47-
set_config(blocking=True, set_view_on_display="isometric")
47+
config.interactive = False
48+
config.view = "isometric"
4849

4950
###############################################################################
5051
# Download files and launch Fluent

examples/00-postprocessing/script_manifold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
ui_mode="gui",
5353
)
5454

55-
from ansys.fluent.visualization import set_config
55+
from ansys.fluent.visualization import config
5656

57-
set_config(blocking=False)
57+
config.interactive = True
5858

5959

6060
from ansys.fluent.visualization import Graphics, Plots

examples/00-postprocessing/updated_exhaust_manifold_example.py

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@
6565
Surface,
6666
Vector,
6767
XYPlot,
68-
set_config,
68+
config,
6969
)
7070

7171
pyfluent.CONTAINER_MOUNT_PATH = pyfluent.EXAMPLES_PATH
7272

73-
set_config(blocking=True, set_view_on_display="isometric")
73+
config.interactive = False
74+
config.view = "isometric"
7475

7576
###############################################################################
7677
# Download files and launch Fluent
@@ -112,7 +113,7 @@
112113
"solid_up:1:830-shadow",
113114
]
114115
mesh = Mesh(solver=solver_session, show_edges=True, surfaces=mesh_surfaces_list)
115-
graphics_window = GraphicsWindow(grid=(1, 2))
116+
graphics_window = GraphicsWindow()
116117
graphics_window.add_graphics(mesh, position=(0, 0))
117118

118119
mesh = Mesh(solver=solver_session, surfaces=mesh_surfaces_list)
@@ -124,36 +125,36 @@
124125
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125126
# Create a plane-surface XY plane.
126127

127-
surf_xy_plane = Surface(solver=solver_session)
128-
surf_xy_plane.definition.type = "plane-surface"
129-
surf_xy_plane.definition.plane_surface.creation_method = "xy-plane"
130-
plane_surface_xy = surf_xy_plane.definition.plane_surface.xy_plane
131-
plane_surface_xy.z = -0.0441921
132-
graphics_window = GraphicsWindow(grid=(1, 3))
128+
surf_xy_plane = Surface(
129+
solver=solver_session,
130+
type="plane-surface",
131+
creation_method="xy-plane",
132+
z=-0.0441921,
133+
)
134+
graphics_window = GraphicsWindow()
133135
graphics_window.add_graphics(surf_xy_plane, position=(0, 0))
134136

135137
###############################################################################
136138
# Create plane-surface YZ plane
137139
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138140
# Create a plane-surface YZ plane.
139141

140-
surf_yz_plane = Surface(solver=solver_session)
141-
surf_yz_plane.definition.type = "plane-surface"
142-
surf_yz_plane.definition.plane_surface.creation_method = "yz-plane"
143-
plane_surface_yz = surf_yz_plane.definition.plane_surface.yz_plane
144-
plane_surface_yz.x = -0.174628
142+
surf_yz_plane = Surface(
143+
solver=solver_session, type="plane-surface", creation_method="yz-plane", x=-0.174628
144+
)
145145
graphics_window.add_graphics(surf_yz_plane, position=(0, 1))
146146

147147
###############################################################################
148148
# Create plane-surface ZX plane
149149
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150150
# Create a plane-surface ZX plane.
151151

152-
surf_zx_plane = Surface(solver=solver_session)
153-
surf_zx_plane.definition.type = "plane-surface"
154-
surf_zx_plane.definition.plane_surface.creation_method = "zx-plane"
155-
plane_surface_zx = surf_zx_plane.definition.plane_surface.zx_plane
156-
plane_surface_zx.y = -0.0627297
152+
surf_zx_plane = Surface(
153+
solver=solver_session,
154+
type="plane-surface",
155+
creation_method="zx-plane",
156+
y=-0.0627297,
157+
)
157158
graphics_window.add_graphics(surf_zx_plane, position=(0, 2))
158159
graphics_window.show()
159160

@@ -163,23 +164,20 @@
163164
# Create an iso-surface on the outlet plane.
164165

165166
surf_outlet_plane = Surface(solver=solver_session)
166-
surf_outlet_plane.definition.type = "iso-surface"
167-
iso_surf1 = surf_outlet_plane.definition.iso_surface
168-
iso_surf1.field = "y-coordinate"
169-
iso_surf1.iso_value = -0.125017
170-
graphics_window = GraphicsWindow(grid=(2, 1))
167+
surf_outlet_plane.type = "iso-surface"
168+
surf_outlet_plane.field = "y-coordinate"
169+
surf_outlet_plane.iso_value = -0.125017
170+
graphics_window = GraphicsWindow()
171171
graphics_window.add_graphics(surf_outlet_plane, position=(0, 0))
172172

173173
###############################################################################
174174
# Create iso-surface on mid-plane
175175
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176176
# Create an iso-surface on the mid-plane.
177177

178-
surf_mid_plane_x = Surface(solver=solver_session)
179-
surf_mid_plane_x.definition.type = "iso-surface"
180-
iso_surf2 = surf_mid_plane_x.definition.iso_surface
181-
iso_surf2.field = "x-coordinate"
182-
iso_surf2.iso_value = -0.174
178+
surf_mid_plane_x = Surface(
179+
solver=solver_session, type="iso-surface", field="x-coordinate", iso_value=-0.174
180+
)
183181
graphics_window.add_graphics(surf_mid_plane_x, position=(1, 0))
184182
graphics_window.show()
185183

@@ -188,13 +186,14 @@
188186
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
189187
# Create an iso-surface using the velocity magnitude.
190188

191-
surf_vel_contour = Surface(solver=solver_session)
192-
surf_vel_contour.definition.type = "iso-surface"
193-
iso_surf3 = surf_vel_contour.definition.iso_surface
194-
iso_surf3.field = "velocity-magnitude"
195-
iso_surf3.rendering = "contour"
196-
iso_surf3.iso_value = 0.0
197-
graphics_window = GraphicsWindow(grid=(2, 2))
189+
surf_vel_contour = Surface(
190+
solver=solver_session,
191+
type="iso-surface",
192+
field="velocity-magnitude",
193+
rendering="contour",
194+
iso_value=0.0,
195+
)
196+
graphics_window = GraphicsWindow()
198197
graphics_window.add_graphics(surf_vel_contour, position=(0, 0))
199198

200199
###############################################################################
@@ -269,8 +268,8 @@
269268
surfaces=["outlet"],
270269
y_axis_function="temperature",
271270
)
272-
plot_window = GraphicsWindow(grid=(2, 2))
273-
plot_window.add_graphics(xy_plot_object, position=(0, 0))
271+
plot_window = GraphicsWindow()
272+
plot_window.add_plot(xy_plot_object, position=(0, 0))
274273

275274
###############################################################################
276275
# Create residual plot
@@ -279,7 +278,7 @@
279278

280279
residual = Monitor(solver=solver_session)
281280
residual.monitor_set_name = "residual"
282-
plot_window.add_graphics(residual, position=(0, 1))
281+
plot_window.add_plot(residual, position=(0, 1))
283282

284283
###############################################################################
285284
# Solve and plot solution monitors
@@ -291,10 +290,10 @@
291290

292291
mass_bal_rplot = Monitor(solver=solver_session)
293292
mass_bal_rplot.monitor_set_name = "mass-bal-rplot"
294-
plot_window.add_graphics(mass_bal_rplot, position=(1, 0))
293+
plot_window.add_plot(mass_bal_rplot, position=(1, 0))
295294

296295
point_vel_rplot = Monitor(solver=solver_session, monitor_set_name="point-vel-rplot")
297-
plot_window.add_graphics(point_vel_rplot, position=(1, 1))
296+
plot_window.add_plot(point_vel_rplot, position=(1, 1))
298297
plot_window.show()
299298

300299
###############################################################################

examples/00-postprocessing/updated_script_manifold_example.py

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
# Run the following in command prompt to execute this file:
3434
# exec(open("updated_script_manifold_example.py").read())
3535

36-
from ansys.fluent.visualization import set_config
36+
from ansys.fluent.visualization import config
3737

38-
set_config(blocking=False)
38+
config.interactive = True
3939

4040
import ansys.fluent.core as pyfluent
41-
from ansys.fluent.core import examples
41+
from ansys.fluent.core import SolverEvent, examples
4242

4343
import_case = examples.download_file(
4444
file_name="exhaust_system.cas.h5", directory="pyfluent/exhaust_system"
@@ -100,26 +100,26 @@
100100
p1 = XYPlot(solver=session, surfaces=["solid_up:1:830"])
101101
p1.y_axis_function = "temperature"
102102
p_xy = GraphicsWindow()
103-
p_xy.add_graphics(p1)
103+
p_xy.add_plot(p1)
104104
p_xy.show()
105105

106106
session.monitors.get_monitor_set_names()
107107
residual = Monitor(solver=session)
108108
residual.monitor_set_name = "residual"
109109
p_res = GraphicsWindow()
110-
p_res.add_graphics(residual)
110+
p_res.add_plot(residual)
111111
p_res.show()
112112

113113
mtr = Monitor(solver=session)
114114
mtr.monitor_set_name = "mass-tot-rplot"
115115
p_mtr = GraphicsWindow()
116-
p_mtr.add_graphics(mtr)
116+
p_mtr.add_plot(mtr)
117117
p_mtr.show()
118118

119119
mbr = Monitor(solver=session)
120120
mbr.monitor_set_name = "mass-bal-rplot"
121121
p_mbr = GraphicsWindow()
122-
p_mbr.add_graphics(mbr)
122+
p_mbr.add_plot(mbr)
123123
p_mbr.show()
124124

125125
p_mesh = GraphicsWindow()
@@ -135,35 +135,24 @@
135135
p_pathline.add_graphics(pathlines1)
136136
p_pathline.show()
137137

138-
p_cont.plotter.view_isometric()
138+
p_cont._renderer.plotter.view_isometric()
139139

140140
p_surf = GraphicsWindow()
141141
p_surf.add_graphics(surface1)
142142
p_surf.show()
143143

144-
145-
def auto_refersh_call_back_iteration(session, event_info):
146-
p_cont.refresh_windows(session.id)
147-
p_res.refresh_windows(session.id)
148-
p_mtr.refresh_windows(session.id)
149-
p_mbr.refresh_windows(session.id)
150-
151-
152-
def auto_refersh_call_back_time_step(session, event_info):
153-
p_res.refresh_windows(session.id)
154-
155-
156-
def initialize_call_back(session, event_info):
157-
p_res.refresh_windows(session.id)
158-
p_mtr.refresh_windows(session.id)
159-
160-
161-
cb_init_id = session.events.register_callback("InitializedEvent", initialize_call_back)
162-
cb_data_read_id = session.events.register_callback(
163-
"DataReadEvent", initialize_call_back
144+
p_res.real_time_update(
145+
events=[SolverEvent.SOLUTION_INITIALIZED, SolverEvent.ITERATION_ENDED]
146+
)
147+
p_mtr.real_time_update(
148+
events=[SolverEvent.SOLUTION_INITIALIZED, SolverEvent.ITERATION_ENDED]
149+
)
150+
p_mbr.real_time_update(
151+
events=[SolverEvent.SOLUTION_INITIALIZED, SolverEvent.ITERATION_ENDED]
164152
)
165-
cb_itr_id = session.events.register_callback(
166-
"IterationEndedEvent", auto_refersh_call_back_iteration
153+
p_cont.real_time_update(
154+
events=[SolverEvent.SOLUTION_INITIALIZED, SolverEvent.ITERATION_ENDED]
167155
)
168156

169-
p_cont.animate_windows(session.id)
157+
session.settings.solution.initialization.hybrid_initialize()
158+
session.settings.solution.run_calculation.iterate(iter_count=50)

0 commit comments

Comments
 (0)