We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.
General Mechanical

General Mechanical

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

How to store “Fsum” command for each load step into an excel file?

    • safiana
      Subscriber

      Hi everyone,

      I am having a 3D model in Ansys APDL solved by transient analysis. I would like to store the summation of nodal forces for a group of nodes for each load step.

      Let's say I already have assigned the name "gp" to that group of nodes. Also, I have solved the model with 400 load steps. How can I export nodal forces in Z direction only into an excel file? Can anyone give me a sample code for obtaining Fz for a group of nodes and exporting into an excel file where the first column is the load step (time) and the second column is Fz?


      Thank you,

      Ali

    • Govindan Nagappan
      Ansys Employee
      Create an array to store the results using *DIM command
      Then use a *DO loop to loop through each step and save the result to the array
      Example:
      cmsel,s,gp *do,j,1,400
      set,j !select result set
      fsum
      *get,my_fsum,fsum,,ite,fz !get fz and store it to variable my_fsum
      !save my_fsum to the array
      !save j(load step number) to the array
      *enddo
      Use *cfopen to opena text file. Then use *vwrite to write the array to a text file. Use *cfclose to close the text file
    • Erik Kostson
      Ansys Employee
      Hi as said that is the basic flow - I had something lying around and took very little change , so wanted to share in case anyone else would need this (have in mind there should not be any empty rows especially between *vwrite and (F20.10,F20.10)). Also the text file is placed in the solver files directory is.


      ! Allocate arrays
      cmsel,s,gp,NODE
      *GET,my_NNUM,NODE,,COUNT !GET NUMBER OF SELECTED NODES IN MODEL
      *GET,my_numtimes, ACTIVE, 0,SOLU,NCMLS

      *dim,fsP,array,my_numtimes,2

      ! Extract force sum
      *do,ii,1,my_numtimes,1
      set,ii,last
      *get,my_time,time
      fsum
      *get,my_fsum,fsum,,item,fz
      fsP(ii,1) = my_time
      fsP(ii,2) = my_fsum
      *enddo

      *CFOPEN,timefsumz,txt
      *VWRITE,fsP(1,1),fsP(1,2)
      (F20.10,F20.10)
      *CFCLOS
    • safiana
      Subscriber
      Thank you very much @gnagapp and @ekostson. I really appreciate your help.
      Best
      Ali
Viewing 3 reply threads
  • The topic ‘How to store “Fsum” command for each load step into an excel file?’ is closed to new replies.