From 22781fc55f622e7ea1b538014c60f3ce5d8565cf Mon Sep 17 00:00:00 2001 From: Yogesh Patel Date: Wed, 29 Jun 2022 23:00:44 -0400 Subject: [PATCH 1/5] Adding residual plotting --- .../post_processing_exhaust_manifold.py | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/examples/00-postprocessing/post_processing_exhaust_manifold.py b/examples/00-postprocessing/post_processing_exhaust_manifold.py index ca5babf9..cbd48c8f 100644 --- a/examples/00-postprocessing/post_processing_exhaust_manifold.py +++ b/examples/00-postprocessing/post_processing_exhaust_manifold.py @@ -55,10 +55,9 @@ mesh1 = graphics.Meshes["mesh-1"] ############################################################################### -# Show edges and faces +# Show edges mesh1.show_edges = True -mesh1.show_faces = True ############################################################################### # Get the surfaces list @@ -91,7 +90,7 @@ surf_outlet_plane.display("window-3") ############################################################################### -# Create iso-surface on the mid-plane (Issue # 276) +# Create iso-surface on the mid-plane surf_mid_plane_x = graphics.Surfaces["mid-plane-x"] surf_mid_plane_x.surface.type = "iso-surface" @@ -100,6 +99,17 @@ iso_surf2.iso_value = -0.174 surf_mid_plane_x.display("window-4") +############################################################################### +# Create iso-surface using the velocity magnitude + +surf_vel_contour = graphics.Surfaces["surf-vel-contour"] +surf_vel_contour.surface.type = "iso-surface" +iso_surf3 = surf_vel_contour.surface.iso_surface +iso_surf3.field = "velocity-magnitude" +iso_surf3.rendering = "contour" +iso_surf3.iso_value = 0.0 +surf_vel_contour.display("window-5") + ############################################################################### # Temperature contour on the mid-plane and the outlet @@ -150,7 +160,16 @@ # Plot the created XY-Plot plot_1.plot("window-7") -######################################################################### +############################################################################### +# Plot residual + +local_surfaces_provider = Graphics(session).Surfaces +matplotlib_plots1 = Plots(session, local_surfaces_provider=local_surfaces_provider) +session.monitors_manager.get_monitor_set_names() +residual = matplotlib_plots1.Monitors["residual"] +residual.monitor_set_name = "residual" +residual.plot("window-8") + # Close Fluent session.exit() From 70c1af76e2fc934d20f09839b3455e24e7732aad Mon Sep 17 00:00:00 2001 From: Yogesh Patel Date: Thu, 30 Jun 2022 00:06:33 -0400 Subject: [PATCH 2/5] Adding residual plotting to the users guide --- doc/source/users_guide/postprocessing.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/source/users_guide/postprocessing.rst b/doc/source/users_guide/postprocessing.rst index da29ecb7..76daac97 100644 --- a/doc/source/users_guide/postprocessing.rst +++ b/doc/source/users_guide/postprocessing.rst @@ -104,4 +104,17 @@ The following example demonstrates how you can display the xy plot: plot_1 = plots_session_1.XYPlots["plot-1"] plot_1.surfaces_list = ["outlet"] plot_1.y_axis_function = "temperature" - plot_1.plot("window-5") \ No newline at end of file + plot_1.plot("window-5") + +Plotting Residual +~~~~~~~~~~~~~~~~~ +The following example demonstrates how you can plot solution residual: + +.. code:: python + + local_surfaces_provider = Graphics(session).Surfaces + matplotlib_plots1 = Plots(session, local_surfaces_provider=local_surfaces_provider) + session.monitors_manager.get_monitor_set_names() + residual = matplotlib_plots1.Monitors["residual"] + residual.monitor_set_name = "residual" + residual.plot("window-6") \ No newline at end of file From 2cf8dc7471b361338121fa405d2678cde0f1350e Mon Sep 17 00:00:00 2001 From: Yogesh Patel Date: Thu, 30 Jun 2022 08:20:20 -0400 Subject: [PATCH 3/5] Development feedback for residual --- doc/source/users_guide/postprocessing.rst | 13 ++++++------- .../post_processing_exhaust_manifold.py | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/doc/source/users_guide/postprocessing.rst b/doc/source/users_guide/postprocessing.rst index 76daac97..5769a499 100644 --- a/doc/source/users_guide/postprocessing.rst +++ b/doc/source/users_guide/postprocessing.rst @@ -101,10 +101,10 @@ The following example demonstrates how you can display the xy plot: .. code:: python plots_session_1 = Plots(session) - plot_1 = plots_session_1.XYPlots["plot-1"] - plot_1.surfaces_list = ["outlet"] - plot_1.y_axis_function = "temperature" - plot_1.plot("window-5") + xy_plot = plots_session_1.XYPlots["xy-plot"] + xy_plot.surfaces_list = ["outlet"] + xy_plot.y_axis_function = "temperature" + xy_plot.plot("window-5") Plotting Residual ~~~~~~~~~~~~~~~~~ @@ -112,9 +112,8 @@ The following example demonstrates how you can plot solution residual: .. code:: python - local_surfaces_provider = Graphics(session).Surfaces - matplotlib_plots1 = Plots(session, local_surfaces_provider=local_surfaces_provider) - session.monitors_manager.get_monitor_set_names() + + matplotlib_plots1 = Plots(session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" residual.plot("window-6") \ No newline at end of file diff --git a/examples/00-postprocessing/post_processing_exhaust_manifold.py b/examples/00-postprocessing/post_processing_exhaust_manifold.py index cbd48c8f..e49f2715 100644 --- a/examples/00-postprocessing/post_processing_exhaust_manifold.py +++ b/examples/00-postprocessing/post_processing_exhaust_manifold.py @@ -149,23 +149,21 @@ ############################################################################### # Create a default XY-Plot -plot_1 = plots_session_1.XYPlots["plot-1"] +xy_plot = plots_session_1.XYPlots["xy-plot"] ############################################################################### # Set the surface on which the plot is plotted and the Y-axis function -plot_1.surfaces_list = ["outlet"] -plot_1.y_axis_function = "temperature" +xy_plot.surfaces_list = ["outlet"] +xy_plot.y_axis_function = "temperature" ############################################################################### # Plot the created XY-Plot -plot_1.plot("window-7") +xy_plot.plot("window-7") ############################################################################### # Plot residual -local_surfaces_provider = Graphics(session).Surfaces -matplotlib_plots1 = Plots(session, local_surfaces_provider=local_surfaces_provider) -session.monitors_manager.get_monitor_set_names() +matplotlib_plots1 = Plots(session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" residual.plot("window-8") From 0af1318ec00bfef118b4374464694550fb8e1800 Mon Sep 17 00:00:00 2001 From: Yogesh Patel Date: Thu, 30 Jun 2022 11:05:48 -0400 Subject: [PATCH 4/5] Adding solution monitors in the example --- doc/source/users_guide/postprocessing.rst | 16 ++++++++++++++- .../post_processing_exhaust_manifold.py | 20 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/source/users_guide/postprocessing.rst b/doc/source/users_guide/postprocessing.rst index 5769a499..e5cffc44 100644 --- a/doc/source/users_guide/postprocessing.rst +++ b/doc/source/users_guide/postprocessing.rst @@ -116,4 +116,18 @@ The following example demonstrates how you can plot solution residual: matplotlib_plots1 = Plots(session) residual = matplotlib_plots1.Monitors["residual"] residual.monitor_set_name = "residual" - residual.plot("window-6") \ No newline at end of file + residual.plot("window-6") + +Solve and Plot Solution Minitors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. 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) + mass_bal_rplot = matplotlib_plots1.Monitors["mass-bal-rplot"] + mass_bal_rplot.monitor_set_name = "mass-bal-rplot" + mass_bal_rplot.plot("window-7") \ No newline at end of file diff --git a/examples/00-postprocessing/post_processing_exhaust_manifold.py b/examples/00-postprocessing/post_processing_exhaust_manifold.py index e49f2715..a5e9b67a 100644 --- a/examples/00-postprocessing/post_processing_exhaust_manifold.py +++ b/examples/00-postprocessing/post_processing_exhaust_manifold.py @@ -15,7 +15,7 @@ - Display velocity vectors. - Plot quantitative results using Matplotlib """ -# sphinx_gallery_thumbnail_number = -3 +# sphinx_gallery_thumbnail_number = -5 ############################################################################### import ansys.fluent.core as pyfluent @@ -168,6 +168,24 @@ residual.monitor_set_name = "residual" residual.plot("window-8") +############################################################################### +# Solve and Plot Solution Minitors. + +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) +mass_bal_rplot = matplotlib_plots1.Monitors["mass-bal-rplot"] +mass_bal_rplot.monitor_set_name = "mass-bal-rplot" +mass_bal_rplot.plot("window-9") + +matplotlib_plots1 = Plots(session) +point_vel_rplot = matplotlib_plots1.Monitors["point-vel-rplot"] +point_vel_rplot.monitor_set_name = "point-vel-rplot" +point_vel_rplot.plot("window-10") + +############################################################################### # Close Fluent session.exit() From 474ed8260a3cc1c50bc6733b396d6af68da0d408 Mon Sep 17 00:00:00 2001 From: Yogesh Patel Date: Thu, 30 Jun 2022 11:08:53 -0400 Subject: [PATCH 5/5] Adding solution monitors in the users guide --- doc/source/users_guide/postprocessing.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/users_guide/postprocessing.rst b/doc/source/users_guide/postprocessing.rst index e5cffc44..9584286e 100644 --- a/doc/source/users_guide/postprocessing.rst +++ b/doc/source/users_guide/postprocessing.rst @@ -118,8 +118,9 @@ The following example demonstrates how you can plot solution residual: residual.monitor_set_name = "residual" residual.plot("window-6") -Solve and Plot Solution Minitors -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Plotting Solution Minitors +~~~~~~~~~~~~~~~~~~~~~~~~~~ +The following example demonstrates how you can plot solution monitors: .. code:: python