particle custom property getDelta in calculateForce

Sunny_21964
Sunny_21964 Altair Community Member
edited August 2023 in Community Q&A

Dear guys

I have a question about getDelta when using calculateForce. Assuming contact of particle 1 with both particle 2 and 3, and calculateForce goes for 1-2 first, then 1-3. So when calculateForce for particle 1-particle 2, the custom property of particle 1, i.e. m_delta_1, is only the increament from interaction 1-3, or already considering the increment from interaction 1-2, as "m_delta_1 +=value" (example) is involved in multi-contacts.

PS: defining:

const double* m_value_1 = elem1CustomProperties->getValue(m_index);

double* m_delta_1 = elem1CustomProperties->getDelta(m_index);

 

Best wishes

Sunny

Answers

  • RWood
    RWood
    Altair Employee
    edited July 2023

    Hi,

    I don't think it's that straightforward. The short version is, always use +=, but multi threading complicates things a bit. If contact(1-2) and contact(1-3) happen on different threads, they will both initially receive the same m_delta_1, increment it, and then you won't see the real value until the end of the timestep. So something like:

    Time step 0:
    Particle property value = 0
    On thread 0 - contact (1-2) reads the property value of 0 and increments the delta +1
    On thread 1 - contact (1-3) reads the property value of 0 and increments the delta +1

    Time step 1:
    Particle property value = 2

    As you can see, the end value is correct, but neither thread ever had the correct cumulative delta. They all get summed by the solver.

    Richard

  • satri
    satri Altair Community Member
    edited August 2023

    Hey any idea how to access the values in the debugger

    because say if this is the statement as above

    const double* m_value_1 = elem1CustomProperties->getValue(m_index);

    when i look at the debugger and look for m_value_1[0] i keep getting this error memory cannot be read

    because of which the calculation does not proceed at all

    i use it to calculate

    double factor = m_value_1[0]*Pi...etc

    please let me know if you know of any way to resolve this