It’s often useful to determine the node number associated with the maximum value of a result, such as stress, in ANSYS Workbench. Although Workbench can identify the location of the node, it doesn’t automatically provide the node ID. While it’s possible to manually select the node and read its ID, this becomes cumbersome in scenarios involving multiple time steps, components, or specific regions of interest. To simplify this process, we can automate it using APDL commands.
In this article, we’ll present a straightforward APDL command snippet that can be used within Workbench. This command snippet will find the node ID of the node with the highest equivalent stress. It’s a basic version of the code, and you can enhance it further to include additional functionalities like looping over time steps or considering specific regions. We’ll discuss these enhancements in future articles.
The APDL Command Snippet:
/POST1 !Enter Post Processor (Not needed if you use the snippet within workbench)
/SHOW,PNG !Show plot. Required to show plot in workbench
SET,LAST !Specify last time step for post-processing
*CFOPEN,VALUES,TXT !Open a text file titled VALUES
PLNSOL,S,EQV !Plot nodal solution for equivalent stress
*GET,NODENUM,COMMON,,CPOST1,,INT,108 !Get node number of node with the max value in previous
*VWRITE,’NODE:’,NODENUM !Write to text file
*CFCLOS !Close text file. If not closed the data will not be output to file.
Output from the Code
When you execute the snippet in ANSYS Workbench, a result plot called “Post Output” will be added to the workbench tree, as shown below:
The post output displays the requested result, in this case, the equivalent von Mises stress.
Additionally, a text file named “VALUES” will be generated in the default folder. The file will contain the following information:
Here, 4760 represents the node number of the node with the highest stress at the final time step of the analysis.
Discussion on the Code
There are a couple of important points that the previous comments didn’t cover:
In this example, we examined the equivalent stress (PLNSOL, S, EQV), but users can choose any desired result.
For convenience, the result was saved in a text file. However, this step is not mandatory. You can view the post output directly in Workbench (Solution Information, Solution Output, Post Output) and identify the desired result from there. The image below illustrates this. (Keep in mind that this approach is suitable for simpler cases, involving only one part and one time step.)
As mentioned earlier, we will publish follow-up articles to improve this code for specific scenarios.