Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a loop in APDL over every node

Status
Not open for further replies.

helplessapld

Student
Oct 28, 2022
8
Hi everyone,

I'm trying to do a loop in ANSYS APDL over every node with the command n to assing every node a new position/angle.
The loop which i have at the moment looks loke this:
Code:
*do,counter,1,anz_nodes
      n,counter,x_pos(counter,1),y_pos(counter,1),ampl*v_uni_imp(counter,1),p_r_y(counter,1),p_r_z(counter,1),p_r_x(counter,1)
*enddo
Every used parameter (exept ampl - which is a scalar) is formed like
Code:
*dim,parameter_name,array,anz_nodes,1
Because the arrays are a few thousand rows long this loop takes quite a long time.
I have tried to replace the shown loop with this:
Code:
n,(1:anz_nodes),x_pos(1:anz_nodes),y_pos(1:anz_nodes),ampl*v_uni_imp(1:anz_nodes),p_r_y(1:anz_nodes),p_r_z(1:anz_nodes),p_r_x(1:anz_nodes)
The used parameters are the same for sure and the programm execudes this much much faster and without any errors or warings. But the resulting geometry is completely wrong and has nothing in common with the geometry of the first shown loop. So could some explain what I did wrong with do second loop? I would be very thankful if someone could give me a hint where to find any information about this kind of loop, becaus over the official site of ANSYS I haven't found anything.
Thanks in advance!
 
Replies continue below

Recommended for you

So I found a solution by myself.
It seems that the second of the shown loops cannot perform multiplications. When outsourced as shown below, the loop runs through and takes less than one percent of the previous run time.
Code:
*voper,new_z_pos,v_uni_imp,mult,ampl
n,(1:anz_nodes),x_pos(1:anz_nodes),y_pos(1:anz_nodes),new_zd_pos(1:anz_nodes),p_r_y(1:anz_nodes),p_r_z(1:anz_nodes),p_r_x(1:anz_nodes)
I hope it helps someone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor