Selecting named selections in a loop
Selecting named selections in a loop
(OP)
I am trying a case of element death and Birth using EKILL and EALIVE in workbench
I have selected and using Named Selection named by 10 bodies at 1,2,3,4...
I have set the number of timesteps at 10
I want to use the following command to do the EKILL and EALIVE
! Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
! These commands may supersede command settings set by Workbench.
! Active UNIT system in Workbench when this object was created: Metric (m, kg, N, s, V, A)
! NOTE: Any data that requires units (such as mass) is assumed to be in the consistent solver unit system.
! See Solving Units in the help system for more information.
!Get current time step
*GET,ldstep,ACTIVE,,SOLU,NCMLS
!Time step as integer value (eg. 0.000000 to 0)
current_loadstep = NINT(ldstep)
!Store the timestep as a string/character
str1 = chrval(current_loadstep)
!at inital time step apply EKILL
*if,str1,EQ,'0',THEN
!allbody is a named selection consisting all the bodies
cmsel,s,allbody
EKILL, ALL
cmsel,all
allsel,all
!rest of the time steps select the named selection 1,2,3 etc.. and apply EALIVE
*else
cmsel,s,str1
EALIVE, ALL
cmsel,all
allsel,all
*endif
But I am getting error that
*GET LDSTEP FROM ACTI ITEM=SOLU NCML VALUE= 1.00000000
PARAMETER CURRENT_LOADSTEP = 1.000000000
PARAMETER STR1 = 1
*IF str1 ( = 1 ) EQ
0 ( = 0 ) THEN
*ELSE
SELECT COMPONENT 1
*** ERROR *** CP = 29.641 TIME= 15:32:34
Component 1 is not defined.
Is the problem associated with my named selections? (ie i cannot use number as named selections) Or is my selection command cmsel wrong?
if it is with named selections, how can I select my geometry one by one inside a loop?
I have selected and using Named Selection named by 10 bodies at 1,2,3,4...
I have set the number of timesteps at 10
I want to use the following command to do the EKILL and EALIVE
! Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
! These commands may supersede command settings set by Workbench.
! Active UNIT system in Workbench when this object was created: Metric (m, kg, N, s, V, A)
! NOTE: Any data that requires units (such as mass) is assumed to be in the consistent solver unit system.
! See Solving Units in the help system for more information.
!Get current time step
*GET,ldstep,ACTIVE,,SOLU,NCMLS
!Time step as integer value (eg. 0.000000 to 0)
current_loadstep = NINT(ldstep)
!Store the timestep as a string/character
str1 = chrval(current_loadstep)
!at inital time step apply EKILL
*if,str1,EQ,'0',THEN
!allbody is a named selection consisting all the bodies
cmsel,s,allbody
EKILL, ALL
cmsel,all
allsel,all
!rest of the time steps select the named selection 1,2,3 etc.. and apply EALIVE
*else
cmsel,s,str1
EALIVE, ALL
cmsel,all
allsel,all
*endif
But I am getting error that
*GET LDSTEP FROM ACTI ITEM=SOLU NCML VALUE= 1.00000000
PARAMETER CURRENT_LOADSTEP = 1.000000000
PARAMETER STR1 = 1
*IF str1 ( = 1 ) EQ
0 ( = 0 ) THEN
*ELSE
SELECT COMPONENT 1
*** ERROR *** CP = 29.641 TIME= 15:32:34
Component 1 is not defined.
Is the problem associated with my named selections? (ie i cannot use number as named selections) Or is my selection command cmsel wrong?
if it is with named selections, how can I select my geometry one by one inside a loop?





RE: Selecting named selections in a loop
True. Please see help document on CM.
Perhaps look into Substitution of Numeric Parametric Values to loop through the name selection of bodies that all start with an alphabet followed by looped number. For example, your bodies are named bod1, bod2, bod3 etc, you can select them via this code:
CODE --> APDL
Best regards,
Jason