Introduction
Random Vibration simulations are often used to assess an assembly's ability to withstand the vibrations in transportation. A Random Vibration analysis utilizes frequency and mode content from a preceding Modal analysis to perform a linear superposition over a spectrum of frequencies and power content defined via a Power Spectral Density (PSD) load. In most assembly models, bolted connections (that become BEAM188 elements by the solver) are typically used in place of 3D solid-meshed bolts in order to drive computational efficiency; in most analysis systems, i.e., Static or Transient Structural, Beam Probes are available to postprocess the reactions and stresses in Beam Connections. (In a previous article, we detailed how the Bolt Tools Add-On in Ansys Mechanical can be used to extract such reactions and stresses.) However, Beam Probes are not available to postprocess Beam Connection reactions and stresses from within a Random Vibration analysis. In this article, we will explain how PyAnsys DPF, from within Ansys Mechanical, is able to retrieve these items from the results file and export the results to a CSV file.
Case Study
In a previous article, we investigated how to automatically create equivalent stress results objects using Python from within Mechanical for a simple bolted flange assembly.
Here, we will extend our analysis of the same bolted flange assembly with a Random Vibration analysis using the vertical PSD from MIL-STD-810H for common carrier US highway truck vibration:
Scripting Algorithm
In order to retrieve the results, we will utilize the Ansys Python Data Processing Framework (DPF) from within Ansys Mechanical (implemented in version 2024 R2). Pseudocode of the algorithm, typical of a DPF script, is as follows:
- Enter analysis numbers for which the script will extract results by editing the analysisNumbers list.
- Note: The script can also retrieve the results for Static and Transient Structural analyses if desired.
- Define desired length and force units for the output.
- Retrieve solver data, analysis type and solver units from the results file.
- Create a dpf.DataSources object (data source) connected to the results file.
- From the data source, read information about all results sets, i.e., number and time.
- Create a mesh operator and read the mesh data.
- Define a time scoping operator.
- Read in all materials and associated properties. If elastic modulus is available, place material name with the modulus in a dictionary.
- Get all beam connection IDs and the associated element IDs (which differ).
- For each beam connection, create a dictionary to store all properties and
- Read the coordinates of each end node and compute the length.
- Read the material and radius, then compute the area and moments of inertia.
- Create a SMISC results operator to retrieve the force and moment at each node of each BEAM188 element, i.e., Beam Connection.
- Connect the data source, time scoping and mesh scoping to the SMISC operator.
- Use DPF functions to convert force and moment results to the desired units.
- Compute the direct stress, bending stress, torsional stress, equivalent stress and combined stress using standard formulas.
- Add computed results to the results dictionary and write to file.
- The file will be stored in the user_files folder within the Workbench project and will be named and date-stamped according to the analysis type and name.
Resulting Output
After running the script, the files are stored in the user_files folder as shown here:
For a Random Vibration analysis, multiple result sets are output, but only results set = 2 has useful information: the 1-sigma level results. Thus, one will simply filter the Set column = 2 to get the desired results. A snippet of the resulting CSV file is shown here (with more columns to right not shown):
Conclusion
The (Ansys 2024 R2) script that was demonstrated in this article provides an automated way to obtain reaction and stress results for Beam Connections that are not available in the Ansys Mechanical GUI for Random Vibration analyses. Additionally, the same script can obtain the results for Static and Transient Structural analysis systems. Using standard formulae, the stress resultants are also computed and included in the CSV output file. In conclusion, utilizing Ansys DPF from within Mechanical to automate repetitive tasks and/or retrieve data that are not available from within the Mechanical GUI is a powerful addition to one's simulation workflow.
Going Further
- Try to implement a Python Results object to automate the process so that the CSV file is written after every solve.
- Contact the experts at Ozen Engineering for expert consulting for your scripting and simulation needs.
Downloadable Resources
Tags:
Python, Reactions, FEA, Random Vibration, Structural Analysis, Bolt, Stress, ANSYS Mechanical, PyANSYS, PyDPF, PyMechanical, Beam ConnectionNovember 7, 2024