Deactivating NewtonIntegrator.gravity on just a group of particles in the model

Asked by Marcus Moravia on 2021-04-16

Hi everyone!

In just a few particles of my model, I would like to keep the dynamics, but without the gravitational force on these elements. I mean, I wonder if it's possible to do this by turning off gravitational acceleration (NewtonIntegrator.gravity) on just a part of the model's elements and at the same time having gravitational forces acting on the rest of the model's particles.

Thank you very much,


Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Jérôme Duriez
Last query:
Last reply:
Jan Stránský (honzik) said : #1


it is not possible.
It would not be too difficult (IMO!) to implement if needed.

A simple workaround is to apply "opposite force" on "gravity-free" particles.



> A simple workaround is to apply "opposite force" on "gravity-free" particles.

Indeed. Or even set null gravity and assign weight as a permanent force, selectively.

Marcus Moravia (mgmoravia) said : #3

Thanks for the answers. I had thought about applying a counter force as suggested by Jan, but the idea of applying a permanent force seems to me to be less costly for the simulation loop than a routine of counter forces. I'm going to test it, but Bruno would you know beforehand if this approach has a lower computational cost?


Best Jérôme Duriez (jduriez) said : #4

Since we have two ways to impose gravity, you may also look at and its "mask" attribute.

By order of performance I would say, probably:
1. add forces selectively
2. add counter-forces selectively
3. gravity engine #4 (it implies one more loop)

The difference between 1 and 2 is probably negligibly small, though.

Marcus Moravia (mgmoravia) said : #6

Thank you to share that Jérôme, it solved my question.

Marcus Moravia (mgmoravia) said : #7

Thank you very much, Bruno.

Marcus Moravia (mgmoravia) said : #8

Thanks Jérôme Duriez, that solved my question.