Introduction
It is often desirable to identify the node number of the node with the maximum value of a result. While ANSYS workbench identifies the location of the node it does not automatically give you the node id associated with it. It is possible to select the node and read its id, in most cases. This method is reasonable for simple cases such as when you are dealing with a single component and a single load step. But this manual identification of node numbers is very cumbersome for scenarios when you are dealing with multiple time steps, multiple components or are interested in only certain regions of the mode. For this reason, it is helpful to be able to automate this process. Fortunately, there are APDL commands that can assist us in doing just that.
In this article we will present a simple APDL command snippet which may be used within workbench. The command snippet will identify the node id of the node with the maximum equivalent stress. This is the most simple form of this code and one can further enhance it to perform specific functions (such as loop over time steps, or only consider a specified region etc.) We will address such 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
%C %I
*CFCLOS !Close text file. If not closed the data will not be output to file.
Output of the Snippet
If the above snippet is run in ANSYS workbench, a result plot titled Post Output will be inserted into the workbench tree as shown below:
Post output refers to the result requested (in this case equivalent von Mises stress):
A text file titled “VALUES” will also be created in the default folder. It will contain the following text:
NODE: 4760
where 4760 is the node number for the node with the maximum stress at the last time step of the analysis.
Discussion on the Code
A couple noteworthy points which are not addressed by the comments above:
- This example looked at equivalent stress (PLNSOL,S,EQV ). The user can use any result that they want.
- The result was output to a text file for convenience. But this is not necessary. You can look at the post output in workbench (Solution Information, Solution Output, Post Output) and identify the result from there. This is shown in the image below. (Of course, this method is only suitable for ‘simple’ cases, i.e one part, one time step).
As mentioned earlier we will post follow up articles to enhance this snippet for specific scenarios.