General Mechanical

General Mechanical

Run a simulation for a large number of load steps and export all sets displacements at once

    • mehrdadsaeedi
      Subscriber
      Hello friends,nI am trying to run a simulation in which I have to apply approximately 700 load steps on several nodes and export the corresponding x,y,z displacements for each node and for each set.nfor example I have a node that there will be loads applied on. for this node I have considered 720 load steps which each gives specific displacements. the question here is how can I export the corresponding directional displacements for all those 720 sets at one time? I thought that this could be done by using a for loop or something similar.nThe problem is I have little knowledge of APDL commands.nI appreciate any help.n
    • Wenlong
      Ansys Employee
      This is a rushed answer and others please feel free to add comments.nHi mehrdadsaeedi,nYes a do loop can help. In Mechanical, right click on solutions and choose commands to insert a command snippet. Say you want to plot displacements at all these steps, you can add:n*do, i, 1, 720n/show, PNG, REV,,8, ux_at_step_%i% !output a PNG imagen/post1nset, i, lastnallsel, allnplnsol, u, x !plot x displacementn/show, close n*enddonnIf you want to print out the solution, you can use command like prnsol. I am sure there are better options to directly write to a file. Others feel free to contribute. nRegards,nWenlongnReference: https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v193/ans_cmd/Hlp_C_DO.html?q=\*donhttps://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v202/en/ans_cmd/Hlp_C_PRNSOL.html?q=prnsoln
    • HarsihilZLHZ
      Subscriber
      /POST1nset,lastn*get, numnode, node, 0, countn*DIM,DN,array,numnode,3n*do, j, 1, numnoden  *get,dispX,node,j,u,xn  *get,dispY,node,j,u,yn  DN(j,1) = j  t   t   n  DN(j,2) = dispXtn  DN(j,3) = dispYn*enddonn*CFOPEN,file_Name,txt,Z:\Ansys(here comes directory)n*vwrite, DN(1,1),DN(1,2),DN(1,3)n(4x,' ', F6.0,4x,' ',G15.8,4x,' ',G15.n*CFCLOSEnnif it doesn't worked, then share your file if possible.n
    • mehrdadsaeedi
      Subscriber
      Thank you HarsihilZLHZ  for your reply. the file is not something special. it is just a simply cube with hexahedral elements and 1 node receives a nodal force with tabular data for a certain load step. I tried your code but it only produced a blank text file. Here is my file attached.nn
    • HarsihilZLHZ
      Subscriber
      for the time being consider below code...n!!! I HAVE TESTED AND IT WORKSnn*DO, i, 4, 5 ! here I have used last two subset (edit here!!) (!!!! ATTENTION here i have used 4 and 5 SUBSET)nSET, i,LASTnnn*GET, my_numnode, node, 0, countn*DIM,DN,ARRAY,my_numnode,4nn*DO, j,1,my_numnoden *GET,my_dispX,NODE,j,U,Xn *GET,my_dispY,NODE,j,U,Yn *GET,my_dispZ,NODE,j,U,Zn  DN(j,1) = j      n  DN(j,2) = my_dispXn  DN(j,3) = my_dispYn  DN(j,4) = my_dispZn*ENDDOnn*IF,i,EQ,4,THEN !!!! ATTENTION here i have used 4 and 5 SUBSETn*CFOPEN,fileName1,txt,\ !!!!(writes the file for 1 subset)n*vwrite,DN(1,1),DN(1,2),DN(1,3),DN(1,4)n(4x, ', F6.0,4x, ',G15.8,4x, ',G15.8,4x, ',G15.8)n*CFCLOSn*ELSE  !!! ( if you have more than two subset then write *ELSEIF,VAL1,Oper,VAL2 )n*CFOPEN,fileName2,txt,\ !!!!(writes the file for 2 subset and so on.....)n*vwrite,DN(1,1),DN(1,2),DN(1,3),DN(1,4)n(4x, ', F6.0,4x, ',G15.8,4x, ',G15.8,4x, ',G15.8)n*CFCLOSn*ENDIF   nn*ENDDOnn
Viewing 4 reply threads
  • You must be logged in to reply to this topic.