Introduction
In a previous article, we detailed the process of extracting reaction forces for all bolted connections within an Ansys Mechanical Static/Transient Structural, Random Vibration and/or Response Spectrum analysis. He, we discuss how to do the same for jointed connections using a Python Code results object, which is useful for Random Vibration/Response Spectrum analyses as no Joint Probe results object is available.
Example Model
To illustrate the process of extracting joint reactions, we have a sample model that utilizes one Bushing Joint, one General Joint and one Beam Connection to connect two brackets together. Here, we reoriented the joint reference coordinate systems in order to show that the resulting force/moment reactions resolve w.r.t. the joint reference coordinate system. We apply a force in an arbitrary direction in order to achieve moments in all directions; not shown in the image below is a fixed support on the bottom face of the flat bracket.
Python Code Results Object
To output the force/moment reaction results, a Mechanical script can be used but must be manually executed. An automated way to output the results every time the solution is run is to use a Python Code results object with "After Post" Target Callback. To insert the Python Code object, simply right-click on Solution and select Insert -> Python Code. Then, copy and paste the downloadable code into the Python Code window.
Target Callback
Setting the target callback instructs Mechanical as to when it should execute the Python Code results object. The appropriate Target Callback is "After Post" as we want to read the results file and extract the results without needing to trigger another solve. This is similar to adding an APDL Command Snippet and then selecting "Execute Post Commands" after the solution is complete. In the image below, we see the Target Callback setting for the Python Code object:
User-Defined Choice of Units
Within the code, we have the ability to select the desired output units for length and force from which derived units will be consistent. The lines bracketed in red allow the user to enter in string values for the desired length and force units. NOTE: These units are case-sensitive and must be abbreviations that Ansys Mechanical understands; details can be found in Mechanical help.
Connect and Evaluate Results
After initially creating the Python Code object, or once any changes are made to it, one must "Connect" the Python Code object to Mechanical by right-clicking on it and selecting "Connect". In the image below we see that this one needs to be connected.
Once the object is connected, then we see that it needs to be evaluated, indicated by having a yellow lightning bolt next to it as shown here:
Finally, Evaluate All Results and the Python Code object will be executed.
Results Comparison
Upon execution, the Python Code results object writes a file to the user_files directory of the Workbench project which is named after the analysis system type and name. A snapshot of the results for the Static Structural system are shown in the image below with the end time results highlighted in yellow:
The following images show the reaction force and moment for the bushing, noting that the spreadsheet data from the Python Code results object matches those of the results probes:
![]() |
![]() |
![]() |
![]() |
Conclusion
In conclusion, we introduced a Python Code results object that retrieves the force and moment results from the results file and outputs the results to a spreadsheet file in the user_files directory of the Workbench project. The example problem showed the process in action for a Static Structural system, however the same code works for Random Vibration and Response Spectrum analyses where reaction probes are not available.
Downloadable Resources
Python scripts for Joint and Beam Reactions
Ozen Engineering Inc. leverages it's extensive consulting expertise in CFD, FEA, thermal, optics, photonics, and electromagnetic simulations to achieve exceptional results across various engineering projects, addressing complex challenges like multiphase flows, erosion modeling, and channel flows using Ansys software. |
|
May 20, 2025 10:27:16 AM