General Mechanical

General Mechanical

Output frequency spectrum automatically after harmonic analysis

    • hmpws
      Subscriber

      Hello,


      At the moment, I have a harmonic analysis and the frequency spectrum for Z directional velocity on a named selection gives me the exact values that I require for further processing. I can manually export the frequency/amplitude/phase table.


      However, I like to run a parametric study and would like the table to be exported automatically.


      How do I average the data on the named selection and export them? I looked at the documentation and /post26 seem to have the required.


      I imagine it is something like this:


      /PREP7


      ALLSEL,ALL  ! select everything


      CMSEL ,S, ns_region


       


      FINISH


      /POST26


      ????output averaged frequency, amplitude and phase of selected nodes????


       


      Thanks.

    • Rohith Patchigolla
      Ansys Employee

      Hello, 


      Please try the below script.


      This script gets the Average frequency Uy response (for example) of a named selection (having a set of nodes). 


      You can modify it as needed. Hope this helps. 


      Best regards,


      Rohith



      /POST26
      FILE,'file','rst'
      NUMVAR,200
      SOLU,191,NCMIT
      STORE,MERGE
      FILLDATA,191,,,,1,1
      REALVAR,191,191
      LINES,99999,

      !Provide the named selection name below
      CMSEL,S,MySelection
      *GET,nodeNum,NODE,0,COUNT

      CURR = 0
      *DO,I,1,NODENUM
      CURR = NDNEXT(CURR)

      !Result quantity being extracted for the frequency response curve, in this case, Uy
      NSOL,3,CURR,U,Y

      *IF,I,EQ,1,THEN
      ADD, 4, 3
      *ELSE
      ADD, 4, 2, 3
      *ENDIF
      ADD,2,4
      *ENDDO
      PROD, 5, 4, , ,UY, , , 1/NODENUM

      !Create text files in solver files directory
      PRCPLX,0
      /OUTPUT,Frequency_Plot_real_im,txt
      PRVAR,5
      /OUTPUT

      PRCPLX,1
      /OUTPUT,Frequency Plot_ampl_ph,txt
      PRVAR,5
      /OUTPUT


       

    • hmpws
      Subscriber

      Thank you very much! It is so much nicer to find example code to work with. I had to add NSLE in the line after CMSEL to make this work but other than that!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.