Skip to main content

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:

  1. Enter analysis numbers for which the script will extract results by editing the analysisNumbers list.
    1. Note:  The script can also retrieve the results for Static and Transient Structural analyses if desired.
  2. Define desired length and force units for the output.
  3. Retrieve solver data, analysis type and solver units from the results file.
  4. Create a dpf.DataSources object (data source) connected to the results file.
  5. From the data source, read information about all results sets, i.e., number and time.
  6. Create a mesh operator and read the mesh data.
  7. Define a time scoping operator.
  8. Read in all materials and associated properties.  If elastic modulus is available, place material name with the modulus in a dictionary.
  9. Get all beam connection IDs and the associated element IDs (which differ).
  10. For each beam connection, create a dictionary to store all properties and
    1. Read the coordinates of each end node and compute the length.
    2. Read the material and radius, then compute the area and moments of inertia.
  11. Create a SMISC results operator to retrieve the force and moment at each node of each BEAM188 element, i.e., Beam Connection.
  12. Connect the data source, time scoping and mesh scoping to the SMISC operator.
  13. Use DPF functions to convert force and moment results to the desired units.
  14. Compute the direct stress, bending stress, torsional stress, equivalent stress and combined stress using standard formulas.
  15. Add computed results to the results dictionary and write to file.
    1. 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

Script and example output file.

Mark Lytell
Post by Mark Lytell
November 7, 2024