Particle replace tutorial

satri
satri Altair Community Member
edited February 23 in Community Q&A

Hello,

I have a few questions of the particle replacement API

1. If i want to recompile particle replacement API files what all libraries do i pick as dependent libraries while compiling is it body force 

C:\Program Files\Altair\2022.3\EDEM\src\Api\Factories

C:\Program Files\Altair\2022.3\EDEM\src\Api\ParticleBodyForce

C:\Program Files\Altair\2022.3\EDEM\src\Misc

C:\Program Files\Altair\2022.3\EDEM\src\Api\Core?

2. From what i understand the tutorial is replacing a particle called whole with a fraction. 

when i look at the sequence diagram i see that the particle creation is the first step then body force will be calculated in the next step. so does it mean the replacement of the particle happens in the second time step?

The reason i ask this is i want to control the orientation of the meta particles i create. I see that the orientation matrix is being created for the new particle in CRemoval.cpp. so does it mean that this orientation matrix will be passed to the meta particle? i also see the orientation being called in CReplacementFactory.cpp. I don't know where i should enforce the orientation for the particles 

for the time being let us say i want all the meta particles chain to have an orientation of [cos(30), -sin(30), 0; sin(30) cos(30) 0;0 0 1] from the centroid of it. (my meta particle is a long chain of 200 particles) Where do i enforce this orientation in the CReplacementFactory.cpp or CRemoval.cpp? or should i write the file "Particle_Cluster_Data.txt"  every time i create a random particle?

 

Tagged:

Best Answer

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited February 23 Answer ✓

    So i am on the right track. What i did is i used the Custom factory tutorial and created the particles called whole is the locations i wanted with an orientation i need it works fine

    I even attached the particle replacement factory and the simulation can add the meta particles based on the Particle_Cluster_Data given in the example file. so i can mix both (tutorial 06-custom factory) and (tutorial 01- particle replacement). Now when i change the coordinates from 127 spheres to say maybe 10 spheres also the tutorial works. But why does it not work when i give this or a chain of particles

    3        
    0 0 0 1
    1 0 0 1
    2 0 0 1

    am I doing anything wrong here? i thought i should get a chain of particles

    I even tried the debugger and saw that the debugger stops there 9 times (as i am creating three particles in total and 3 more particles in meta particle) creating the particles in the particle replacement API

    image

    I thought the bonding parameters were a problem but it is not because i can create meta particles with that parameter. Please let me know what are the possible causes for such a thing
     

    Hi Shyam,

    I think the Units are the issue with your file.  API is typically SI units only so the 3 particles will be created at 0 m, 1 m and 2 m spacing, the scale is 1 which is 1x particle size in the Creator.  


    Regards

    Stephen

Answers

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited February 22

    Hi Shyam,

    You can just reference the folders and the relevant files will be picked up automatically, looks like you have the correct folders shown, newer versions of EDEM have the same structure just with a different version shown in the path.  This is shown in the video here:

    EDEM API

    For the sequence that's correct, the particle is removed at time-step t and because of the sequence we can only create new particles at time-step t+1.

    We can't create meta particles in the API but you can create multiple individual particles which would act as a meta particle.  All the individual particle orientations maybe the same if it's a straight chain or all different if it's a complex shape.  Orientation of a particle is relative to its own centre of mass, so you have to make sure you change the orientation and the position of the particles in the chain to account for this.

    The particle cluster data is essentially the shape that you want to create, same as what you may define as a meta particle in the Creator, this contains all the relative positions of the individual particles, in this example we are only creating copies of this specific shape so it reads the relative positions and orientations from this pre-defined text file.  If you were calculating new shapes you would not have to write them to a file but would have to specify the positions and orientations in the factory.

     

    Regards

    Stephen

     

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited February 22

    Hi,

    1. Those you list should work for the vast majority of plugins. You can add those to your Visual Studio project for any API plugin.

    2. I don't recall everything about the tutorial but I know it uses the particleManager to remove the 'whole' particle, which will be replaced at the end of one timestep, then at the beginning of the next timestep the custom factory is used to create the cluster of fraction particles. 

    As I mentioned in your other post, custom factories don't work with meta-particles (...yet). The tutorial maybe doesn't quite do what you want as it works with spheres, so the orientation is, practically speaking, irrelevant. The replacement takes the spheres in the cluster file and then puts them in the specified positions. If you changed the contents of the .txt file to have the positions of your particles in the meta particle, you would have to apply your orientation to the whole 'meta-particle' afterwards. This will not be trivial. The orientation will still act on the individual particles (spheres?) and not the whole 200 particle chain. 

    I wrote the precursor to the meta-particles as an API plugin and the way I did it was I would generate all my particles (so your 200 particle chain), relocate them so that the centroid is at the origin, rotate via a rotation matrix as required , then move all the particles back. 

    Hope that helps.

    Cheers,

    Richard

     

     

  • satri
    satri Altair Community Member
    edited February 22

    So i am on the right track. What i did is i used the Custom factory tutorial and created the particles called whole is the locations i wanted with an orientation i need it works fine

    I even attached the particle replacement factory and the simulation can add the meta particles based on the Particle_Cluster_Data given in the example file. so i can mix both (tutorial 06-custom factory) and (tutorial 01- particle replacement). Now when i change the coordinates from 127 spheres to say maybe 10 spheres also the tutorial works. But why does it not work when i give this or a chain of particles

    3        
    0 0 0 1
    1 0 0 1
    2 0 0 1

    am I doing anything wrong here? i thought i should get a chain of particles

    I even tried the debugger and saw that the debugger stops there 9 times (as i am creating three particles in total and 3 more particles in meta particle) creating the particles in the particle replacement API

    image

    I thought the bonding parameters were a problem but it is not because i can create meta particles with that parameter. Please let me know what are the possible causes for such a thing
     
  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited February 23 Answer ✓

    So i am on the right track. What i did is i used the Custom factory tutorial and created the particles called whole is the locations i wanted with an orientation i need it works fine

    I even attached the particle replacement factory and the simulation can add the meta particles based on the Particle_Cluster_Data given in the example file. so i can mix both (tutorial 06-custom factory) and (tutorial 01- particle replacement). Now when i change the coordinates from 127 spheres to say maybe 10 spheres also the tutorial works. But why does it not work when i give this or a chain of particles

    3        
    0 0 0 1
    1 0 0 1
    2 0 0 1

    am I doing anything wrong here? i thought i should get a chain of particles

    I even tried the debugger and saw that the debugger stops there 9 times (as i am creating three particles in total and 3 more particles in meta particle) creating the particles in the particle replacement API

    image

    I thought the bonding parameters were a problem but it is not because i can create meta particles with that parameter. Please let me know what are the possible causes for such a thing
     

    Hi Shyam,

    I think the Units are the issue with your file.  API is typically SI units only so the 3 particles will be created at 0 m, 1 m and 2 m spacing, the scale is 1 which is 1x particle size in the Creator.  


    Regards

    Stephen

  • satri
    satri Altair Community Member
    edited February 23

    I think that might partly be the problem but how to fix it. my factory domain is

    300e-6 meter * 300e-6 meter and my simulation unit of length is set to micrometer

    Because when I do this I can faintly see one chain and nothing else

    3
    0 0 0 1e-6
    1e-6 0 0 1e-6
    2e-6 0 0 1e-6

    image

    whereas when I give this

    3
    0 0 0 1
    1 0 0 1
    2 0 0 1

    image

    so in what units should my particle cluster file be written? both the images contradict your statement..if what you said is true i should not have seen anything in the second picture because the unit is m and my domain is in micro meter

    Please let me know how to fix this

     

  • satri
    satri Altair Community Member
    edited February 23

    Hey as you mentioned units are the problem. This configuration of the file worked

    3
    0 0 0 1
    1e-6 0 0 1
    2e-6 0 0 1

    image

    if you look at the file the coordinates are in unit-meter whereas the radius of the particle is in micro-meter which is not intuitive to any user. As a user I will use a common unit base in the entire file which makes more sense. having two units in a single file does not make any sense. I think you guys should correct this in the particle replacement factory example tutorial or at least mention it in the pdf

    if you see the example particle cluster file

    127            
    -0.000333084    -0.0128111    -0.00939735    1
    -0.000763135    0.00809117    0.0136587    1
    0.00515972    0.00733823    0.0131243    1

    i think the coordinates are in meters whereas the radius of the particle is in millimeters. if it is not possible to fix this please mention this in the pdf document of the tutorial. it will be helpful to other users too

  • satri
    satri Altair Community Member
    edited February 23

    I think i should correct myself the last digit number 1 is not the radius or the diameter of the particle it is the scale. of the replaced particle. 

    please let me know if this is the correct understanding of the structure particle cluster file

    2
    0 0 0 1
    7.5e-6 0 0 1

    ----------------------------------

    number of particles

    x1(m) y1(m) z1(m) (scale of replaced particle)

    x2(m) y2(m) z2(m) (scale of replaced particle)

  • satri
    satri Altair Community Member
    edited February 23

    Hi Shyam,

    I think the Units are the issue with your file.  API is typically SI units only so the 3 particles will be created at 0 m, 1 m and 2 m spacing, the scale is 1 which is 1x particle size in the Creator.  


    Regards

    Stephen

    I understand your statement now -

    I think the Units are the issue with your file.  API is typically SI units only so the 3 particles will be created at

    -> 0 m, 1 m and 2 m spacing, "the scale is 1 which is 1x particle size in the Creator".

    and the one in the arrow mark corresponds to the format of particle cluster file and

    in your statement the last sentence in quotes corresponds to the scale of the particle, not any dimension.