Normal velocity of particles in collision to wall

Unknown
edited June 2022 in Community Q&A

Hello Every body,
I want to write a code in python to use EDEMpy to study deposition. 
I need to achieve normal velocity of particles in collision with wall (geometries). I used this code:

velocity=deck.timestep[t].collision.surfGeom.getFirstZVelocity()
idd=deck.timestep[t].collision.surfGeom.getIds()

I want to ask you which velocity is achieved from the first line? Is it velocity magnitude?
I want to use getZVelocities() instead of getFirstZVelocity() but it is not defined in SGcollision.
It would be appreciated if you could guide me in this field. 

Regards,
Fatemeh 

Tagged:

Answers

  • RWood
    RWood
    Altair Employee
    edited June 2022

    Hi,

    Looking at the src for EDEMpy (which you can find in the EDEM install path) you'll need to use getFirstIds() to get the corresponding IDs in a given collision.

    The getFirst/getSecond notation is there because a collision happens between either a p-p or a p-g. Element1 is always a particle, but element2 can be either a particle or a geometry.

    GetZVelocities() will return all the particle Z velocities from whatever you are querying.

    GetFirstZVelocity() will return the Z velocity for a particle in a single collision.

    Cheers,

    Richard

  • Unknown
    edited June 2022

    Hi,

    Looking at the src for EDEMpy (which you can find in the EDEM install path) you'll need to use getFirstIds() to get the corresponding IDs in a given collision.

    The getFirst/getSecond notation is there because a collision happens between either a p-p or a p-g. Element1 is always a particle, but element2 can be either a particle or a geometry.

    GetZVelocities() will return all the particle Z velocities from whatever you are querying.

    GetFirstZVelocity() will return the Z velocity for a particle in a single collision.

    Cheers,

    Richard

    Many Thanks for your quick response.
    I noticed that getFirstIds() get the id of particles in collision.
    but I don't understand what's is the difference between getIds() and getFirstIds().
    I tried it on my code, both have same len but the ids are quiet different.

    Regards
    Fatemeh

  • RWood
    RWood
    Altair Employee
    edited June 2022

    Many Thanks for your quick response.
    I noticed that getFirstIds() get the id of particles in collision.
    but I don't understand what's is the difference between getIds() and getFirstIds().
    I tried it on my code, both have same len but the ids are quiet different.

    Regards
    Fatemeh

    "I noticed that getFirstIds() get the id of particles in collision."

    This isn't quite true. It provides the IDs of the first particle in a collision. It does not give you the IDs of the second particle in any collision.

    getIDs() will give you all the particle IDs in whatever container you have. This will depend based on your binning etc.

    getFirstIds() will only get data from collisions.

    I guess it's possible the two could provide the same sized array but I would not expect that in the general case. 

    If I had a system of 4 particles [0,1,2,3] and collisions [0,1] and [2,3], I'd expect getIDs() to return [0,1,2,3] and getFirstIds() to return [0,2].

    Richard

  • Renan
    Renan
    Altair Employee
    edited June 2022

    Hi Fatemeh,

     

    Just to add on what my colleague Richard has said. If your goal is to get normal velocity of a particle when it hits a wall you could do something like this:

     

    velocities = deck.timestep[t].collision.surfGeom.getFirstVelocity() normal_direction =  deck.timestep[t].collision.surfGeom.getUnitcpVector() normal_velocity = np.dot(velocities,normal_direction)*normal_direction 

     

    Hope this helps you.

     

    Best regards,

    Renan

  • Unknown
    edited June 2022

    "I noticed that getFirstIds() get the id of particles in collision."

    This isn't quite true. It provides the IDs of the first particle in a collision. It does not give you the IDs of the second particle in any collision.

    getIDs() will give you all the particle IDs in whatever container you have. This will depend based on your binning etc.

    getFirstIds() will only get data from collisions.

    I guess it's possible the two could provide the same sized array but I would not expect that in the general case. 

    If I had a system of 4 particles [0,1,2,3] and collisions [0,1] and [2,3], I'd expect getIDs() to return [0,1,2,3] and getFirstIds() to return [0,2].

    Richard

    Many Thanks Richard.
    Just to be sure that I understand the concept true:
    Based on the picture, in the initial time steps particle with ID of 8 collide to the part of wall with Id of 67087.
    but an another way the particle is count as id=1.

    As the id of particle that has collision to the wall is important so 8 is the id that I need.

    Or in the second picture the id of particles that have collision with the wall were( 18, 129,200, and 8). 


    I mean getID() has no relation with collision.


    Do I understand well?

    Regards,
    Fatemehimageimage

  • RWood
    RWood
    Altair Employee
    edited June 2022

    Many Thanks Richard.
    Just to be sure that I understand the concept true:
    Based on the picture, in the initial time steps particle with ID of 8 collide to the part of wall with Id of 67087.
    but an another way the particle is count as id=1.

    As the id of particle that has collision to the wall is important so 8 is the id that I need.

    Or in the second picture the id of particles that have collision with the wall were( 18, 129,200, and 8). 


    I mean getID() has no relation with collision.


    Do I understand well?

    Regards,
    Fatemehimageimage

    Ah, I see the confusion. What you're calling idd2 is the ID of the collision:


    image

    This has nothing to do with the particle IDs. It's the ID of the collision itself.

    What you're calling "id_collision" is (confusingly) the ID of the first element (necessarily a particle) in the collision, and what you're calling "idd" is the ID of the second element (this could be a particle or a geometry triangle) of the collision.

    If I were to rename your terms more logically I'd use something like:

    id_collision -> ID_element1

    idd -> ID_element2

    idd2 -> ID_collision

    Hope that helps.

    Richard

  • Unknown
    edited June 2022

    Hi Fatemeh,

     

    Just to add on what my colleague Richard has said. If your goal is to get normal velocity of a particle when it hits a wall you could do something like this:

     

    velocities = deck.timestep[t].collision.surfGeom.getFirstVelocity() normal_direction =  deck.timestep[t].collision.surfGeom.getUnitcpVector() normal_velocity = np.dot(velocities,normal_direction)*normal_direction 

     

    Hope this helps you.

     

    Best regards,

    Renan

    Many thanks Renan.
    Could you please tell me the theoretical formula for calculating normal velocity from normal direction and velocity?

    for example :
    normal direction of particle 1: [nx1,ny1,nz1]

    velocity vector of particle 1:[vx1,vy1,vz1]

    what will be the normal velocity of particle based on these 2 vectors?


    Regards,
    Fatemeh

  • Renan
    Renan
    Altair Employee
    edited June 2022

    Many thanks Renan.
    Could you please tell me the theoretical formula for calculating normal velocity from normal direction and velocity?

    for example :
    normal direction of particle 1: [nx1,ny1,nz1]

    velocity vector of particle 1:[vx1,vy1,vz1]

    what will be the normal velocity of particle based on these 2 vectors?


    Regards,
    Fatemeh

    Hi Fatemeh,

     

    Just to clarify: the normal direction is a collision property not a particle one. With that out of the way, let's say v is the particle's velocity vector and n is the collision normal direction. To calculate what's called the normal velocity you just have to project v onto n. To do that you just need to calculate the dot product between n and v and multiply n by this result (assuming n has length one). In the end it would look like this:

    v_n = (v.n)*n = (v1*n1 + v2*n2 + v3*n3)*n

    You can check this page to know more about vector projection.

    Best regards,

    Renan