Often, solving an engineering problem using simulation tools such as LS-DYNA or Ansys Mechanical requires that tensorial results be compared to an analytical solution. One such example is a pressurized cylinder in which the circumferential, or hoop, stress is the main stress measure of interest. If such a simulation is conducted on a geometry that has complex end treatments, for example, one would like to use the hoop stress, say in the center of the vessel, to validate that the simulation is providing accurate results in areas of more complex geometry where analytic results do not exist.
In most modern postprocessors, stress components may be fringe plotted in either cartesian coordinates, principal directions, or even in cylindrical or spherical coordinates. However, it may necessary to rotate the results a tensorial result into an orientation that is not available "out-of-the-box" in said postprocessors. In this article, we will provide a verifiable example of tensor transformation using a Python 3.11 script to read stress fringe plot results for a pressurized cylinder from LS-PrePost in Cartesian coordinates and subsequently rotate the stress tensor into cylindrical coordinates to compute the hoop stress.
The model that we will use to illustrate the concept is a d = 100 mm mean diameter x l = 150 mm long x t = 2mm thick cylinder subject to an internal pressure of p = 4 MPa solved using LS-DYNA. A textbook image1 of the problem is shown here:
The material for the cylinder is the standard linear isotropic elastic Structural Steel from Workbench Engineering Data, and the mesh is composed of 2.5 mm sized shell elements, using default section properties. The mesh sizing provides a uniform grid.
The internal pressure, p, was chosen to be 4 MPa so that the hoop stress would equal 100 MPa according to the well-known formula
where r = mean cylinder radius and t = wall thickness. Additionally, isostatic constraints (a.k.a. 3-2-1 constraints) are applied to the vertices shown in yellow in order to provide stress-free constraint.
The analysis type is set to implicit with a pseudo end-time of 0.01 s. Implicit analysis is chosen for speedy analysis run time.
Using a cylindrical coordinate system in Ansys Mechanical, we can easily postprocess the (unaveraged) hoop stress, resulting in 100 MPa, thus matching theory.
This result shows that our simulation matches theory.
Now that the hoop stress results have been found using Ansys Workbench LS-DYNA, we will reconstruct the same hoop stress results by processing the Cartesian stress components that are output from LS-PrePost.
To obtain the data necessary to rotate the stress tensor, all six components must be exported from LS-PrePost. The process to export each stress component will be illustrated for the X-component and must be repeated for the Y-, Z-, XY-, YZ- and ZX- components:
The format of the output files is in LS-DYNA keyword format which is a fixed-width file format. The Python script parses each section of the file taking advantage of the fixed-width structure.
The element connectivity table is within the *ELEMENT_SHELL section of the file, a small except of which is shown here:
The column definitions and widths are as follows:
Column | Data | Width |
1 | Element ID | 8 |
2 | Part ID | 8 |
3 | Node 1 | 8 |
4 | Node 2 | 8 |
5 | Node 3 | 8 |
6 | Node 4 | 8 |
Similarly, the nodal coordinates are given in the *NODE section, an excerpt of which is shown here:
The column definitions and widths are as follows:
Column | Data | Width |
1 | Node ID | 8 |
2 | X-Coordinate | 16 |
3 | Y-Coordinate | 16 |
4 | Z-Coordinate | 16 |
The $SHELL_ELEMENT_RESULTS section provides the output result at every integration point of the element. In this case we are using shell elements with a single integration point. The excerpt of this section is shown here:
The column definitions and widths are as follows:
Column | Data | Width |
1 | Element ID | 8 |
2 | Element Result | 16 |
The $SHELL_ELEMENT_CENTROID section provides the centroid and volume of each element in the deformed state. The excerpt of this section is shown here:
The column definitions and widths are as follows:
Column | Data | Width |
1 | Element ID | 10 |
2 | X-Coordinate | 16 |
3 | Y-Coordinate | 16 |
4 | Z-Coordinate | 16 |
5 | Volume | 16 |
The following pseudocode explains the algorithm used to transform the stress:
An excerpt from the results of the Python script is shown here, where the image on the left displays the element stress in Cartesian coordinates; and the image on the right shows the corresponding hoop stress, S11_loc, resulting from the transformation and the components of the transformation matrix Q:
From the image on the rights, we see that the computed hoop stress, S11_loc, matches very well to the output from Ansys Mechanical.
Although the hoop stress is easily obtained from within Workbench Ansys LS-DYNA or LS-PrePost (as the 1st principal stress), the steps in this article show how to accomplish the rotation of tensorial results for more general orientations by transforming results in Cartesian coordinates. The procedure outlined above can also be used in a larger automation framework using the tools of PyAnsys.
Ansys 2024 R2 Workbench Archive, python code and results
1. Pressure vessel image taken from https://engineersfield.com/stress-and-strain/