EDEM API Contact Model | Override particle velocity

MQ
MQ Altair Community Member
edited February 2022 in Community Q&A

Hello,

Is there any way/workaround to override particle velocity (and set to 0) in custom contact model API?

The idea is that when the two interacting particles (with initial attractive force) reach a certain overlap, they should abruptly stop (i.e. their velocities being instantaneously set to 'zero'), rather than applying decelerating/viscous force?

Simply setting contactResults.normalForce = zeroVector only removes acceleration between the particles, but they continue to move and further overlap with inertia (or last velocity).

Thank you.

Best regards,

MQ

Tagged:

Best Answer

  • RWood
    RWood
    Altair Employee
    edited February 2022 Answer ✓

    Hi,

    You've probably realised that you can't set the particle velocity directly as it's part of the protected data. The way I've done this in the past is to apply a force in a particle body force plugin that takes the current particle velocity and applies a counteracting force based on that.

    results.force -= {
    particle.mass* particle.velocity.getX() / timeStepData.timeStep,
    particle.mass* particle.velocity.getY() / timeStepData.timeStep,
    particle.mass* particle.velocity.getZ() / timeStepData.timeStep};

    Simple, but it worked in my case (see attached). Ignore the random velocity directions, that was something unrelated.

    Cheers,

    Richard

Answers

  • RWood
    RWood
    Altair Employee
    edited February 2022 Answer ✓

    Hi,

    You've probably realised that you can't set the particle velocity directly as it's part of the protected data. The way I've done this in the past is to apply a force in a particle body force plugin that takes the current particle velocity and applies a counteracting force based on that.

    results.force -= {
    particle.mass* particle.velocity.getX() / timeStepData.timeStep,
    particle.mass* particle.velocity.getY() / timeStepData.timeStep,
    particle.mass* particle.velocity.getZ() / timeStepData.timeStep};

    Simple, but it worked in my case (see attached). Ignore the random velocity directions, that was something unrelated.

    Cheers,

    Richard

  • jpmorr
    jpmorr Altair Community Member
    edited February 2022

    You could probably achieve this by using a particle body force model in conjunction with the contact model. Set a custom property to mark the particles that require a reset in the contact model and then set to zero with the particle body force. Works quite well.