Particles flowing around an masked area
I would do this using the built in Foam particle render - it does have basic collision avoidance

https://helpx.adobe.com/after-effects/using/simulation-effects.html#foam_effect