@@ -6,41 +6,39 @@ Visualization
66Postprocessing of Fluent results can be done with either built-in Fluent
77postprocessing capabilities, PyVista, or Matplotlib integration.
88
9- Fluent TUI command example
10- --------------------------
9+ Fluent command example
10+ ----------------------
1111
1212Here visualization objects are constructed within Fluent. You can use
1313standard Fluent commands to write graphics to a file.
1414
1515.. code :: python
1616
17- 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' : [2 , 5 ]}
18- solver_session.tui.display.objects .contour[' contour-1' ]()
19- solver_session.tui.display.objects .contour[' contour-1' ].field.set_state( ' velocity-magnitude' )
20- solver_session.tui.display.objects .contour[' contour-1' ].field()
21- solver_session.tui.display.objects .contour[' contour-1' ].color_map.size.set_state(80.0 )
22- solver_session.tui.display.objects .contour[' contour-1' ].color_map.size()
23- solver_session.tui.display.objects .contour[' contour-1' ].rename(' my-contour' )
24- del solver_session.tui.display.objects .contour[' my-contour' ]
17+ solver_session.settings.results.graphics .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' : [2 , 5 ]}
18+ solver_session.settings.results.graphics .contour[' contour-1' ]()
19+ solver_session.settings.results.graphics .contour[' contour-1' ].field = ' velocity-magnitude'
20+ solver_session.settings.results.graphics .contour[' contour-1' ].field()
21+ solver_session.settings.results.graphics .contour[' contour-1' ].color_map.size.set_state(80.0 )
22+ solver_session.settings.results.graphics .contour[' contour-1' ].color_map.size()
23+ solver_session.settings.results.graphics .contour[' contour-1' ].rename(' my-contour' )
24+ del solver_session.settings.results.graphics .contour[ ' contour-1 ' ] [' my-contour' ]
2525
26- PyVista example (graphics)
27- --------------------------
26+ Visualization example (graphics)
27+ --------------------------------
2828
2929Here field data is extracted from the Fluent session into the Python
30- environment. PyVista is then used to visualize the extracted data.
30+ environment. Visualization is then used to visualize the extracted data.
3131
3232.. code :: python
3333
3434 # import module
35- from ansys.fluent.visualization import Graphics
35+ from ansys.fluent.visualization import GraphicsWindow, Mesh, Contour, Surface
3636
3737 # get the graphics objects for the session
38-
39- graphics_session1 = Graphics(solver_session)
40- mesh1 = graphics_session1.Meshes[" mesh-1" ]
41- contour1 = graphics_session1.Contours[" contour-1" ]
42- contour2 = graphics_session1.Contours[" contour-2" ]
43- surface1 = graphics_session1.Surfaces[" surface-1" ]
38+ mesh1 = Mesh(solver = solver_session)
39+ contour1 = Contour(solver = solver_session)
40+ contour2 = Contour(solver = solver_session)
41+ surface1 = Surface(solver = solver_session)
4442
4543 # set graphics objects properties
4644
@@ -55,55 +53,41 @@ environment. PyVista is then used to visualize the extracted data.
5553 contour2.field = " temperature"
5654 contour2.surfaces = [' symmetry' , ' wall' ]
5755
58- # copy
59- graphics_session1.Contours[" contour-3" ] = contour2()
60-
61- # update
62- contour3 = graphics_session1.Contours[" contour-3" ]
63- contour3.update(contour1())
64-
65- # delete
66- del graphics_session1.Contours[" contour-3" ]
67-
68- # loop
69- for name, _ in graphics_session1.Contours.items():
70- print (name)
71-
7256 # iso surface
73- surface1.surface.iso_surface.field= " velocity-magnitude"
74- surface1.surface.iso_surface.rendering= " contour"
75-
76- # display
77- contour1.display()
78- mesh1.display()
79- surface1.display()
57+ surface1.definition.type = " iso-surface"
58+ surface1.definition.iso_surface.field= " velocity-magnitude"
59+ surface1.definition.iso_surface.rendering= " contour"
60+
61+ # display
62+ plotter = GraphicsWindow(grid = (2 , 2 ))
63+ plotter.add_graphics(mesh1, position = (0 , 0 ))
64+ plotter.add_graphics(contour1, position = (0 , 1 ))
65+ plotter.add_graphics(contour2, position = (1 , 0 ))
66+ plotter.add_graphics(surface1, position = (1 , 1 ))
67+ plotter.show()
8068
81- # To display in specific window e.g. window-2
82- contour1.display(" window-2" )
83-
84- Matplotlib example (XY plots)
85- -----------------------------
69+ Visualization example (XY plots)
70+ --------------------------------
8671
8772Here plot data is extracted from the Fluent session into the Python
88- environment. Matplotlib is then used to plot data.
73+ environment. Visualization is then used to plot data.
8974
9075.. code :: python
9176
9277 # import module
93- from ansys.fluent.visualization import Plots
78+ from ansys.fluent.visualization import XYPlot
9479
9580 # get the plots object for the session
96- plots_session1 = Plots(solver_session)
97-
98- # get xyplot object
99- plot1= plots_session1.XYPlots[" plot-1" ]
81+ plots_session1 = XYPlot(solver = solver_session)
10082
10183 # set properties
102- plot1 .surfaces = [" symmetry" ]
103- plot1 .y_axis_function = " temperature"
84+ plots_session1 .surfaces = [" symmetry" ]
85+ plots_session1 .y_axis_function = " temperature"
10486
10587 # Draw plot
106- plot1.plot(" window-1" )
88+ plotter = GraphicsWindow()
89+ plotter.add_graphics(plots_session1)
90+ plotter.show()
10791
10892 solver_session.exit()
10993
0 commit comments