[EDEM] Can we get energy loss with GPU calcuration

Sakae
Sakae Altair Community Member

Hi,

I'd like to get energy loss after simulation by GPU.

I think currrent .dill file that we use for getting energy loss is available only CPU calculation. Do you have any idea to get it with GPU calculation.

Tagged:

Answers

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi,

    We are currently developing an Energy loss model to work internally with EDEM, however this is not completed yet.

    The API model here runs on CPU only:

    EDEM API - Contact Model Example: Energy Loss

    However it has recently been updated to run on GPU. To use you need either the .dll (Windows) or .so (Linux) and the .cu file (for GPU) in the same location as the .dem file, otherwise follow the same instructions to use as in the above post.

    We will update the post with the model shortly.

    This is different to the model which is to be released with EDEM 2025.x (or later) which will have more functionality.

    Regards
    Stephen

  • Sakae
    Sakae Altair Community Member

    Hi, thank you for your quick reply.

    I have tried to use it but it seems not to work.

    Please refer to below. My operation is correct?

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi Sakae, It looks like the Linux version was updated but not the windows one. The engineer who updated the model is on vacation and back on Monday, we'll attach the updated version then.

    Regards

    Stephen

  • Sakae
    Sakae Altair Community Member

    Hi, could you send me Windows version?

    Thank you for your support

  • Renan
    Renan
    Altair Employee

    Hi Sakae,

    Here's the Windows version of the Energy Loss API

  • Sakae
    Sakae Altair Community Member

    Thank for your support.

    I have tried to use it , then it have worked well.

    But I wonder the result with my past calcuration by CPU and my

    new calculation by GPU is totally different. Why it happend, is there any idea?

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi, Renan updated the model on the community page on the 21st with a bug fix which may resolve this issue:

  • Sakae
    Sakae Altair Community Member

    Hi, Thank you for your strong support.

    But I still have one question.

    I have tried to simulate it but Energy loss between particle to particle was 0.

    On the other hand, I got some value of Energy loss between particle to geometry.

    My understanding is that both energy loss should be occured but my case was not.

    Is this correct situation or my simulation condition was wrong?

    Thanks

  • Stephen Cole
    Stephen Cole
    Altair Employee

    hi, did you set at Contact Radius on the particles? The particles need a contact radius to be greater than the physical radius for the energy to be captured. This allows the model to write the data once the collision has ended.

  • Sakae
    Sakae Altair Community Member

    Hi, Yes I did set contact radius, its value was larger than physical radius.

    and I simulated it with several case, in some case, I got energy loss btw particle to particle.

    But other case, No value.

    pls see attached for your well understanding.

    Thank you for your strong support.

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Model B looks reasonable, you should not see any change in energy loss with Contact Radius value as it only needs to be large enough to check the last contact. I would expect in both cases you can reduce this to be ~1% larger than the physical radius or calculate the actual value. It needs to be larger than the physical radius by "maximum particle velocity in the system" * time-step. You could estimate max particle velocity = max geom velocity and given the time-step is small this value will be small increase in radius required.

    For Model A how did you change the contact Radius? Just to note any changes to particle size or shape only affect particles which are created after this change is made. If you created the 1 million particles and let them settle with contact radius = physical radius and then changed the radius after the particles were created, it would still use the orignal value not the updated value. To ensure the contact radii changes are taken you either have to re-create the particles or manually edited the 0.h5 file with a HDF5 editor (not recommended).

    Regards

    Stephen

  • Sakae
    Sakae Altair Community Member

    Hi stephen, thanks for your strong support.

    I could calculated energy loss bw particle to particle. but we clould see 2 types of result shown in attached. Could you teach me Which one is correct?

  • Renan
    Renan
    Altair Employee

    Hi Sakae,

    The correct result is the one on the right. The contact energy loss is only calculated for the contacts that happened in the exact same time as the save interval, whereas Particle-Particle Energy Loss simulation property is calculated for all contacts that happened in all timesteps.

    Best regards,

    Renan

  • Guo
    Guo Altair Community Member
    edited January 7

    Hi Stephen and Renan,

    I am from the same research group as Mr. Sakae. Thank you for providing the updated API for GPU calculation, which is very helpful for our current research. However, I have a question regarding the calculation accuracy of the updated API (2024-version).

    The attached file shows the ‘particle-particle energy loss’ calculated using both the old API(2022-version, CPU-only)and the updated API(2024-version, GPU-enabled). You can observe a significant difference between the two results. However, the result obtained using 2022-version API is somewhat similar to the ‘contact energy loss’ result calculated with the 2024-version API.

    I have checked the code in the CEnerfyLoss.cpp file. Below is the calculation algorithm for ‘particle-particle energy loss’ in the 2022-version API.

    E5…E8 represent the Normal, Torque, and Tangential energy loss for each timestep.

    The operator ‘-=’ is used to calculate the total energy loss for all timesteps. Thus, 'particle-particle energy loss' can be calculated by this equation.

    This is the calculation algorithm of ‘contact energy loss’ in the 2024-version API that you updated on December 5, 2024.

    E1…E4 represent the Normal, Tangential, and Torque energy loss for each timestep.

    However, the operator ‘+=’ is also used here for calculating the ‘contact energy loss’. According to your response, ‘contact energy loss’ represents the energy loss for each timestep. Could you kindly confirm if this code is correct?

    And the ‘particle-particle energy loss’ and ‘particle-geometry energy loss’ values are calculated based on the ‘contact energy loss’. The operator “+=” is used again.

    If the ‘contact energy loss’ in the updated API represents the total energy loss across all timesteps. Could you kindly clarify the meaning of 'PP and PG energy loss'?

    Perhaps I might have misunderstood due to my limited programming skills. Could you help us determine which API is most appropriate for calculating the energy loss? Thank you very much!

    Best regards,

    Guo

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi, the latest 2024 API is best for energy loss as this uses the updated methods.

    The models are different methods for calculating energy loss so best not to compare them directly. The operator shouldn't matter in this case. As a quick answer I'm unsure exact on the impact as it may be covered earlier in the code, or it may just reverse the sign of the total energy loss value.


    Regards

    Stephen

  • Guo
    Guo Altair Community Member

    Hi Stephen,

    I wanted to add my response here, but it keeps showing 'Your comment will appear after it is approved.' To communicate with you more efficiently, I have included my question as an attachment. I look forward to your reply.

    Regards,

    Guo