×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Picking a random node or element

Picking a random node or element

Picking a random node or element

(OP)
Hello,

I am using Ansys Mechanical and doing some stress simulations. Is there an option to select random nodes or elements?

I want to pick for example 10% of all nodes randomly.

Thanks for your help.

sadegh87

RE: Picking a random node or element

You would have to write some APDL to do this. APDL has a random function PAR = RAND() which you could include as part of a script to select nodes (NSEL) or elements (ESEL).

A sample random number generator code might be:

*GET,DIM,ACTIVE,0,TIME,WALL
DIM=DIM*3600
*DIM,DUMMY,ARRAY,DIM
*VFILL,DUMMY(1),RAND
*DEL,DIM
*DEL,DUMMY

Then combine the above with other APDL functions to select nodes / elements.


------------
See FAQ569-1083: Asking questions the smart way on Eng-Tips fora for details on how to make best use of Eng-Tips.com

RE: Picking a random node or element

(OP)
Hello Drej,

thank you for your help. It helped me so far.
I have now written an APDL as follows:

*DIM,dtab,ARRAY,100,2
NSEL,S,S,3,-1,0, ,0
*VGET,dtab(1,1),node,,nlist
*vfill,dtab(1,2),rand,0,100

So I have selected some Nodes by results and stored their nodenumbers into the first column of the array.
Then I have put a random number from 0 to 100 into the second column.
So now each nodenumber has one random number.

Now unfortunately I dont know the next step.

I want to select nodes, for example which have random numbers in their second column, that are equal 10 or below.
Thats how I want to make sure, that I have chosen around about 10% of all nodes.

How can I get those nodenumbers, which have a 10 or below in the second column
And how can I select the nodes, that have these nodenumbers?

I would be very happy if you have a solution for me.

Thank you.

Bye.

RE: Picking a random node or element

I have a solution concerning the workbench I dont know whether it would help you, You can export the nodes list from the solution of the simulation and in that list there are the numbers and coordinates of each point.. you can select the nodes if you select the option >select mesh and next to it >single select and you can easily then pick the nodes you need.. but I dont know what you want to do further.. you can put a load or something if thats what you need!

Regards,
Jessi M.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources