Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

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

Export of a 2D- Array with apdl-command-block as an csv- file

    • BassaSelim3
      Subscriber

      Hello to everybody,

      I am trying to export an 2D- with an apdl command. The has n rows and m columns (m is greater than 19). For different simulations the size of the array differs and therefore the export is depended on variables. So far I used this type of command to export:

      *VWRITE,Eig(1,1),Eig(1,2),Eig(1,3),Eig(1,4)  

      (F0.0,';',F0.4,';',F0.4,';',F0.4)

      where "Eig" is an array with 4 columns. Since the arrays are increasing in size I think I need an other approach (I also think *VWRITE is limited to 19 columns). With the written code above I have to enter every column and the format of that column seperately. For varaible depending sizes I have to automate this.

      Can someone give me a hint or an approach for my problem?

      I am grateful for every answer

    • ErKo
      Ansys Employee
      Hello

      I think you are correct - it has a limit.

      See *MWRITE instead

      All the best

      Erik
    • BassaSelim3
      Subscriber
      Hi Erik thank you for the answer. I think the *MWRITE command is the right approach. The problem is the format. I can't set the number of the columns to a varaible. it has to be a written integer. So for example see the line of code down below:
      RSTMAC,file,1,ALL,file1,1,ALL,,,,2
      *GET,nummode,ACTIVE,0,SOLU,NCMSS
      *DIM,MAC,ARRAY,nummode,nummode
      *DO,k,1,nummode,1
      *DO,n,1,nummode,1
      *GET,MAC(n,k),RSTMAC,k,MAC,n
      *ENDDO
      *ENDDO
      *MWRITE,MAC,MAC,csv
      (10F0.4)
      This works fine (I have 10 modes), but if replace the last line with (nummodeF0.4) or with (nummode(F0.4)) my file stays empty. Is there a way to replace the 10 to a variable?

    • ErKo
      Ansys Employee
      Hi Just set it perhaps to a high number (say 1000) which is more than enough?
      Perhaps that will work.
      *mwrite,reP
      (1000(F20.10))

      All the best

      Erik
    • BassaSelim3
      Subscriber
      Hi Erik Yes that worked perfectly. Thank you very much
    • ErKo
      Ansys Employee
      Thank you

      Erik
    • anuj yadav
      Subscriber

      Hi Erik,

      Im facing a similar issue.

      My code

      !!!!!!!

      /post26 
      FILE,'file','rst','.'   
      /UI,COLL,1  
      NUMVAR,200  
      SOLU,191,NCMIT  
      STORE,MERGE 
      FILLDATA,191,,,,1,1 
      REALVAR,191,191 
      nsel,s,loc,x,0.01495,0.01505
      *Get,NoNodes,node,0,count              !Get the number of nodes in the selected set  
                                  
      *Dim, MyNodeNoArray,array, NoNodes                             !Array used to save nodes No.
      *SET,SelNode,0 
                                            !Counter to save the selected node number
      *Do,i,1,NoNodes 
      *SET,NodeNo,NDNEXT(SelNode)                                !NDNEXT(N) Next selected node having a node number greater than N.  
      *SET,MyNodeNoArray(i), NodeNo   
      *SET,SelNode,NodeNo 
      /AUTO,1 
      /REP,FAST 

      NSOL,i+1,NodeNo,U,X,NodeNo
      STORE,MERGE   
      *Enddo  

      *CREATE,output,txt 
      *DIM,_P26_EXPORT,TABLE,401,NoNodes+1 
      *Do,j,0,NoNodes
      VGET,_P26_EXPORT(1,j),j+1 
      *Enddo  
      *MWRITE ,_P26_EXPORT,21mm,csv
      %G, %G, %G, %G, %G, %G, %G, %G, %G, %G,%G, %G, %G, %G, %G, %G, %G, %G, %G, %G,%G, %G, %G, %G, %G, %G, %G, %G, %G, %G,%G, %G, %G, %G, %G, %G 
      *END
      /INPUT,output,txt

      !!!!!!

       

      I running a transient analysis and i require time series data for more than 1000 nodes

      using mwrite , Im unable to extract more than 41 columns.

      also numvar command takes only 200 variables

    • anuj yadav
      Subscriber

      please update my code 

Viewing 7 reply threads
  • The topic ‘Export of a 2D- Array with apdl-command-block as an csv- file’ is closed to new replies.
[bingo_chatbox]