General Mechanical

General Mechanical

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

APDL Command for Changing Material Properties on Individual Structural Elements

    • Audy Maulizar
      Subscriber

      Dear all. I am currently working on a model of a cable-stayed bridge as shown above. As part of the modelling process, I would like to simulate sagging effect on the cables by calculating modified elasticity modulus for every cable. I figured I could do it more efficiently by using an APDL command in the analysis. My idea is to create a txt file that is comprised of two columns with the first column comprised of the stay cable ID and the second column comprised of the calculated values of the elasticity modulus. Roughly speaking, the file would look like this:

      Cable ID       |          Modified Elasticity Modulus (MPa)

      EC1              |              174000

      EC2              |              160000

      I would then make named selections of each cable pair (e.g. "EC1", "EC2", etc) in Mechanical. The APDL command script would read the cable ID in the first column, select the appropriate named selection, and then change the elasticity modulus of the elements in the named selection with the values in the second column. So far I've come up with this script but it still doesn't work.

      /inquire,my_lines,lines,D:\Sagging_Calc,txt
      *DIM,STRING_DATA,string,128,my_lines
      *DIM,ARRAY_DATA,array,my_lines
      *SREAD,STRING_DATA(1),D:\Sagging_Calc,txt
      !Read from files
      *DO,AR80,1,my_lines
      AR70 = strpos(STRING_DATA(1,AR80),'')
      ARRAY_DATA(AR80) = valchr(strsub(STRING_DATA(1,AR80),1,AR70))
      AR71 = strleng(STRING_DATA(1,AR80))-AR70+1
      STRING_DATA(1,AR80) = strsub(STRING_DATA(1,AR80),AR70,AR71)
      *ENDDO
      !Change the Elasticity Modulus
      *DO,I,1,my_lines,1
      CMSEL,S,STRING_DATA(I)
      MP,EX,,ARRAY_DATA(I)
      CMSEL,U,STRING_DATA(I)
      *ENDDO
      CMSEL,all

      From the result of the analysis, it seems that the problem is in the last block of code. I couldn't get CMSEL to recognize the stay cable ID which is stored in STRING_DATA. Any help would be appreciated.

    • Ashish Khemka
      Forum Moderator

      Hi,

      Please see if the following link helps: How to change material properties or material assignment in between steps (ansys.com)

      Regards,

      Ashish Kumar

    • Rahul Kumbhar
      Ansys Employee

      Hi,

      Can you check if the first do loop has filled the array successfully?

      • Audy Maulizar
        Subscriber

        How do you check the content of the array?

Viewing 2 reply threads
  • The topic ‘APDL Command for Changing Material Properties on Individual Structural Elements’ is closed to new replies.