Can I customize the particle orientation using Edem API

Saeed Naamnh
Saeed Naamnh Altair Community Member
edited February 22 in Community Q&A

Hi 

Can I customize the particle orientation using Edem API ?

 

 

Best 

Tagged:

Answers

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2022

    Hi,

    Depends what you mean. You could use a custom factory to make them start in whatever orientation you like, though you can do similar in a regular factory without the API.

    If you mean mid simulation, then yes - kind of - but you can't explicitly set the orientation in the API, you would need to back calculate it from an appropriate force/torque. The same concept, but with velocity, is mentioned in this post:

    https://community.altair.com/community?id=community_question&sys_id=b219e5811bd59d14507ca6442a4bcb8b&anchor=answer_88763c761b1dd954507ca6442a4bcbad

    Cheers,

    Richard

     

  • satri
    satri Altair Community Member
    edited February 19

    The random orientation is not truly random. I am trying to generate a bunch of particles and i have kept the orientation random but whenever the meta-particles get generated it is slightly biased in one direction why is ti so? Is there a workaround? can the orientation be set to a truly random number through an API at the beginning when the particle is generated? 

    Please see the image below

    image

    There is some kind of a bias

    why are there very less particles in y direction? i don't have too many constraint for factory generation the dimensions of the factory is 300*300 sq units Which is ample room to have a lot more orientations.

    How to get a truly random orientation?

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited February 20

    The random orientation is not truly random. I am trying to generate a bunch of particles and i have kept the orientation random but whenever the meta-particles get generated it is slightly biased in one direction why is ti so? Is there a workaround? can the orientation be set to a truly random number through an API at the beginning when the particle is generated? 

    Please see the image below

    image

    There is some kind of a bias

    why are there very less particles in y direction? i don't have too many constraint for factory generation the dimensions of the factory is 300*300 sq units Which is ample room to have a lot more orientations.

    How to get a truly random orientation?

    Hi,

    I'd say that's not a huge sample size but I get your point - it certainly looks like it has a bias based on that sample. At first glance it doesn't look totally random but I'd maybe leave it running just to double check? Is it the same when looking along X and Y axes as well?

    I couldn't tell you our implementation off the top of my head so it would require some investigation on our side.

    In the mean time, if you did want to do a more random distribution (you will never get true random in code, without external input of some nature) you could write a custom factory using the API, where you can control the orientation. Alongside that, it's up to you what random number generator you want to use.

    Cheers,

    Richard

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited February 20

    The random orientation is not truly random. I am trying to generate a bunch of particles and i have kept the orientation random but whenever the meta-particles get generated it is slightly biased in one direction why is ti so? Is there a workaround? can the orientation be set to a truly random number through an API at the beginning when the particle is generated? 

    Please see the image below

    image

    There is some kind of a bias

    why are there very less particles in y direction? i don't have too many constraint for factory generation the dimensions of the factory is 300*300 sq units Which is ample room to have a lot more orientations.

    How to get a truly random orientation?

    I just did my own meta particle random test and it seems fine to me:

    image

    Are you sure there's plenty of room for it to be oriented in all those different orientations? I could see how in a very small volume that there would only be a limited number of orientations possible

  • satri
    satri Altair Community Member
    edited February 20
    Please let me know how to write a custom factory?

    I looked for examples in knowledge Base and couldn't find any examples for a API of custom factory to give orientation

  • satri
    satri Altair Community Member
    edited February 20

    Please let me know how to write a custom factory?

    I looked for examples in knowledge Base and couldn't find any examples for a API of custom factory to give orientation

    Never mind i found it EDEM tutorial 6 is for custom factory. 

    I have a question about that API now. suppose i want to use that API to create particles of different orientations and random positions.

    If there is any particle already present in that random position I pick how will I make the API skip that position? How can I check for the presence of another particle at that position? is there any inbuilt command for that?Please let me know

    I only want to create particles with the API in the initial step only after that i don't want to control its position

     

  • satri
    satri Altair Community Member
    edited February 20

    Also can you create meta particles with this factory? because i get this error

     

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited February 22

    Also can you create meta particles with this factory? because i get this error

     

    Hi,

    No, currently you can only place 'regular' particles. You can recreate the same behaviour as a meta-particle through a custom factory and bond the particles after creation, but it's a bit of work to do so. This is essentially what meta-particles are though.

    Cheers,

    Richard