EDEM CUDA API - Contact Model Example: Hertz-Mindlin Effective Sphere

RWood
RWood
Altair Employee
edited February 28 in Altair Exchange

Overview

Attached is the source code for the Hertz-Mindlin Effective Sphere model using version 3.3 of the API. Please note that this has been written for EDEM’s CUDA solver and as such will only run on Nvidia GPUs. The model is for the base contact model only; for rolling friction please add a rolling friction model from the EDEM GUI.

The source code consists of:

  • Two .cpp files

    • CHertzMindlinEffectiveSphere_v3_3_0.cpp
    • HertzMindlinEffectiveSphere_v3_3_0.cpp
  • One .h file

    • CHertzMindlinEffectiveSphere_v3_3_0.h
  • One .cu file

    • HertzMindlinEffectiveSphere_v3_3_0.cu

To use the model, the CPU-API code should be compiled into a library file. When running a simulation the .cu file should be in the same location as the library file.

Please see the EDEM API Documentation and the Programming Guide > GPU API User Guide in the EDEM help for further details.

Usage/Installation Instructions

.

Comments

  • satri
    satri Altair Community Member

    Hey why can't this model be downloaded?

  • Jocelyn
    Jocelyn
    Altair Employee
    edited February 28

    @satri You can see the download again. We have reverted the feature that caused the issue. Let us know if you are unable to download it yet.

  • satri
    satri Altair Community Member

    Sounds good thank you.

  • satri
    satri Altair Community Member
    edited February 28

    I am defining custom properties in the CUDA file.

    I have found a way to define the custom property based on what i saw here

    Please let me know how this can be connected to the debugger, similar to what we see in the snooker factory. I have not seen a single example that shows how to debug the cuda file. Please tell me where should i connect the CUDA file in VS?

    (I am not able to delete the comment. I found the solution there is a CUDA tutorial )

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi, I don't know of any way to incldue the CUDA file in visual studio debugger however you can include printf in the CUDA code to write out values (doubles and integers) to a command window. You can then place the printf fuctions in differnet areas of the code to ssee what values are been assigned.

    To use:

    Open a command window and start EDEM with the flag —no-free

    edem --no-free
    

    And in your .cu code you can include have lines such as:

    real3 test1 = F_total_n;
    printf("test1.x = %f \n", test1.x );
    printf("test1.y = %f \n", test1.y );
    printf("test1.z = %f \n", test1.z );
    

    Then this will print out the results into the command window.

    Note that printf is a slow function so make sure you remove it once you've finished debugging to avoid slowing down the simulation.

    Regards

    Stephen