How to get particle all neighbor infos and current particle force in particle body force API

Raheem Sterling_22160
Raheem Sterling_22160 Altair Community Member
edited May 2022 in Community Q&A

Hi, I want to do two thing in particle body force API

1 How to get current particle force, I didn't find method like getparticledata();

2 How to get all the bonded particles' positions with selected one, are there any existed method about this? 

Thanks for help.

Tagged:

Answers

  • PrasadAvilala
    PrasadAvilala
    Altair Employee
    edited May 2022

    Hi Raheem,

    You can use python script to extract Particle force and Bonded particle position

    1) To get particle force you can use the following function

    deck.timestep[].particle[].getXForce()

    deck.timestep[].particle[].getYForce()

    deck.timestep[].particle[].getZForce()

    2) To get bonded Particle position you can below functions

    deck.timestep[].bond.getPositions()

     

    However you can do different ways to get particle positions for your reference edempy document is attached.

    The same document can be found in EDEM installation directory as well.

     

    Thanks,

    Prasad A

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited May 2022

    Hi Raheem,

    You can use python script to extract Particle force and Bonded particle position

    1) To get particle force you can use the following function

    deck.timestep[].particle[].getXForce()

    deck.timestep[].particle[].getYForce()

    deck.timestep[].particle[].getZForce()

    2) To get bonded Particle position you can below functions

    deck.timestep[].bond.getPositions()

     

    However you can do different ways to get particle positions for your reference edempy document is attached.

    The same document can be found in EDEM installation directory as well.

     

    Thanks,

    Prasad A

    Hi Prasad

    Actually I want to add some new particle body force in API, I know what you described in edempy.

    For example, I know the ID of specified particles, how to get the position in api C++ code, I guess may relatios with particleCustomProperties->getValue, but I don't know how to do it in my user defined code.

    Thanks

    Raheem

  • PrasadAvilala
    PrasadAvilala
    Altair Employee
    edited May 2022

    Hi Prasad

    Actually I want to add some new particle body force in API, I know what you described in edempy.

    For example, I know the ID of specified particles, how to get the position in api C++ code, I guess may relatios with particleCustomProperties->getValue, but I don't know how to do it in my user defined code.

    Thanks

    Raheem

    Hi Raheem,

    Here is the example code to get the particle position also  I am attaching an relevant example

    case study to understand about the particle generation

     

     

     

    Thanks,

    Prasad Aimage

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited May 2022

    Hi Raheem,

    Here is the example code to get the particle position also  I am attaching an relevant example

    case study to understand about the particle generation

     

     

     

    Thanks,

    Prasad Aimage

    Thank you very much, it really helps a lot!

    I think what made me introuble was that I didn't find 'ParticleList', which class include this 'ParticleList' method or instance?

  • PrasadAvilala
    PrasadAvilala
    Altair Employee
    edited May 2022

    Thank you very much, it really helps a lot!

    I think what made me introuble was that I didn't find 'ParticleList', which class include this 'ParticleList' method or instance?

    Hi Raheem,

     

    Particle List is defined in "CParticleList.h" header file.

    Also, sharing one more example about how to debug. Please go through this tutorial which will help you to understand how to debug about each function.

     

    Thanks,

    Prasad A

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited May 2022

    Hi Raheem,

     

    Particle List is defined in "CParticleList.h" header file.

    Also, sharing one more example about how to debug. Please go through this tutorial which will help you to understand how to debug about each function.

     

    Thanks,

    Prasad A

    Hi Prasad,

     

    Thanks for your help, I learned a lot about ParticleManager in EDEM, I guess I can solve my problem.

     

    Raheem

  • RWood
    RWood
    Altair Employee
    edited May 2022

    Hi Prasad,

     

    Thanks for your help, I learned a lot about ParticleManager in EDEM, I guess I can solve my problem.

     

    Raheem

    Just to add, CParticleList.h is not an EDEM header, that's specific to that one example. 

    You can access the force acting on the particle within externalForce( ) via results.force

    image

    Richard