Introduction
Harmonic analysis is a powerful tool in Ansys Mechanical that enables engineers to evaluate how structures respond to steady state dynamic loading conditions and can be used in a wide variety of applications.
Ansys Mechanical allows the user to plot many useful output quantities from a harmonic analysis including deformation, stress and strain. Surface rotations, however, are not readily available as an output quantity. It is posssible to extract the rotation from a surface in a harmoic analysis but it require a bit more input. In this post, we will walk through the process of extracting surface rotations from a harmonic analysis in Ansys Mechanical. Will also go over some of the common issues that can come up and provide an example toy model.
Background
There are two complicating factors when extracting surface rotations in a harmonic analysis. The first that is that surface rotations are not a standard result that is avaiable in Mechanical. This means we will have to use APDL snippets to get the rotation results, and use a remote point to specify the surface we want to measure. The second complicating factor is that a harmonic analysis produces many independent analysis results and we need some way to specify which frequency result we want to use. In this guide we show how to specify the frequency result in the APDL command snippet. We also take it a step further by introducing some logic to loop through all the frequency results to find the maximum rotation and the frequncy at which it occured.
Step-by-Step Guide
For this guide we use a simple toy model to demonstrate the principles involved. The completed project archive can be downloaded from a link at the bottom of the page.
1. Setup
For our toy model we have setup a modal superposition harmonic analysis on a simple rectangular part that has been split into three surfaces. We have specified fixed supports on each end of the surface for the modal analysis. For the harmonic analysis we specify loads at the edges that form the inner boundaries of our surfaces.
2. Specify a remote point
A remote point is used to specify the surface we want to measure and to provide a point about which to measure the rotation. By using a surface to define the remote point, the remote point is automatically placed at the centroid of the surface.
In addition to defining the remote point, we use an APDL command snippet to create a variable for the remote point that we can reference later. The syntax for the command is:
myPoint=_npilot
]
3. Save MAPDL database
In the details of the analysis setting of the harmonic analysis, change the Save MAPDL db option to yes. This will save the extra data that will allow us to run the command we will write without having to re-solve the harmonic analysis.
4. Add solution command
The following lines can be inserted as a command snippet in the solution branch of the harmonic analysis. This is the command that will loop through all the different results, measure the surface rotations and save the largest rotation about X along with the frequency at which that maximum rotation occurs. Note that ! denotes a comment in APDL.
FINISH !exit the current processor
/POST1 !enter the database results postprocessor
RESUME !load the MAPDL database
my_max_x_rot=0 !initialize max variables
my_max_freq=0
*DO,f,1,78 !start do loop over frequencies
SET,1,f,,AMPL !set the current result to the current substep represented by f
*GET,my_freq,ACTIVE,,SET,FREQ !Get the current frequency
my_rot_x=ROTX(myPoint)*(180/3.14) !Get the surface rotation about the x axis
*IF,my_rot_x,GT,my_max_x_rot,THEN !If the current rotation is greater than the our max rotation
my_max_x_rot=my_rot_x !set the max rotation to the current rotation
my_max_freq=my_freq !set the max frequency to the current frequency
*ENDIF !end if block
my_rot_y=ROTY(myPoint)*(180/3.14) !get y rotation
my_rot_z=ROTZ(myPoint)*(180/3.14) !get z rotation
*ENDDO !end do loop
Note that in the *DO line, the last parameter is the index of the last frequency result in the harmonic results. This number will differ depending on your analysis settings. The ROTX, ROTY and ROTZ lines will return the results in radians so here we have scaled the value to degrees. Also take note that both the SET and *GET lines have empty parameters, so there are two commas one right after the other. This tells APDL to use the default value for those parameters. The result will be shown in the details of the commands object.
Common Issues
One potential pitfall comes when defining parameters in your script that you want to output. Mechanical defines a search prefix that will filter the variables int he script that will be output. By default this is set to my_ but it can be changed. Any parameters that don't contain this prefix will not be shown in the result section.
Additional Resources
The link below contains an archive of the project used in the step by step guide.
Rotation in harmonic analysis example
To view details on APDL commands you can use the command reference
For more information about controlling program flow using APDL you can use the reference below
Controlling Program Flow in APDL
Ozen Engineering Expertise
Ozen Engineering Inc. leverages it's extensive consulting expertise in CFD, FEA, thermal, optics, photonics, and electromagnetic simulations to achieve exceptional results across various engineering projects, addressing complex challenges like multiphase flows, erosion modeling, and channel flows using Ansys software.
We provide expert consulting, mentoring, and training to optimize hydraulic and water control systems. Our team leverages advanced simulation tools like Ansys Fluent to deliver precise, reliable solutions for piezoelectric actuator design and analysis. For details, visit https://ozeninc.com.
Aug 28, 2025 10:12:46 AM