Export contact particle ID with EDEMpy

Guozhen Li
Guozhen Li Altair Community Member
edited September 2022 in Community Q&A

Hi anyone,

I am trying to get ids of particles in contact with each other using EDEMpy. I only want information of particle conatacting with particle and I have used two methods.
1.contactids = deck.timestep[tstep].contact.surfSurf.getIds()
2. contacts = deck.timestep[tstep].contact.surfSurf.getContacts()

contactids = contacts[:,[1,3]]

I previously thought these two methods should return identical results, both returns contact particle pairs.
However, I noticed that the two methods generate different results and I am confused about the reasons. I would like to know what exactly does the two functions: contact.surfSurf.getIds() and contact.surfSurf.getContacts() returns? Why is there a difference?

Many thanks,

Jason

Tagged:

Best Answer

  • jpmorr
    jpmorr Altair Community Member
    edited September 2022 Answer ✓

    getContacts() returns an array where each row represents the index location for the ID of the two particles. So the first value is element 1 particle type and the second value is the index location of it's ID in the particle ID lists. Values 3 and 4 repeat this for particle two in the contact. These two pieces of information are required to extract the correct ID for each particle in a contact pair- EDEM stores the index location to the ID rather than the ID itself.

    getIds() is basically an index lookup function using getContacts() information. Hope that makes sense.

    JP

Answers

  • jpmorr
    jpmorr Altair Community Member
    edited September 2022 Answer ✓

    getContacts() returns an array where each row represents the index location for the ID of the two particles. So the first value is element 1 particle type and the second value is the index location of it's ID in the particle ID lists. Values 3 and 4 repeat this for particle two in the contact. These two pieces of information are required to extract the correct ID for each particle in a contact pair- EDEM stores the index location to the ID rather than the ID itself.

    getIds() is basically an index lookup function using getContacts() information. Hope that makes sense.

    JP

  • RWood
    RWood
    Altair Employee
    edited September 2022

    And as a follow on to JP's answer, if you take a look at SSContact.py and SingleContact.py within the EDEMpy source files, you can see the relevant code for these functions. The getContacts() isn't too informative but if you look at what that corresponds to in an EDEM .h5 file you will see what JP is talking about when it comes to what a single row represents.

    Richard

  • Guozhen Li
    Guozhen Li Altair Community Member
    edited September 2022

    getContacts() returns an array where each row represents the index location for the ID of the two particles. So the first value is element 1 particle type and the second value is the index location of it's ID in the particle ID lists. Values 3 and 4 repeat this for particle two in the contact. These two pieces of information are required to extract the correct ID for each particle in a contact pair- EDEM stores the index location to the ID rather than the ID itself.

    getIds() is basically an index lookup function using getContacts() information. Hope that makes sense.

    JP

    Many thanks JP

    How could I get particle ID list? Is it from deck.timestep.particle[].getIds()?  I think this function returns a row array so the index location you mentioned in getContacts() are row index of getIds()?

    Regards,

    Jason

  • jpmorr
    jpmorr Altair Community Member
    edited September 2022

    Many thanks JP

    How could I get particle ID list? Is it from deck.timestep.particle[].getIds()?  I think this function returns a row array so the index location you mentioned in getContacts() are row index of getIds()?

    Regards,

    Jason

    Yes, as Richard pointed out this can be found in the getContacts() code. Within the function there is a call to get the particle ids for each type for lookup.

    This is the same information that can be accessed from deck.timestep.particle[].getIds().

    In the case of spherical particles, the index location from getContacts() (2nd and 4th columns) is a direct index for the ID. For multi-spheres, it requires a little bit of extra manipulation.

    JP