General Mechanical

General Mechanical

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

Grouping elements with a command in APDL

    • Dawid Lewna
      Subscriber

      Good morning everyone.

      I hope I have chosen the right section, if not then please correct me.

      I am looking for an expert who is well versed in writing scripts in APDL inside Workbench. I'm doing a thermal-structural analysis and have encountered the following problem. I have a temperature distribution from the "transient thermal" modules. I imported the result of the last calculation step into the "transient structural" module. Inside the "transient structural" module, I want to divide the finite elements into groups according to what temperature they have. To do this, I wrote APDL code that looks like the following (this is a piece of code that later based on the groups assigns them the appropriate critical value and kills the elements):

      group1=0
      group2=0
      group3=0
      group4=0
      group5=0
      group6=0
      group7=0

      *get, NUMELEM, ELEM, 0, COUNT

      *do, i, 1, NUMELEM
        *get, temp_val, elem, i, temp 

        ! Group 1
        *if, temp_val, le, 20
          *if, temp_val, gt, 0
            group1 = 1
          *endif

        ! Group 2
        *if, temp_val, le, 0
          *if, temp_val, gt, -40
            group2 = 1
          *endif

        ! Group 3
        *if, temp_val, le, -40
          *if, temp_val, gt, -60
            group3 = 1
          *endif

        ! Group 4
        *if, temp_val, le, -60
          *if, temp_val, gt, -100
            group4 = 1
          *endif

        ! Group 5
        *if, temp_val, le, -100
          *if, temp_val, gt, -130
            group5 = 1
          *endif

        ! Group 6
        *if, temp_val, le, -130
          *if, temp_val, gt, -160
            group6 = 1
          *endif

        ! Group 7
        *if, temp_val, le, -160
          group7 = 1
        *endif
      *enddo

      cmgroup,group1,1
      cmgroup,group2,2
      cmgroup,group3,3
      cmgroup,group4,4
      cmgroup,group5,5
      cmgroup,group6,6
      cmgroup,group7,7

      I get the following error, which I can't solve myself:

      "Unknown label in field 5 ( temp ) of *GET command.                     
        Line= *get, temp_val, elem, i, temp                                   
        The *GET command is ignored."

      I'm hoping to find someone here who can help me fix it. 

    • dlooman
      Ansys Employee

      There is no *get of element temperature mentioned in the *get documentation.  It appears you would need to be in post1, create an element table for temp (etab,temp,temp) and then *get the etable item.  If you can't be in post1 when you issue these commands you could *get one of the nodes of the element and *get its temperature. 

      Also, I'm pretty sure the *if command needs to end with then, *if, temp_val, le, 20,then.  You could replace the two *if commands with one:  *if, temp_val, le, 20,and,temp_val,gt,0,then

Viewing 1 reply thread
  • The topic ‘Grouping elements with a command in APDL’ is closed to new replies.