EDEM crashed with API

Raheem Sterling_22160
Raheem Sterling_22160 Altair Community Member
edited August 2023 in Community Q&A

Hi,

When I modified some code of my api, just delete some custom properties and added some values to preference file, and then when I run the simulation with new API, EDEM crashed. When I debug the code, the value of timestepdata.time was a wired value. I can't locate where was wrong. Thanks

 image

Tagged:

Best Answer

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023 Answer ✓

    Sorry, I upload again.

    Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time 

Answers

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023

    Hi,

    That's a perfectly valid value for the time, why do you think it's weird?

    You would have to debug line by line to see where your issue is. If you're saying the only new bits of code are custom properties and reading prefs file values, start there. It's very easy to read in incorrect values in a preference file.

    Richard

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    Hi,

    That's a perfectly valid value for the time, why do you think it's weird?

    You would have to debug line by line to see where your issue is. If you're saying the only new bits of code are custom properties and reading prefs file values, start there. It's very easy to read in incorrect values in a preference file.

    Richard

    Hi Richard,

    Because I saw time was a negative value. 

    Regards!

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023

    Hi Richard,

    Because I saw time was a negative value. 

    Regards!

    Ah, I missed that. Not sure I've seen a negative time value in EDEM before, impressive!

    I'd still debug a line at a time and check all your values for the source of your error

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    Ah, I missed that. Not sure I've seen a negative time value in EDEM before, impressive!

    I'd still debug a line at a time and check all your values for the source of your error

    Hi Richard

    Thanks, because sometimes the simulation can finish, and crash happens at the beginning of simulation, I have debugged the code and the values read from the preference file were correct. That's why I am confused.

    Regards!

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023

    Hi Richard

    Thanks, because sometimes the simulation can finish, and crash happens at the beginning of simulation, I have debugged the code and the values read from the preference file were correct. That's why I am confused.

    Regards!

    I'm intrigued now. I'm not guaranteeing anything but if you can post your code I'll take a quick look

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    I'm intrigued now. I'm not guaranteeing anything but if you can post your code I'll take a quick look

    Thanks Richard, I've attached the cpp file and preference file, please check out, just inform me if you need edem file.

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023

    Thanks Richard, I've attached the cpp file and preference file, please check out, just inform me if you need edem file.

    Can you send the rest of the src? If you're following the usual API plugin style that would be the .h for that class and another .cpp for the macros

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    Can you send the rest of the src? If you're following the usual API plugin style that would be the .h for that class and another .cpp for the macros

    I've added the rest of code and edem file which crashed.

    Regards!

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023

    I've added the rest of code and edem file which crashed.

    Regards!

    I can't see any attachments at all, anymore

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    I can't see any attachments at all, anymore

    Sorry, I upload again.

  • Richard Wood_20774
    Richard Wood_20774
    Altair Employee
    edited August 2023 Answer ✓

    Sorry, I upload again.

    Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time 

  • Raheem Sterling_22160
    Raheem Sterling_22160 Altair Community Member
    edited August 2023

    Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time 

    Ah, I missed this, thanks for pointing out this problem.