Skip to main content

Ansys Euler Angle Calculation

Tait-Brian Angles Z-X'-Y'' *

After a simulation is complete, it is sometimes useful to know how much the overall object is rotated and translated. This is true especially for rigid body objects. While simple in 2D, it gets more complicated for 3D rotations. Euler angles always makes my head spin.

A rotating reference frame?* 

Ansys uses the Z-X'-Y'' sequence for defining the coordinate system but there is also the *GET command to extract the Euler Angles of a Local Coordinate System.

So let's say you have 3 nodes on a rigid beam that has been rotated and translated in 3D space. One could do it the hard way by starting with the general definition of R in the Rotation Matrices and go in reverse to get the angles with some fun scripting in your math package of choice.

Or... the easy way: define a local coordinate system using NWPLAN at the deformed nodes at each result time step and use the *GET command to extract angles.
*dim, MyAngles, ,3

*dim, MyDisp, ,3
nwplan, 10, n1, n2, n3 ! n1->n2 is X-axis
cswpla, 101, 0,        ! defines rotated coordinate system
! Extracts Angles and Location
*get, MyAngles(1), CDSY, 101, ang, xy
*get, MyAngles(2), CDSY, 101, ang, yz
*get, MyAngles(3), CDSY, 101, ang, zx
*get, MyDisp(1), CDSY, 101, loc, x
*get, MyDisp(2), CDSY, 101, loc, y
*get, MyDisp(3), CDSY, 101, loc, z

Below is the script that creates three local coordinate system to represent translation and rotation of an element with known answers. The resultant nodes are then used to define a 'test' local coordinate system for extraction of angles and displacements. The results are identical as expected.

Script [Link]

What if the key interest is the relative 3D Euler angles between two bodies? One could potentially hack it with the TRANSFER command to rotate nodes of both bodies such that the first body align with the global coordinate system. The resultant extracted Euler Angles at the second body would thus be the relative angles.

Update: Future blog post to extract large rotation and translation of body [Link].

Comments