-
-
May 28, 2020 at 5:57 am
nima_nzm
SubscriberHello,
I am very new to APDL commanding in workbench. I have a spring that deflects under a sinusoidal motion. I have completed a transient analysis and what I am trying to do is to use a command block to generate a sum of a parameter for all of the elements in the body for some of the result sets, like 200 sets out of the total 1000 sets. My problems are two things.
Question one:
I found a youtube video and used the below lines which are for generating the sum of the strain energy of all elements at one result set, LAST here:
SET,LAST
etab,sen,sene
ssum
*get,my_tot_se,ssum,,item,sen
The above code works fine and gives the sum of the strain energy of all elements at the last result set. But what I really want to find is the total energy of the elements which is equal to potential_energy+kinetic_energy. So, I tried to change "sene" at the end of the second line with a related parameter from the worksheet. I used "ENERGYPOTENTIAL", "ENERGYKINETIC", and also tried them in lower letters, but it didn't work. Can't we use the worksheet expressions for this purpose? So, where can I find the right terms representing parameters (i.e. kinetic or potential energies)? and in that place, can I use the +/- signs to add or subtract parameters?
Â
Question two:
Â
Assuming that I found the right term of kinetic and potential energies in the above commands, could anyone complete the code and add a DO or FOR loop so that it runs from the result set saying 800 to 1000 and in each iteration, it writes the result (sum of the energy of all elements at that result set) in a file? Definitely, if it can write all of the 200 numbers in a single file it's the best.
Â
Â
Thank you very much for your help. I am looking for a good source to start to learn command block in workbench and I appreciate it if you could suggest a source for Getting Started type of tutorials. I could only find complete APDL commands references and programming without effective examples.
-
May 29, 2020 at 7:27 am
Rahul Kumbhar
Ansys EmployeeHi nima_nzm,
You should use
SENE-Potential energy
KENE-Kinetic energy
DENE-Damping energy
WEXT-External energy
AENE-Artificial energy
STEN-Stability energy
You can not use +/- sign in ETAB command. You need to separately perform the operations
-
May 29, 2020 at 7:49 am
Rahul Kumbhar
Ansys EmployeeYou can *do loop in APDL. Please see below a template.
total= total number of load steps
*dim,totalsene,array,total,1
*DO,i,1,total
SET,%i%
etab,sen,sene
ssum
*get,my_tot_se%i%,ssum,,item,sen
totalsene(%i%,1)=my_tot_se%i%
*ENDDO
-
May 29, 2020 at 7:51 pm
nima_nzm
SubscriberHello Rahul,
Â
Thank you for your reply. First, About your first post, is there any library/table that I can find all of the available parameter's acronyms as apparently not all of the names in the worksheet table work in the command block.Â
Â
Second, thanks for the code that you completed. It actually works, but it needs a few modifications. I used the below:
Â
total= 1000
*dim,my_totalsene,array,total,1
*DO,i,995,total
SET,1,%i%
etab,sen,sene
ssum
*get,my_tot_se,ssum,,item,sen
my_totalsene(%i%,1)=my_tot_se
*ENDDO
Â
1) so first, apparently "%i%" in the "*get" line doesn't work, so, I just removed it, no problem so far. .
Â
2) then I added "my_" term to the beginning of the parameter "totalsene" as the "Output Search Prefix" is set to "my_", but after solving the command, it still only recognize "my_tot_se". Please see the first picture attached. Do you have any idea?
Â
3) Searching for the "my_totalsene" array, I could only find the results in the "post.out" file as shown in the second attached picture which are the results of sets 995 to 1000. Is there any way that I can write or save the parameter somewhere so that I can only copy and paste the results, not all other information?Â
Â
Thank youÂ
Â
-
- The topic ‘DO-LOOP in Command Block in Workbench’ is closed to new replies.
-
3632
-
1313
-
1142
-
1068
-
1008
© 2025 Copyright ANSYS, Inc. All rights reserved.