Introduction
Joints defined by bolted connections are very prevalent in industrial applications. Analyzing them in Ansys Mechanical FEA is a very common practice. Generating bolted connections in Ansys Mechanical is very easy using beam elements from line bodies, beam connections, or even 3D solid bodies via the Object Generator or Bolt Tools Add-on. The same can be said for the Bolt Pretension objects that define the preload character of the bolted connections. However, creating a Bolt Tool for postprocessing a Bolt Pretension is a manual process that can become very tedious should the number of bolted connections become even moderately large. In this article we will discuss how Ansys Mechanical scripting using Python can automate the creation and organization of the Bolt Tools used in postprocessing.
FE Model
The following example model contains eight bolts, each of which has a different topology, but only seven of them have defined Bolt Pretension objects; the eighth bolt uses an APDL command to pretension the bolt.
Typically for simulations with Bolt Pretension objects, the analysis is set to run for two preload steps before the environmental loads are applied:
- Apply the bolt preload.
- Lock the bolt preload in place and let the model stabilize.
How to Run the Script
Once the script is generated, it is a simple matter to apply it to any Ansys Mechanical model that has Bolt Pretension objects therein. From within the Automation ribbon, select Scripting which will open a script window on the side of the graphics window.
In the scripting window, select the Open Script icon and browse to the python script file as shown here:
After the script is opened for the first time, Mechanical will open it again each time the Scripting environment is launched. Additionally, the scripting area has a tabbed file list so that one's favorite (pre-opened) scripts will be easily accessible. To run the script, push the Run Script button, circled in red below, or use the Ctrl-F5 keyboard shortcut:
Result of Running the Script
The result of running the script is manifold. For each Bolt Pretension object,
- A Bolt Tool for postprocessing is created and renamed using the same name as the corresponding Bolt Pretension object.
- The Bolt Tool is scoped only the particular Bolt Pretension object.
- The Adjustment and Working Load results are generated for each time step in the analysis.
Finally, after all Bolt Tools are created, they are grouped into a folder. The result for the example model is shown here, where one of the Bolt Tools is expanded to show the results:
Conclusion
This article shows how easy it is to automate tedious tasks by using Python scripting from within Ansys Mechanical. Although the example model only had seven Bolt Tools to create, manual creation would have taken several minutes, whereas it took only seconds by using a script. The script that generated these Bolt Tools can be applied either before or after the solution, and if one were to add several more Bolt Pretension objects, one could re-run the script to recreate the Bolt Tools and then delete the redundant Bolt Tools folder as a group. This shows that Python scripting in Ansys Mechanical is a very powerful tool for automation and will save time when performing redundant tasks from model to model.
Going Further
- Automate other tasks using Ansys Mechanical scripting and PyAnsys.
- Learn more about Ansys scripting through a PyAnsys course on the Ansys Learning Hub or the Ansys Innovation Space.
Downloadable Resources
Tags:
Python, Scripting, Static Structural, Bolt, ANSYS Mechanical, PyANSYS, PyDPF, Pretension, Bolt Tool, PostprocessingAugust 12, 2024