General Mechanical

General Mechanical

Script for writing node displacements at at all times to a file in Ansys Workbench

    • Gurra
      Subscriber
      Hi,nI am working in Static Structural in Ansys Workbench. I want to write the displacements and rotations for all nodes in a named selection for all time steps to a file. I am aware that similar questions exist here, and as I understand I should use a command object under /post and using *vget and *vwrite commands. However, I need a little more information than this because I do not manage to sort it out. Does anyone have an example of a script solving this task?.Thanks.n
    • Kai
      Ansys Employee
      Hi Array, nFirst of all, I would like clarify that rotation DOFs only exists for beam and shell elements. Node of solid elements only have 3 translational DOFs. Below is a sample of command snippet that can be used do what your want. I also commented the script to help you understand syntax.nresume                            !please set save MAPDL db Yesnset,lastn*get,total_sets,active,0,set,nsett!get total number of result sets tnncmsel,s,surface,nodettttttn*get,nmax,node,,num,max                    ! max node ID of selected noden*dim,narray,array,nmax,total_sets+1tt       ! define a matrix that will contain node ID and uy at all result setsttnn*dim,node_vmask,array,nmax                  !define mask vectorn*vget,node_vmask(1),node,,nselnnnsel,s,node,,1,nmax                      !retrieve node ID and skip nodes that are not in named selection surfacen*vmask,node_vmask(1n*vget,narray(1,1),node,,nlistnn*do,i,1,total_sets                      !use *do loop to retrieve uy at all result setsnset,,,,,,,in*vmask,node_vmask(1n*vget,narray(1,i+1),node,,u,yn*enddonn*vmask,node_vmask(1n*mwrite,narray,my_uy,txttt!writes out a 2D matrix with 1st column node ID and 2nd to 11th columns are uy for set 1 to 10 n(F10.0,TL1,30(F20.nThanks,nKain
    • Gurra
      Subscriber
      Array Thanks for your answer. I inserted this code in a command object just as it is written here under Solution (A6). No previous commands. I looked in the Solver Files Directory, but no file named my_uy appears. Is it saved somewhere else? nAnd also, the cmsel command, I guess this should be change if I would like to study only the nodes in a named selection? Or is this done with a other command? How should this line look?.Again thanks.n
    • Kai
      Ansys Employee
      Array, please note cmsel, s, surface, node. I have a named selection called surface and I selected nodes on that named selection. You may want to change surface to the name of your named selection. The command snippet probably didn't work out for some reason in your model. One way to check is to look at the post.out file saved in model directory and see if you have any warning or error messages. If you didn't save MAPDL db file, (by default db file is not saved), you will need to clear results and rerun the model together with the commands to make it work.nn
    • Gurra
      Subscriber
      ArraySorry, I did miss that surface was your named selection. Now I get a file, but I get print out for all nodes in the model (not only for those in the named selection) and besides some node numbers that do not even exist in the model and then many rows with the node number set to zero. And on top of that the results printed out for a specific node number do not match the results inside Mechanical. But the rows with node number zero contains results which seem to belong to nodes in my named selection.nSorry for this, but can perhaps it be something wrong with the mask commands?n
Viewing 4 reply threads
  • You must be logged in to reply to this topic.