Introduction
Hello, I am currently developing a customized contact model using the API.
For reference, I based my code on the Customized Bonding V2 model shared in the EDEM discussion forum.
link : https://community.altair.com/discussion/35365/edem-api-contact-model-example-updated-bond-model-example-of-customisation-of-bond-model#latest
That model only used a contact custom property. However, I would like to introduce and use a particle custom property called SELFFRICTION.
The purpose of this custom property is to check whether a specific calculation has already been performed for each particle.
Detailed Description
I want to define a particle custom property named SelfFriction, which has no units like a bond status indicator to represent certain states.
At each time step, forces "between" particles are calculated.
The forces for each particle can be divided into two types: Self Friction and Coupled Friction.
- Self Friction must be calculated only once per particle per time step (similar to a body force).
- Coupled Friction must be calculated between all connected particles at every time step.
To implement this, I used the fact that the delta value of a custom property (the value for the next time step) is reset to the default value of 0.0 at the beginning of each time step. I then used this mechanism to mark which particles have already had their self friction computed.
Problem
The problem I am facing is as follows:
When I run my code, the simulation stops with an error indicating that it is accessing an invalid pointer. After several tests, I discovered that this issue occurs because the pointer for the particle custom property is not created correctly. To summarize, my main problem is that I do not know how to use and assign both particle custom properties and contact custom properties simultaneously.
Questions
- How can I properly create both particle custom properties and contact custom properties, manage them with the API manager, and ultimately access their "value" and "delta" correctly in the
calculateForce
function? - At each time step, is the delta value of a custom property indeed initialized to 0.0, as defined in the
getDetailsForProperty
function with oss << 0.0
? - Is there a way to declare and use an array that maintains values within a single time step but resets when the time step changes? If this is possible, I would not need to use a particle custom property at all.
Thank for advance!
Here's my codes.