General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Data export from simulation way too slow

    • Sebastien ARRIVET
      Subscriber

      Hi,

       

      I'm trying to export results in .csv format, from a static simulation.

      I've struggled to understand how to achieve that, but after looking around in various forum I came up with that bit of code:

      !--------------------------------------------------------------------------

      /POST1

      RSYS,0

      SET,1,LAST

      csv_name = 'out_node_U_s_1_LAST_post.csv'

      *cfopen,csv_name

      *cfwrite,'node_num',S11,S22,S33,S12,S13,S23,SEQV

      /POST1

      allsel

      cmsel,s,N_POST,NODE

       

      *vget,nodeIds_sel,NODE,,NLIST

      *get,nNodes,NODE,0,COUNT

      *do,i_noeud,1,nNodes,1

          no_node=nodeIds_sel(i_noeud)

          nsel,s,node,,no_node

          *get,variable_S11,NODE,no_node,S,X

          *get,variable_S22,NODE,no_node,S,Y

          *get,variable_S33,NODE,no_node,S,Z

          *get,variable_S12,NODE,no_node,S,XY

          *get,variable_S13,NODE,no_node,S,XZ

          *get,variable_S23,NODE,no_node,S,YZ

          *get,variable_SEQV,NODE,no_node,S,EQV

       

          *cfwrite, %no_node%,variable_S11,variable_S22,variable_S33,variable_S12,variable_S13,variable_S23,variable_SEQV

       

      *enddo

      *cfclos

      !--------------------------------------------------------------------------

       

      The simulation in itself takes less than a second, as the model is very light (around 12k nodes, shell181 elements, one step and simple load), but the export (the selection has around 10k nodes) takes more than 15min on a cluster with loads of ram and cpus.

      I have a large amount of such simulation to carry, and I can't understand how outputing 10k nodes can take that much time when the simulation itself wrote it in the .rst file in less than a second.

      If you know a better way for outputs I'm listening, as I'm kinda stucked.

      Sebastien

    • Govindan Nagappan
      Ansys Employee

      HI Sebastien,

      You have a do loop that goes through 10k times(once for each node). 

      A much more efficient way to read data into arrays is to use the *VGET command. *VGET is much like *GET , except instead of returning a scalar parameter, *VGET fills arrays with data. 

      You do not need a do loop. Here is an example:

      cmsel, s, N_POST  
      *vget,NMASK,node,,nsel
      *vmask,NMASK(1)
      *vget,array_S11,node,,S,X   !component stress in X

      Check help doc for more details: *VGET (ansys.com)

       

    • Sebastien ARRIVET
      Subscriber

      Thanks for your answer. I've tried the following based on what I understood:

      *cfopen,csv_name
      *cfwrite,'node_num',S11,S22,S33
      /PREP7
      allsel
      cmsel,s,N_POST,NODE
      *vget,NMASK,node,,nsel
      *vmask,NMASK(1)
      *vget,node_list,node,,NLIST
      /POST1
      *vmask,NMASK(1)
      *vget,array_S11,node,,S,X
      *vget,array_S22,node,,S,Y
      *vget,array_S33,node,,S,Z
      *vwrite, node_list,array_S11,array_S22,array_S33
      (I,ES2.3,ES2.3,ES2.3)
      *cfclos

       

      And I get the following warning: "Some entities requested in the *VGET were underfined". It happens for the request of S,X; S,Y and S,Z. 

      I'm not familiar with array like variable in ANSYS APDL, so I'm not sure how to solve that.

    • Govindan Nagappan
      Ansys Employee

      select the result set in post prcessor. For example:

      /post1

      set,last  !select last result set

    • Sebastien ARRIVET
      Subscriber

      I selected it just before the code I pasted:

      /POST1
      RSYS,0
      SET,1,LAST
      csv_name = 'out_node_U_s_1_LAST_post.csv'

    • Sebastien ARRIVET
      Subscriber

      Also: i've tried without the /PREP7 but the doc seems to indicate that NLIST or NSEL only works in /PREP7 for *VGET

Viewing 5 reply threads
  • The topic ‘Data export from simulation way too slow’ is closed to new replies.