General Mechanical

General Mechanical

Separate killing of elements on two different bodies of a model

    • Ifexco
      Subscriber
      Hello guys Kindly assist. I am not used to coding. If for instance I want to kill all the elements in two separate bodies (flaw_1 and flaw_2) separately and in succession, how do I modify the code below such that the elements in flaw_1 is killed first in a time-step, after which those in flaw_2 are killed in the next time-step. I initially tried having a second Commands (APDL) and changing the element component to be killed to flaw_2, but the second APDL ends up overriding the first, killing only elements in flaw_2. I also tried using the element birth and death icon in Ansys mechanical enterprise but it didn't work. Perhaps, you may suggest to me a different way of doing it.

      /com, #
      *get,myncmls,active,,solu,ncmls ! cumulative number of load steps
      *if,myncmls,gt,0,then ! if this is after the first
      cmsel,s,flaw_1 ! ELEMENT component to be checked (This is for flaw 1)
      nsle ! nodes on these elements
      SELTOL,1.0e-12 ! stay within range below
      ! #########
      nsel,r,s,eqv,234,2000000 ! re-select nodes with results above a value <<<
      ! #########
      SELTOL ! selection tolerance back to default
      *get,numnode,node,,count ! how many nodes with result above?
      *if,numnode,gt,0,then
      esln ! elements with any node selected
      *get,numelem,elem,,count
      *if,numelem,gt,0,then
      ekill,all
      *endif
      *endif
      allsel
      *else
      ! if first load step, have result written to in-memory database
      fini
      /config,noeldb,0 ! write results into the database
      /solu ! continue with solution
      *endif
      /com, #
      /com
    • Mike Rife
      Ansys Employee
      Please see the Details of the Commands Object in WB Mechanical - there is an option to chose which load step to apply the commands to. You can then write two commands objects; the first activated at the first load step, the second CO at the second load step.
      Mike
    • Ifexco
      Subscriber
      Thank you Mike. It worked!

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