Three options to generate a contour plot with the requested minimum and maximum values.
In Ansys Mechanical, during structural analysis, the scale in contour plots automatically shows the maximum and minimum values for the selected bodies. However, adjusting the scale is sometimes necessary to focus on specific ranges and gain deeper insights into the results. There are some options to do it and presented in this blog.
.
Case Study - Consider the body of a gate valve, as shown below. The planar surfaces at both ends have Frictionless Support, allowing displacement along each plane. Additionally, the cylindrical surfaces of the holes have Cylindrical Support, permitting free displacement only in the tangential direction. Finally, the body is subjected to an internal pressure of 4 MPa.
The Von Mises stress contours are displayed as follows (section view):
.
But what if the user is interested in evaluating the range between 20 and 50 MPa? Let's apply the three methods to do it.
.
1. Modify the scale by adding the desired range
Click on both locations highlighted in pink and enter the upper and lower limits of the range. The internal boundaries of each color band will be calculated automatically.
Now add or reduce the number of colour bands. Here is an example with only one band showing the results in the specified range (highlighted in green):
.
A similar result can be achieved by selecting the following option. The difference lies in the non-conventional colors at both ends of the legend. Right-click on the legend > Independent Bands > Top and Bottom. To revert the changes, click on 'Reset All' (the last option on the list).
.
2. Create a Capped Isosurface
This option shows the color bands, a) for an specific value, b) between the automatic minimum to the specified value, and c) from the automatic maximum to the specified value. See the image below with 'Iso', 'Top' and 'Bottom' (right). Follow this path: Results Tab > Display > Geometry > Capped Isosurface. Then, you will see the options on the right-hand side of the screen.
In this example (option b), the results can be visualized up to the specified value of 30 MPa. See the color bands on the left to verify it (three colors on the results): .
3. Using a provided Script
In this method the legend will show color bands only within the specified range. Go to the Automation Tab > Mechanical > Scripting. The 'Mechanical Scripting' window will open on the right-hand side of the screen.
Copy and paste the following lines. Just change the min and max values you want, and the units as well. In this example, the expected range is between 20 and 50 MPa:
.
legendSettings = Ansys.Mechanical.Graphics.Tools.LegendSettings("MPa")
legendSettings.SetMinMax(Quantity(20,'MPa'),Quantity(50,'MPa'))
legendSettings.CopyTo(Ansys.Mechanical.Graphics.Tools.CurrentLegendSettings())
.
.
Run the Script by clicking on the icon highlighted in red as shown above. Now the contour plot changes as follows:
.
Now you're ready to dive deeper into postprocessing your simulations in Ansys Mechanical! Armed with these techniques, you can extract valuable insights from your results and make informed engineering decisions. Happy analyzing!