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.
Structural & Thermal

Structural & Thermal

Need a script to calculate percentage of volume with stress over certain value

    • FAQFAQ
      Participant

      This is post processing commands should be added under the ‘Solution’ object:

      resume
      strs_limit=100 !element with equivalent stress larger than this limit will be outputed
      my_volu_all = 0
      my_volu = 0

      /post1
      set,last
      allsel
      *get,my_n_el,elem,,count !count of elements
      etable,vonMises,s,EQV
      etable,el_volu,volu
      *cfopen,el_out,dat !open a dat file to write output
      *do,i,1,my_n_el,1 !do loop over all elements
      *dim,avg_vonMise,array,1,1
      *vget,avg_vonMise(1,1),elem,i,etab,vonMises !get vonMise stress of element i
      *get,i_volu,elem,i,volu !get element volume
      my_volu_all = my_volu_all+i_volu !add element volume to total volume of the model
      *if,avg_vonMise(1,1),gt,strs_limit,then my_volu = my_volu + i_volu !add element volume to volume with stress over stress limit
      my_volu_ratio = my_volu/my_volu_all
      *endif
      *ENDDO
      *cfclose