Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to generate random array

Please login with a confirmed email address before reporting spam

Hi,

I have a model that I would like to use the array command to generate same structure in the model. However, array command gives equal distances between the structures but I would like to place the structures randomly in the space. Any way to do that faster than placing one by one?

Thank you in advance


2 Replies Last Post Feb 20, 2023, 8:41 a.m. EST
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 year ago Feb 20, 2023, 7:59 a.m. EST
Updated: 1 year ago Feb 20, 2023, 10:56 a.m. EST

There are several possibilities.

One, very lightweight method, is shown in the attached screenshot: Use a Copy node referencing a random function.

A more sophisticated variant, using a model method, is described in this blog post:

https://www.comsol.com/blogs/how-to-create-a-randomized-geometry-using-model-methods/

An important thing to consider, is whether it is a problem or not if the generated objects overlap.

-------------------
Henrik Sönnerlind
COMSOL
There are several possibilities. One, very lightweight method, is shown in the attached screenshot: Use a *Copy* node referencing a random function. A more sophisticated variant, using a model method, is described in this blog post: An important thing to consider, is whether it is a problem or not if the generated objects overlap.


Please login with a confirmed email address before reporting spam

Posted: 1 year ago Feb 20, 2023, 8:41 a.m. EST

There are several possibilities.

One, very lightweight method, is shown in the attached screenshot: Use a Copy node referencing a random function.

A more sophisticated variant, using a model method, is described in this blog post:

An important thing to consider, is whether it is a problem or not if the generated objects overlap.

thank you!

>There are several possibilities. > >One, very lightweight method, is shown in the attached screenshot: Use a *Copy* node referencing a random function. > >A more sophisticated variant, using a model method, is described in this blog post: > > > >An important thing to consider, is whether it is a problem or not if the generated objects overlap. thank you!

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.