Skip to main content

Defining Ansys Superelement SUB File Manually

Photo by  James Owen  on  Unsplash A surprisingly popular blog-post written here is Exporting Stiffness Matrix from Ansys . A sensible follow up question is what can one do with the exported stiffness matrix? In a recent Xansys Forum post, a question was raised on how we can edit the stiffness matrix of a superelement and use it for our model.  An approach presented below is to first create a superelement that has the same number of DOF and nodal location that will serve as a template. An APDL script can then be written to edit the stiffness matrix entries as desired before exporting to a new superelement *.SUB file for use in future models. The self-contained script below demonstrates this.  /prep7 et ,1, 185 mp , ex, 1, 200e3 mp , prxy, 1, 0.33 w = 0.1 ! single element (note nodal locations) n , 1, w, -w, -w n , 2, w, w, -w n , 3, -w, w, -w n , 4, -w, -w, -w n , 5, w, -w, w n , 6, w, w, w n , 7, -w, w, w n , 8, -w, -w, w e , 1, 2, 3, 4, 5, 6, 7, 8 /solu antype , substr     ! analy

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