General Mechanical

General Mechanical

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

how to assign energy probe using APDL command ?

    • Md_Salem
      Subscriber

      Hi everyone,

      I am working on direct structural optimization project with Workbench 22R1 where the optimizer is allowed to change the number of bolts in some structure  for each design point (increase them or decrease them).

      The objective of the aptimization is to minimize potential energy in all bolts. How can I enforce the solver at each design point to select all bolts (the number of them changes as an optimization parameter) and assign an energy probe to all of them, then minimize it?

      Are there any APDL commands that can be used, or any tool that enforce the energy probe to select certain material for instant ? or any other solutions for this sistuation ? or is it possiple to use a pattern for the bolts configuration and assign the energy probe to this pattern ?

    • dlooman
      Ansys Employee

      A nice feature of "Commands Objects" is the ability to make the inputs and outputs design parameters.  If you  retrieve the energy into a parameter with the prefix my_ it shows up in the Commands Object details as shown below and you can check the parameter box to make it an output parameter.

      • Md_Salem
        Subscriber

        I appreciate your concern,

        In your code, can I use "SOLID185" (which is the used element for the bolts)  instead of "188"   at the third line ?

        Also, is  the "sene" referring to  general potential energy? I mean, in the case of working with some coupled field element, for example, will "sene" get the potential energy for such a coupled field element (electric, magnetic, thermal, ,..)

        Regards

      • Md_Salem
        Subscriber

         

        Well, I used your code to develop the next code in which I applied harmonic analysis (55 steps) and selected the maximum set of the induced potential energy in order to parametrize it later and then minimize it :

        /POST1
        SET,LAST
        ESEL,S,ENAME,,188
        *DIM,potential_energy, ARRAY,55     !number of steps

        *DO, step,1,55,1
            /SOLU
            *GET,energy,sene,step,ITEM
              potential_energy(step)=energy
        *ENDDO
        *GET,max_index,total_potential_energy,MAX
        max_potential_energy = potential_energy(max_index)
        *get,my_energy,ssum,,Item,max_potential_energy

         

        but unfortunately the resultant “my_energy” was 0 , what would be the result for such a failure ?

        Regards.

         

    • dlooman
      Ansys Employee

      If you are using solid185 for the bolt then it must be an actual geometric body which you could make a named selection for.  Then the line esel,s,enam,,188 could be replaced by cmsel,s,name where "name" is the name you give the named selection.  SENE is just structural strain energy, 1/2 int(stress*strain)dv

      • Md_Salem
        Subscriber

        Hi Dave,

        What does "188" stand for ?

        also in case of using any other coupeled field material such as piezoelectric material, How can I assign the potential energy for it ?

        Regards

      • Md_Salem
        Subscriber

        Well, I used 185 (which is assigned for bolts only) instead of 188 and my_energy still =0 , is something wrong with the syntax of the code ?

        Regards

    • Erik Kostson
      Ansys Employee

       

      Hi

      Q:What does “188” stand for ?

      It stands for beam188 beam element (or short 188).

       

      As for the other question soild226 (short 226), they have SENE as well, so the script to get that is the same as above but change the esel to select the 226 elements (coupled field):

      esel,s,ename,,226 .

      Finally inside mechanical we can post process strain energy with the user defined result (set expression ):

      ENERGYPOTENTIAL

       

      See the help manual for more info if needed.

      Erik

       

    • dlooman
      Ansys Employee

      Yes, to all your statements above.  My example with selecting beam188 elements was intended to demonstrate how to use SSUM, not how to select the bolts.  If you want to learn how to retrieve non-structural energy review the solid226 documenation in the APDL Elements Manual.  It contains information like below:

    • dlooman
      Ansys Employee

      Your commands still select the beam elements, 188.  Is that what you want.  Your *get command in solution is not going to work.  If you notice, my *get command was issued after creating an etable item in post1 and summing it with ssum.  That's not going to be possible from within the solution module.  Perhaps you didn't mean to issue /solu, but if your loop is to be executed from post1 then there should be a set command to store each result and etable/ssum commands like I did.

      • Md_Salem
        Subscriber

         

        I tried to modify the code as next, , in addition, I tried to print out the potential_energy array to a text file as shown. The text file was created, but unfortunately empty. And also ‘my_energy’ is zero

        /POST1
        SET,LAST
        ESEL,S,ENAME,,185

        *DIM,potential_energy,ARRAY,55 ! Number of steps

        *DO, step, 1, 55, 1
            /SOLU
            *GET,energy,SENE,step,ITEM
            potential_energy(step) = energy
        *ENDDO

        *CFOPEN,my_file,TXT,C:\Users\MD\Desktop\energy\
        *VWRITE, potential_energy(1:55),”%10.2F”
        *CFCLOSE

        *GET, max_index, potential_energy, MAX
        *GET, my_energy, ARRAY, potential_energy(max_index)

        regards

         

         

    • dlooman
      Ansys Employee

      There could be other errors, but procedurally the script should be like this:

      /POST1
      ESEL,S,ENAME,,185

      *DIM,potential_energy,ARRAY,55 ! Number of steps

      *DO, step, 1, 55, 1
          set,,,,,,,step         ! store results for set step
          *GET,energy,SENE,step,ITEM
          potential_energy(step) = energy

         *CFOPEN,my_file,TXT,C:\Users\MD\Desktop\energy\
        *VWRITE, potential_energy(1:55),”%10.2F”
        *CFCLOSE

      *ENDDO

      I don't recognize the format of the two commands below.  Are they based on the *GET command documentation?

      *GET, max_index, potential_energy, MAX
      *GET, my_energy, ARRAY, potential_energy(max_index)

       

      • Md_Salem
        Subscriber

        Dear Dave,

        I appreciate your cooperation, but unfortunately, when I applied your code, I received the next two warnings :

         *** WARNING ***                      
         Unknown label for *GET command= SENE                                   
          The *GET command is ignored.                                          

         *** WARNING ***                       
         Unknown parameter name= ENERGY.  A value of 7.888609052E-31 will be  used.   

         

         
        and hence, the file my_energy was created but empty without any data .
        for the last two lines of the code I wrote, I was trying to get the maximum value of the "potential_energy" array to the parameter "my_energy"
         Regards
    • dlooman
      Ansys Employee

      Referring back to my May 10 posting you have left out the etable and ssum commands and your *get command is incorrect (see below.)

       

      *DO, step, 1, 55, 1  
          set,,,,,,,step         ! store results for set step

         etable,energy,sene

         ssum

         *get,my_energy,ssum,,ITEM,energy

       

          *GET,energy,SENE,step,ITEM           ! this command was incorrect (see above)

      • Sheref haddad
        Subscriber

        Hello @Dave,

        I am writing APDL code inside the workbench, and I need to select some nodes in a plan at some distance from the origin in the Z axes. The problem is that distance is parametrized with the name H. How can I write this line of code?

        greetings

         

    • Ashish Khemka
      Forum Moderator

      Hi Sheref,

      Can you please create a new post for your query?

      Regards,

      Ashish Khemka

      • Sheref haddad
        Subscriber

        Hi Ashish,

        excuse me for such way to contact you , but I don't know why I am blocked from starting new post ! would you please help me with tha issue 

        regards

         

    • Ashish Khemka
      Forum Moderator

      Hi,

      I did check and you are not blocked from creating new posts. Please share a snapshot of the issue while creating a new post.

      You can use NSEL command to select the nodes based on location (X, Y, or Z). Also, use of Named Selections Worksheet is an easy option to do so.

      NSEL (ansys.com)

      Named Selections (ansys.com)

      Regards,

      Ashish Khemka

       

       

Viewing 9 reply threads
  • The topic ‘how to assign energy probe using APDL command ?’ is closed to new replies.