Skip to content

Commit e72c343

Browse files
authored
Refactoring examples to not use pyvista library for all the examples and keep pyvista only for postprocessing example (#457)
1 parent cc530df commit e72c343

File tree

8 files changed

+14
-130
lines changed

8 files changed

+14
-130
lines changed

doc/source/_static/DP_table.png

48.7 KB
Loading
768 KB
Loading
218 KB
Loading

examples/00-fluent/exhaust_system.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
unlike the watertight workflow used in Fluid Flow in a Mixing Elbow, is
1111
appropriate for geometries with imperfections, such as gaps and leakages.
1212
13-
End-to-end Fault Tolerant Meshing Workflow example:
13+
End-to-end Fault Tolerant Meshing Workflow example
1414
1515
- Use the Fault-tolerant Meshing guided workflow to:
1616
- Import a CAD geometry and manage individual parts
@@ -34,6 +34,8 @@
3434
to demonstrate the automatic leakage detection aspects of the meshing workflow.
3535
"""
3636

37+
# sphinx_gallery_thumbnail_path = '_static/exhaust_system.png'
38+
3739
###############################################################################
3840
# First, download the geometry file and start Fluent as a service with
3941
# Meshing Mode, Double Precision, Number of Processors 2

examples/00-fluent/mixing_elbow.py

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
temperature field in the area of the mixing region in order to properly design
1010
the junction.
1111
12-
End-to-end Watertight Meshing Workflow example:
12+
End-to-end Watertight Meshing Workflow example
1313
1414
- Use the Watertight Geometry guided workflow to:
1515
- Import a CAD geometry
@@ -33,17 +33,14 @@
3333
boundary conditions are given in SI units. The Reynolds number for the flow at
3434
the larger inlet is 50, 800, so a turbulent flow model will be required.
3535
"""
36+
# sphinx_gallery_thumbnail_path = '_static/mixing_elbow.png'
3637

3738
###############################################################################
3839
# First, download the geometry file and start Fluent as a service with
3940
# Meshing Mode, Double Precision, Number of Processors 2
4041

4142
import ansys.fluent.core as pyfluent
4243
from ansys.fluent.core import examples
43-
from ansys.fluent.post import set_config
44-
from ansys.fluent.post.pyvista import Graphics
45-
46-
set_config(blocking=True, set_view_on_display="isometric")
4744

4845
import_filename = examples.download_file("mixing_elbow.pmdb", "pyfluent/mixing_elbow")
4946

@@ -346,21 +343,6 @@
346343
# Solve for 100 Iterations.
347344
session.solver.tui.solve.iterate(100)
348345

349-
###############################################################################
350-
# Examine the mass flux report for convergence: Select cold-inlet, hot-inlet,
351-
# and outlet from the Boundaries selection list.
352-
353-
# session.solver.tui.report.fluxes.mass_flow(
354-
# "no",
355-
# "cold-inlet",
356-
# "hot-inlet",
357-
# "outlet",
358-
# "()",
359-
# "yes",
360-
# "mass-flux1.flp",
361-
# )
362-
363-
364346
###############################################################################
365347
# Save the data file (mixing_elbow1.dat.h5).
366348
# session.solver.tui.file.write_data('mixing_elbow1.dat.h5')
@@ -371,7 +353,6 @@
371353
# Provide contour-vel for Contour Name. Select velocity magnitude. Select
372354
# symmetry-xyplane from the Surfaces list. Display contour-vel contour.
373355

374-
375356
session.solver.tui.display.objects.create(
376357
"contour",
377358
"contour-vel",
@@ -436,7 +417,7 @@
436417
"2",
437418
"quit",
438419
)
439-
# session.solver.tui.display.objects.display("vector-vel")
420+
# session.solver.tui.display.objects.display("vector")
440421

441422
###############################################################################
442423
# Create an iso-surface representing the intersection of the plane z=0 and the
@@ -458,59 +439,6 @@
458439
"()",
459440
"quit",
460441
)
461-
# session.solver.tui.display.objects.display("xy-outlet-temp")
462-
# session.solver.tui.plot.plot(
463-
# "yes",
464-
# "temp-1.xy",
465-
# "no",
466-
# "no",
467-
# "no",
468-
# "temperature",
469-
# "yes",
470-
# "1",
471-
# "0",
472-
# "0",
473-
# "z=0_outlet",
474-
# "()",
475-
# )
476-
#
477-
478-
###############################################################################
479-
# Mesh display using PyVista
480-
481-
graphics_session = Graphics(session)
482-
mesh_1 = graphics_session.Meshes["mesh-1"]
483-
mesh_1.show_edges = True
484-
mesh_1.surfaces_list = [
485-
"cold-inlet",
486-
"hot-inlet",
487-
"wall-elbow",
488-
"wall-inlet",
489-
"symmetry-xyplane",
490-
"outlet",
491-
]
492-
493-
mesh_1.display()
494-
495-
###############################################################################
496-
# Temperature Contour display using PyVista
497-
498-
# contour_1 = graphics_session.Contours["contour_1"]
499-
# contour_1.field = "temperature"
500-
# contour_1.surfaces_list = [
501-
# "symmetry-xyplane"
502-
# ]
503-
# contour_1.display()
504-
505-
###############################################################################
506-
# Velocity Magnitude Contour display using PyVista
507-
508-
# contour_2 = graphics_session.Contours["contour_2"]
509-
# contour_2.field = "velocity-magnitude"
510-
# contour_2.surfaces_list = [
511-
# "symmetry-xyplane"
512-
# ]
513-
# contour_2.display()
514442

515443
###############################################################################
516444
# Write final case and data.
@@ -521,5 +449,4 @@
521449

522450
session.exit()
523451

524-
525452
###############################################################################

examples/00-fluent/mixing_elbow_settings_api.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
temperature field in the area of the mixing region in order to properly design
1010
the junction.
1111
12-
This example demonstrates use of 'settings' modules (Beta):
12+
This example demonstrates use of 'settings' modules (Beta)
1313
1414
- Launch Ansys Fluent
1515
- Import Mesh
@@ -18,7 +18,6 @@
1818
- Setup Boundary Conditions
1919
- Iniialize and Solve
2020
- Compute Mass Flow Rate and Temperature
21-
- Display Mesh and Contour using PyVista
2221
2322
Problem Description:
2423
A cold fluid at 20 deg C flows into the pipe through a large inlet, and mixes
@@ -27,18 +26,13 @@
2726
boundary conditions are given in SI units. The Reynolds number for the flow at
2827
the larger inlet is 50, 800, so a turbulent flow model will be required.
2928
"""
30-
# sphinx_gallery_thumbnail_number = 2
3129

3230
###############################################################################
3331
# First, download the mesh file and start Fluent as a service with
3432
# Solver Mode, Double Precision, Number of Processors 2
3533

3634
import ansys.fluent.core as pyfluent
3735
from ansys.fluent.core import examples
38-
from ansys.fluent.post import set_config
39-
from ansys.fluent.post.pyvista import Graphics
40-
41-
set_config(blocking=True, set_view_on_display="isometric")
4236

4337
import_filename = examples.download_file("mixing_elbow.msh.h5", "pyfluent/mixing_elbow")
4438

@@ -196,31 +190,6 @@
196190
session.solver.root.solution.report_definitions.flux["mass_flow_rate"].print_state()
197191
session.solver.root.solution.report_definitions.compute(report_defs=["mass_flow_rate"])
198192

199-
###############################################################################
200-
# Mesh display using PyVista
201-
202-
graphics_session = Graphics(session)
203-
mesh_1 = graphics_session.Meshes["mesh-1"]
204-
mesh_1.show_edges = True
205-
mesh_1.surfaces_list = [
206-
"cold-inlet",
207-
"hot-inlet",
208-
"wall-elbow",
209-
"wall-inlet",
210-
"symmetry-xyplane",
211-
"outlet",
212-
]
213-
214-
mesh_1.display()
215-
216-
###############################################################################
217-
# Temperature Contour display using PyVista
218-
219-
contour_1 = graphics_session.Contours["contour_1"]
220-
contour_1.field = "temperature"
221-
contour_1.surfaces_list = ["symmetry-xyplane"]
222-
contour_1.display()
223-
224193
###############################################################################
225194
# Write final case and data.
226195
# session.solver.tui.file.write_case_data('mixing_elbow2_set.cas.h5')

examples/01-parametric/parametric_static_mixer_1.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
33
Parametric Study Workflow
44
------------------------------
5-
This parametric study workflow example performs these steps:
5+
6+
This parametric study workflow example performs these steps
67
78
- Reads a case file and data file
89
- Creates input and output parameters
@@ -13,6 +14,7 @@
1314
- Creates, updates, and deletes more DPs
1415
- Creates, renames, duplicates and deletes parametric studies
1516
"""
17+
# sphinx_gallery_thumbnail_path = '_static/DP_table.png'
1618

1719
############################################################################
1820
from pathlib import Path
@@ -21,7 +23,6 @@
2123
from ansys.fluent.core import examples
2224
from ansys.fluent.parametric import ParametricProject, ParametricStudy
2325
from ansys.fluent.post import set_config
24-
from ansys.fluent.post.pyvista import Graphics
2526

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

@@ -146,21 +147,6 @@
146147

147148
study_1.update_all_design_points()
148149

149-
#########################################################################
150-
# Mesh display using PyVista
151-
152-
graphics_session = Graphics(session)
153-
mesh_1 = graphics_session.Meshes["mesh-1"]
154-
mesh_1.show_edges = True
155-
mesh_1.surfaces_list = [
156-
"inlet1",
157-
"inlet2",
158-
"wall",
159-
"outlet",
160-
]
161-
162-
mesh_1.display()
163-
164150
###############################################################################
165151
# Export design point table as a CSV table
166152

examples/02-postprocessing/post_processing_exhaust_manifold.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
The flow through the manifold is turbulent and
99
involves conjugate heat transfer.
1010
11-
This example demonstrates postprocessing using pyvista:
11+
This example demonstrates postprocessing using pyvista
1212
1313
- Create surfaces for the display of 3D data.
1414
- Display filled contours of temperature on several surfaces.
1515
- Display velocity vectors.
1616
- Plot quantitative results using Matplotlib
1717
"""
18-
# sphinx_gallery_thumbnail_number = -1
18+
# sphinx_gallery_thumbnail_number = -3
1919

2020
###############################################################################
2121
import ansys.fluent.core as pyfluent
@@ -127,8 +127,8 @@
127127
# Currently using outlet-plane since mid-plane is affected by Issue # 276
128128

129129
velocity_vector = graphics.Vectors["velocity-vector"]
130-
velocity_vector.surfaces_list = ["outlet-plane"]
131-
velocity_vector.scale = 1
130+
velocity_vector.surfaces_list = ["solid_up:1:830"]
131+
velocity_vector.scale = 2
132132
velocity_vector.display("window-6")
133133

134134
###############################################################################

0 commit comments

Comments
 (0)