TAGGED: /post1, ansys-mechanical, apdl, post-processing
-
-
January 27, 2025 at 8:10 pm
jmcclos8
SubscriberHi I am trying to write some nodal deformation relative to a user defined coordinate system to some txt files for postprocessing. I am using a command block in the solution portion of Ansys Workbench. I am unable to retieve the nodal deformation. I'm curious if this is result of an error in my code or if I am not outputting the correct information when I run the simulation?
Here is the code:
/post1
file,file,rst !select result fileÂSET, LAST
! Define the base file path for saving the output filesÂ
FilePath = 'C:\\Users\\Admin\\Documents\\Simulation and Analysis\\MIRMOS\\Thermal Model\\Ansys_Raw_Data_Warm\\'! Define the single named selection
NamedSelection = 'Fold1_RZ' Â
CoordSystem = 111 Â! Check if the coordinate system exists
RSYS, CoordSystem Â! Log the selected coordinate system and named selection
*CFOPEN, FilePath + 'Debug.txt', txt
*VWRITE, 'Coordinate System: ', CoordSystem
(A, F8.0)*VWRITE, 'Named Selection: ', NamedSelection
(A, F8.0)*CFCLSE
! Apply the Named Selection (ensure the selection is active)
CMSEL,S,NamedSelection! Check if nodes were selected
*GET, nsel, NODE, 0, COUNT Â ! Get number of selected nodes
*IF, nsel, LT, 1, THEN
  *VWRITE, 'No nodes found in the selected Named Selection: ', NamedSelection
  (A)
  *EXIT  ! Exit if no nodes were selected
*ENDIF! Open separate files for each displacement direction
*CFOPEN, FilePath + NamedSelection + ' 0 deg X.txt', txt
*VWRITE, 'Node ID', 'Displacement X'
(A, A)*CFOPEN, FilePath + NamedSelection + ' 0 deg Y.txt', txt
*VWRITE, 'Node ID', 'Displacement Y'
(A, A)*CFOPEN, FilePath + NamedSelection + ' 0 deg Z.txt', txt
*VWRITE, 'Node ID', 'Displacement Z'
(A, A)! Loop through the nodes in the Named Selection and output displacement values
*DO, i, 1, nsel  ! Get node coordinates
  *GET, nodeX, NODE, i, LOC, X
  *GET, nodeY, NODE, i, LOC, Y
  *GET, nodeZ, NODE, i, LOC, Z  ! Get displacement values in X, Y, ZÂ
  *GET, dispX, NODE, i, U, X
  *GET, dispY, NODE, i, U, Y
  *GET, dispZ, NODE, i, U, Z  ! Write node coordinates and displacement values to each corresponding file
  *VWRITE, nodeX, nodeY, nodeZ, dispX
  (F10.4, F10.4, F10.4, F10.4)  *VWRITE, nodeX, nodeY, nodeZ, dispY
  (F10.4, F10.4, F10.4, F10.4)  *VWRITE, nodeX, nodeY, nodeZ, dispZ
  (F10.4, F10.4, F10.4, F10.4)
*ENDDO*CFCLSE
FINISH
Here is an warning I recieve when I attempting to access the nodal deformations. Note, I am able to access the element locations.
*DO LOOP ON PARAMETER= I FROMÂ 1.0000Â Â Â Â TOÂ 2214.0Â Â Â Â BYÂ 1.0000Â Â Â
 *GET NODEX    FROM NODE        1 ITEM=LOC X    VALUE=-0.191897697   Â
 *GET NODEY    FROM NODE        1 ITEM=LOC Y    VALUE=-0.648200003E-001
 *GET NODEZ    FROM NODE        1 ITEM=LOC Z    VALUE= 0.862828271   Â
 *** WARNING ***                        CP =     24.281  TIME= 14:41:33
 Requested data is not stored for node 1.                              Â
 Line= *GET, loc_defX, NODE, i, U, X                                  Â
 The *GET command is ignored.         ÂÂ
Â
Here are the simulation output controls:
Â
Thank you for any assistance you can provide.
-
January 28, 2025 at 3:53 pm
Mike Rife
Ansys EmployeeHi jmcclos8
There seems to be a gap in the node nubering IDs. So there is no node #1. There are several ways to address this but the most generic/defensive programming method would be to use ndnext(N) which returns the ID of the next selected node after N. So after the component selection capture the lowest node ID number in the selected set:
CMSEL,S,NamedSelection
n_num = ndnext(0)
Then in the *GET commands replace the 'i' with n_num. Then right before the *ENDDO command use:
n_num = ndnext(n_num)
to advance the variable.
Mike
p.s. the ndnext is one in a series of short-cut versions of specific *GET commands.
Â
-
January 28, 2025 at 6:43 pm
jmcclos8
SubscriberHi Mike,
I apperciate you getting back to me. ndnext does not seem to be a post1 command, so the compiler just ends up ignoring it:Â
*** WARNING ***Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â CP =Â Â Â Â Â 22.891Â Â TIME= 13:34:09
 NDNEXT is not a recognized POST1 command, abbreviation, or macro.     Â
 This command will be ignored
-
-
January 28, 2025 at 7:55 pm
Mike Rife
Ansys EmployeeWeird. Please send a screen shot of the beginning of the solve.out showing the version and license used by MAPDL.
Mike
p.s. ndnext is just a short cut to *get command that would do the same function. And works in any MAPDL processor...you're not using a custom version of MAPDL are you?
-
January 28, 2025 at 8:02 pm
-
-
January 29, 2025 at 3:54 pm
Mike Rife
Ansys EmployeeCould you please send a test model that shows the behavior? I've not been able to recreate this.
-
January 29, 2025 at 4:02 pm
Mike Rife
Ansys EmployeeWe should also test the full version of the *get command. Instead of "n_num = ndnext(0)" try *get,n_num,node,0,nxth
Then for the "n_num = ndnext(n_num)" use instead *get,n_num,nodel,n_num,nxth
What happens? Â
-
- You must be logged in to reply to this topic.
-
4693
-
1565
-
1386
-
1242
-
1021
© 2025 Copyright ANSYS, Inc. All rights reserved.

