Dear Jijo,
gravity is applied as a (constant) external acceleration, see accExt
and apply_gravity
in examples/particles/dkt2d
. So the changes of the fluid density don’t affect the particle.
Also, currently the external acceleration is defined for the whole particle system. Updating it within the ParticleManager
would therefore update it for all particles. In your particular case, I think it would be best to manually apply the gravity at each timestep. For example, you could evaluate the density at the current particle position if an averaged density is sufficient. If you need different forces on the surfaces, then a more sophisticated approach would be necessary.
Best regards,
Jan