Adding a particle custom property to heat transfer API

Yangyang_Shen
Yangyang_Shen Altair Community Member
edited November 2023 in Community Q&A

Hi. I want add a particle custom property that is calculated from the particle temperature. And I took the heat conduction API code in the example  'HeatConductionForGeometry_29July2014.zip' from the page link below:  

https://community.altair.com/community/en/edem-api-contact-model-example-heat-conduction?id=kb_article&sysparm_article=KB0121824

The new custom property, PARTICLE_CONTENT, is a mass property. The PARTICLE_TEMPERATURE and GEOMETRY_TEMPERATURE are from the heat conduction code before. 

const string CHeatConduction::PARTICLE_TEMPERATURE = "Temperature"; const string CHeatConduction::PARTICLE_CONTENT = "Content Particle"; const string CHeatConduction::GEOMETRY_TEMPERATURE = "Temperature Geometry"; 

And I defined PARTICLE_CONTENT as below: 

    if(eParticle == category &&         0 == propertyIndex)     {         strcpy(name, PARTICLE_CONTENT.c_str());         dataType		= eDouble;         numberOfElements= 1;         unitType		= eMass;         return true;     } 

I was able to compile the code, but when I tried to load the library file in EDEM, I got an error message: 

image

For my simulation, I only selected 2 inbuilt models (Hertz-Mindlin with JKR, Standard Rolling Friction) for Particle-Particle and Particle-Geometry interactions. Also my EDEM deck was created from scratch, so I don't think there's any previously used custom properties. 

Can anyone please help me figure out what I have done wrong? 

Thanks a lot! 

Tagged:

Answers

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited November 2023

    Hi,

    Could you share your code and model, I can review to see if I can see the issue.  

    Just to note I see in the code you share that it defines

    if(eParticle == category && 0 == propertyIndex)

    When you define the particle temperature did increase the property index?  

    Regards

    Stephen

  • Yangyang_Shen
    Yangyang_Shen Altair Community Member
    edited November 2023

    Hi,

    Could you share your code and model, I can review to see if I can see the issue.  

    Just to note I see in the code you share that it defines

    if(eParticle == category && 0 == propertyIndex)

    When you define the particle temperature did increase the property index?  

    Regards

    Stephen

    Hi Stephen,

    Thank you so much for pointing out the property index. That's exactly where my mistake is. 

    The PARTICLE_TEMPERATURE is registered as property index 0, so the new custom property PARTICLE_CONTENT should be registered as property index 1. 

    Now I can load my API and run my simulation. 

    Thanks again for your help!