gravity vs addforce vs setforce

Submitted by Kashminder on Tue, 11/16/2021 - 22:45

The issue is that I have ran three different codes keeping everything same but only these 3 commands different in each code

fix gravi all gravity 9.81 vector 0. 0.0 -1.0.
fix p all addforce 0 0 -9.81
fix p all setforce 0 0 -9.81

So, the code with gravity force command acts like the particle comes down very slowly but in their 2 commands i.e. (add-force and setforce) the particles leaves the box quiet early, My question is that in all three cases the particles should act similarly as the force is same in three cases? Is the issue seems to be in fix?

mschramm | Mon, 11/29/2021 - 20:53

fix gravity sets the gravity inside the simulation domain. The force added to each particle would then be {0, 0, -9.81}*m where m is the particle mass.
addforce simply adds the force vector {0, 0, -9.81} to each particle (not scaling by mass).
setforce sets the force vector {0, 0, -9.81} on each particle. Again not scaling by mass but all removing all other force contributions to the particle.

The only way that these would all be the same is if you dropped particles that were scaled in such a way that they had a mass of 1kg and had no other interactions.